Repository navigation
fix(analysis): resolve repo-seam grip associations across platform path separators - #3598
Conversation
…forms The repo-seam grip path derived both sides of the same-test-file association with the host-native Path::file_stem: the owner stem in OwnerContext::resolve and the tests_by_file_stem index key in CompactGripContext::new. A path carrying the other platform's separator makes file_stem treat an entire relative path as one file name, so the lookup missed and the SameTestFile relation silently vanished on exactly one host (#3469 residue identified by the 2026-08-29 investigation). Apply the #3545 normalized_file_stem pattern to both sides, mirror it in the cfg(test) same_test_file helper, and pin the contract with a mixed-separator regression test that exercises all four owner/test separator combinations end to end through evidence_for_seam. Classify-side association was already normalized in #3545; this closes the remaining known host-native stem family on the grip path. Zero golden drift (goldens check + dogfood).
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedNext included review available in 29 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThe change normalizes path separators before extracting file stems and classifying test files. Owner resolution, test indexing, and same-file matching now support foreign separators. Regression tests cover mixed separators and non-UTF-8 filename collisions. ChangesCross-platform path normalization
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The change fixes cross-platform grip associations, but its fallback owner lookup can still misattribute files with distinct non-UTF-8 names because lossy normalization may collide. This is a bounded correctness risk and the PR is mergeable with explicit owner awareness or follow-up. Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides a detailed summary, scope, non-goals, verification results, and issue linkage, but it omits many template sections, including source-of-truth links, scope classification, support-tier impact, policy impact, claim boundary, rollback, traceability, static language checks, CI economics, engineering checks, and the gates checklist. Full details: Linked Issues checkExplanation The changes address the coding objective in issue [ Full details: Out of Scope Changes checkExplanation The changed production code and tests remain within the linked issue scope. They all support platform-independent repo-seam grip association, related test-file detection, or regression coverage. No unrelated product, release, workflow, or documentation changes are present. ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a211b20b77
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…th separators A foreign-separator path broke the grip association in two stacked places (#3469): the owner lookup compared the seam's /-normalized file identity against raw host-separator index keys (component-wise Path equality only absorbs this on backslash-native hosts), and both association stems were derived with the host-native Path::file_stem. is_test_file had the same component-vs-string divergence, and lossy non-UTF-8 stems could collapse distinct names into one stem. - find_owner_function: normalized-key fallback on the miss path only - normalized_file_stem: separator-normalized, fails closed on non-UTF-8 paths (mirrors #3545 cross_host_stem) - is_test_file: judge the normalized path form - regression: all four separator combinations associate end-to-end; unix pin for the non-UTF-8 fail-closed behavior Verified by WSL reproduction of the CI failure and a green Linux lib suite; native-separator behavior is unchanged (zero golden drift).
…lback The normalized-key fallback compared lossy renderings, so two distinct non-UTF-8 index keys sharing one replacement-character form could attribute a seam to the wrong file. Both sides of the fallback comparison now require valid UTF-8; non-UTF-8 queries return None and non-UTF-8 keys are skipped. is_test_file keeps lossy normalization: replacement characters can never become separators there. Pinned by a unix unit test asserting a lossy-colliding query resolves to None. (devin + coderabbit review findings on de28bd9)
…#3600) The classify-side stem extraction composed over the lossy to_string_lossy rendering, so two distinct non-UTF-8 leaf names whose lossy forms collide (pricing_<0xFF>.rs vs pricing_<0xFE>.rs) produced one stem string, and the file-name affinity check could relate unrelated entities. The grip-side copy received the same fail-closed guard in #3598; this closes the last copy (#3599). Valid-UTF-8 stems are byte-identical to the previous pipeline (separator replace, ./ trim, last component, file_stem); only undecodable paths change behavior, from a lossy-colliding stem to an empty one, which the affinity consumers already skip. Pinned by a unix-only regression asserting colliding invalid-byte leaves yield no stem and UTF-8 forms are unchanged.
#3606) * fix(diff): pin core.quotePath=true so non-UTF-8 paths survive decoding With a repo's core.quotePath=false (non-default), raw non-UTF-8 path bytes reached run_git_diff's lossy String::from_utf8_lossy and distinct file names collapsed onto one U+FFFD string before any analysis saw them - downstream file-affinity and same-test-file consumers could then relate unrelated entities through a single merged path (#3601, upstream of the #3598/#3600 path guards, which cannot recover identity the producer destroyed). The diff invocation now pins -c core.quotePath=true, so git's own C-quoting carries non-ASCII names as ASCII escapes through the decode; the existing quoted-path parser already decodes octal escapes, and distinct names stay distinct. ASCII-only paths are byte-identical, so goldens and fixtures see no change (zero drift verified). Pinned by a unix regression: a repo configured quotePath=false with two distinct invalid-byte filenames diffs into two distinct parsed paths, neither containing the replacement character. * fix(test): correct unix-test module path and error conversion * fix(diff): decode C-quoted paths at byte level so UTF-8 names keep identity Review finding (devin + codex, P1): forcing quotePath=true sends valid UTF-8 names through git's C-quoting (cafe.rs with e-acute becomes caf\303\251.rs), and the old parser mapped each escaped byte to one Unicode scalar, decoding to caf\303\202\302\251-style mojibake that no longer matched the workspace index - regressing quotePath=false repos where those names previously arrived as valid UTF-8. parse_c_quoted_path now accumulates octal escapes as raw bytes and reconstructs the path from bytes: valid UTF-8 sequences restore their true on-disk name; bytes that are not valid UTF-8 render as literal octal residue (\377), keeping distinct invalid names distinct and never introducing the U+FFFD replacement character. Escaped metacharacters and the no-closing-quote malformed contract are unchanged. Pinned at both layers: path.rs unit test (UTF-8 reconstruction, distinct octal residue, backslash/tab escapes, malformed input) and the unix end-to-end regression extended with a valid UTF-8 filename asserted to decode to its exact on-disk identity alongside the two invalid-byte names.
Summary
Fixes a proven platform-dependent break in the repo-seam test-grip
association path (#3469 family): a path carrying the other platform's
separator lost its owner resolution — and therefore every related-test
relation — on exactly one host.
Root cause (pinned by the end-to-end regression's Linux CI
diagnostics):
RepoSeam::newnormalizes file identity to forwardslashes while index keys keep the producer's raw separators.
find_owner_functionthen compared the normalized seam file againstraw keys with
Pathequality — separator-insensitive on Windows butexact on Linux — so the failing run showed
owner=None,stem_keysintact,related=[]. The two stacked stem sites(
OwnerContext::resolve,tests_by_file_stemkeys) had the samehost-native
Path::file_stemdivergence, andis_test_filemixedcomponent-wise and string separators.
Changes (final head 54d3ed6)
find_owner_function: exact-Pathfast path unchanged; on amiss, fall back to normalized-key matching with valid-UTF-8 required
on both sides — lossy replacement characters must never fabricate
an owner (devin/coderabbit findings).
normalized_file_stem(grip): separator-normalized, fails closedon non-UTF-8 leaves (mirrors fix(analysis): normalize probe paths before test association #3545's
cross_host_stemguard).is_test_file: judges the normalized form; lossy text is safe herebecause replacement characters can never become separators.
separator combinations (failure message carries full association
diagnostics), rust_index unit pins for normalized-key resolution and
non-UTF-8 fail-closed (unix), and a non-UTF-8 stem-collision pin.
Verification
54d3ed6 re-verified below
-p ripr --all-targets -D warnings, fmt,goldens check,dogfood,precommit— all green with pipefail-guarded exitsseparator behavior unchanged (zero golden drift)
Non-goals
the issue-thread investigation attributes those runs to input skew
(worktree-mode reads, merge-ref vs branch-tip trees, build skew).
This PR removes the platform-dependence the investigation and the
CI-pinned diagnostics proved on the current code.
normalized_file_stemcopies (classify + grip) into oneshared helper remains deferred.
Closes #3469 (the investigation thread remains the analysis record for
the same-binary cross-platform repro protocol).