Repository navigation
Fix apply --check remedy dropping scope flags (#1219) - #1325
Merged
Mikola Lysenko (mikolalysenko) merged 5 commits intoOct 9, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`apply --check` ended its drift report with a fixed "Run `socket-patch apply`" line. A check run with --cwd, -g/--global-prefix, --manifest-path or --ecosystems printed a remedy that targets another tree: run as printed it exited 0 and left the drift in place. The remedy now repeats the check's scope flags, shell-quoted when needed, through one shared ui::scope_args helper (the report-only scan hint's quoting moves to ui::shell_word). Integration tests run the printed remedy verbatim for the --cwd and --global-prefix lanes and assert the next check exits 0. Fixes #1219 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 9, 2026 16:57
Collaborator
Author
|
BugBot review |
Mikola Lysenko (mikolalysenko)
enabled auto-merge
October 9, 2026 16:57
The remedy_commands_parse test reads backticked commands out of source
literals; `socket-patch apply{}` parsed as an unknown subcommand. Build
the command first and interpolate it whole.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
|
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 8a76154. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 9, 2026
Mikola Lysenko (mikolalysenko)
disabled auto-merge
October 9, 2026 19:55
Mikola Lysenko (mikolalysenko)
enabled auto-merge
October 9, 2026 21:31
Mikola Lysenko (mikolalysenko)
deleted the
agent/v5-apply-check-remedy-scope
branch
October 9, 2026 22:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1219
Summary
When
apply --checkfinds drift, its human report now ends with a remedy that uses the check's own scope:Before, the line was always
Run \socket-patch apply` to regenerate them.. Run as printed after a-g,--global-prefixor--cwd` check, it acted on a different tree, exited 0 and left the drift in place.Root cause
apply.rsprinted a constant remedy and never looked atargs.common. This is the same class of bug as #464, which #777 fixed only for the report-onlyscanhint.Change
ui::scope_args(common)renders the flags that choose the tree:--cwd,--manifest-path,-g/--global-prefixand--ecosystems, each only when it differs from its default.ui::shell_wordquotes each value when needed. It is Fix report-only scan -g hint dropping -g (#464) #777's quoting helper, moved out ofscan/render.rsso both hints share it.ui::global_scope_argis the global-only part. The report-onlyscanhint now uses it, and its output is unchanged.apply --checkprintscheck_remedy(&args.common).apply --checkrow now documents the remedy and its scope.--jsonoutput is unchanged.Tests (per issue)
apply --checkdrift report tells you to runsocket-patch applywithout the-g/--global-prefix/--cwdit was given, so following it patches nothing and exits 0 #1219,--cwdlane:tests/apply/check_verifies_installed_tree.rs::check_remedy_keeps_cwd_and_heals_the_checked_treeruns the check from the parent dir with--cwd, parses the printed remedy, runs it verbatim and asserts that the file is patched and the next check exits 0.apply --checkdrift report tells you to runsocket-patch applywithout the-g/--global-prefix/--cwdit was given, so following it patches nothing and exits 0 #1219,--global-prefixlane:check_remedy_keeps_global_prefix_and_heals_the_checked_treedoes the same with a prefix that contains a space, so the quoting is exercised.commands::apply::tests::check_remedy_repeats_the_check_scopechecks the default,--cwd,-g, a quoted--global-prefix, and--cwd+--manifest-path+--ecosystems.Red before the fix: both integration tests fail with
left: ["apply"]againstright: ["apply", "--cwd", ".tmp…"]/["apply", "--global-prefix", "…/global lib/node_modules"]. Green after.Commands run
cargo test -p socket-patch-cli --lib --test apply --test cli_apply_silent --test covgap_commands_scan_mod --test remedy_commands_parse: all passed (remedy_commands_parse caught the first version'sapply{}literal; fixed in the second commit)cargo clippy --workspace --all-features -- -D warnings: cleancargo fmt --all -- --check: clean for the changed files (core/src/patch/redirect/upstream/mod.rshas a main-wide fmt diff that this PR does not touch)🤖 Generated with Claude Code
Generated by Claude Code
Note
Low Risk
User-facing CLI hint text only; apply/check logic and JSON output are unchanged aside from the stderr remedy line.
Overview
Fixes #1219: when
apply --checkreports drift, the closing remedy no longer suggests a baresocket-patch apply. It now repeats the check’s tree scope (--cwd,--manifest-path,-g/--global-prefix,--ecosystems), shell-quoted where needed, so pasting the line heals the same tree that was audited.Shared UI helpers implement that:
shell_wordmoves from scan rendering intoui::text, with newglobal_scope_argandscope_argsonGlobalArgs. Report-onlyscanhints useglobal_scope_arg(behavior unchanged). CLI_CONTRACT.md documents the scoped remedy. Unit and integration tests assert remedy text and that running it verbatim fixes drift under--cwdand spaced--global-prefix.Reviewed by Cursor Bugbot for commit 8a76154. Configure here.