Repository navigation
Report artifact GC in one JSON shape and count every rollback leg - #1273
Mikola Lysenko (mikolalysenko) wants to merge 6 commits into
Conversation
|
bugbot run Generated by Claude Code |
|
[agent] Follow-up on my earlier comment: I had the diagnosis half wrong, and the flip in 3e6153c trades one red for two others.
|
|
bugbot run Generated by Claude Code |
|
Burn-down agent: pushed
These pass locally: Generated by Claude Code |
|
Ready for review (burn-down agent).
Generated by Claude Code |
, #1066) GC was reported four ways. repair and remove buried the sweep in artifact-level event details with no byte count, while rollback and scan --prune printed a hand-built `gc` object. The contract documented summary.bytesFreed, summary.bytesDownloaded and events[].bytes, but no command emitted any of them, so its GC jq recipe returned null. - json_envelope::GcReport {removedBlobs, removedDiffArchives, removedPackageArchives, bytesFreed} is built from the three sweep passes and serialized identically everywhere: the envelope's new top-level `gc` (repair, remove), rollback's `gc` and scan's `gc`. The hand-written json! blocks are gone. - summary.bytesFreed is always present and mirrors gc.bytesFreed. events[].bytes is set on the GC carrier event and on --update's downloaded event. summary.bytesDownloaded is dropped from the contract. - repair's GC carrier event no longer bumps summary.removed/verified, matching remove: summary counters count patch entries, and the sweep totals live in `gc`. - remove's human output now names the diff/package archives it sweeps. - rollback --json: rolledBack and failed now span the agent, vendored and hosted legs (#1066). A run where something failed and nothing was rolled back, already original or not installed now reports status "error" with error.code rollback_failed instead of partial_failure. Exit codes are unchanged. - CLI_CONTRACT.md: the envelope and PatchEvent schemas, the PatchAction "Emitted by" column, the per-command action matrix and the GC jq recipe now match the emitters. New unit tests pin the documented summary/gc/PatchEvent key sets against what json_envelope serializes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The --dry-run preview of scan --prune/--sync used its own vocabulary (prunableManifestEntries, orphanBlobs, orphanDiffArchives, orphanPackageArchives, revertableVendoredEntries, vendorOrphanDirs, bytesReclaimable). It now prints the same keys as the wet pass and every other GC-running command, counting what the pass would remove, and leaves out only the keys a real pass alone can fill (keptVendoredEntries, failedVendoredEntries, skipped, warnings). v5.0 MAJOR. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
113c017 to
f7977fa
Compare
All packages refused and nothing rolled back is a failed run since #1066. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
[final reviewer] Not enqueuing. Tanmay Singla (@Tanmay182003), the commit you approved ( Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
The shared bun.lockb rollback helper expected status "error" for every caller, so the hosted -> vendored -> hosted takeover leg went red: there a manifest record makes the agent leg report the copy already original, and the run is correctly a partial_failure. A branch rewrite had dropped the earlier fix for this. Each caller now states which outcome it expects, so the takeover leg checks partial_failure and the hosted-only alias/transitive shapes keep checking rollback_failed. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit bc9c9be. Configure here.
|
|
||
| /// The ```jsonc block under `heading` in CLI_CONTRACT.md. | ||
| fn contract_block(heading: &str) -> &'static str { | ||
| let doc = include_str!("../CLI_CONTRACT.md"); |
There was a problem hiding this comment.
[agent] The rebase dropped the CRLF normalizer from 3e6153c: contract_block is back to raw include_str!("../CLI_CONTRACT.md") (json_envelope.rs:1391, :1468) while matching "```jsonc\n" / "\n }". With no LF rule in .gitattributes, a Windows checkout has CRLF and contract_envelope_block_matches_serialized_keys / contract_patch_event_block_matches_serialized_keys panic at :1396 — the same failure as run 37936140203 test (windows-latest, 1). Fix: restore contract_doc() (include_str!(..).replace("\r\n", "\n")) and use it at both call sites.
Closes #1257. Closes #1066.
Both are JSON-contract drift that should be fixed before v5.0.0 ships (#1194).
Artifact GC: one shape (#1257)
repair --jsonremovedevent,details: {count, checked}; no bytes; bumpedsummary.removedby 1gc+summary.bytesFreed; carrier event keepscount/checked, gainsbytes, bumps no counterremove --jsondetails: {blobsRemoved, rolledBack, archivesRemoved}; no bytesbytes; top-levelgc+summary.bytesFreedrollback --jsongcjsonGcReportscan --prune --jsongcjsonGcReport(plus scan's manifest/vendored keys)json_envelope::GcReport {removedBlobs, removedDiffArchives, removedPackageArchives, bytesFreed}, folded from the three sweep passes.summary.bytesFreedis always present (0 when no GC ran).events[].bytesis set on the GC carrier and on--update'sdownloadedevent.summary.bytesDownloadedwas never emitted, so it is removed from the contract.remove's human output now prints the diff/package archives it sweeps, likerepairdoes.--dry-runGC preview uses the same keys too (MAJOR):prunableManifestEntries/orphanBlobs/orphanDiffArchives/orphanPackageArchives/revertableVendoredEntries/vendorOrphanDirs/bytesReclaimablebecameprunedManifestEntries/removedBlobs/removedDiffArchives/removedPackageArchives/revertedVendoredEntries/removedVendorOrphanDirs/bytesFreed. The preview leaves out only the keys a real pass alone can fill (keptVendoredEntries,failedVendoredEntries,skipped,warnings).Rollback counters span every leg (#1066)
rolledBack= agent restores +vendoredReverted+vendoredPreserved+hosted.reverted.failed= agent failures +vendoredKept+vendoredFailed+hosted.failed+hosted.unsupported.status: "error"witherror.code: "rollback_failed"instead ofpartial_failure. Exit codes are unchanged (1).Contract
updatetocommand, plusrebuilt,bytesFreedandgc; dropsbytesDownloaded.PatchEventaction enum now includesrebuilt.applynever emitsupdated,discoveredislist-only,vexwas missing..gc.*and.summary.bytesFreed.summary,gc, top-level andPatchEventkey sets, and the action vocabulary rows, against whatjson_envelopeserializes.Tests
--lib(910), plus the rollback, repair, remove, scan, in_process_scan, covgap rollback/scan-hosted and in-process rollback hosted/vendored suites, all pass locally.cargo clippy --locked --workspace --all-features -- -D warningsis clean.summary.removed: 1and the oldpartial_failureon all-failed rollbacks. The mixed hosted case now assertsrolledBack: 1, failed: 1(was 0/0).e2e_bun_lockb(needs the real toolchain) is updated to the new status, but CI is the first to run it.v5 blocker agent update (bc9c9be)
e2e_bun_lockbwas red on9714d570:native_binary_hosted_vendored_takeover_roundtripexpectedstatus: "error", but a staged manifest makes the agent leg report the copyalreadyOriginal: 1, so the run ispartial_failure, as the contract says. The per-caller fix from113c0177was lost in the branch rewrite.rollback_refuses_binary_hosted_pin_then_checkoutnow takes acopy_already_originalflag from each caller: takeover and shared-bundled-record legs (manifest staged) expectpartial_failure+alreadyOriginal: 1; hosted-only alias/transitive shapes expecterror/rollback_failed+alreadyOriginal: 0. All expectfailed: 1.origin/main(merge, not rebase) at1e69b30.e2e_bun_lockbtests pass. The other 2 fail only because this sandbox can't reach patches-api.socket.dev / GitHub tarballs (proxy 403), not because of the change.cargo fmt --all -- --checkclean.🤖 Generated with Claude Code
Note
Medium Risk
MAJOR JSON shape changes (scan dry-run GC keys, rollback total-failure status) affect automation consumers; rollback counter semantics changed across vendored/hosted legs.
Overview
v5 JSON contract: artifact GC is reported through one shared
gcobject (removedBlobs,removedDiffArchives,removedPackageArchives,bytesFreed) on envelope commands (repair,remove) and aligned withrollback/scan --prune.summary.bytesFreedmirrorsgc.bytesFreed; GC carrier events carrybytesbut no longer inflatesummary.removed.summary.bytesDownloadedis dropped from the contract.Breaking (scan dry-run): GC preview keys are unified with the wet pass (
prunedManifestEntries,removedBlobs, …) instead of the oldprunable*/orphan*/bytesReclaimablenames.Rollback (#1066): top-level
rolledBack/failedcount agent, vendored, and hosted legs. When every targeted package fails and nothing is restored or already original, JSON isstatus: "error"witherror.code: "rollback_failed"(still exit 1), notpartial_failure.Docs & tests:
CLI_CONTRACT.mdupdated (envelope,updatecommand, action matrix, jq recipes); contract tests pin serialized keys; broad test updates for GC shape and rollback status.Reviewed by Cursor Bugbot for commit bc9c9be. Configure here.
Generated by Claude Code