Repository navigation
Sweep remove.rs and repair.rs - #1875
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
The human formatters took an ArtifactNoun that production always passed as BLOB; they now use BLOB directly. Envelopes print through ui::print_json. Trims history comments and bare issue numbers. Tests: drops the tautological HOSTED_ONLY_REASON assert, the two multibyte runs that format_id_list's own test already covers, and merges the two offline no-download tests into one that covers dry run and wet run. Assisted-by: Claude Code:claude-opus-5-5
Inlines emit_not_found and hosted_unwind_error, and replaces the HostedUnwindError newtype with a String. The hosted_reverted event and the kept-entries exit tail are each built by one helper instead of twice. print_hosted_leg_warnings becomes print_run_warnings, since it also prints the rollback's warnings. Envelopes print through ui::print_json and warnings use RunWarning::new. Output is unchanged. Tests: deletes dry_run_footer_matches_repair, which compared a constant to its own literal, and asserts the not-installed warning's exact lines instead of fragments. Assisted-by: Claude Code:claude-opus-5-5
The hosted-only path records its events directly with the hosted mode instead of collecting and tagging them, and stops cloning the leg's warnings. Repair's hosted-only print says why it adds a period. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
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 b2e8bc9. Configure here.
Assisted-by: Claude Code:claude-opus-5-5
|
Ready for review at
Slack announcement not sent this run (the Slack send tool was unavailable); a later run will retry. Generated by Claude Code |
Final review brief:
|
LLM Description written by Claude Code:claude-opus-5-5
Architecture refactor sweep of
crates/socket-patch-cli/src/commands/remove.rsandrepair.rs. It applies the local cleanups from those files' audit notes incoverage/files.tsv(discussion #1830, Part 4 structure and Part 5 tests).Changes
remove.rs(production −62, tests +4)emit_not_found, at its one caller;hosted_unwind_error, intoemit_hosted_unwind_error.HostedUnwindErrornewtype.unwind_hostednow returnsResult<_, String>.hosted_revertedevent (hosted_reverted_event);kept_exit_code, used by both the manifest-backed path and the ledger-only path.print_hosted_leg_warningstoprint_run_warnings. It also prints the nested rollback's warnings.println!("{}", env.to_pretty_json())calls now go throughui::print_json(byte-identical, becauseserde_jsonis built withpreserve_order), and the 2RunWarningliterals now useRunWarning::new.DRY_RUN_FOOTERconstant, inlined at its one use;#NNNreferences, history narration, and theparse_bool_flagstory.dry_run_footer_matches_repair, which compared a constant to its own literal and couldn't fail.not_installed_warning_claims_kept_blobs_only_when_presentnow asserts the exact warning lines instead of.containsfragments.repair.rs(production −52, tests −108)noun: ArtifactNounparameter fromformat_id_list,format_found_missing,format_nothing_missing,format_offline_warningandformat_final_line. Production always passedBLOB.format_cleanup_summarykeeps its nouns because it really covers three kinds.#NNNreferences). Thehad_failureexit becamei32::from.ui::print_json.HOSTED_ONLY_REASON == "<literal>"assert.tests/repairchecks the JSON reason by substring only, so its full text is no longer pinned (noted in the final review).offline_warning_survives_multibyte_manifest_hashanddry_run_preview_survives_multibyte_manifest_hash, plus their fixture. The multibyte id case is asserted directly inid_list_is_sorted_capped_and_honest_about_truncation(and in core'sdisplay_idtest).offline_dry_run_does_not_record_download_eventandoffline_missing_artifact_warns_without_failureintooffline_missing_artifact_records_no_download_event, which runs both a wet run and a dry run. Red→green: dropping the!args.common.offline &&conjunct from the download-event gate fails it withdry_run=true: events=[… "downloadMode": "file" …].Totals
git diff --stat: 2 files, +188 / −406. Production −114, tests −104.Not done
run: too big for a sweep; it needs its own issue.(String, String, String)vendor references: the type belongs tovendored_backend/repair.rs.Dry run: no changes made.literal now appears in both remove and repair. The old test only compared remove's constant with itself, so the two were never kept in sync anyway.emit_error_envelopesets a different status. Unifying the error emit is T20.print_jsonis the canonical--jsonmechanism in Part 2.kept/kept_causesare always pushed together.Behavior change
None. Output bytes, JSON, exit codes and error codes are unchanged.
Verification
cargo clippy --workspace --all-features -- -D warningsis clean.cargo test -p socket-patch-cli --lib(remove and repair) passes: 25 tests.remove,cli_parse_remove,cli_parse_repair,cli_remove_silent,in_process_remove_repair_lifecycleandremove_rollback_api_overridesall pass.repair: 127 pass and 2 fail, both because the sandbox runs as root and the tests rely on chmod (repair_cleanup_failure_is_reported_in_json_and_silent_modesandrepair_exits_zero_and_stays_quiet_when_lock_file_unremovable). They pass in CI.Risk
Low. The changes are mechanical inlining, parameter removal and comment and test cleanup.
🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aeSLfu6JCwzAqH82nG5
Note
Low Risk
Refactor-only changes to remove/repair with integration tests asserting unchanged behavior; no auth, security, or data-path logic changes.
Overview
Mechanical cleanup of
removeandrepairinsocket-patch-cli: dedupe helpers, route--jsonthroughui::print_json, and trim comments/tests without changing CLI behavior.remove.rsinlines the oldemit_not_foundpath and drops theHostedUnwindErrorwrapper (unwind_hostedreturnsResult<_, String>). Shared pieces arehosted_reverted_event,kept_exit_code, andprint_run_warnings(renamed from hosted-only naming). Envelope printing andRunWarning::newreplace ad-hoc JSON prints and struct literals.repair.rsremoves the redundantArtifactNounargument from blob-only formatters (alwaysBLOB), usesprint_jsonfor envelopes, and tightens unit tests (merged offline download-event cases; multibyte ID coverage lives informat_id_listtests).Net diff is mostly deleted lines (~400) with no intended change to stdout/stderr bytes, JSON envelopes, exit codes, or error codes.
Reviewed by Cursor Bugbot for commit b2e8bc9. Configure here.
Generated by Claude Code