Repository navigation
fix(rust): name the unresolved #[path] a changed file is only reached through (#4435) - #4906
Conversation
… through (#4435) A changed Rust file whose only route into its crate is a `mod` with an unresolved `#[path]` target (`#[cfg_attr(unix, path = "unix.rs")] mod sys;`) gets no module context, so its findings can miss related tests, yet the run read as complete with only a stderr note. The module-tree scan now reports the literal targets such a declaration spells, and whether default resolution still applies (every path inside `cfg_attr`). When no resolved edge reaches a changed file, the owners' exhausted walks ask whether one of those declarations routes to it (directly, through the target's children, or by default resolution). The diff run then adds one `language_scope_unsupported` limitation per such file that produced a finding, naming the declaration. Files reached through resolved edges, and comment-only changes, are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hoZSKinxoMBpo7Js7zymG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hoZSKinxoMBpo7Js7zymG
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. Summary by CodeRabbit
WalkthroughThe Rust module scan now reports unresolved ChangesUnresolved Rust module paths
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant ModuleTreeScan
participant PackageWalk
participant SourceRoleContext
participant RustAnalysis
ModuleTreeScan->>PackageWalk: unresolved path candidates
PackageWalk->>SourceRoleContext: candidate paths and declaration locations
RustAnalysis->>SourceRoleContext: look up routes for changed files with findings
SourceRoleContext-->>RustAnalysis: unresolved route and declaration
RustAnalysis->>RustAnalysis: add language-scope limitation
Merge Risk: ⚪ Minimal · up to The change reports incomplete Rust module-path coverage without reclassifying findings. No concrete merge-blocking issue is established; merge after normal checks pass. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change exposes incomplete Rust analysis without changing its findings. It reads additional candidate files using existing filesystem permissions. No increased privilege or introduced security vulnerability was established, but runtime isolation and coverage edge cases remain uncertain. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings
🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
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. A rabbit checks each module trail Comment |
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12444945dd
ℹ️ 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".
…4435) - Parse cfg_attr structurally: only attributes it introduces after the predicate supply targets, so a custom cfg keyed `path` is not one. - Keep two declarations on one line distinct (dedupe on name too), and merge a second anchor's default targets into the same declaration. - `cfg_attr` paths under `p` and `not(p)` always apply, so default resolution is not a route for them. - A file another package compiles through a resolved `#[path]` or `include!` gets no limitation. - One tagged route walk per package replaces a walk per declaration, so the cost stays linear (400 declarations sharing a subtree: 135 s to 0.7 s). - Name a declaring file outside the workspace by its file name only. - Register the behavior in RIPR-SPEC-0153 and the traceability map. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hoZSKinxoMBpo7Js7zymG
…aph-7ija8k # Conflicts: # CHANGELOG.md # crates/ripr/src/analysis/language/rust/mod.rs
Summary
Before: take a changed Rust file whose only route into its crate is a
modwith an unresolved#[path]target, such as#[cfg_attr(unix, path = "platform/unix_impl.rs")] mod sys;. That file got no module context. On a fixture where an integration test calls it through the public API, ripr reported threeno_static_pathfindings, and the run still read ascomplete_with_findingswith no limitations. The only trace was the stderrrust_module_unresolved_targetnote.After: the run adds one
language_scope_unsupportedlimitation for that file. The limitation names the file and the declaration (the mod at src/lib.rs:3), so the outcome readspartial_with_limitations. The file still seeds, and its findings are not reclassified.How:
modwith an unresolved#[path], the literalpath = "..."targets its attributes spell. It also records whether default resolution still applies, which is the case when every path is insidecfg_attr.sys.rs).Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #4435 (follow-up the UX grind asked for, after #4802)
Acceptance delta (one sentence): A changed file reached only through an unresolved
#[path]makes the run partial and names the declaration; runs that change files reached through resolved edges are unchanged.Candidate Relationships
Candidate branch:
claude/rust-module-graph-7ija8k. It was restarted from main 636d353, after #4556 was closed and its content landed as #4802. No other open PR covers this.Scope
#[path]declarations.Production delta:
module_tree.rs: newRustModuleTreeEdge::UnresolvedPath { inline, name, line, candidates, default_applies }. The scan stays incomplete, so no orphan verdict changes.module_graph.rs: package walks record unresolved declarations. When a candidate is reached by no resolved edge, a reusable route walk per declaration decides whether it reaches the file. Route walks follow further unresolved targets; package walks never do.source_role.rs:SourceRoleContext::module_graph_unresolved_routes.rust/mod.rs:unresolved_route_limitations, limited to files whose probes became findings. Both limitations bound their paths so the recovery text stays under the 512-character cap.Evidence/support delta:
cfg_attrtargets, including one nested in anothercfg_attrand one written as a raw string; a cfg predicate'sfeature = "..."is not taken as a target. Also covers duplicate#[path](no default resolution),concat!(no targets) and an inline-nested declaration.sys.rsmap tosrc/lib.rs:3. A resolved module, a file never loaded because a plain#[path]always applies, and an unnamed stray file are not routes, and no orphan is recorded.src/platform/unix_impl.rsgets the limitation. The resolvedsrc/used.rsdoes not, nor does the comment-only change tosrc/sys.rs.Single acceptance criterion:
#[path]add a limitation.Non-goals:
cfg_attrpaths into module context. That is the index's job, and fixing the underlyingno_static_pathis separate.cfg_if!or macro-emitted declarations.#[path = concat!(..)], which spells no target.Support-tier Impact
Claim/proof notes:
The UX-grind ask was not to degrade unrelated runs; an earlier broad fix was dropped because it flipped receipts, pr-summary and LSP to incomplete. This limitation is per changed file and per finding, not keyed on any
Unknowntarget in the index. It adds no neweprintln, and the LSP partition is unchanged.Real crates from the local cargo registry. I touched every
srcfile with a comment, then made single behaviour changes:src/unix.rsbehaviour changelib.rsmod sys;)lib.rsbehaviour changecomplete_with_findings, no limitationsrc/fs/abs.rssrc/backend/linux_raw/fs/dir.rsrustix's whole backend tree enters through one
cfg_attrmod backend;. Every backend behaviour change now reads partial, which is accurate because ripr has no module context for those files.Policy Impact
Proof
Result, failures, or skipped proof:
["src/platform/unix_impl.rs", "src/sys.rs"].unwritable_*output-dir tests. They fail because this sandbox runs as root, so permission bits do not block writes. They are inoutput/andcli/commands/pilot, which this PR does not touch; CI decides them.Claim Boundary
#[path](spelled target, its children, orcfg_attr-only default resolution) reports a limitation naming the declaration.Rollback
Revert the squash commit. It adds one limitation shape using an existing kind, with no schema, config or output-contract change.
Spec-Test-Code Traceability
analysis/language/rust/mod.rs:diff_analysis_names_the_unresolved_path_a_changed_file_is_reached_through,unresolved_route_limitation_bounds_long_pathsanalysis/workspace/module_graph.rs:unresolved_path_routes_name_the_declaration_for_files_only_it_reachesanalysis/syntax/module_tree.rs:unresolved_path_declarations_report_the_targets_they_spellworkspace/source_role.rsandsyntax/ra.rs(visibility only).Static Language Check
killed,survived,untested,proven, andadequate.Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code or tests.🤖 Generated with Claude Code
https://claude.ai/code/session_011hoZSKinxoMBpo7Js7zymG
Generated by Claude Code