Skip to content

fix(cli): prune only pull records and keep an entry run's counts - #2763

Merged
thiras merged 1 commit into
mainfrom
fix/activity-prune-and-entry-counts
Oct 29, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/activity-prune-and-entry-counts

Conversation

@thiras

@thiras thiras commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

What

Two follow-ups to #2752, both in the pull-record directory and the dashboard.

#2754: prune deletes only pull records. prune ranked every *.json by its numeric name prefix, and ranked a name with no prefix as 0, so it deleted a non-record file first. It now ranks and deletes only files named <start-ms>-<pid>.json (record_start, which replaces started_of). Any other *.json stays 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 with countParts, 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 records counts: null.

adr/appendix-binaries.md states both behaviours.

Closes #2754
Closes #2753

Reviewer notes

  • The pull record's entry variant gains a counts field. Nothing breaks: a record written before this change, with no counts, still parses, because serde reads a missing Option field as None. No compatibility code was added.
  • record_files does not change. The dashboard listing still sees every *.json, and only prune is narrowed.
  • In the regenerated dashboard-full.json fixture, the interrupted entry run now carries counts with not_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_null
  • Dashboard: pnpm install --frozen-lockfile, typecheck, lint, test (new skip-only entry view test), build
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • CARGO_BUILD_WARNINGS=deny cargo doc -p decdn-cli --no-deps --document-private-items
  • make -C adr check-refs
  • pre-commit hooks on commit
  • CHANGELOG entry under ### Changed

🤖 Generated with Claude Code

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]>
@thiras thiras self-assigned this Oct 29, 2026
Copilot AI balanced review requested due to automatic review settings October 29, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main f3e6938 fix/activity-prune-a... c20f6c7 +/-
77% 77% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@thiras
thiras merged commit b647762 into main Oct 29, 2026
38 checks passed
@thiras
thiras deleted the fix/activity-prune-and-entry-counts branch October 29, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

activity: prune deletes a *.json that is not a pull record first dashboard: say why an ended entry run fetched nothing

2 participants