Skip to content

analysis(classify): fail closed on unscopable absolute related-test paths (#3235) - #3247

Merged
EffortlessSteven merged 3 commits into
mainfrom
fix-3235-absolute-path-package-scope
Aug 14, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
fix-3235-absolute-path-package-scope

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Change

Closes the defensive gap in find_related_tests package scoping (#3235): package_prefix returns None for absolute or drive-prefixed paths without a crates/ segment, and the classifier treated that None as "no scoping needed" — silently disabling the package guard, so a wrong-package name/token coincidence could be admitted as related. The supported pipeline never supplies those shapes (discovery strips the workspace root; RustAdapter passes relative identities into the index), so this hardens against direct/internal and future callers, per the issue's ruling.

  • Extracts one path_is_absolute_form authority (Unix-rooted, Windows drive-prefixed, or host-absolute), shared by package_prefix and the package guards.
  • When the owner/probe path is unscopable-absolute and the candidate test's path is also absolute, no package comparison is possible: weak matches fail closed; only the strong uniquely-owned call path (slice(#2664-A): allow cross-crate test match when calls_owner signal is true (minimal fix) #2971) admits.
  • A relative test file keeps current behavior — the production-pinned mixed-form companion flow (absolute probe, relative test files, absolute_root_probe_matches_relative_companion_test_file) is unchanged, as are relative-marker and crates/<name>/ scoping.
  • Pins the discovery boundary the issue's audit relied on: discover_rust_files_returns_repo_relative_identities proves every discovered identity is repo-relative on every host (the acceptance's production-path test).

Proof

Verification

  • cargo test -p ripr --lib -- related_tests discover — 120 passed (5 new + strengthened discovery pin)
  • cargo fmt --check, cargo clippy -p ripr --all-targets -- -D warnings, cargo xtask precommit — pass

Closes #3235

…aths (#3235)

package_prefix returns None for absolute or drive-prefixed paths
without a crates/ segment, and find_related_tests treated that None as
"no scoping needed" — silently disabling the package guard so a
wrong-package name/token coincidence could be admitted as related. The
supported pipeline never supplies those shapes (discovery strips the
workspace root; the RustAdapter passes the relative identities into the
index), so this is a defensive gap for direct/internal callers, flagged
by the ripr#1543 review.

Extract one path_is_absolute_form authority (Unix-rooted,
drive-prefixed, or host-absolute) shared by package_prefix and the
guards. When the owner/probe path is unscopable-absolute AND the
candidate test's path is also absolute, no package comparison is
possible: weak matches fail closed, and only the strong uniquely-owned
call path (#2971) admits. A relative test file keeps current behavior —
the production-pinned mixed-form companion flow (absolute probe,
relative test files) is unchanged, as is relative and crates/<name>/
scoping.

Also pin the discovery boundary the audit relied on:
discover_rust_files_returns_repo_relative_identities proves every
discovered identity is repo-relative on every host.

Discriminating power proven by scratch-disabling the guards (all three
new filters fail). Zero golden drift; related_tests suite 99 passed;
dogfood green.

Closes #3235
@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 Aug 14, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@EffortlessSteven, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 100 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4a51a0eb-1d02-43ff-9d5e-836187ddec25

📥 Commits

Reviewing files that changed from the base of the PR and between 5218a6c and 622eb15.

📒 Files selected for processing (2)
  • crates/ripr/src/analysis/classify/related_tests.rs
  • crates/ripr/src/analysis/workspace/discover.rs

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: 39a70c8de5

ℹ️ 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".

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/analysis/workspace/discover.rs 96.29% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…aths (#3235)

Restores the classifier half of #3235 lost from the previous commit
(the review caught that only the discovery pin had landed): extract one
path_is_absolute_form authority shared by package_prefix and the
guards, and when the owner/probe path is absolute without a crates/
segment AND the candidate test's path is also absolute, weak matches
fail closed — only the strong uniquely-owned call path (#2971)
admits. A relative test file keeps current behavior (the
production-pinned mixed-form companion flow), as do relative-marker
and crates/<name>/ scoping.
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Correct — the previous commit had lost the classifier half: a git checkout -- during my local discriminating-power check reverted the then-uncommitted related_tests.rs work, so only the discovery pin landed. Restored in 5e9c3f3: the shared path_is_absolute_form authority, the fail-closed guards (owner and struct-probe paths), and all four #3235 tests. Verified against the commit this time: scratch-disabling the guards makes the three filter tests fail; the committed tree passes 103 related_tests tests, goldens zero drift, clippy/precommit green.

…review)

check-local-context correctly flags literal drive-letter paths in
source; construct the Windows-form tokens at runtime like #3231 does.
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.

analysis(classify): retain package scoping for absolute related-test paths

1 participant