-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Feature Type
Pipeline architecture
Problem or Need
19 functions across the pipeline are exported solely so unit tests can import them directly. These are internal implementation details — not called from any other production module — and their export keyword falsely signals they're part of the module's public contract. This couples tests to implementation details, making refactors harder.
Proposed Solution
Remove the export keyword from 19 functions and refactor their tests to either:
- (a) Test through the parent module's public function (preferred for tightly-coupled helpers), or
- (b) Continue importing from the module file directly (TypeScript allows importing non-exported members for tests via path imports in some setups, or keep the export but gate behind
@internal)
If (a) isn't practical for a given function, fall back to adding @internal instead of removing export.
Stage 1 — Analysis (2 exports):
| Export | File | Line |
|---|---|---|
analyzeHooks |
src/stages/1-analysis/hook-analyzer.ts |
287 |
readRawManifest |
src/stages/1-analysis/plugin-parser.ts |
89 |
Stage 2 — Generation (4 exports):
| Export | File | Line |
|---|---|---|
createBaseScenario |
src/stages/2-generation/diversity-manager.ts |
83 |
baseToTestScenario |
src/stages/2-generation/diversity-manager.ts |
106 |
createBatchConfig |
src/stages/2-generation/batch-calculator.ts |
128 |
wouldExceedTokenLimit |
src/stages/2-generation/batch-calculator.ts |
187 |
Stage 3 — Execution (9 exports):
| Export | File | Line |
|---|---|---|
filterTriggerCaptures |
src/stages/3-execution/hook-capture.ts |
164 |
analyzeHookResponses |
src/stages/3-execution/hook-capture.ts |
438 |
isFilesPersistedEvent |
src/stages/3-execution/sdk-client.ts |
342 |
isTaskNotificationMessage |
src/stages/3-execution/sdk-client.ts |
355 |
isAuthStatusMessage |
src/stages/3-execution/sdk-client.ts |
368 |
extractSessionId |
src/stages/3-execution/transcript-builder.ts |
255 |
countAssistantTurns |
src/stages/3-execution/transcript-builder.ts |
292 |
isSuccessfulExecution |
src/stages/3-execution/transcript-builder.ts |
271 |
parseCustomId |
src/stages/4-evaluation/batch-evaluator.ts |
163 |
Stage 4 — Evaluation (1 export):
| Export | File | Line |
|---|---|---|
isLowVariance |
src/stages/4-evaluation/multi-sampler.ts |
293 |
State (3 exports):
| Export | File | Line |
|---|---|---|
updateStateWithPartialExecutions |
src/state/updates.ts |
146 |
updateStateWithError |
src/state/updates.ts |
166 |
getIncompleteScenarios |
src/state/queries.ts |
117 |
Steps:
- For each export, determine if the test can be refactored to test through the parent module's public interface
- If yes: remove
export, refactor tests - If no: add
@internalJSDoc tag instead (knip already excludes@internal) - Update barrel re-exports as needed
- Verify:
npm run build && npm run typecheck && npm test && npm run knip
Pipeline Stage Affected
General / Multiple stages
Component Type (if applicable)
Not component-specific
Alternatives Considered
- Keeping all exports as-is with documentation — rejected because it misleads about API surface
- Moving functions to test utility files — rejected because they're genuinely called internally by production code; duplicating logic would be worse
How important is this feature to you?
Medium - Would be nice to have
Additional Context
Identified during comprehensive dead code analysis (2026-01-31). Related: #371 (dead types), #372 (stdlib wrappers). The 3 state exports (updateStateWithPartialExecutions, updateStateWithError, getIncompleteScenarios) are scaffolding for an unimplemented checkpointing/resume feature — consider whether to keep or delete entirely.
🤖 Created with Claude Code