fix(nap): add silent-failure detection when archival returns null on oversized file#636
Closed
diberry wants to merge 1 commit intobradygaster:devfrom
Closed
fix(nap): add silent-failure detection when archival returns null on oversized file#636diberry wants to merge 1 commit intobradygaster:devfrom
diberry wants to merge 1 commit intobradygaster:devfrom
Conversation
…oversized file When decisions.md exceeds 20KB but archiveDecisions() returns null (no entries archivable — all recent or undated), emit a warning action in the nap report instead of silently reporting 'nothing to clean up'. Changes from review: - Add 'warning' type to NapAction (was using 'cleanup' with cast) - Extract oversizedDecisionsWarning() helper (DRY — was duplicated in runNap/runNapSync) - Tests assert on type='warning' instead of just description text Closes #25 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
@bradygaster Ready for your review — team-approved with 3-reviewer gate (Flight, FIDO, Procedures). |
larsontim12
pushed a commit
to larsontim12/squad
that referenced
this pull request
Mar 27, 2026
) (bradygaster#636) * test: add comprehensive nap feature tests (38 tests) Covers 11 test categories for the nap context hygiene engine: - Metrics collection (before state) - History compression (Tier 1, ## section boundaries) - Log pruning (7-day threshold) - Inbox cleanup (merge + delete) - Decision archival (20KB threshold, 30-day age) - Deep mode (3 entries vs 5) - Dry-run mode (no file modifications) - Journal safety (.nap-journal lifecycle) - Report formatting (humanized bytes, tokens, NO_COLOR) - Edge cases (missing dirs, empty files, 100KB+ files, multi-agent) - Combined scenarios (all actions + flag combinations) Tests use isolated temp directories with cleanup. Written against the NapOptions/NapResult/NapAction interface contract. Closes bradygaster#635 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: update Hockney history with nap test learnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: implement nap feature — context hygiene for .squad/ state (bradygaster#635) Add squad nap command with tiered compression, log pruning, decision archival, and inbox cleanup. Supports --deep and --dry-run flags. - Core engine: packages/squad-cli/src/cli/core/nap.ts - Tier 1: history compression (keep 5), log pruning (7d), inbox merge, decision archival (20KB/30d) - Tier 2 (--deep): aggressive history compression (keep 3) - Dry-run: scan and report without modifications - Journal-based safety (.nap-journal) for interrupted runs - Both async (runNap) and sync (runNapSync) exports - Humanized before/after report with token estimates - NO_COLOR support - CLI entry: squad nap command + help text in cli-entry.ts - REPL: /nap slash command + help text in commands.ts - Skill template: .squad-templates/skills/nap/SKILL.md All 3229 tests pass (38 nap-specific). TypeScript compiles clean. Closes bradygaster#635 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
Author
|
Closing as duplicate — Brady merged related archival fallback in #627 (count-based archiveDecisions). |
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.
When decisions.md exceeds 20KB but archiveDecisions() returns null (no entries archivable), emit a warning action. Adds 'warning' type to NapAction, extracts oversizedDecisionsWarning() helper. 3 tests.
Team review: Flight ✅, FIDO ✅, Procedures ✅
Closes diberry#25