Increase test coverage for hook system context-bloating bottlenecks#30
Closed
Increase test coverage for hook system context-bloating bottlenecks#30
Conversation
Co-authored-by: JordanCoin <[email protected]>
Copilot
AI
changed the title
[WIP] Increase test coverage for hook system
Increase test coverage for hook system context-bloating bottlenecks
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hook system injects output directly into Claude's context window, but key output-limiting paths (event log caps, file truncation, dep-graph guards, handoff summaries) had near-zero test coverage — making it hard to detect regressions that cause context bloat.
New:
limits/limits_test.go(0% → 100%)TruncateAtLineBoundary— within-budget no-op, truncation with custom/default suffix, clean line-boundary cut, zero/negative guardAdaptiveDepth— depth 4→3→2 scaling across small/medium/large repo thresholdsHandoffBudgetForRepo— list-size budgets monotonically decrease with repo sizeNew tests in
cmd/hooks_test.go(4.2% → 18.5%)TestGetLastSessionEventsevents.log, blank-line skipping, missing/empty fileTestShowLastSessionContext... and N more files), malformed line skip, REMOVE→"edited" fixupTestShowSessionProgressTestGetHubInfoNoDepsnilwhen state has no dep graph, preventing expensive fallback scansTestHookPreCompacthubs.txtcreation, correct content, silent skip when no hubsTestShowRecentHandoffSummaryA shared
writeWatchStatehelper sets up daemon state for tests that needwatch.ReadStateto return real data:Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.