API Surface Issue
Category
Unused export (production-side dead code)
Summary
- File:
src/container-lifecycle-state.ts
- Symbol:
resetAgentExternallyKilled (line 15)
- Issue:
resetAgentExternallyKilled is exported but never imported by any production module. The only external consumer is src/container-lifecycle.test-utils.ts, which re-exports it for use in lifecycle test suites. The sibling state-mutation functions (markAgentExternallyKilled, isAgentExternallyKilled) are consumed by production code (src/container-cleanup.ts, etc.); resetAgentExternallyKilled is the odd one out — its sole purpose is to reset module-level state between Jest test cases.
Evidence
$ grep -rw "resetAgentExternallyKilled" src/ --include="*.ts"
src/container-lifecycle-state.ts:15: export function resetAgentExternallyKilled(): void {
src/container-lifecycle.test-utils.ts:5: import { isAgentExternallyKilled, resetAgentExternallyKilled } from './container-lifecycle-state';
src/container-lifecycle.test-utils.ts:9: resetAgentExternallyKilled,
The .test-utils.ts suffix on the only consumer is the project's convention for test scaffolding (parallel to copilot-api-resolver.test-utils.ts, host-env.test-utils.ts, etc.), confirming the symbol exists solely to support test isolation.
This matches the pattern of #3828, #4173, #4174 — module-private helpers exported solely so the test layer can drive them.
Recommended Fix
This case is borderline. Unlike parseResolvConf or validateApiTargetInAllowedDomains, there is no "public entrypoint" the test could call instead: resetting module-level state between tests legitimately requires a reset function, and the alternatives (e.g., jest.resetModules() + dynamic re-import) are clunkier than a one-line helper.
Options:
- Keep the export, document it. Add a
// test-only JSDoc tag and accept the slightly wider surface in exchange for clean test isolation.
- Move the state into a small object/class so each test can instantiate a fresh state holder rather than reset a module-level flag — eliminating the need for the reset function entirely.
The maintainer should pick based on how much refactor budget exists for the lifecycle-state module.
Impact
- Dead code risk: Low (sole consumer is the test scaffolding)
- Maintenance burden: Low (single one-line function on a small file, unlikely to drift)
Detected by Export Audit workflow. Triggered by push to main on 2026-06-02
Generated by API Surface & Export Audit · opus47 5.5M · ◷
API Surface Issue
Category
Unused export (production-side dead code)
Summary
src/container-lifecycle-state.tsresetAgentExternallyKilled(line 15)resetAgentExternallyKilledis exported but never imported by any production module. The only external consumer issrc/container-lifecycle.test-utils.ts, which re-exports it for use in lifecycle test suites. The sibling state-mutation functions (markAgentExternallyKilled,isAgentExternallyKilled) are consumed by production code (src/container-cleanup.ts, etc.);resetAgentExternallyKilledis the odd one out — its sole purpose is to reset module-level state between Jest test cases.Evidence
The
.test-utils.tssuffix on the only consumer is the project's convention for test scaffolding (parallel tocopilot-api-resolver.test-utils.ts,host-env.test-utils.ts, etc.), confirming the symbol exists solely to support test isolation.This matches the pattern of #3828, #4173, #4174 — module-private helpers exported solely so the test layer can drive them.
Recommended Fix
This case is borderline. Unlike
parseResolvConforvalidateApiTargetInAllowedDomains, there is no "public entrypoint" the test could call instead: resetting module-level state between tests legitimately requires a reset function, and the alternatives (e.g.,jest.resetModules()+ dynamic re-import) are clunkier than a one-line helper.Options:
// test-onlyJSDoc tag and accept the slightly wider surface in exchange for clean test isolation.The maintainer should pick based on how much refactor budget exists for the lifecycle-state module.
Impact
Detected by Export Audit workflow. Triggered by push to main on 2026-06-02