[Duplicate Code] Extract shared routed configuration fixture in compose-generator tests

Chiusa
#10,430 0 commenti 1 reazione 2 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@lpcox ci sta già lavorando.

Dal 21/10/2026.

  • #10436 di @copilot-swe-agent — integrata

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

code-quality refactoring

Duplicate Code Opportunity

Summary
  • Pattern: The routed-proxy tests duplicate the digest, base configuration, API-proxy/routing flags, and image setup instead of sharing a fixture builder.

  • Locations: File(s) and line ranges containing duplicates

    • src/compose-generator.test.ts: lines 190-212
    • src/compose-generator.test.ts: lines 38-60
  • Impact: More than 20 repeated setup lines; changes to routed proxy test configuration must be updated in multiple places, increasing the chance of inconsistent coverage.

Evidence

src/compose-generator.test.ts lines 190-212:

const digest = 'a'.repeat(64);
const savedEnv = { ...process.env };

function routedConfig(overrides: Partial<WrapperConfig> = {}): WrapperConfig {
  return {
    ...mockConfig,
    enableApiProxy: true,
    experimentalModelRouting: true,
    images: {
      squid: `ghcr.io/example/squid:test@sha256:${digest}`,

src/compose-generator.test.ts lines 38-60:

const digest = 'a'.repeat(64);
const routingConfig: WrapperConfig = {
  ...mockConfig,
  enableApiProxy: true,
  experimentalModelRouting: true,
  images: {
    squid: `ghcr.io/example/squid:test@sha256:${digest}`,
Suggested Refactoring

Extract a shared routedConfig(overrides) test fixture (and, if needed, a shared digest constant) at the suite level. Use it in both the wiring test and the OpenTelemetry settings tests so routing defaults and image references have one source of truth.

Affected Files
  • src/compose-generator.test.ts — lines 190-212
  • src/compose-generator.test.ts — lines 38-60
Effort Estimate

Low


Detected by Duplicate Code Detector workflow. Run date: 2026-10-21

Generated by Duplicate Code Detector · copilot · gpt54mini · 1.03 AIC · ⊞ 29.8K · ◷

  • expires on Nov 20, 2026, 9:53 PM UTC
Lingua principale
TypeScript
Stelle
157
Fork
80
Merge medio
4h 31m
PR unite (30g)
407

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/gh-aw-firewall

Tutte le issue di github/gh-aw-firewall

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.