Skip to content

fix(analysis): discover test-case parameterized tests - #3522

Merged
EffortlessSteven merged 6 commits into
mainfrom
fix/test-case-attribute-discovery
Aug 28, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
fix/test-case-attribute-discovery

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Closes #3519

Change

  • promotes explicit #[test_case(...)] and #[test_case::test_case(...)] functions into the ordinary Rust test index
  • preserves their attributes and extracts supported numeric case arguments for infection evidence
  • extracts body assertions and keeps file-local and repository-wide facts aligned
  • keeps rstest, plain #[test], an orphan #[case], and an unannotated helper as positive and negative controls

Design

The parser remains responsible for source facts. Framework semantics are applied once at the fact-normalization boundary, after both fresh and cached indexing, so downstream CLI, LSP, and evidence consumers receive one consistent index.

Claim boundary

This recognizes explicit source-level attribute syntax. It does not expand procedural macros, infer arbitrary custom harnesses, or claim runtime execution.

Verification

  • integration regression builds an ordinary Rust index from a mixed parameterized-test fixture
  • hosted Ripr Rust Small Result is the exact-head authority

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Caution

CodeRabbit couldn't post its review summary.

Error details
HttpError

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • is_explicit_test_case_attribute uses a whitespace-stripped prefix check, which accepts malformed leading forms like #[test_case (...)] or comments-only attribute strings; harmless for parsing but loose. No semantic risk for the fixture.
  • artifact-verifier failed exit 2; not blocking for source-route but plan/compiler should track before gate.

Verification questions

  • Confirm coverage gaps in the new module: no test for stacked #[test_case(...)] on one function, no cache-path coverage (build_index_from_loaded_files_with_cache), and no negative for is_explicit_test_case_attribute rejecting #[case( and rstest internal expansions.
  • Confirm is_explicit_test_case_attribute collapses whitespace and matches a prefix; attr text containing #[test_case( inside a multiline macro could false-positive on attr boundaries, and macros that re-export test_case under aliased paths are not recognized.
  • Confirm pR claim 'framework semantics applied once at the fact-normalization boundary, after both fresh and cached indexing' must hold for build_index_from_loaded_files_with_cache; diff adds promote in both fresh and cached paths. Verify LSP/CLI callers route through these wrappers and not through build::build_index directly.
  • Confirm no regression-style red/green test: existing baseline behavior on this fixture is not asserted separately. Single in-file integration test mixes old-behavior absence and new-behavior presence; a focused control (pre-promotion index of same fixture) would harden the red/green proof.

Refuted

  • Box::from(slice) allocation failure on cache path is a regression risk.; refuted because: Diff does not touch Box::from(slice), allocation, or any native path. False premise under calibration rules; allocation failure would surface as an error and not be papered over.
  • Whitespace-collapsed prefix match on attribute text could miss nested or aliased test_case attributes (e.g., rstest::test_case, test_case::case).; refuted because: Lane scope is public-API source-route, not attribute parsing exhaustiveness. PR body explicitly excludes procedural-macro expansion and 'arbitrary custom harnesses'; plain prefix match is consistent with stated scope. Demoted to verification-question, not finding.

Test proof

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

Evidence gaps

  • Artifact-verifier failed (exit 2) without receipt; cargo-test is scheduled-late only. Compiler downstream of these receipts cannot fully confirm artifact shape from sensors.
  • Model proof intent was rejected by deterministic validation.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 53 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: 171898d8-5e51-4bf3-a050-ab4eb96d3708

📥 Commits

Reviewing files that changed from the base of the PR and between 9e41eec and 839a529.

📒 Files selected for processing (4)
  • crates/ripr/src/analysis/facts/mod.rs
  • crates/ripr/src/analysis/facts/parameterized_tests.rs
  • crates/ripr/src/analysis/syntax/mod.rs
  • crates/ripr/src/analysis/syntax/ra.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.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Exact-head substantive review — d735bd297 against current main b9ae54c2f

Status: REVIEW_COMPLETE / no actionable code finding.

The candidate promotes only explicit source-level test_case attributes at the fact-normalization boundary, preserves existing negative controls, and keeps the claim bounded away from procedural-macro expansion and runtime execution. The repair adds a discriminating warm-cache regression: stacked #[test_case(...)] functions are promoted exactly once in both cold and cached indexes, including the per-file test projection.

Exact-head local proof passed: cargo fmt --all -- --check; cargo test --locked -p ripr analysis::facts (28 passed); cargo clippy --locked -p ripr --all-targets -- -D warnings; and git diff --check. The historical --test facts_promoted command is invalid because that target does not exist in the current package; the real in-module proof now covers the seam. Fresh hosted checks are required before merge.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review August 28, 2026 16:33

@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: d735bd2971

ℹ️ 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 repair evidence — 839a529 against main 9e41eec

Addressed the valid parser/oracle finding. Promoted explicit #[test_case] functions now use the parser-backed Rust oracle extraction used by ordinary AST-indexed tests, with the existing lexical extraction retained only when parsing the function text fails. Added a negative fixture containing assert_eq! only in a comment and string; it produces no assertions. Validation: cargo fmt --all -- --check — PASS; cargo test --locked -p ripr analysis::facts::parameterized_tests — PASS, 2 passed; git diff --check — PASS. This proves the promotion seam and its false-positive guard; it does not establish hosted CI or release readiness.

@EffortlessSteven
EffortlessSteven enabled auto-merge (squash) August 28, 2026 17:47
@EffortlessSteven
EffortlessSteven merged commit ef1bb75 into main Aug 28, 2026
21 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/test-case-attribute-discovery branch August 28, 2026 18:05
EffortlessSteven added a commit that referenced this pull request Aug 30, 2026
…3594)

* docs(changelog): record the recent user-visible merges in Unreleased

Entries for the recent user-visible merges: test-case parameterized
test discovery (#3522), nonstandard test attributes (#3513), active
Jest/Vitest modifiers (#3506), the perl class-cap fix (#3583), Python
LSP config reload and auto-detection invalidation (#3503/#3576), policy
covered_by enumeration reliability (#3577), and front-panel movement
vocabulary (#3491). Entries state what the merged PR titles state — no
invented mechanism detail.

* docs(changelog): capitalize Perl in the class-cap entry (#3594 review)
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: discover test-case parameterized Rust tests

1 participant