Repository navigation
Sweep json_envelope, update_notifier, main, path_scope - #1967
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
update_notifier: inline in_ci, upgrade_command and grace_budget; one millis_or parser for the timeout and grace knobs; guard types private; the notice test compares exact plain and colored strings. main/interrupt: the SIGPIPE reset moves into interrupt::install. json_envelope: drop the unused sidecar re-export and the test-only GcReport::to_value; usage_error prints through ui::print_json; trim stale and history docs. Tests that claimed "every" action, command or status now cover all variants; drop 4 duplicate tests and the JSON string round trips. path_scope: replace a tautological bind-vs-matches test and a duplicate; add the relative --cwd strip case. Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
Labeled Ready for review (burn-down agent).
Generated by Claude Code |
Final review briefWhat it does. A tidy-up of five Risk: low. Production changes are small and mechanical. The JSON bytes are the same ( Look here
Verified
Changes I made: none. Open questions (not blocking)
Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
The sweep dropped it together with a stale comment. No other test covers a bare * pattern. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] Re the final review's open question: no other test covered a bare Generated by Claude Code |
Final review brief (head
|
|
bugbot run 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 37dc766. Configure here.
LLM Description written by Claude Code:claude-opus-5-5
Sweep of five audited top-level files in
crates/socket-patch-cli/src:json_envelope.rs,update_notifier.rs,main.rs,interrupt.rsandpath_scope.rs. It applies the coverage-row notes from the architecture ledger. The aim is fewer wrappers, docs that are true ofmain, and tests that check what their names claim.Changes
update_notifier.rsin_ci,upgrade_commandand thegrace_budgetwrapper (each had one caller).SOCKET_UPDATE_TIMEOUT_MSandSOCKET_UPDATE_GRACE_MSwere parsed by two copies of the same code. Both now go through onemillis_or, which replacesgrace_budget_from. Dropping the.filter(!empty)changes nothing, because"".parse()already fails.GuardCtx,SkipReason,should_checkandGuardCtx::captureare now private (only this file uses them).notice_is_two_prefixed_lines_with_a_green_versionchecks the exact plain string and the exact colored string. Before, it ran 4.containschecks that the equality assert already covered, plus a bare "has an escape" check.main.rs/interrupt.rsrestore_default_sigpipeand its non-unix stub moved intointerrupt's unixinstall(). The order is unchanged: SIGPIPE is reset first, then the handlers are installed, all before any output. The doc now says the reset is unconditional.json_envelope.rspub usere-export of the sidecar types (nothing imports through it) and the test-onlyGcReport::to_value.usage_errornow prints throughui::print_json, which writes the same bytes.usage_error_jsonis now private.package,diff,blob" list, staleRemoved/Verifiedscopes (now matching the CLI_CONTRACT vocabulary table), the section banner, and "the prior test only checked…" narration.RolledBack,Rebuilt,Update, 8 of the 10 statuses). They now share the completeACTIONSandCOMMANDStables, andevery_status_serializes_camel_casecovers all 10 statuses. It replacesstatus_serializes_camel_caseandspecial_statuses_serialize_camel_case.record_keeps_summary_in_sync, covered byeach_action_bumps_exactly_its_own_counter;old_uuid_omitted_when_unsetandskipped_reason_does_not_leak_into_error_field, covered byskipped_event_omits_uuid_and_files;status_serializes_camel_case.from_str(&to_pretty_json())andfrom_str(&to_string())round trips becameto_value.path_scope.rs(tests only;PathScope::matches's one production caller is inrollback.rs, which #1864 holds)bound_scope_matches_like_the_per_call_formcomparedbind().matchesagainstmatches, which is implemented asbind().matches, so it could not fail. It now asserts the expected outcomes directly.matching_is_purely_textual, a duplicate of the directory-pattern test.relative_cwd_strips_relative_candidatesfor the--cwd ././node_modules/xcase thecwdfield exists for.nested/*comment.Red→green
These mutations were applied to committed code and then reverted. Each turns the named tests red:
Summary::bump'sRolledBackarm bumprebuiltfailseach_action_bumps_exactly_its_own_counter. The old test listed neither variant.Command::UpdatetoselfUpdatefailsevery_command_serializes_to_its_contract_tagandusage_error_json_is_a_full_envelope_for_every_command. Neither old list hadUpdate.33) instead of green failsnotice_is_two_prefixed_lines_with_a_green_version. The old test only checked for an escape.Size
+195 / −447 across 5 files. Production code goes from 1,486 to 1,422 lines (−64), and test code from 1,036 to 848 lines (−188).
Behavior
None. Output bytes, JSON, exit codes and signal handling are unchanged.
Verification
cargo clippy --workspace --all-features -- -D warningsis clean.cargo test -p socket-patch-cli --libpasses 936/936.updatesuite passes 113 (it includesupdate_notifier_e2e), and theclisuite passes 68.interrupt.rsiscfg(unix)code, but it only gained the SIGPIPE line that used to run inmain. The Windows path is untouched./code-review high
Six findings. Three are fixed:
hosted-bundleas the exception to the envelope;millis_or's doc no longer callsSOCKET_UPDATE_TIMEOUT_MSa "test knob".Three are not fixed:
GuardCtx/SkipReason/sidecar re-export/GcReport::to_value):socket_patch_cli's lib only serves its own binary and tests, and nothing in the workspace uses these items.UpdateTimeouts::from_envparsesSOCKET_UPDATE_TIMEOUT_MStoo: this predates the PR (audit A09/C19). The two parses differ: core capsconnectand the notifier does not. Unifying them would change behavior, so it stays for the structural row.in_ciinlined and the 500 ms literal:in_cihad no test before this PR either, and the 500 ms literal now sits next to its why comment.Risk
Low. The changes are local, and the touched test suites are green.
🤖 Generated with Claude Code
https://claude.ai/code/session_011f9aeSzcBKdmvUrvNDZi76
Note
Low Risk
Refactor and test/doc changes within the CLI crate; PR asserts unchanged JSON bytes, exit codes, and signal handling, with broad test coverage still green.
Overview
This is a behavior-neutral cleanup across five
socket-patch-climodules: fewer one-off helpers, docs aligned withmain, and tests that actually cover the full JSON contract tables.Startup / signals: Unix SIGPIPE handling moves from
mainintointerrupt::install()(still before any output), alongside the existing lock-cleanup signal handlers.JSON envelope: Trims stale module docs, drops unused
GcReport::to_valueand sidecar type re-exports, routesusage_errorthroughui::print_json, and tightens tests with sharedACTIONS/COMMANDStables so every action, command, and status serializes as documented (includingRolledBack,Update, etc.).Update notifier: Inlines single-use helpers, unifies
SOCKET_UPDATE_*_MSparsing viamillis_or, narrowsGuardCtx/SkipReason/should_checkto crate-private, and strengthens the notice formatting test.Path scope: Test-only fixes—replaces a tautological bind-vs-
matchescheck, adds--cwd ././node_modules/…coverage, and corrects glob comments.Reviewed by Cursor Bugbot for commit 37dc766. Configure here.
Generated by Claude Code