Skip to content

fix(rust): ignore comment and string module mentions in test discovery - #7603

Merged
EffortlessSteven merged 3 commits into
mainfrom
fix/rust-commented-module-discovery
Oct 13, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
fix/rust-commented-module-discovery

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Rust diff discovery could credit an unchanged test file that Cargo never
compiles when a comment or string contains mod <file_stem>;. Mask comments
and literals in the existing suspect prefilter's declaration scan, preserving
literal path hints and the authoritative module walk's incomplete result.

Refs #6979, item 5's comment/string subcase only. The parent remains open for
same-package name coincidence, repo/dependent scope, ambiguous target roots
and cfg-edge follow-ups.

Swarm / Source Boundary

  • Ordinary analyzer, spec, fixture and regression-test development for
    EffortlessMetrics/ripr-swarm.

Scope and acceptance

Production delta: one existing declaration-mention scan in
analysis/language/rust/mod.rs. No new discovery authority, dependency,
schema, support-tier or process/network change.

Evidence delta: three public API integration tests, one retained nested-orphan
fixture with JSON/human goldens, an independent honesty-corpus literal class
pin, RIPR-SPEC-0153 and traceability updates.

Acceptance: an unchanged orphan whose module is mentioned only inside a
comment/string contributes no related test; actual cfg(test) and renamed
literal-path modules retain their test, and an incomplete walk retains credit.

Governing spec: RIPR-SPEC-0153.
Candidate: 9fa309e96197fbccf8068dfd3b7e42a8e3574fb0, based on
be2ad06fa86edf2cca68f9dd0ffb107b94c16484. No stack prerequisite or replacement PR.

Observed proof

Rust/Cargo 1.95.0 on Linux, serial builds:

  • Exact-base worktree doctor, check-fast (verified zero changed paths)
    and cargo check --locked -p ripr --all-targets: passed.
  • Public rust_discovery_comments: intended RED (2 controls passed, 1 false
    discovery assertion failed), then GREEN (3 passed, 0 failed).
  • Actual Cargo test --all-targets -- --list: orphan has zero unit tests
    plus exactly integration_is_collected; renamed nested #[path] control
    has exactly tests::renamed::discount_applies plus that integration test.
    These inventories are checked against independent literal names.
  • Both tests pass in the declared control; replacing > with >= fails
    the boundary assertion with actual 90 versus literal expected 100.
  • The retained baseline CLI falsely names discount_applies on both orphan
    shapes. The repaired fixture has exactly one no_static_path finding and
    an empty related-test list.
  • Formatting and git diff --check: passed.

The reviewer found that the honesty gate also requires full human output.
The gate reproduced that missing-artifact RED, and passed after retaining the
actual full renderer output without changing the literal assertion.

At repaired head 9fa309e96, check-fast passed all 15 selected gates with
an independently verified 18-path selector, and precommit passed, including
dependency, process, network and strict lint policy. The focused public
compatibility suites passed 24 tests (21 existing helper controls and 3 new
discovery controls).

The preceding source-identical head 699237517 passed the complete golden
run: 385 selected/executed/compared fixtures, 939 passing surface comparisons,
zero drift. Dogfood passed. The only later change removes the new std-only
fixture's unnecessary generated lockfile; source, assertions and expected
outputs are unchanged. The current discovery fixture passed all three JSON/human/full-human
comparisons, and the frozen final CLI independently produced one
no_static_path finding with an empty related-test list.

The first full golden run had a setup failure: this fresh Cargo home lacked
the separate locked anyhow 1.0.100 fixture dependency required by
docs/TESTING.md. Exact-base and candidate finding payloads agreed before
and after the documented locked fetch. No source or expected output was
changed to resolve that failure. Precommit then rejected the unnecessary
new fixture lockfile; removing it preserved the dependency policy unchanged.

Required Routed Rust Small run completed SUCCESS at the exact final head. Its actual checkout was d28664f3c7199dbd9e692b9dfeb3ecdd0120d653 (verified parents: main 6bd4e76cce997a216f11d7841d80a14b280f4070 and candidate 9fa309e96197fbccf8068dfd3b7e42a8e3574fb0). Native nextest reported 14,904 passed across 81 binaries, two skipped, including all three new tests and 21 helper controls. The actual gate job, doctests and required Result job succeeded; all 15 gate inputs reported success.

Current-main integration review against eb98f3300bc2df258db03b790276ee4d193d0cf5 found a clean composition to tree 92dd489736ed45a8453b35ccbbcf237b059e1cbb, preserving the complete candidate delta and upstream additive corpus/traceability entries. No restack or duplicate build was needed. Source of Truth, Printed Command Paste, Security and Windows Advisory also succeeded. Artifact metadata binds the exact head/run, but payload access returned HTTP 403; archive/JUnit bytes and their digest were not verified, and the denied route was not retried. Protection/ruleset reads remain unavailable; no bypass is authorized.

Review, limits and rollback

Independent published-head review earned REVIEW_READY after inspecting consumer/oracle/source/output evidence, actual hosted steps and current-main composition. CodeRabbit also inspected exact-head 18 files and found no actionable comments. Live inline threads are empty. Pending Droid and quota-limited Gemini output are not claimed as clean reviews. Native Windows/macOS execution is not claimed; the path hints and case-sensitive module-walk policy are unchanged.

Merged through the ordinary protected squash API at 0381f98e7ad1a8c10c2e15deda8ceed310cd0d54. GitHub confirms merged/closed at 2026-10-13T04:12:59Z. Fetched main contains that commit; its actual parent is the reviewed eb98f3300bc2df258db03b790276ee4d193d0cf5 and its tree is exactly 92dd489736ed45a8453b35ccbbcf237b059e1cbb. The full 18-file landed delta matches the reviewed candidate. The prior false mergeability flag did not establish a source conflict. No bypass or settings change was used.

This does not repair the other #6979 leaves, general cfg evaluation, arbitrary
macro expansion, repo-mode test discovery, direct Err seams, #7553 or #7563.
Revert this single candidate to restore the prior prefilter and evidence.
Next eligible discovery work remains tracked on #6979.

Changelog disposition: changelog.d/6979-commented-module-discovery.md uses
the canonical <!-- section: Fixed --> marker, - bullet and trailing
(#6979) reference. No policy exceptions or gate weakening are introduced.

@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 Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7fe98f0c-bdc3-4bc4-be3d-36dada8c6725
📥 Commits

Reviewing files that changed from the base of the PR and between 6bd4e76 and 9fa309e.

📒 Files selected for processing (18)
  • .ripr/traceability.toml
  • changelog.d/6979-commented-module-discovery.md
  • crates/ripr/src/analysis/language/rust/mod.rs
  • crates/ripr/tests/rust_discovery_comments.rs
  • docs/specs/RIPR-SPEC-0153-rust-source-role.md
  • fixtures/evidence-promotion-honesty-corpus/corpus.json
  • fixtures/rust_commented_module_orphan/SPEC.md
  • fixtures/rust_commented_module_orphan/diff.patch
  • fixtures/rust_commented_module_orphan/expected/CHANGELOG.md
  • fixtures/rust_commented_module_orphan/expected/check.json
  • fixtures/rust_commented_module_orphan/expected/human-full.txt
  • fixtures/rust_commented_module_orphan/expected/human.txt
  • fixtures/rust_commented_module_orphan/input/Cargo.toml
  • fixtures/rust_commented_module_orphan/input/src/lib.rs
  • fixtures/rust_commented_module_orphan/input/src/tests/data/used_tests.rs
  • fixtures/rust_commented_module_orphan/input/src/tests/mod.rs
  • fixtures/rust_commented_module_orphan/input/src/used.rs
  • fixtures/rust_commented_module_orphan/input/tests/live.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Summary by CodeRabbit

  • Bug Fixes
    • Rust diff analysis no longer treats module names mentioned only in comments or strings as evidence that a test covers changed code.
    • Test discovery continues to recognize real test-module declarations, including renamed modules, and preserves existing behavior when module analysis is incomplete.
  • Documentation
    • Updated guidance and examples to clarify how Rust module mentions affect test reachability and analysis results.

Walkthrough

The Rust module-name prefilter now ignores declarations inside comments and strings. Regression tests and a new fixture cover orphaned test files, real and renamed cfg(test) modules, and incomplete module walks.

Changes

Rust module discovery

Layer / File(s) Summary
Mask module mentions and test discovery
crates/ripr/src/analysis/language/rust/mod.rs, crates/ripr/tests/rust_discovery_comments.rs
The mod scan now uses comment- and string-masked source. Tests check that comment-only mentions do not add related tests, while real cfg(test) and renamed modules retain their related tests.
Orphan-module fixture and expected results
fixtures/rust_commented_module_orphan/*, fixtures/evidence-promotion-honesty-corpus/corpus.json
The fixture includes a nested commented-out module mention and an unrelated integration test. Its expected reports record one no_static_path finding with no related tests.
Specification and changelog
docs/specs/RIPR-SPEC-0153-rust-source-role.md, .ripr/traceability.toml, changelog.d/6979-commented-module-discovery.md
The specification, traceability entry, and changelog describe the updated comment and string handling and the covered module-walk cases.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

Merge Risk: ⚪ Minimal · up to 9fa30

The change is mergeable after normal checks; no actionable issue is established by the supplied evidence.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 7 files. (11 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 primary change: Rust test discovery now ignores module mentions in comments and strings.
Description check Passed The description is detailed and covers the change, scope, acceptance criteria, governing specification, tests, proof, limitations, rollback, and review status. It does not reproduce every template hea…
Full details: Docstring Coverage

Explanation

Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 7 files. (11 skipped: 11 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each module line,
And skips the comments, strings, and signs.
Real test paths still join the show,
While orphan hints no credit know.
The burrow’s tests stay sound and clear!

Comment @coderabbitai help to get the list of available commands.

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

REVIEW_INCOMPLETE at 6992375. Independent exact-head candidate review found no remaining actionable findings after repairing the missing full-human oracle artifact.

Inspected surfaces: complete 19-file delta; declaration prefilter → authoritative module walk → dropped-file set → fact-cache/index → public related-test projection; shared comment/string masker; source-role spec and traceability; literal honesty assertion and JSON/compact/full human outputs.

Observed: actual public-consumer RED (phantom discount_applies), GREEN3/0, independent Cargo1.95.0 orphan and renamed nested module inventories, wrong >= control failing90vs100, and honesty-gate artifact RED/GREEN. Full-human artifact matches retained renderer output SHA-256 1464c312fc280ea92f578761bf3b436ef29cffa489efbd156f718ead2b93dd3e. Raw path hints remain unmasked and an incomplete walk retains credit. Filtering precedes cache lookup, so cached orphan facts cannot restore dropped files.

Not established yet: terminal final-head check-fast/focused compatibility results, full golden/dogfood/precommit results, hosted required checks, hosted review/thread disposition, or native Windows/macOS execution. Shell protection/ruleset reads returned Forbidden; protection is not assumed absent and no bypass is authorized. Draft→Ready qualification and complete published-head review remain required before normal protected squash merge. This author-side COMMENT is an inspection record, not an approval or merge-readiness claim.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 13, 2026 02:57
@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!

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@EffortlessSteven
EffortlessSteven marked this pull request as draft October 13, 2026 03:06
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 13, 2026 03:16
@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!

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

REVIEW_INCOMPLETE at 9fa309e; local acceptance supported, no remaining actionable findings.

Independent read-only exact-head review inspected the complete 18-file change and real consumer chain: shared masking → declaration prefilter → complete/incomplete module walk → file filtering before fact-cache lookup → public related-test findings. Literal Cargo inventories, actual public-consumer RED/GREEN, renamed nested cfg(test) positives, opaque-walk retention, and wrong-boundary assertion failure were challenged.

Observed local evidence on the final head: check-fast 15 gates/no skips and independently matching 18-path selector; precommit report/receipt pass at exact head/base; 24 consumer tests pass; all three affected fixture output surfaces pass; frozen CLI embeds the reviewed head and independently produces exactly one no_static_path finding with zero related tests. Executable SHA-256: cc14c2a1b7428dbd193756c394fa327d7bbfdcbe10b54c965047c4dd2f463c9b. Direct native commands exited 0; the independent reviewer inspected retained reports/logs rather than rerunning them.

The prior full golden run at source-identical 6992375 passed 385 selected/executed/compared fixtures and all 939 surface comparisons. The later change only removes a generated std-only fixture lockfile; no source, assertion, expected-output or dependency-policy bytes changed, and the affected fixture was refreshed. The first golden failure was the documented unprepared locked anyhow dependency, verified on exact base and candidate and repaired through setup only.

Remaining boundary: current-head Routed Rust Small run38340964920 and other hosted required proof/review must finish and be inspected before REVIEW_READY or normal protected squash merge. Current thread read returned zero; empty threads and provider quota messages do not establish review. No auto-merge or bypass is armed. Shell protection/ruleset reads returned Forbidden, retained as an evidence gap. Native Windows/macOS execution by this lane is not claimed; hosted Windows Advisory succeeded.

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

Parked follow-ups

  • Honesty-gate artifact issue referenced in PR body ('full human output' SHA-256 1464c312...) was resolved by retaining actual renderer output without changing literal assertion, per prior review summary; no overclaim.

Evidence gaps

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

REVIEW_READY for published head 9fa309e.

Independent read-only review inspected the complete 18-file delta and actual consumer chain: shared masking → declaration prefilter → authoritative complete/incomplete module walk → filtering before fact-cache lookup → public related-test output. Actual consumer RED/GREEN, independent literal Cargo 1.95.0 inventories, renamed nested cfg(test) positives, opaque-walk retention and wrong >= boundary control were challenged. Raw literal path hints remain intact; incomplete walks keep credit. The orphan cannot acquire cached test facts after filtering.

Retained exact-head local proof: all 15 check-fast gates/no skips with independently matching 18-path selector; precommit passed; 24 public consumers passed; JSON/compact/full-human affected fixture comparisons passed. Frozen final CLI SHA-256 cc14c2a1b7428dbd193756c394fa327d7bbfdcbe10b54c965047c4dd2f463c9b reports exactly one no_static_path finding with zero related tests. Source-identical predecessor 6992375 passed 385/385/385 golden fixtures and 939 surface comparisons; only a generated std-only lockfile was subsequently removed.

Hosted qualification: required run38340964920 completed SUCCESS for this exact PR head. The actual checkout was d28664f (verified Git parents 6bd4e76 and 9fa309e). Native cargo nextest reported 14904 passed across81 binaries,2 skipped, including all3 new discovery tests and21 assertion-helper controls. Actual Rust gates job and required Result job succeeded; all15 gate result inputs are success, doctests succeeded. Native output and workflow exit handling were inspected, rather than accepting an aggregate alone.

Integration basis: current main eb98f33 composes without conflicts to tree92dd489736ed45a8453b35ccbbcf237b059e1cbb. The entire added/removed18-file delta matches the original candidate; all16 non-additive candidate blobs are preserved, with additive corpus/traceability changes only. New upstream inequality-oracle rules cannot affect the orphan's absent reachable oracles or the positives' discovery-name assertions. The Rust discovery/mask/module-walk source is unchanged; single-finding human rendering remains unchanged. No restack or duplicate local build was needed.

Live disposition: zero inline threads; CodeRabbit inspected exacthead18files and reported no actionable comments with successful status. UB's parked artifact follow-up is repaired; its rejected model-proof intent is a provider evidence gap, not an active source finding. Gemini quota and pending Droid review are unavailable provider output, not clean reviews; the substantive independent pass and CodeRabbit supply an adequate alternative.

Residual limits: artifact metadata identifies exacthead/run, but archive/JUnit payload access returned403; those bytes/digest were not verified and no alternate route was attempted. Native Windows/macOS proof is not claimed. Protection/ruleset reads previously returned Forbidden and were not retried; policy absence/bypass is not inferred. The API mergeable boolean is false while native composition is clean; normal protected squash must still accept the operation before any merge is claimed. Other #6979 leaves, direct Err seams, #7553 and #7563 remain outside this delivery.

This author-side COMMENT records the earned published-head disposition; it is not a human approval or protection exception.

@EffortlessSteven
EffortlessSteven merged commit 0381f98 into main Oct 13, 2026
39 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/rust-commented-module-discovery branch October 13, 2026 04:13
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