Repository navigation
fix(diff): disclose mixed-quote renames and prevent adjacent-file scope masking (#7795) - #8285
Conversation
…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
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
Comment |
There was a problem hiding this comment.
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.
…) (#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
Summary
With
core.quotePath=true(the loader's established pin, unchanged here) git quotes eachdiff --githeader path independently. An ASCII-to-Unicode rename therefore arrives as:parse_git_old_pathonly recognized the unquotedb/boundary, so for this asymmetric header it returned no old path. The exact rename-pair match inhandle_rename_metadatathen failed,current_pathwas cleared, and the renamed file silently vanished from scope: zero probes, zero findings, no rename notice, while a separately parseable section (theCargo.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 asmalformed_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.
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_layoutpins 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 returnedNone(left: None); green: all five assertions pass. The CLI matrixmixed_quote_rename.rs::all_quoting_layouts_disclose_renames_pure_and_editedbuilds real git fixtures for five layouts × pure/edited; every expected filename is pinned againstgit diff --name-status -zNUL inventory bytes, never derived from ripr's parser. Red: matrix failed atnew-quoted-only/pure; green: all 10 arms pass.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, andlimitationsis empty.mixed_quote_rename.rs::isolated_mixed_quote_pure_rename_section_is_disclosed_not_malformedadditionally isolates the quoted pure-rename section through the--diffroute: red it was refused; green it exits 0 with the disclosure and nomalformed_difflimitation. Parser units:parse.rs::tests::metadata_registers_mixed_quote_pure_rename_under_new_path(redrenamed_file_count 0→ green 1,pure_rename_paths == [src/日本語.rs], no limitations, not truncated).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_pathand the edited CLI arms failed pre-fix. Green: the parser unit pins the changed file atsrc/日本語.rs, line 2, added textamount > threshold; the CLI arm pins the predicate finding at./<NUL-inventory new path>, line 2, expressionamount > threshold, plus the edited-rename disclosure (old-path test associations are not carried forward) on stderr.Existing confinement/adversarial path controls remain fail-closed. No
core.quotePath=trueremoval, 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).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 failedcargo test -p ripr --lib rename— 50 passed, 0 failedcargo test -p ripr --test cli_smoke mixed_quote_rename— 3 passed, 0 failedcargo clippy -p ripr --lib --tests -- -D warnings— cleancargo fmt --check— cleancargo xtask check-changelog-fragments— passcargo xtask check-traceability— pass (new tests linked under RIPR-SPEC-0170)Closes #7795