Repository navigation
Sweep hosted_unwind, lock_cli, list, commands/mod (+ rollback dead branch) - #1864
Mikola Lysenko (mikolalysenko) wants to merge 5 commits into
Conversation
Sweep hosted_bundle, hosted_unwind, list, lock_cli, commands/mod and pypi_reinstall per the coverage notes. Assisted-by: Claude Code:claude-opus-5-5
HostedLegOutcome::unsupported was never written, so rollback's hosted_unsupported events and its exit-code conjunct were dead. run_hosted_leg now merges its two post-flush blocks and skips the bun patch-key read on a dry run, which never used it. hosted-bundle moves the bundle's option fields instead of cloning them, and its module doc lists policySha256. Assisted-by: Claude Code:claude-opus-5-5
list uses ledgers::Store directly, builds uuid-only records and run warnings through their helpers, and reads the vendor ledger leniently inline (vendor_state_lenient had one caller). The can't-fail determinism test is gone. user_patches is declared with the other modules, and the mode tests compare the whole usage error, so a swapped agent/hosted variant fails them. Assisted-by: Claude Code:claude-opus-5-5
emit, held_hint and held_message fold into their only callers, and the lifecycle essay that core apply_lock already documents is gone. The three held_message tests become one on lock_failure, and the held_hint test duplicated format_lock_error's. Output is unchanged. Assisted-by: Claude Code:claude-opus-5-5
The human branch now calls the formatter the self-enveloping sites use, so the two cannot drift. The budget test is renamed after the function it exercises. 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 1d557d4. Configure here.
|
Burn-down agent: labeled Generated by Claude Code |
|
Burn-down agent: labeled Ready for review at
Generated by Claude Code |
|
Final review brief: approver-ready What it does: It is a behavior-preserving cleanup of five CLI command modules: it inlines single-use helpers, dedupes tests and trims docs. It also deletes the Risk: low. Every user-visible string, error code, exit code and JSON field compares identical to main. The only runtime difference is that a dry-run unwind skips one read-only lockfile scan whose result it never used. Look here
Verified
Changes I made: none. Open questions (non-blocking)
Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Sweep of the next audited, unswept rows of
coverage/files.tsvincrates/socket-patch-cli/src/commands/:hosted_bundle.rs,hosted_unwind.rs,list.rs,lock_cli.rs,mod.rsandpypi_reinstall.rs(clean). No other open PR touches these files. This follows the architecture audit's per-file notes (discussion #1830, living document Part 4).Changes
hosted_unwind.rs(+rollback.rs)HostedLegOutcome::unsupportedfield. Nothing ever wrote to it. Removing it also removes rollback'shosted_unsupportedevent loop and its exit-code conjunct (−11 lines inrollback.rs). Thehosted_unsupportedcode appears nowhere else: not in the contract and not in any test.flush_error.is_none()blocks into one. Warning order is unchanged.live_user_patch_keysread, since only the wet run uses it.hosted_bundle.rstake()instead of cloned.policySha256; it is now listed.list.rsStore as Sourcealias and its 6-line comment.PatchRecordliteral withledgers::uuid_only_record.RunWarningliterals withRunWarning::new.read_manifest.vendor_state_lenient, which had one caller and lived inmod.rs.vendor_entry.ordering_is_deterministic_across_builds. It built the envelope twice from the sameHashMap, so both builds iterate in the same order and the test can't fail.mod.rsmod user_patchesup with the other module declarations.hosted_state_from_pinsnow usesuuid_only_record.an_uncovered_manifest_record_beside_a_ledger_is_ambiguousasserted only.contains("--mode").a_malformed_manifest_is_not_a_hosted_projectasserted onlyis_err().a_hosted_pin_over_a_ledger_entry_is_ambiguousasserted onlyis_err().hosted_pins_beside_a_ledger_are_ambiguousnow does the same.(true, true)arm to return"<root> --mode". The old asserts still passed. The new tests failed (an_uncovered_…anda_malformed_…), and they pass again after the revert.lock_cli.rsemit,held_hintandheld_messageinto their only callers.acquire_or_emitnow prints throughformat_lock_error, so it shares one formatter with the sites that build their own envelope.apply_lockalready documents the lifecycle.--break-lockand the acquire-mkdirs change.error_envelope_propagates_dry_run_and_command.held_messagetests became one,lock_failure_renders_the_waited_budget.held_hint_depends_on_whether_we_already_waited, a duplicate offormat_lock_error_matches_acquire_or_emit.waiting_messageis still a separate function, because its status-line text is tested only through it.Not done here, because each would reach files that #1698 touches or would change output:
acquire_or_emit(&GlobalArgs)(T09/Acquire apply.lock through one lock_cli helper that takes &GlobalArgs; the sequence is open-coded 9 times and renders lock_held 3 ways #1858)patch_server_originsforwarder (callers inget.rs/vendor.rs)global_scope_flagvsui::global_scope_arg(they print different text)hosted_bundle'sjson!error and its hand-builtApiClient(both would change output or behavior)Size
git diff --stat: 6 files, +160 / −300.Behavior change
None. Output bytes, JSON, exit codes and error codes are unchanged. Removing the dead
hosted_unsupportedbranch changes nothing, because that list was always empty.Verification
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --lib: 936 passed.--test rollback,remove,in_process_rollback_hosted,in_process_rollback_vendored,scan_get_mode_from_project_state,e2e_safety_lock,cli_parse_list,command_module_layeringandhosted_memory_parity: all pass./code-review high
Six findings. I fixed three:
acquire_or_emitnow reusesformat_lock_error.lock_failuredoc no longer overclaims.I did not fix three:
list --jsondoesn't report an unreadable vendor ledger inwarnings[]. This is pre-existing; I only moved the code. Fixing it would change JSON output, so it belongs in its own issue.HashMap.Risk
Low. The changes are mechanical inlining and deletions, and the touched paths are covered by the suites above.
🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aeQq8rjUYApktQhf6WR
Note
Low Risk
Mechanical refactors and deletion of dead rollback paths in CLI listing, lock, and hosted helpers; PR asserts output and exit codes stay the same aside from never-fired
hosted_unsupported.Overview
Architecture-audit cleanup across several
socket-patch-clicommand modules: mostly doc trims, shared helpers, and dead-code removal with no intended user-visible behavior change.Hosted unwind and rollback drop the never-populated
HostedLegOutcome::unsupportedfield and rollback’shosted_unsupportedJSON events / exit-code check. Hosted restore dry runs skip the bunlive_user_patch_keysread; post-restore warning logic is merged into oneflush_error-gated block.List and mod centralize uuid-only patch stubs via
ledgers::uuid_only_record, useRunWarning::new, rename ledgerStoreusage (noSourcealias), and inline vendor-ledger lenient loading intolist(stderr warning unchanged;--jsonstill omits that warning). Mode-resolution tests now assert full--modeusage strings instead of partial checks.Lock CLI inlines lock-failure formatting so human-mode
acquire_or_emitgoes throughformat_lock_errorwithlock_failure; redundant tests and long historical comments are removed.Hosted bundle documents
policySha256on stdin and moves optional bundle fields into scan options withtake()instead of cloning.Reviewed by Cursor Bugbot for commit 1d557d4. Configure here.
Generated by Claude Code