Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Closed
#10,430 0 comments 1 reaction 2 assignees View on GitHub

Maintainers usually reply within 1 day

@lpcox is already working on this.

Since Oct 21, 2026.

  • #10436 by @copilot-swe-agent — merged

Assessment

This issue has not been assessed yet.

Description

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
Dominant language
TypeScript
Stars
150
Forks
76
Avg merge
4h 10m
Merged PRs (30d)
457

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/gh-aw-firewall

All issues in github/gh-aw-firewall

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.