Skip to content

fix(analysis): resolve repo-seam grip associations across platform path separators - #3598

Merged
EffortlessSteven merged 4 commits into
mainfrom
fix/3469-grip-association-stems
Aug 31, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
fix/3469-grip-association-stems

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

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::new normalizes file identity to forward
slashes while index keys keep the producer's raw separators.
find_owner_function then compared the normalized seam file against
raw keys with Path equality — separator-insensitive on Windows but
exact on Linux — so the failing run showed owner=None,
stem_keys intact, related=[]. The two stacked stem sites
(OwnerContext::resolve, tests_by_file_stem keys) had the same
host-native Path::file_stem divergence, and is_test_file mixed
component-wise and string separators.

Changes (final head 54d3ed6)

  • find_owner_function: exact-Path fast path unchanged; on a
    miss, 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 closed
    on non-UTF-8 leaves (mirrors fix(analysis): normalize probe paths before test association #3545's cross_host_stem guard).
  • is_test_file: judges the normalized form; lossy text is safe here
    because replacement characters can never become separators.
  • Regression coverage: end-to-end grip test over all four owner/test
    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

  • Linux CI (Ripr Rust Small Result): pass on de28bd9; final head
    54d3ed6 re-verified below
  • locally: grip 251 / rust_index 27 / classify 27 tests, clippy
    -p ripr --all-targets -D warnings, fmt, goldens check,
    dogfood, precommit — all green with pipefail-guarded exits
  • parallel-agent WSL reproduction of the original CI failure; native
    separator behavior unchanged (zero golden drift)

Non-goals

  • No claim that fix(analysis): exposure classification diverges across platforms on identical committed trees #3469's 0.10.0-era observations came from this path:
    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.
  • Hoisting normalized_file_stem copies (classify + grip) into one
    shared helper remains deferred.

Closes #3469 (the investigation thread remains the analysis record for
the same-binary cross-platform repro protocol).

…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).
@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!

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-31T00:21:48.479521Z a211b20 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 29 minutes.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 52226257-7b97-4ab2-a9cd-ec2538ec5025

📥 Commits

Reviewing files that changed from the base of the PR and between de28bd9 and 54d3ed6.

📒 Files selected for processing (1)
  • crates/ripr/src/analysis/rust_index.rs

Summary by CodeRabbit

  • Bug Fixes

    • Improved matching between source files and related tests when paths use mixed or platform-specific separators.
    • Preserved same-test-file associations across operating systems and path formats.
    • Improved recognition of test files regardless of path separator style.
  • Tests

    • Added regression coverage for mixed separator combinations and path resolution.
    • Added safeguards against incorrect matches for distinct filenames.

Walkthrough

The 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.

Changes

Cross-platform path normalization

Layer / File(s) Summary
Normalized stem resolution
crates/ripr/src/analysis/test_grip_evidence/related_tests.rs, crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs
normalized_file_stem normalizes separators and extracts filename stems. Owner resolution, same-file matching, and test indexing use the helper.
Normalized owner and test paths
crates/ripr/src/analysis/rust_index.rs
Owner lookup falls back to normalized index keys. is_test_file classifies paths independently of separator style. Unit tests cover both behaviors.
Mixed-separator regression coverage
crates/ripr/src/analysis/test_grip_evidence/tests.rs
Tests cover mixed / and \ separators and reject lossy non-UTF-8 stem collisions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to de28b

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

A rabbit trims each path with care

And makes both slash marks pair
Test stems meet from near and far
Even where the separators are
Strange byte names stay apart
Clean paths hop from chart to chart

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning 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, supp… Complete the missing template sections. Mark non-applicable sections such as CI Economics as n/a, and record the relevant scope, proof, rollback, traceability, engineering checks, and gate results.
Docstring Coverage ⚠️ Warning Docstring coverage is 52.94% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: fixing repo-seam grip associations across platform path separators.
Linked Issues check ✅ Passed The changes address the coding objective in issue [#3469] by normalizing repo-seam owner lookup, test-file detection, and file-stem comparison across path separators. Regression tests cover the affect…
Out of Scope Changes check ✅ Passed 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 un…
Full details: Description check

Explanation

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 check

Explanation

The changes address the coding objective in issue [#3469] by normalizing repo-seam owner lookup, test-file detection, and file-stem comparison across path separators. Regression tests cover the affected separator combinations and non-UTF-8 fail-closed behavior. The classify-side path is explicitly handled separately and is not required for this repo-seam change.

Full details: Out of Scope Changes check

Explanation

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 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3469-grip-association-stems

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.

❤️ Share

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

coderabbitai[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration 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.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 2 new potential issues.

Devin Review

@EffortlessSteven EffortlessSteven changed the title fix(analysis): normalize repo-seam grip association stems across platforms fix(analysis): resolve repo-seam grip associations across platform path separators Aug 31, 2026
…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).

@devin-ai-integration devin-ai-integration 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.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 4 new potential issues.

Devin Review

Comment thread crates/ripr/src/analysis/rust_index.rs Resolved
Comment thread crates/ripr/src/analysis/rust_index.rs Resolved
Comment thread crates/ripr/src/analysis/rust_index.rs Resolved
coderabbitai[bot]

This comment was marked as resolved.

…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)

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

Devin Review

Comment thread crates/ripr/src/analysis/rust_index.rs Resolved
@EffortlessSteven
EffortlessSteven merged commit 535138c into main Aug 31, 2026
50 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/3469-grip-association-stems branch August 31, 2026 02:13
EffortlessSteven added a commit that referenced this pull request Aug 31, 2026
…#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.
EffortlessSteven added a commit that referenced this pull request Aug 31, 2026
#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.
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.

fix(analysis): exposure classification diverges across platforms on identical committed trees

1 participant