Repository navigation
fix(cli): prune only pull records and keep an entry run's counts - #2763
Merged
Merged
Conversation
Prune ranks and deletes only files named `<start-ms>-<pid>.json` in the pull records directory. Any other `*.json` stays, does not count toward the 200 kept records, and the dashboard still lists it. `record_start` replaces `started_of` and accepts only a stem of two `-`-separated parts that parse as a u64 start and a u32 pid. `PullKind::Entry` carries `counts: Option<BundleCounts>`, so an entry written to a file keeps the counts its bundle-path summary reports, and the dashboard renders them with `countParts`, as it does for a bundle run: a skip-only entry run reads "1 skipped", not an empty "Done, 0 B". An entry streamed to stdout records `counts: null`. The ADR appendix-binaries dashboard section states both behaviours. Closes #2754 Closes #2753 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the pull-record pruning and dashboard entry-count changes.
No open issues 🎉
What changed in this PR
This PR addresses #2754 and #2753 by narrowing pull-record pruning and showing entry-run outcomes in the CLI dashboard.
Changes:
- Prune only files named
<start-ms>-<pid>.json, leaving other JSON files outside the 200-record limit. - Preserve entry-run counts and display them using the existing bundle-count rendering.
- Add regression coverage and update fixtures and documentation.
| File | Description |
|---|---|
crates/cli/src/commands/dashboard/status/tests.rs |
Include entry counts in generated status fixtures. |
crates/cli/src/commands/activity/tests.rs |
Test filename filtering and entry-count recording. |
crates/cli/src/commands/activity.rs |
Restrict pruning and retain entry-run counts. |
crates/cli/dashboard/src/view.ts |
Map entry counts into dashboard rows. |
crates/cli/dashboard/src/view.test.ts |
Cover skipped entries and absent counts. |
crates/cli/dashboard/src/fixtures/dashboard-full.json |
Add counts for the interrupted entry run. |
crates/cli/dashboard/src/contract.test.ts |
Update entry schema and rendered-count expectations. |
crates/cli/dashboard/src/components/RecentPulls.tsx |
Clarify comments to include entry runs; no functional change. |
crates/cli/dashboard/src/api.ts |
Add nullable counts to the entry type. |
CHANGELOG.md |
Document both fixes. |
adr/appendix-binaries.md |
Describe pruning scope and entry-count retention. |
Review effort: Balanced
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.
What
Two follow-ups to #2752, both in the pull-record directory and the dashboard.
#2754: prune deletes only pull records.
pruneranked every*.jsonby its numeric name prefix, and ranked a name with no prefix as0, so it deleted a non-record file first. It now ranks and deletes only files named<start-ms>-<pid>.json(record_start, which replacesstarted_of). Any other*.jsonstays and does not count toward the 200 kept. The dashboard still lists it, and the banner's "deleting one is safe" stays true.#2753: an entry run keeps its counts. The variant is now
PullKind::Entry { counts: Option<BundleCounts> }. An entry written to a file (decdn get decdn:<hash>/<path> -o FILE) runs the bundle path, and its record now keeps the counts that path reports. The dashboard renders them withcountParts, the same way as for a bundle run. A skip-only entry run reads "1 skipped", not a bare "Done, 0 B". An entry streamed to stdout recordscounts: null.adr/appendix-binaries.mdstates both behaviours.Closes #2754
Closes #2753
Reviewer notes
entryvariant gains acountsfield. Nothing breaks: a record written before this change, with nocounts, still parses, because serde reads a missingOptionfield asNone. No compatibility code was added.record_filesdoes not change. The dashboard listing still sees every*.json, and only prune is narrowed.dashboard-full.jsonfixture, the interrupted entry run now carriescountswithnot_run: 1.Verification
cargo nextest run -p decdn-cli: 1246 of 1246 passed. New tests:prune_leaves_a_json_that_is_not_named_as_a_record,a_record_name_is_its_start_and_its_pid,an_entry_run_keeps_its_counts_and_no_file_progress,an_entry_run_with_no_counts_records_nullpnpm install --frozen-lockfile,typecheck,lint,test(new skip-only entry view test),buildcargo clippy --workspace --all-targets --all-features -- -D warningsCARGO_BUILD_WARNINGS=deny cargo doc -p decdn-cli --no-deps --document-private-itemsmake -C adr check-refs### Changed🤖 Generated with Claude Code