Skip to content

fix(output): shell-quote ids and paths in first-action and test-oracle proof commands - #5269

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/shell-quote-ids-audit
Oct 4, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/shell-quote-ids-audit

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Before: two printed commands interpolated values raw. review_comments gap-ledger cards printed ripr first-action --root <root> --gap-ledger <path>, and the test-oracle assistant proof printed ripr agent start --root … --seam-id <id> and ripr agent verify --root … --before … --after …. Seam ids embed the source file path, so a file like src/it's;x.rs (id probe:src_we ird_it's;x.rs:predicate:ec6d6f91) split the pasted command at the space and ran the tail after ;.

After: those values go through shell_arg, the same quoting the other printed commands use. Plain values print unchanged, so the canonical fixture and goldens are untouched.

How: audit of the remaining format!("ripr … {value}") command sites after #5232. navigation.rs, first_pr.rs, repair_attempt, agent_status.rs, pr_summary/json.rs and the LSP hover commands already quote; the remaining hits were test code. The witness explain_command is fixed on #5232. app/repair_card_handoff.rs is deliberately not touched because #5247 is rewriting those lines.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Governing issue or accepted claim: follow-up audit to the PowerShell quoting work in #5232.
Acceptance delta (one sentence): printed first-action and proof-handoff commands paste as the intended arguments for roots, paths and ids containing spaces, apostrophes and semicolons.

Candidate Relationships

Stack parent or prerequisite PR: none. Disjoint from #5232 (different files) and #5247 (does not touch repair_card_handoff.rs).

Scope

  • output/review_comments.rs first-action command; output/test_oracle_assistant_proof.rs start and verify commands.

Non-goals: PowerShell variants for these JSON fields, repair_card_handoff.rs.

Proof

cargo test -p ripr --lib -- test_oracle_assistant_proof review_comments_gap_ledger
cargo xtask precommit

Result: precommit passes locally. Two new tests assert the exact quoted strings for a hostile root, ledger path, snapshot paths and seam id. The quoted form was round-tripped through bash to a single argument earlier in the audit.

Claim Boundary

May claim: these three commands quote their dynamic values. Not claimed: every command-printing site is audited; the sweep covered format! sites naming a ripr subcommand with a raw {} flag value.

Rollback

Revert the commit.

Policy Impact

  • none

🤖 Generated with Claude Code

https://claude.ai/code/session_01FVLYAKjmToB1PDDGR6u1Hk


Generated by Claude Code

The review-comments first-action command and the test-oracle assistant proof
handoff commands interpolated the root, ledger path, snapshot paths and seam
id raw. Seam ids embed file paths, so a space, apostrophe or semicolon split
or ran the pasted command. Use shell_arg like the other printed commands.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVLYAKjmToB1PDDGR6u1Hk
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c3972c7a-b719-49f2-a653-1cb89ddb346a
📥 Commits

Reviewing files that changed from the base of the PR and between 9403ae7 and 36cd09f.

📒 Files selected for processing (2)
  • crates/ripr/src/output/review_comments.rs
  • crates/ripr/src/output/test_oracle_assistant_proof.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Limit details: You’ve used all 10 included reviews currently available.


Summary by CodeRabbit

  • Bug Fixes
    • Commands shown in gap-ledger guidance and generated for agent verification or startup now correctly quote paths and seam identifiers containing spaces, apostrophes, or shell metacharacters. This helps ensure the commands work as intended when copied into a shell.

Walkthrough

Generated first-action, verification, and agent-start commands now shell-quote root paths, ledger and snapshot paths, and seam IDs. Regression tests check command rendering with spaces, apostrophes, and shell metacharacters.

Changes

Generated Command Quoting

Layer / File(s) Summary
Quote generated command arguments
crates/ripr/src/output/review_comments.rs, crates/ripr/src/output/test_oracle_assistant_proof.rs
Generated commands shell-quote roots, ledger and snapshot paths, and seam IDs. Regression tests check rendered commands with special characters.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 36cd0

No actionable issue remains in the changed generated commands; the PR is mergeable after normal checks.

Architecture Summary

Architecture risk: 🟡 Medium · up to 36cd0

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/ripr/src/output/review_comments.rs: Added the shell_arg import for quoting command arguments.
  • observed — Modified behavior in crates/ripr/src/output/review_comments.rs: The generated first-action command now shell-quotes the root and gap-ledger path instead of interpolating their display strings directly.
  • observed — Modified behavior in crates/ripr/src/output/review_comments.rs: Added a test asserting the rendered command safely quotes root and ledger paths containing apostrophes and a semicolon.
  • observed — Modified behavior in crates/ripr/src/output/test_oracle_assistant_proof.rs: Imports shell_arg for shell-quoting generated command arguments.

Reliability and maintainability

  • inferred — Risk-relevant change factors for crates: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the shell-quoting change and the affected first-action and test-oracle proof commands.
Description check ✅ Passed The description explains the change, scope, source boundary, proof, claim limits, and rollback. It omits several template sections, including Scope Classification, Support-tier Impact, Spec-Test-Code …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each quoted trail,
Past apostrophes and shells that sail.
The paths stay safe in every line,
The seam IDs tuck in just fine.
Then off I hop, with commands aligned!

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision

  • Needs verification checks before upstream.

Verification questions

  • Confirm tests rely on single-quote + escaped-apostrophe form; PowerShell cannot paste these as one argument.
  • Confirm collect_strings flattens JSON to every string field; assert uses .any() so duplicate strings pass.
  • Confirm sensor evidence asymmetry: ripr sensor failed with exit code 2, cargo-check/cargo-clippy/cargo-fmt/cargo-test are skipped or late; the only executable proof is the two new unit tests plus author-reported precommit. PR claim is small and well-scoped but no green build receipt is in the packet.

Refuted

  • Empty --root could now serialize as an empty argument and break the downstream CLI.; refuted because: All changed sites pass values that are non-empty by construction (display_path of a real root, required gap_ledger_path, agent_root returning a string, before/after from snapshot paths, seam.seam_id from the seam). No new empty-arg surface introduced.

Parked follow-ups

  • Only one of the two new tests uses an existing fixture parser; the other hand-builds inputs. The collect_strings helper walks the JSON tree but only checks that the literal strings appear somewhere, not their location. Minor brittleness if other command strings are added later.
  • repair_card_handoff.rs is intentionally not touched because #5247 is rewriting those lines; this is an explicit out-of-scope declaration in the PR body and matches the linked disjoint-stack claim.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven
EffortlessSteven merged commit a637275 into main Oct 4, 2026
31 of 32 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/shell-quote-ids-audit branch October 4, 2026 05:24
EffortlessSteven added a commit that referenced this pull request Oct 4, 2026
…acOS and Windows (#5296)

* fix(first-pr): quote root and refs in preflight recovery commands

The missing-head, no-diff and diff-error preflight recovery commands and the
stale-packet, missing-base messages interpolated the root, base, head and
branch raw. A root with spaces or non-ASCII characters split argv, and a ref
like topic;touch x injected a command. Route them through shell_arg and
command_root like the sibling builders, and add a foreign-cwd regression
test that runs each emitted rerun command against a decoy checkout.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158DzWQfwtytj3uRvMxNmnY

* fix(first-pr): end git options before the fetched branch in the missing-base hint

A base such as origin/--upload-pack=CMD stays one quoted argument but git
still reads it as an option, so pasting the hint ran CMD. Render
git fetch origin -- BRANCH and execute the fetch half in the regression test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158DzWQfwtytj3uRvMxNmnY

* test(first-pr): satisfy clippy in recovery quoting test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158DzWQfwtytj3uRvMxNmnY

* fix(output): double typographic quotes in PowerShell command forms

Before: `shell_arg` leaves U+2018-U+201B untouched inside its single-quoted
span, and `powershell_command` passed them through. PowerShell reads those
characters as single quotes, so a root or ref such as `Steven’s repo` closed
the literal early: the pasted line failed to parse, and a crafted name like
`x’; calc; ‘y` ran a command. Every surface printed "runs unchanged in
PowerShell" for such a path. The plain-text `check` drill-in and the
`explain` next-step also printed only the bash `'\''` form, which PowerShell
rejects for any apostrophe path.

After: the translation doubles each typographic single quote inside a
literal (PowerShell reads a doubled pair as the same character) and
withholds a typographic double quote inside a double-quoted span. The
`check` drill-in and `explain` follow-up print a `(PowerShell)` line when
the shared translation differs, and nothing extra otherwise.

Tests: pure string pins, plus a real-pwsh run that binds apostrophe, space,
non-ASCII, each typographic quote and an injection payload as one argv entry,
with an untranslated control that proves the harness sees the injection.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVLYAKjmToB1PDDGR6u1Hk

* test(output): assert the full PowerShell argv vector in the hostile-path proof

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVLYAKjmToB1PDDGR6u1Hk

* test(first-pr): expect option-terminated fetch in preflight base test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158DzWQfwtytj3uRvMxNmnY

* test(evidence): build the import-line fixture through the fact arenas

#5062 added retained_import_lines_preserve_unbounded_affinity_and_owner_matching,
which constructs RustIndex from its public tests/functions/files fields.
#5109 made those fields generation-owned arenas behind accessors. Each PR
was green on its own base; together, main's ripr lib tests no longer
compile (E0560/E0615/E0616 at related_tests/context.rs:578-595).

Build the fixture with extend_tests/extend_functions plus insert_file_only,
which keeps the flat facts as occurrences separate from the file copy, as
the original fixture had, and rewrite the flat test through test_at_mut.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S5D7B2JxJ754s1p6ktir1Y
(cherry picked from commit e7547c8)

* test(evidence): build the import-line fixture through the fact arenas

#5062 added retained_import_lines_preserve_unbounded_affinity_and_owner_matching,
which constructs RustIndex from its public tests/functions/files fields.
#5109 made those fields generation-owned arenas behind accessors. Each PR
was green on its own base; together, main's ripr lib tests no longer
compile (E0560/E0615/E0616 at related_tests/context.rs:578-595).

Build the fixture with extend_tests/extend_functions plus insert_file_only,
which keeps the flat facts as occurrences separate from the file copy, as
the original fixture had, and rewrite the flat test through test_at_mut.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S5D7B2JxJ754s1p6ktir1Y

* test(evidence): build the import-line fixture through the fact arenas

#5062 added retained_import_lines_preserve_unbounded_affinity_and_owner_matching,
which constructs RustIndex from its public tests/functions/files fields.
#5109 made those fields generation-owned arenas behind accessors. Each PR
was green on its own base; together, main's ripr lib tests no longer
compile (E0560/E0615/E0616 at related_tests/context.rs:578-595).

Build the fixture with extend_tests/extend_functions plus insert_file_only,
which keeps the flat facts as occurrences separate from the file copy, as
the original fixture had, and rewrite the flat test through test_at_mut.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S5D7B2JxJ754s1p6ktir1Y

* fix(agent): bind the selected root in printed card and repair commands

`ripr agent card` and the agent repair/receipt recovery messages printed
commands that only worked from the directory the user ran ripr in: a
relative `--root .` was echoed verbatim, and the card's `full packet:` line
and identity refusal omitted `--root` entirely.

Commands displayed to a CLI user now bind the root with `bound_root`, the
rule `first-pr`, `pilot` and `agent status` already use. The binding is
lexical, so the #4332 intent holds: refusals still never print the
canonicalized verbatim store path. The card's typed command args, detail
routes and the LSP/MCP projections stay portable, and display never enters
card identity.

Refs #3999

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017EDabHFEFLYLzhb7eX34cD

* fix(agent): quote finding and seam ids in repair-card detail routes

Finding ids embed the raw file path, so a file such as `it's;x.rs` put a
space, apostrophe and `;` into the card's `ripr explain` route; pasted, it
split or ran the tail as a second command. The explain, canonical-packet and
identity-refusal routes now quote the id with `shell_arg`. Ordinary ids stay
byte-identical, and route text never enters card identity.

Refs #3999

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017EDabHFEFLYLzhb7eX34cD

* Quote the finding id in the witness explain_command

Finding ids embed the raw file path, so a path with a space, apostrophe or
semicolon split or ran the tail of the pasted command. Use shell_arg, the same
quoting the other printed commands use.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVLYAKjmToB1PDDGR6u1Hk

* Quote ids and paths in first-action and test-oracle proof commands

The review-comments first-action command and the test-oracle assistant proof
handoff commands interpolated the root, ledger path, snapshot paths and seam
id raw. Seam ids embed file paths, so a space, apostrophe or semicolon split
or ran the pasted command. Use shell_arg like the other printed commands.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVLYAKjmToB1PDDGR6u1Hk

* test(paste): paste every printed command into every shell from a foreign directory

Adds the printed_command_paste harness and an advisory lane that runs it on
Linux, macOS and Windows. The main ripr flows run against a repository whose
root and source names hold spaces, apostrophes, typographic quotes,
backticks, `$` and `;` payloads and non-ASCII text, with an absolute and a
relative --root. Every command printed in text, Markdown, JSON and the written
artifacts is pasted into bash, sh, zsh, PowerShell 7 and Windows PowerShell
from a foreign directory, with argv recorders standing in for ripr and git.

A command fails when it does not reach the program exactly once, passes
different argv in different shells, passes a fragment of a hostile name, names
a --root other than the fixture, or leaves a canary or any file beside the
shell. Known gaps found on the stacked #5188, #5232, #5247 and #5269 heads are
listed in a strict ledger: a listed gap is reported, and a row that stops
reproducing fails until deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

* Fix Windows paste lane: PowerShell 5.1 JSON array, Git Bash PATH order

Windows PowerShell 5.1 passes a piped JSON array on as one object, so the
runner iterated once and recorded no calls. Git for Windows' bin/bash.exe
launcher puts mingw64/bin ahead of PATH, hiding the git recorder.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

* Paste lane: require shells per matrix entry, batch known-gap PowerShell cases

The required Rust lane runs this test without zsh, so a missing shell is
only fatal where the paste workflow names it in RIPR_PASTE_REQUIRE. Known-gap
PowerShell cases run in their own batch so a canary from any other command
is no longer excused.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

* Print PowerShell forms for card, pilot, repair-before and workflow Missing Inputs commands

Four of the paste lane's known gaps. The first-pr missing-base sentence stays
listed: first_pr.rs belongs to #5188.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

* Paste lane: pilot closing-block PowerShell form, per-gap problem predicates, review fixes

Review of 1693807 found the pilot 'Next, in order' command without a
PowerShell form, known-gap rows excusing any problem on a matching command,
GapShells::Every cases in the canary-excusing batch, an unescaped recorder
path in BASH_ENV, no git -C root check, and docs that overstated how a
missing shell is handled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

* test(paste): excuse only the listed gap's ROOTCANARY effect in the known-gap batch

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

* docs(changelog): scope the paste-lane claim to the flows it runs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjGXVbKLB8gcwRvXFgbEqG

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants