Skip to content

fix(rust): classify cfg(test) helpers as evidence - #3273

Merged
EffortlessSteven merged 7 commits into
mainfrom
agent/3213-cfg-test-role
Aug 15, 2026
Merged

EffortlessSteven merged 7 commits into
mainfrom
agent/3213-cfg-test-role

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Classify functions nested under an inline #[cfg(test)] module as producer-owned test/evidence role (FunctionFact.is_test) in the Rust syntax producer, so harness plumbing stops becoming a new-production-seam subject.
  • Keep TestFact registration limited to functions that actually carry #[test], so related-test and oracle metadata are unchanged.
  • Narrow same-file helper-ownership suppression to names that are both test-scoped and an unambiguous package production-owner name, preserving tests/** helper→owner attribution and explicit super::-qualified calls.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

No crates.io, VS Marketplace, Open VSX, Release-asset, signing, release-environment, or release-secret surface is touched.

Source-of-truth Links

Proposal: n/a
Spec: docs/specs/RIPR-SPEC-0133-assertion-shaped-owner-guidance.md (fixture contract for the regenerated assertion_shaped_oracle_cfg_test golden)
ADR: n/a
Plan item: n/a
Active goal: n/a
Issue: #3213 (partial — see Claim Boundary)

Scope

  • crates/ripr/src/analysis/syntax/ra.rs — inline #[cfg(test)] module role classification at the producer boundary.
  • crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs — same-file helper-owner attribution guarded by the new producer role fact.
  • fixtures/assertion_shaped_oracle_cfg_test/** — intentional golden regeneration plus SPEC/CHANGELOG reason.

Scope Classification

  • One production behavior

Production delta:

  • A function whose ancestor module carries an exact #[cfg(test)] attribute is now FunctionFact.is_test = true. Diff probes, seam inventory, and evidence relation consume that single producer-owned fact rather than re-inferring the role per consumer.

Evidence/support delta:

  • Parser regression proving the helper is role-classified, the real #[test] function stays in facts.tests, the helper is not promoted into facts.tests, and the production control stays production role.
  • Diff-path regression proving inline cfg(test) helpers emit no production findings while a normal production control and the semantic src/test_helper.rs control still do.
  • Regenerated assertion_shaped_oracle_cfg_test expectations (1 weakly-exposed production finding → 0).

Single acceptance criterion:

  • An inline #[cfg(test)] helper is retained as evidence and excluded from production findings, without changing production controls or TestFact membership.

Non-goals:

  • No dynamic, generated, or macro-expanded test-role inference.
  • No arbitrary call-graph ownership inference.
  • No change to tests/** path exclusion, which already exists on main.

Support-tier Impact

  • none

Claim/proof notes:

  • Rust stays in its existing tier. This narrows a false-positive class; it makes no new sufficiency or adequacy claim.

Policy Impact

  • generated artifact

Ledger or exception notes:

Proof

cargo xtask precommit
cargo xtask goldens check
cargo xtask fixtures assertion_shaped_oracle_cfg_test
cargo test -p ripr analysis::syntax::ra::tests::ra_adapter_marks_inline_cfg_test_helpers_as_test_role -- --exact
cargo test -p ripr analysis::language::rust::tests::diff_analysis_skips_inline_cfg_test_helpers_but_keeps_production_controls -- --exact
cargo test -p ripr analysis::test_grip_evidence
cargo fmt --all -- --check

Result, failures, or skipped proof:

  • Focused proof: RA parser regression 1 passed; test-grip evidence 232 passed; cfg(test) diff control 1 passed; assertion-shaped fixture 1 passed; goldens check passed; fmt/diff-check passed.
  • cargo xtask precommit was NOT_ESTABLISHED at publication (10-minute timeout under concurrent Cargo load). See the precommit follow-up comment on this PR for the re-run disposition on exact head bae14d0e.
  • Hosted evidence on exact head bae14d0e: Routed Rust Small, Coverage, Test Analytics (JUnit), Security, Source of Truth, ub-review, and PR Plan are all success. CI, Future Clippy (advisory), and Windows Advisory are skipped by label policy. Droid Auto Review has remained pending since 08:49Z and is therefore missing review-provider output, not clean output.

Claim Boundary

After this PR it may be claimed that:

  • an inline #[cfg(test)] helper in a src/** file is producer-classified as test/evidence role, stays indexed as evidence, and does not become a production finding subject;
  • normal production functions and semantically production helpers such as src/test_helper.rs remain production subjects;
  • TestFact membership and therefore related-test/oracle metadata are unchanged.

It must not yet be claimed that #3213 is satisfied. Delivered vs residual acceptance:

#3213 acceptance criterion Disposition
tests/foo.rs returning Result<()> emits no production gaps not_applicable to this PR — path exclusion via rust_index::is_test_file already exists on main (analysis/language/rust.rs). Bench targets and *_test.rs / test_*.rs conventions remain uncovered.
Equivalent assert! and if … return Err(…) forms give the same production-seam inventory not_established — no discriminating proof in this PR.
A #[cfg(test)] helper remains relation/oracle evidence for its production owner pass
A focused seam-proof test cannot increase the production gap count through harness plumbing limited — established for inline #[cfg(test)] in src/** only.
A production-source control fixture still emits the expected seam findings pass
CLI JSON, gap ledger, gates, and receipts disclose the subject role consistently not_established — no output-surface disclosure is added here.
Downstream perl-lsp-swarm suppressions attributable only to ripr#1428 can be removed not_established — requires a published release carrying this change.

#3213 therefore stays open with residual acceptance after this merges.

Rollback

Revert the PR. The change is additive at the producer boundary plus one fixture golden regeneration; reverting restores the prior is_test derivation, the prior helper-attribution guard, and the prior expected outputs in one commit. No schema, config, or CI surface is involved.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0133 (fixture contract only)
  • Tests: analysis::syntax::ra::tests::ra_adapter_marks_inline_cfg_test_helpers_as_test_role, analysis::language::rust::tests::diff_analysis_skips_inline_cfg_test_helpers_but_keeps_production_controls, analysis::test_grip_evidence suite
  • Code: crates/ripr/src/analysis/syntax/ra.rs, crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs
  • Golden outputs: fixtures/assertion_shaped_oracle_cfg_test/expected/{check.json,human.txt,CHANGELOG.md}
  • Metrics: none
  • ADR/learning: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a — no workflow, policy gate, branch-protection, artifact, or lane cost change.

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • New non-Rust programming files are allowlisted with owner, surface, and reason. (none added)
  • New generated, dependency, process-spawn, or network surfaces are allowlisted with owner and reason. (none added)
  • Errors are reported with actionable context.
  • Public JSON/schema changes are documented. (none — check.json golden content changes, the schema does not)

Gates

Covered by cargo xtask precommit on exact head bae14d0e plus the hosted lanes listed under Proof. The full fixed-candidate matrix in the template remains the release-qualification step, not this PR's gate.

Advances #3213. Does not close it — residual acceptance is tabulated under Claim Boundary.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9e3ec11f-10c7-4893-974d-f910a8b9b47a

📥 Commits

Reviewing files that changed from the base of the PR and between 376ab0a and bae14d0.

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

Summary by CodeRabbit

  • Bug Fixes

    • Corrected analysis of inline test-only modules so helper functions are excluded from production findings.
    • Preserved analysis of production functions and helpers in files containing test code.
    • Improved test context and helper resolution for mixed test and production code.
  • Tests

    • Added coverage for test classification and production-finding behavior.
    • Updated expected results to report no production candidates for test-only assertion helpers.
  • Documentation

    • Added a changelog entry describing the updated analysis behavior.

Walkthrough

Inline #[cfg(test)] functions are classified as test infrastructure. Only attributed test functions create test facts. Related-test context filters ambiguous helper ownership. Regression fixtures now expect no production findings for inline test helpers.

Changes

Rust test-surface classification

Layer / File(s) Summary
Inline cfg(test) classification
crates/ripr/src/analysis/syntax/ra.rs
Functions inside inline #[cfg(test)] modules are classified as test infrastructure. Only functions with recognized test attributes create TestFact entries.
Helper ownership filtering
crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs
Compact test context receives package-scoped production owner names. Same-file helper calls are filtered using test-scoped and production-owned names.
Regression expectations
crates/ripr/src/analysis/language/rust.rs, fixtures/assertion_shaped_oracle_cfg_test/*
Integration tests and fixture outputs verify that inline test helpers remain evidence inputs and do not create production findings.

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

Merge Risk: ⚪ Minimal · up to bae14

This localized change classifies inline cfg(test) helpers as evidence without altering test registration or production controls, and the supplied checks pass. No actionable merge-blocking risk remains beyond normal review.

Sequence Diagram(s)

sequenceDiagram
  participant RustSource
  participant SyntaxAnalyzer
  participant CompactGripContext
  participant AnalysisOutput
  RustSource->>SyntaxAnalyzer: inspect cfg(test) module ancestors
  SyntaxAnalyzer->>CompactGripContext: provide test-scoped and production owner names
  CompactGripContext->>AnalysisOutput: retain helper evidence and exclude production findings
Loading

Possibly related issues

  • Issue 3213: The changes implement inline #[cfg(test)] source-role classification and preserve test helpers as evidence without treating them as production findings.

Suggested labels: test

Poem

I’m a rabbit in the test code bright,
Helpers stay evidence, out of production sight.
Attributed tests keep their facts,
Ambiguous owners face clear checks.
Hop, hop—the findings now align!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: classifying Rust cfg(test) helpers as evidence.
Description check ✅ Passed The description covers the template sections, scope, proof, claim boundaries, rollback, traceability, and remaining limitations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/3213-cfg-test-role

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the Rust syntax analysis to classify helper functions inside inline #[cfg(test)] modules as test infrastructure, even if they lack a #[test] attribute. This ensures consistent downstream classification. A review comment suggests optimizing the helper function is_cfg_test_module_member by pre-filtering attributes containing 'cfg' and 'test' to avoid unnecessary string allocations and character filtering.

Comment thread crates/ripr/src/analysis/syntax/ra.rs Resolved
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_INCOMPLETE

Reviewed PR #3273 at exact head 5d1ae7333fa5686269effc5116662ef1f3a6578e against base 0446c60d73bba329a393b9696fdecb378edcdd97.

  • RaRustSyntaxAdapter::summarize_file now producer-classifies functions under an inline #[cfg(test)] module via FunctionFact.is_test; the existing fact is consumed by diff probes, seam inventory, and evidence relation rather than re-inferred in renderers.
  • The production-path fixture reaches RustAdapter::analyze_diff, keeps production_control and path-only src/test_helper.rs findings, and excludes the inline helper. The syntax fixture verifies the helper remains indexed in facts.tests while the production control remains non-test.
  • The bounded implementation is limited to exact inline #[cfg(test)] module attributes; no claim is made for dynamic/generated test roles or arbitrary call-graph inference. No semantic finding identified.
  • Fresh hosted evidence is not terminal: routed hosted Rust, coverage, JUnit, source-of-truth, UB, and Droid review remain pending. The body records the local precommit timeout rather than claiming success.

Disposition: REVIEW_INCOMPLETE pending terminal fresh hosted evidence for this exact head.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Replacement head 79040ee0 preserves the existing same-file unit shadow-call unknown behavior after cfg(test) role classification. The producer-derived test-scoped names now guard both same-file helper lookup paths; parent-qualified super:: calls remain allowed. Focused proof: exact shadow regression 1/1, same-file unit regressions 2/2, cfg(test) parser role 1/1, diff producer fixture 1/1, fmt and diff-check pass. Precommit remains NOT_ESTABLISHED due the prior 10-minute concurrent-Cargo timeout.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_INCOMPLETE

Reviewed PR #3273 at exact head 79040ee07788c18868e21f85e594cea29a7b61d6 against base 0446c60d73bba329a393b9696fdecb378edcdd97.

  • The replacement preserves same-file shadow-call ambiguity: producer-derived names for functions inside inline #[cfg(test)] modules gate unqualified same-file helper lookup, while an explicitly super::-qualified call remains allowed. Comment/string masking is retained before the qualified-call check.
  • RaRustSyntaxAdapter marks inline cfg-test helpers as FunctionFact.is_test; the production-path fixture keeps both a normal production control and semantic src/test_helper.rs control while excluding the cfg-test helper from production findings. The helper remains indexed as evidence.
  • The implementation remains bounded to exact inline cfg-test module membership and same-file helper lookup; it does not claim arbitrary call-graph or generated-test inference. I found no new semantic finding in this exact diff.
  • Fresh hosted evidence is not terminal for this SHA: hosted Rust Small, coverage, JUnit, source-of-truth, and UB are still in progress. Routed Rust Small, security, plan, and repository-integrity checks are green; skipped advisory lanes remain policy-skipped.

Disposition: REVIEW_INCOMPLETE pending terminal required hosted evidence for exact head 79040ee07788c18868e21f85e594cea29a7b61d6.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Replacement head 0474b882 preserves the physical tests/** helper-owner positive path while retaining cfg(test)-module shadow suppression. The test-scoped guard is now supplied only for inline cfg(test) helpers in src files; integration-test helpers keep the prior attribution behavior. Focused proof: helper→owner→logs positive 1/1, shadow negative 1/1, same-file regressions 2/2, cfg(test) parser role 1/1, diff producer fixture 1/1, fmt/diff-check pass. Precommit remains NOT_ESTABLISHED.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_INCOMPLETE

Reviewed PR #3273 at exact head 0474b882c889c2faf4128cd79952cdf1172c2ce against base 0446c60d73bba329a393b9696fdecb378edcdd97.

  • The narrow follow-up restores the physical tests/** positive attribution path by supplying cfg-test shadow names only for non-tests/** files. Integration-test helper attribution therefore retains the prior behavior.
  • Inline src cfg(test) helpers remain producer-classified as test/evidence role; unqualified same-file shadow calls stay unknown/suppressed, while explicit parent-qualified calls remain allowed. The normal production control and semantic src/test_helper.rs controls remain covered by the existing production fixture.
  • The delta is limited to the failed positive-contract repair; no new semantic finding identified, and the claim remains bounded to inline cfg(test) classification plus same-file helper attribution.
  • Fresh required hosted evidence is still pending for this exact SHA: hosted Rust Small, coverage, JUnit, source-of-truth, and UB. Routed Rust Small, security, plan, integrity, and CodeRabbit status are green; advisory lanes are skipped by policy.

Disposition: REVIEW_INCOMPLETE pending terminal required hosted evidence for exact head 0474b882c889c2faf4128cd79952cdf1172c2ce.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Replacement head bfe38556 completes the helper lookup matrix. Shadow suppression now requires both a test-scoped name and a producer-owned production-name collision: physical tests/** unique helper→owner→logs remains positive, physical local shadow remains unknown, inline cfg(test) shadow remains unknown, and parent-qualified production calls remain allowed. Focused matrix passes: physical shadow 1/1, helper→owner→logs 1/1, inline shadow 1/1, same-file regressions 2/2, cfg(test) parser 1/1, diff producer fixture 1/1, fmt/diff-check. Precommit remains NOT_ESTABLISHED.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_INCOMPLETE

Reviewed PR #3273 at exact head bfe38556d749ec6ea607fb267a1f1c2c59bb5831 against base 0446c60d73bba329a393b9696fdecb378edcdd97.

  • The collision predicate is conservative: an unqualified same-file call is suppressed only when its name is both producer-classified test-scoped and an unambiguous production-owner name in the same package. This restores the physical tests/** unique helper→owner→logs positive path while retaining physical shadow and inline cfg(test) shadow as unknown.
  • Explicit super:: production calls bypass the collision suppression, preserving the qualified positive path; comment/string masking and named-call validation remain in place.
  • The producer boundary still classifies inline src cfg(test) helpers as FunctionFact.is_test, retains them as evidence, excludes them from production findings, and preserves normal production controls including src/test_helper.rs.
  • No new semantic finding identified in this exact delta; the claim remains limited to bounded helper attribution and cfg(test) role classification.
  • Fresh required hosted evidence remains pending for this SHA: hosted Rust Small, coverage, JUnit, source-of-truth, and UB. Routed Rust Small, security, plan, integrity, and CodeRabbit are green; advisory lanes are policy-skipped.

Disposition: REVIEW_INCOMPLETE pending terminal required hosted evidence for exact head bfe38556d749ec6ea607fb267a1f1c2c59bb5831.

@codecov

codecov Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.85535% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ripr/src/analysis/language/rust.rs 92.98% 4 Missing ⚠️
crates/ripr/src/analysis/syntax/ra.rs 98.21% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Replacement head 376ab0a6 resolves the intentional golden drift. The assertion-shaped helper fixture is explicitly inline #[cfg(test)]; under #3213 it remains evidence but no longer emits a production probe/finding. Updated its SPEC.md contract, regenerated expected/check.json and expected/human.txt, and recorded the RIPR-SPEC-0133/#3213 reason in CHANGELOG.md. Proof: cargo xtask fixtures assertion_shaped_oracle_cfg_test pass; test_grip_evidence 232/232; cfg(test) parser fixture 1/1; diff producer fixture 1/1; fmt/diff-check pass. Precommit remains NOT_ESTABLISHED.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_INCOMPLETE

Reviewed PR #3273 at exact head 376ab0a666b9abc28e364b91f243d8ebf8a19b13 against base 0446c60d73bba329a393b9696fdecb378edcdd97.

  • The golden update is intentional and contract-consistent: the fixture's changed predicate is inside src/lib.rs's inline #[cfg(test)] mod tests, and the helper is called only by a #[test]. The updated SPEC explicitly separates evidence indexing from production subjects and records RIPR-SPEC-0133/analysis(rust): stop treating test-harness plumbing as new production seams #3213 as the reason for regenerating zero-finding JSON/human outputs.
  • The expected transition from one weakly-exposed production finding to zero probes/findings is therefore correct for this source-role fixture; production-role assertion guidance remains outside this fixture. The fixture still requires that the helper remain evidence-indexed and does not claim runtime/test adequacy.
  • Prior collision-based helper attribution and producer controls remain unchanged in this delta. Owner reports the full test-grip matrix as 232/232, plus cfg-test parser and production-path fixture success; those local claims are not substitutes for hosted terminal evidence.
  • Fresh required hosted evidence remains pending for this SHA: hosted Rust Small, coverage, JUnit, source-of-truth, and UB. No new semantic finding identified.

Disposition: REVIEW_INCOMPLETE pending terminal required hosted evidence for exact head 376ab0a666b9abc28e364b91f243d8ebf8a19b13.

@coderabbitai coderabbitai Bot added the test label Aug 15, 2026
@EffortlessSteven

Copy link
Copy Markdown
Member Author

Replacement head bae14d0e published. Golden inventory was one drift only: rust_long_expression_display_bound (production control). The drift came from promoting a cfg(test) helper into TestFact, which altered related-test/oracle metadata. Narrow repair keeps cfg(test) helpers as producer-owned FunctionFact.is_test for suppression while registering only explicit test functions as TestFact; the fixture goldens remain unchanged. Focused proof: RA parser regression 1 passed; test-grip evidence 232 passed; cfg(test) diff control 1 passed; assertion-shaped cfg(test) fixture 1 passed; cargo xtask goldens check passed; fmt/diff check passed. Precommit remains NOT_ESTABLISHED due prior timeout under Cargo contention.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_INCOMPLETE

Reviewed PR #3273 at exact head bae14d0e0d6681478e08d2c2a80cd77ff5d036c8 against base 0446c60d73bba329a393b9696fdecb378edcdd97.

  • The correction cleanly separates the two producer facts: inline cfg(test) helpers retain FunctionFact.is_test = true for production-probe/seam suppression, while only functions with an actual #[test] attribute enter TestFact. The parser regression now asserts the real test function is indexed and the helper is not promoted as a test case.
  • This preserves the prior physical/inline shadow matrix and production controls: helper ownership still consumes the producer role facts, physical tests/** positive attribution remains covered, inline cfg(test) and same-file shadow cases remain conservative, and semantic src/test_helper.rs remains production.
  • The intentional golden inventory from the prior replacement remains coherent: SPEC, expected check JSON/human output, and expected changelog describe the inline cfg(test) helper as evidence-only rather than a production candidate. No new semantic finding in this one-file correction.
  • Fresh required hosted evidence is still pending for this SHA: coverage, JUnit, source-of-truth, and UB. Security, plan, dependency, integrity, and CodeRabbit checks are green; advisory lanes are policy-skipped. Hosted Rust is represented by the routed required workflow and remains non-terminal in the current status set.

Disposition: REVIEW_INCOMPLETE pending terminal required hosted evidence for exact head bae14d0e0d6681478e08d2c2a80cd77ff5d036c8.

Copy link
Copy Markdown
Member Author

Exact-head review — REVIEW_READY

Reviewed PR #3273 at exact head bae14d0e0d6681478e08d2c2a80cd77ff5d036c8 against base 0446c60d73bba329a393b9696fdecb378edcdd97. The prior passes on this head recorded REVIEW_INCOMPLETE because hosted evidence was still in flight. It is now terminal, so this pass closes that dimension.

Semantic owner

RaRustSyntaxAdapter::summarize_file_with_parser is the right owner. The role is derived once at the producer boundary into FunctionFact.is_test, and the two facts stay properly separated: is_test gains inline cfg(test) members, while TestFact registration still keys off has_test_attribute alone. That separation is what keeps related-test and oracle metadata unchanged, and it is the correction that resolved the rust_long_expression_display_bound golden drift from the previous head.

Verified downstream rather than assumed: unambiguous_production_owner_names_by_package (pre-existing on main, context.rs:1112) filters on !function.is_test, so newly test-classified cfg(test) helpers drop out of production-owner names automatically. No renderer re-infers the role.

Helper attribution

test_scoped_function_names_by_file had to drop its !function.is_test guard, since that predicate would now exclude the very functions it needs to collect. The widening pulls #[test] functions themselves into the test-scoped set. That is safe because same_file_unit_production_helper_call_is_allowed suppresses only on the conjunction of test-scoped and unambiguous-production-owner name, and super::-qualified calls bypass suppression entirely. The conjunction is what restores the physical tests/** helper→owner→logs positive path that the intermediate heads broke.

same_file_helper_owner_call_names_for_test moved from iterating the deduped call_names set to iterating test.calls filtered by membership, so per-call-site text is available to the guard. Results still collect into a BTreeSet, so dedup is preserved.

Bounds

is_cfg_test_module_member matches on exact whitespace-stripped #[cfg(test)] text. #[cfg(all(test, …))], #[cfg_attr(…)], and generated or macro-produced test roles are not matched. That fails toward treating code as production, which is the conservative direction — it preserves findings rather than silently suppressing them. Correctly bounded, and the PR claims no more than that.

Evidence

Local, in a clean worktree checked out at exact bae14d0e:

  • cargo xtask precommit — all 34 ci-fast policy checks pass, through check-lint-policy. The subsequent diff-selected Clippy leg did not reach a terminal result: the process was terminated by a container restart, not by a source failure. That leg is recorded as an instrument/infrastructure outcome, not a pass and not a failure.

That gap is superseded rather than outstanding. Routed Rust Small — the sole branch-protection required check per docs/REPO_SETTINGS.md — runs cargo fmt --check, cargo check --workspace --all-targets, cargo clippy --workspace --all-targets -- -D warnings, and cargo nextest run --workspace, and concluded success on this exact head. Workspace-wide Clippy strictly contains the diff-selected leg, so the Clippy dimension is established by stronger evidence than the one that was interrupted.

Hosted evidence on bae14d0e:

Lane Conclusion
Routed Rust Small (required) success
Coverage success
Test Analytics (JUnit) success
Security success
Source of Truth success
ub-review success
PR Plan success
CI, Future Clippy (advisory), Windows Advisory skipped by label policy
Droid Auto Review pending since 08:49Z

Droid has been non-terminal for over eleven hours. Per repository law that is missing review-provider output, not clean output. It is an advisory lane and not branch-protection required, so it does not gate merge, but it is named here rather than counted as a pass.

Review threads

The one inline finding (gemini-code-assist, module-attribute allocation) is answered on its thread with source-backed reasoning and resolved. It is a micro-optimization on a parse-bound cold path that would not have removed the first allocation anyway; declining it is recorded, not silently dropped. CodeRabbit completed a full review at 376ab0a6 and an incremental review here with no actionable comments.

Claim correction applied

The PR body previously read Closes #3213, which would have auto-closed an issue whose acceptance is mostly unmet. Verified against the source: the tests/** path exclusion this issue also asks for already exists on main via rust_index::is_test_file and is not this PR's work, and criteria for assertion-form equivalence, subject-role disclosure across CLI JSON / ledger / gates / receipts, and downstream suppression removal are untouched here. The body now carries a per-criterion disposition table and reads Advances #3213. #3213 stays open with residual acceptance.

Disposition

REVIEW_READY for merge convergence at bae14d0e0d6681478e08d2c2a80cd77ff5d036c8. The required check is green, the reviewed diff is semantically sound and correctly bounded, review threads are answered, and the issue disposition now separates delivered from residual work. The Droid lane remains missing rather than passing, and the local Clippy leg remains superseded rather than independently re-established — both stated rather than absorbed.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review August 15, 2026 20:03
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions github-actions 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.

Confirmed findings

  • No active-view or resizable-buffer UB surface is touched by this PR; lane reports zero in-scope findings. Resizable/stale-length/etc. checks trivially hold vacuously. Residual: cfg(test) helper classification is checked by parser+diff+test_grip fixtures already in the PR; allocation-per-attribute is bounded and out of scope for this lane.
  • No exploit-primitive surface touched: no unsafe, no native interop, no secret material, no I/O. Hosted security lane green per seeded thread; Droid Auto Review pending is a review-provider gap, not a clean signal.
  • This lane has nothing actionable to report. The PR touches no JS-backed or worker-boundary code; the only ownership of 'handoff' relevant here is the helper→owner call handoff in CompactGripContext, which is already gated by the same-file unit production-helper-allowed predicate (test_scoped AND production_owner collision) plus explicit super:: bypass, and exercised by the 232/232 test_grip_evidence suite.

Verification questions

  • Confirm cargo-test receipt absent in this PR review packet. Local focused proofs were run (RA parser 1, test_grip 232, cfg(test) diff 1, assertion-shaped fixture 1) but full cargo-test terminal output not landed for head bae14d0. Lane cannot independently confirm full suite passes.
  • Confirm sibling-path scan: rust_index::is_test_file path exclusion remains the only path-based producer rule; non-test files in src/ with inline cfg(test) get full AAT coverage but the change is bounded to exact #[cfg(test)] string match. Sibling patterns not examined: #[cfg(test)] on fn directly (cfg-test fn attribute rather than module), nested mods under cfg(test), multi-line cfg(any(test, ...)) — out of scope per PR Claim Boundary but worth a verification probe.
  • Confirm same-file helper suppression now requires both test-scoped name AND production-owner name — but test_scoped_function_names_by_file no longer filters on !function.is_test, so physical tests/** files and non-src/**/*.rs test files populate it; in a file where the same identifier names both a cfg(test) helper and the local package production owner, a same-name function defined OUTSIDE any cfg(test) module in that file will NOT be filtered and the conjunction still allows the production-helper attribution path to pass for non-test-scoped helpers, leaving the physical positive path unchanged. The conjunction does not protect non-test-scoped same-file shadow calls.
  • Confirm is_cfg_test_module_member matches #[cfg(test)] only by whitespace-collapsed string equality against "#[cfg(test)]", so legitimate variants like #[cfg(all(test, feature = "x"))], #[cfg(any(test, ...))], macro-generated #[cfg(test)] inside other macros, or proc-macro re-emitted attributes are silently ignored — making the is_test role depend on textual accident rather than semantic membership.

Test proof

  • Focused HEAD proof failed (exit 101): cargo test --locked --package ripr --test syntax_ra_tests ra_adapter_marks_inline_cfg_test_helpers_as_test_role -- --exact. This is a current failure, not a red/green witness.

Refuted

  • Could a producer-owned is_test reclassification leak across an async/RPC/transfer boundary where a stale value is held by a worker and escape classification on detach?; refuted because: There is no such boundary in the diff: no JS host, no wasm-bindgen postMessage, no async runtime, no Send/Sync crossing in the changed lines. FunctionFact is a plain serializable struct consumed within the same synchronous analyze_diff call.
  • Tests are tautological or smoke-only (would assert same condition they set up); refuted because: Each new regression exercises a distinct invariant: helper role classification (4-assertion), semantic vs path-only production (3-assertion), and helper attribution conjunction (existing matrix still passes). None of them reduces to setup==assertion.

Evidence gaps

  • Hosted evidence is still pending for this SHA per seeded thread (Rust Small, coverage, JUnit, source-of-truth, UB) and precommit is NOT_ESTABLISHED; only local focused proofs are reported.
  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Post-merge exact-head review — follow-up changes required

Reviewed the merged candidate at PR head bae14d0e0d6681478e08d2c2a80cd77ff5d036c8 / merge commit 6cd70658c5fa86f4c65a1d1730729a95649edab7.

The narrow producer change is directionally correct, but two production-path defects remain after merge.

P1 — cached pre-fix facts and classifications remain authoritative

This PR changes the semantic meaning of FunctionFact.is_test, but it does not change any cache generation. At the merged head:

CACHE_SCHEMA_VERSION                       = 0.6
COMPACT_CLASSIFIED_SEAM_CACHE_SCHEMA_VERSION = 0.3
FILE_FACT_CACHE_SCHEMA_VERSION             = 0.2
CARGO_PKG_VERSION                          = 0.10.0

RepoFileFactCacheKey is only schema version + package version + path + content hash. For an unchanged source file, a cache written by the pre-merge 0.10.0 binary therefore still matches the post-merge 0.10.0 binary and replays the old is_test = false fact. The full and compact classified-seam caches can likewise replay the old finding directly. A user with a warm cache may therefore observe none of #3273's behavior until source bytes, package version, or cache state changes.

Required follow-up: bump every cache generation that can retain FileFacts or a derived classified result, and add a regression that writes a pre-change semantic envelope and proves the post-change key cannot hit it. A cold-only fixture does not discriminate this failure.

P1 — the helper remains indexed, but no longer remains relation evidence

ra.rs now sets a plain function inside inline #[cfg(test)] to FunctionFact.is_test = true, while correctly withholding TestFact unless the function itself has a test attribute. However, helper_owner_calls_by_file_with_fanout still builds the helper graph only from index.functions.filter(|function| !function.is_test).

That leaves an inline helper in neither role used by the relation path:

not a TestFact
and
excluded from HelperOwnerCallsByFile

So a real #[test] that calls an inline helper, where the helper calls the production owner, can lose the established helper→owner relation and under-credit the production seam. The new tests prove raw functions retention and prove that the helper does not become a production finding; they do not prove the load-bearing test→helper→production relation or oracle survives.

Required follow-up: preserve evidence-role helpers in the bounded helper relation graph without re-admitting them as production seam subjects. Add a fixture whose changed subject is production code, whose only exact observer is #[test] → inline cfg(test) helper → production owner, and whose removal experiment fails when the helper is filtered out. Keep the same-name collision and explicit super:: controls.

Bounded residual

The parser-side role is also RA-only: lexical fallback still sets is_test from test attributes only. That broader parser/fallback source-role parity belongs in the next source-role slice, but it needs an explicit acceptance row rather than being assumed from #3273.

Disposition: the merged change may retain its narrow claim that exact inline #[cfg(test)] functions do not seed production findings on a cold RA-parse path. It cannot yet claim warm-cache correctness or preservation of helper-mediated production evidence.

EffortlessSteven added a commit that referenced this pull request Aug 16, 2026
…ter source-role classification (#3286) (#3304)

* fix(rust): preserve inline cfg(test) helper-to-production evidence after source-role classification (#3286)

#3273 widened FunctionFact::is_test to plain helpers inside inline
#[cfg(test)] modules; the helper-relation graph and local-name resolver
excluded every is_test function, silently dropping the
#[test] -> cfg(test) helper -> owner evidence path (reproduced: the
relation degraded to the weak SameTestFile fallback). Helper-graph
admission now excludes only actual TestFact members; seam and
production-owner filters keep the wider #3273 role. Regression fixture
pins the retained HelperOwnerCall relation, the non-promotion to
TestFact, and the unchanged evidence-role classification.

* test(rust): key helper-graph test exclusion on exact function identity (#3286)

Review hardening: the actual-test set keys on (file, name, start_line) so
a same-file same-name plain helper is admitted exactly instead of
conservatively excluded, and the regression fixture pins the mediated
relation's oracle kind and strength, not just the relation reason.

* refactor(rust): borrow the actual-test identity keys (#3286)

Review cleanup: admission lookups use a borrowed key struct instead of
cloning path and name per function.

* test(rust): pin same-file test/helper name-collision identity (#3286)

Review hardening: a #[test] fn and a plain helper sharing (file, name)
stay distinguished by start_line identity — the helper keeps mediating
evidence and the test stays out of helper admission.
EffortlessSteven added a commit that referenced this pull request Aug 16, 2026
… evidence (#3287) (#3305)

* fix(cache): invalidate pre-source-role file facts and classified evidence (#3287)

Bump the four fact/classification cache generations — file facts 0.2 to
0.3, full classified seams 0.6 to 0.7, sharded 0.2 to 0.3, compact 0.3 to
0.4, and the test-gated count cache 0.1 to 0.2 — with version-history
reasons naming the #3273 source-role and #3286 helper-evidence semantic
changes at package 0.10.0. Generation-transition tests prove a
previous-generation envelope with identical package/path/content identity
misses, a cold-then-warm run preserves the corrected semantics as a real
hit, and RIPR_CACHE_DIR relocation plus sharded paths follow the same
law.

* test(cache): prove copied-envelope rejection and the file-fact generation (#3287)

Review hardening: the transition test now copies a previous-generation
envelope to the current key's entry path and proves the embedded key
identity still rejects it; the directory-law test covers the file-fact
cache; style nits applied (direct source slice, absolute constant path).
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.

1 participant