Skip to content

fix(analysis): recognize test conjunct order in cfg(all) - #3537

Merged
EffortlessSteven merged 12 commits into
mainfrom
codex/3527-reconcile
Aug 28, 2026
Merged

EffortlessSteven merged 12 commits into
mainfrom
codex/3527-reconcile

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Swarm / Source Boundary

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

Source-of-truth Links

Scope

One Rust syntax/evidence-role seam with focused regression coverage.

Scope Classification

  • One production behavior
  • One architectural seam

Production delta:

  • cfg(all(..., test)) role detection is order-insensitive and remains fail-closed for nested, negated, literal, or comment-only tokens.

Evidence/support delta:

  • Same-file test-helper shadowing uses parser-derived test roles; affected cache schemas invalidate old facts.

Single acceptance criterion:

  • Direct top-level test conjuncts are test-scoped in any order, while non-direct forms remain production-scoped.

Non-goals:

  • No runtime, mutation, release, publication, or public support-tier claim.

Support-tier Impact

  • none

Claim/proof notes:

  • Static source-role classification only.

Policy Impact

  • none

Proof

  • cargo fmt --all -- --check: PASS
  • git diff --check: PASS
  • Original equivalent hosted checks: PASS
  • Fresh current-base hosted checks: pending
  • Local Cargo tests: not run while shared builders were active

Claim Boundary

This establishes order-insensitive direct cfg(all(..., test)) role detection and aligned same-file shadow handling. It does not establish runtime, mutation, release, or publication readiness.

Rollback

Revert this PR; prior conjunct-order behavior and cache schema values return.

Spec-Test-Code Traceability

  • Spec: existing Rust source-role and test-grip contracts
  • Tests: token-safe cfg conjunct tests, parser role integration, same-file shadow regression
  • Code: crates/ripr/src/analysis/syntax/ra.rs, crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs
  • Golden outputs: none
  • Metrics: none

Static Language Check

  • Static output avoids banned claim terms.
  • Unknowns include stop reasons where applicable.

CI Economics

  • LEM impact: ordinary analysis PR
  • Workflows touched: none
  • Required lanes affected: standard Rust checks
  • Rollback path: revert this PR

Engineering Check

  • No new panic-family production/test surfaces.
  • No public JSON/schema changes.

Gates

  • cargo fmt --check
  • git diff --check
  • hosted Rust, coverage, JUnit, and UB checks (pending)

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Substantive exact-head review — REVIEW_INCOMPLETE\n\nReviewed current head �478091d4 against current main �db6aabd3. The claim is bounded to order-insensitive direct est conjunct recognition in cfg(all(...)), parser-owned test-role reuse for same-file shadow exclusion, and the corresponding cache schema bumps. Static review found no actionable defect in the changed seam; the token-depth and negative controls cover nested/negated/literal cases. cargo fmt --all -- --check and git diff --check pass. Fresh hosted checks are pending, local compile was not run while shared Cargo/rustc builders were active, and independent approval is absent. This PR is not merge-ready yet.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 58 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: 6a259067-433d-4656-ab3d-f055f9d57995

📥 Commits

Reviewing files that changed from the base of the PR and between 4905340 and d346616.

📒 Files selected for processing (3)
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/syntax/ra.rs
  • crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs

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: 985bed15-163c-40c5-9363-2b482bfc3b61

📥 Commits

Reviewing files that changed from the base of the PR and between edb6aab and 4905340.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • crates/ripr/src/analysis/language/rust.rs
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/syntax/ra.rs
  • crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs
  • crates/ripr/src/analysis/test_grip_evidence/tests.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Summary by CodeRabbit

  • Bug Fixes
    • Improved Rust source-role analysis for test modules using #[cfg(all(..., test))], regardless of condition order.
    • Prevented test-only helpers from contributing to production findings.
    • Reduced false positives from nested alternatives, negations, comments, and string literals containing test.
  • Cache Updates
    • Existing analysis caches are automatically invalidated to ensure updated classifications are used.
  • Tests
    • Added coverage for mixed-condition test modules and same-file helper shadowing.

Walkthrough

Rust source-role analysis now recognizes direct top-level test conjuncts in cfg(all(...)) attributes regardless of order. Evidence scoping uses the parsed role, regression fixtures cover the change, and affected cache schemas are versioned.

Changes

Rust test-role classification

Layer / File(s) Summary
Token-aware cfg test detection
crates/ripr/src/analysis/syntax/ra.rs
Token parsing recognizes qualifying cfg(all(...)) forms and rejects nested, negated, alternative, literal, comment-only, and malformed cases.
Test-scoped evidence integration
crates/ripr/src/analysis/test_grip_evidence/related_tests/context.rs, crates/ripr/src/analysis/language/rust.rs, crates/ripr/src/analysis/test_grip_evidence/tests.rs
Evidence scoping uses parser-derived test roles. Regression fixtures cover test-second cfg(all(...)) helpers.
Cache schema invalidation
crates/ripr/src/analysis/seam_cache.rs, CHANGELOG.md
Classified-seam, compact, count, and file-fact cache versions advance. The changelog records the source-role behavior.

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

Merge Risk: ⚪ Minimal · up to 49053

This PR updates localized Rust analysis classification and safely separates affected local cache entries; no actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit checks each cfg with care
Top-level test is found in there
Old cache keys hop away
Helpers leave production's hay
Fresh facts now guide the hare

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 5 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the main change: recognizing the test conjunct order in cfg(all).
Description check ✅ Passed The description covers the change, scope, acceptance criterion, non-goals, proof status, claim boundary, rollback, traceability, and engineering impact. It clearly identifies pending hosted checks and…
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 5 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description covers the change, scope, acceptance criterion, non-goals, proof status, claim boundary, rollback, traceability, and engineering impact. It clearly identifies pending hosted checks and skipped local Cargo tests. Some template checklist items are not fully populated, but the description is mostly complete.

✨ 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 codex/3527-reconcile

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 source-role analysis to recognize a direct top-level test conjunct in #[cfg(all(...))] regardless of the order of conjuncts, ensuring helpers under attributes like #[cfg(all(feature = "slow", test))] are correctly classified with an evidence role. It also increments the cache schema versions to prevent warm analysis from reusing outdated classifications and simplifies the retrieval of test-scoped function names by leveraging FunctionFact::is_test. The review feedback recommends optimizing test_scoped_function_names_by_file to avoid redundant PathBuf cloning and simplifying the slice comparison in cfg_term_is_test to be more idiomatic.

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

@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: 490534045b

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

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head quality repair — REVIEW_INCOMPLETE\n\nCurrent head: �076fbd5b against main �db6aabd3. Addressed the automated review’s actionable quality findings: completed the repository PR-template sections in the description and documented the touched cfg test-role helpers. cargo fmt --all -- --check PASS; git diff --check PASS. Fresh hosted checks restarted for this exact head; no code-defect findings were reported. Merge remains deferred until current required proof completes.

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
crates/ripr/src/analysis/syntax/ra.rs 98.94% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Codex exact-head review — 2026-08-28

Reviewed replacement PR #3537 at current head a4471dedce7f4b72a9d0a01dec64badb53b0331e, after merging current origin/main into the replacement branch.

  • The replacement remains bounded to cfg(all) test-conjunct recognition plus its focused characterization/proof and documentation.
  • The current-main reconciliation introduced no conflict or new actionable defect in the candidate diff.
  • git diff --check — PASS.
  • Hosted Rust, JUnit, coverage, and UB checks for the reconciled head are pending.

Merge remains blocked until the fresh exact-head required result is green.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Codex exact-head review — 2026-08-28

Re-reviewed current head b354a0df86cb55dc8da556a04024c53ca54a08f2 against current main 3d466044d566acb82332bef71b7742937dd31378 after the latest base reconciliation.

The replacement remains bounded to cfg(all) test-conjunct recognition, focused characterization/proof, and documentation. The reconciliation was conflict-free; local git diff --check passes. Fresh hosted Rust, coverage, JUnit, and UB checks are pending for this exact head. No new actionable defect found; merge remains blocked until current-head evidence completes.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Codex exact-head review update\n\nAddressed the two current review suggestions in commit 2bd6fd5: same-file shadow lookup now avoids repeated PathBuf cloning, and cfg_term_is_test uses the direct token-slice comparison. The existing unction.is_test || is_test_file filter preserves lexical-fallback shadow detection for parser-error facts.\n\ncargo fmt --all and git diff --check pass locally. Fresh hosted proof is required for the new head before merge.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Codex exact-head review update\n\nReconciled the reviewed candidate to main 14f2522 and retargeted the PR to main. Current head is �0e383b2a; prior review threads remain resolved and the candidate remains bounded to cfg(all) test-conjunct recognition plus focused proof. Fresh hosted proof is required for this exact head.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head review (2026-08-28)\nReviewed current head d346616 against current main after the #3540 merge. The candidate remains a narrow Rust source-role classification/cache-schema change. The earlier actionable findings (same-file lookup clone, direct cfg slice comparison, and lexical fallback preservation) are implemented; the current merge-base refresh adds only already-landed CI documentation/workflow changes. No new correctness, scope, or proof gap found. Existing current-head checks are still pending on source-of-truth/UB/routed aggregation; merge remains gated on those results.

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