Problem
The highest-risk modules have zero tests on their core paths (per architecture audit):
tracker.js — session finalization, usefulness recompute, pattern/co-occurrence aggregation, auto-template creation. High risk, untested.
read-cache.js — checkStaleness() (token/file/time thresholds) and the big-file map-then-load nudge. High risk, untested.
budget.js — warning-emission gating at 50/70/85/95% and the compact recommendation.
Current tests/test.js covers pure helpers (estimateTokens, isRangeCovered, globToRegex, analyzePrompt, etc.) but not the stateful pipelines that actually decide what gets blocked and what "savings" are reported.
Why it matters
A product marketed as honest needs its decision logic under test, not just its formatters.
Proposal
- Add fixture-based tests: feed a synthetic session → assert finalized usefulness/wasted classification + pattern aggregation.
- Staleness: table-driven tests over (elapsedTokens, elapsedFiles, elapsedTime) → allow/block.
- Budget gating: assert each threshold emits exactly once.
- Refactor any
process.exit(0) out of the testable core (see read-cache allow()), so tests don't terminate the runner.
Acceptance
tracker finalization, read-cache staleness, budget gating each covered.
npm test count meaningfully increases; no path calls process.exit during tests.
Problem
The highest-risk modules have zero tests on their core paths (per architecture audit):
tracker.js— session finalization, usefulness recompute, pattern/co-occurrence aggregation, auto-template creation. High risk, untested.read-cache.js—checkStaleness()(token/file/time thresholds) and the big-file map-then-load nudge. High risk, untested.budget.js— warning-emission gating at 50/70/85/95% and the compact recommendation.Current
tests/test.jscovers pure helpers (estimateTokens, isRangeCovered, globToRegex, analyzePrompt, etc.) but not the stateful pipelines that actually decide what gets blocked and what "savings" are reported.Why it matters
A product marketed as honest needs its decision logic under test, not just its formatters.
Proposal
process.exit(0)out of the testable core (see read-cacheallow()), so tests don't terminate the runner.Acceptance
trackerfinalization,read-cachestaleness,budgetgating each covered.npm testcount meaningfully increases; no path callsprocess.exitduring tests.