Skip to content

[Export Audit] Test-only exports in api-proxy-config.ts (3 internal helpers) #4173

@github-actions

Description

@github-actions

API Surface Issue

Category

Unused export (production-side dead code)

Summary

  • File: src/api-proxy-config.ts
  • Symbols:
    • validateApiTargetInAllowedDomains (line 85)
    • extractGhecDomainsFromServerUrl (line 216)
    • extractGhesDomainsFromEngineApiTarget (line 267)
  • Issue: All three functions are exported but never imported by any production module outside api-proxy-config.ts. Each is called internally by other functions in the same file (e.g., resolveApiTargetsToAllowedDomains calls the extract helpers) and is also imported directly from co-located test files. This unnecessarily widens the module's public API and couples tests to internal implementation details rather than the public entrypoints that actually compose them.

Evidence

grep -rEw "validateApiTargetInAllowedDomains|extractGhecDomainsFromServerUrl|extractGhesDomainsFromEngineApiTarget" src/ --include="*.ts" outside api-proxy-config.ts returns only test files:

src/api-proxy-config-validation.test.ts:  validateApiTargetInAllowedDomains,
src/api-proxy-config-validation.test.ts:describe('validateApiTargetInAllowedDomains', () => {
src/api-proxy-config-validation.test.ts:    const result = validateApiTargetInAllowedDomains(...)  [7 call sites]

src/api-proxy-config-domains.test.ts:  extractGhesDomainsFromEngineApiTarget,
src/api-proxy-config-domains.test.ts:  extractGhecDomainsFromServerUrl,
src/api-proxy-config-domains.test.ts:describe('extractGhesDomainsFromEngineApiTarget', () => { ... }   [6 call sites]
src/api-proxy-config-domains.test.ts:describe('extractGhecDomainsFromServerUrl', () => { ... }         [12 call sites]

ts-prune flagged all three as "used in module" (i.e., only called from within their defining file by other code in the same module), confirming no production caller outside the file.

This is the same pattern as closed-completed #4007 (translateBindMountHostPath), where an internal helper exported solely for direct testing was demoted to module-private and tests were rerouted through the public composition function.

Recommended Fix

  1. Drop the export keyword from all three functions in src/api-proxy-config.ts, making them module-private helpers.
  2. Update src/api-proxy-config-validation.test.ts and src/api-proxy-config-domains.test.ts to exercise these behaviors through the public entrypoints that compose them (e.g., resolveApiTargetsToAllowedDomains, validateApiProxyConfig), so the tests verify the contract that production code actually observes.

Impact

  • Dead code risk: Low (logic is still exercised via internal callers)
  • Maintenance burden: Medium (three symbols on the public API surface, three test suites coupled to private helpers — refactors to the composition functions can silently break tests that bypass them)

Detected by Export Audit workflow. Triggered by push to main on 2026-06-02

Generated by API Surface & Export Audit · opus47 5.1M ·

  • expires on Jul 2, 2026, 12:39 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions