Skip to content

fix(diff): disclose mixed-quote renames and prevent adjacent-file scope masking (#7795) - #8285

Merged
EffortlessSteven merged 1 commit into
mainfrom
fix/diff-disclosure-7795
Oct 17, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
fix/diff-disclosure-7795

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

With core.quotePath=true (the loader's established pin, unchanged here) git quotes each diff --git header path independently. An ASCII-to-Unicode rename therefore arrives as:

diff --git a/src/lib.rs "b/src/日本語.rs"

parse_git_old_path only recognized the unquoted b/ boundary, so for this asymmetric header it returned no old path. The exact rename-pair match in handle_rename_metadata then failed, current_path was cleared, and the renamed file silently vanished from scope: zero probes, zero findings, no rename notice, while a separately parseable section (the Cargo.toml [lib] path edit the fixture needs to stay valid) masked the missing scope with a complete-looking result. An isolated pure-rename section was refused as malformed_diff.

The fix is confined to the production old-path reader: it recognizes the independently quoted destination boundary ( "b/) before its existing unquoted boundary. An unquoted old path cannot contain a quote — git would have C-quoted the whole path — so the quoted boundary is unambiguous. All existing metadata/disclosure consumers, the native decoder/confinement, the exact rename-from match, and the loader quoting pin are reused unchanged.

Distinct from the delivered ordinary-rename claim (#2668 / merged #2727): this is the asymmetric-header witness those controls did not cover.

Acceptance predicates and red→green evidence

Red was captured with the tests committed against the unmodified reader; the same tests are green with the fix. Local runs: Windows, Rust 1.95.0.

  1. Literal, native-inventory controls cover all four old/new quoting combinations, pure and edited.
    path.rs::tests::parse_git_old_path_pairs_each_destination_quoting_layout pins all four header layouts (both unquoted incl. spaces, old-quoted-only, new-quoted-only, both-quoted) plus the mixed-layout confinement rejection. Red: the new-quoted-only case returned None (left: None); green: all five assertions pass. The CLI matrix mixed_quote_rename.rs::all_quoting_layouts_disclose_renames_pure_and_edited builds real git fixtures for five layouts × pure/edited; every expected filename is pinned against git diff --name-status -z NUL inventory bytes, never derived from ripr's parser. Red: matrix failed at new-quoted-only/pure; green: all 10 arms pass.

  2. A pure mixed-quote rename is counted/disclosed without invented probes or a malformed-diff accusation; an adjacent parseable file cannot conceal it.
    Red (CLI witness, matching the issue's executed numbers): changed_file_count 1, changed_line_count 2 — only the Cargo.toml edit; zero probes/findings; no rename notice; the rename lost while the parseable neighbor survived. Green: changed_file_count 2, the pure-rename disclosure (detected 1 pure rename(s) with no changed lines; rename-only changes produce no probes.) is on stderr, probes == 0, no zero-scope/non-source disclosures, and limitations is empty. mixed_quote_rename.rs::isolated_mixed_quote_pure_rename_section_is_disclosed_not_malformed additionally isolates the quoted pure-rename section through the --diff route: red it was refused; green it exits 0 with the disclosure and no malformed_diff limitation. Parser units: parse.rs::tests::metadata_registers_mixed_quote_pure_rename_under_new_path (red renamed_file_count 0 → green 1, pure_rename_paths == [src/日本語.rs], no limitations, not truncated).

  3. Edited mixed-quote findings retain the new path, line 2, actual live/committed expression and the existing old-path-association limitation.
    Red: metadata_registers_mixed_quote_edited_rename_under_new_path and the edited CLI arms failed pre-fix. Green: the parser unit pins the changed file at src/日本語.rs, line 2, added text amount > threshold; the CLI arm pins the predicate finding at ./<NUL-inventory new path>, line 2, expression amount > threshold, plus the edited-rename disclosure (old-path test associations are not carried forward) on stderr.

  4. Existing confinement/adversarial path controls remain fail-closed. No core.quotePath=true removal, no golden relabeling (no goldens touched). cargo test -p ripr --lib analysis::diff: 225 passed / 0 failed post-fix (222 pre-existing passed pre-fix); cargo test -p ripr --lib rename: 50 passed / 0 failed. The mixed-layout traversal control in the new unit test is rejected (None).

  5. Pre-repair red, candidate green, review, hosted CI. Red→green captured locally per above; this PR carries the hosted proof (routed gate below) and independent exact-head review per the normal lane process.

Non-goals (unchanged)

Test-association transfer, parser architecture, Python/TypeScript oracles, gate/policy/MCP/SDLC changes, releases. The inherited residual from the issue — a both-unquoted real-git old name containing b/ still splits at the first fallback delimiter — is deliberately out of scope and unchanged.

Local verification

  • cargo test -p ripr --lib analysis::diff — 225 passed, 0 failed
  • cargo test -p ripr --lib rename — 50 passed, 0 failed
  • cargo test -p ripr --test cli_smoke mixed_quote_rename — 3 passed, 0 failed
  • cargo clippy -p ripr --lib --tests -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo xtask check-changelog-fragments — pass
  • cargo xtask check-traceability — pass (new tests linked under RIPR-SPEC-0170)

Closes #7795

…pe masking

With core.quotePath=true (the loader's pin) git quotes each diff --git
header path independently, so an ASCII-to-Unicode rename arrives as
a/src/lib.rs "b/src/<quoted>.rs". parse_git_old_path only recognized the
unquoted " b/" boundary, so the old path was lost, the exact rename-pair
match in handle_rename_metadata failed, and the renamed file silently
vanished from scope; a separately parseable section (e.g. a Cargo.toml
[lib] path edit) then masked the missing scope with a complete-looking
result, and an isolated pure-rename section was refused as malformed_diff.

The old-path reader now recognizes the independently quoted destination
boundary before its existing unquoted boundary. An unquoted old path
cannot contain a quote (git would have quoted the whole path), so the
quoted boundary is unambiguous. Confinement, adversarial-path controls,
and the loader quoting pin are unchanged.

Red -> green evidence (predicates 1-3 of #7795):
- path.rs::parse_git_old_path_pairs_each_destination_quoting_layout
- parse.rs::metadata_registers_mixed_quote_pure_rename_under_new_path
- parse.rs::metadata_registers_mixed_quote_edited_rename_under_new_path
- cli_smoke mixed_quote_rename.rs: five literal layouts x pure/edited
  with native NUL name-status inventory pins, adjacent-file masking, and
  isolated pure-section disclosure

Closes #7795
@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 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 52 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 6d2c1e4f-e46d-40f7-808d-fffdb3eaf3fd
📥 Commits

Reviewing files that changed from the base of the PR and between a1ea790 and 1b4a5f6.

📒 Files selected for processing: 6
  • .ripr/traceability.toml
  • changelog.d/7795-mixed-quote-rename-disclosure.md
  • crates/ripr/src/analysis/diff/parse.rs
  • crates/ripr/src/analysis/diff/path.rs
  • crates/ripr/tests/cli_smoke.rs
  • crates/ripr/tests/cli_smoke/mixed_quote_rename.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 reviewer attention before upstream: findings remain.

Confirmed findings

  • Siblings not enumerated exhaustively: cli_smoke module inclusion order (mixed_quote_rename placed before native_fanout) and any future sibling test module following the same shape should follow the same lang-rust gate pattern; this is calibration guidance, not a defect.

Refuted

  • split_once(" "b/") could mis-split an unquoted old path containing literal space-quote-b inside it.; refuted because: Git would have whole-path C-quoted any path containing "; an unquoted old path cannot legitimately contain "; the new boundary is unambiguous and the unquoted split_once(" b/") fallback is retained for the unquoted-both case.
  • A symmetric independently-quoted SOURCE boundary (vs the fixed DESTINATION boundary) creates a parallel blind spot in parse_new_path_marker or hunk readers.; refuted because: parse_new_path_marker and parse_diff_path_token operate on a single token and never split on b/; hunk headers route through the same per-token decoder, so no analogous unquoted/quoted boundary exists to miss.

Parked follow-ups

  • Park for follow-up (not this PR): verify no other diff consumer assumes symmetric a/... b/... quoting outside path.rs; the inheritance list in the changelog fragment is currently scoped to metadata/disclosure/native decoder/confinement/loader pin only.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit f3fa41d into main Oct 17, 2026
36 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/diff-disclosure-7795 branch October 17, 2026 02:05
EffortlessSteven added a commit that referenced this pull request Oct 17, 2026
…) (#8440)

* test(issue-lifecycle): capture real issue-to-merge closeout rows (#4932)

Two real (synthetic: false) issue_lifecycle_attempt.v1 rows join the
RIPR-SPEC-0218 counting law corpus:

- Row A binds the complete #7795 journey: issue snapshot -> PR #8285 ->
  green checks on head 1b4a5f6 -> squash merge f3fa41d -> issue CLOSED
  -> compare-verified current head at main b038650 (behind_by 0) ->
  burn-down closed with five covered acceptance predicates -> closeout
  completed.
- Row B binds the live negative control: PR #8325 squash-merged as
  70d053f while parent #1706 stays OPEN with ten uncovered acceptance
  rows and no current-head receipt -> merged_pending_closeout.

Every identity is verified with read-only gh commands recorded in
provenance.json; snapshot digests recompute fail-closed over LF bytes in
check-fixture-contracts; gaps GitHub does not record stay recorded as
limitations. Adapter tests (cargo test -p xtask issue_lifecycle_real_rows)
pin wrong-identity rejection, zero-subject verification, stale receipts,
uncovered acceptance, duplicate import dedup and synthetic/real separation.

Spec: RIPR-SPEC-0278. Refs #4932

* test(issue-lifecycle): reduce gh captures to context-clean receipts (#4932)

The first gate run flagged two verbatim captures under
check-local-context: a local F:\ path inside a third-party commit
message of the 41-commit compare payload and a .codex role-path inside
the PR #8325 body. The local-context policy removes rather than
allowlists real machine state, so the compare and the PR #8325 captures
are jq-reduced receipts (base/head SHAs, ahead/behind counts, merge
facts) that bind the same identities without third-party prose. Row
digests and provenance snapshot digests recompute over LF bytes; the
now-unneeded static-language allowlist entry for the compare capture is
dropped. Refs #4932

* test(fixtures): correct real-rows captured_at to UTC and fail closed on capture-time inconsistency

Graphite review on #8440 caught that provenance.captured_at recorded
02:27 local as if it were UTC while the Row B snapshot binds PR #8325
mergedAt 06:06:21Z — about 3h39m "after" the stated capture. The capture
session was internally consistent (the captures happened at 02:27 -0400
== 06:27 UTC, after every bound merge/close event); only the timezone
label was wrong.

- provenance.json: captured_at corrected to 2026-10-17T06:27:51Z, the
  true UTC instant of the capture session
- verify_real_rows_bindings now cross-checks capture-time consistency
  fail-closed: captured_at must not predate the latest mergedAt/closedAt
  event any bound snapshot records, and non-UTC event timestamps reject
- new adapter test capture_time_predating_a_bound_event_rejects pins
  the rejection
- RIPR-SPEC-0278 behavior section and the changelog record the
  cross-check

Refs #4932
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.

ux(diff): ASCII-to-Unicode rename loses disclosure; adjacent file masks missing scope

1 participant