Repository navigation
Description
Parent: #3213
Depends on: #3283
Existing partial implementation: PR #3273 — inline #[cfg(test)] role only
Builder-Ready Plan
Plan disposition: builder-ready after the source-role model covers the intended test/evidence surfaces. This is S3.
Problem
Source-role classification should stop ordinary harness code from becoming the production subject, but #3213 also carries a stronger observed failure: semantically equivalent test assertions can change the reported production-gap denominator solely because one form uses explicit control flow and Result<()> plumbing.
The producer needs a discriminating corpus proving test syntax affects oracle/evidence facts only where the semantic assertion actually changes—not because if, return Err, ?, map_err, Ok(()), or helper calls are available as probe shapes.
Current evidence
- A downstream
#[cfg(test)]module produced 58 gaps; rewritingif cond { return Err(...) }into a message-carryingassert!reduced the count to zero while preserving the product behavior, fixture, oracle, and failure message. - PR fix(rust): classify cfg(test) helpers as evidence #3273 establishes inline helper role but explicitly marks equivalent assertion-form parity
not_established. fileciteturn128file0 - analysis(rust): classify Cargo test, bench, and confirmed test-convention targets as evidence role #3283 broadens source role across Cargo test/bench/registered evidence surfaces.
- Existing assertion/oracle analyzers should still distinguish broad from exact oracles; this issue must not flatten real semantic differences.
Reproduction / example
Equivalent pair:
assert!(actual == expected, "actual={actual:?}");if actual != expected {
return Err(anyhow!("actual={actual:?}"));
}
Ok(())For the same production owner and exact comparison, the production-seam inventory and credited discriminator/oracle meaning should agree. Harness-only control-flow shapes must not add production subjects.
Non-equivalent control:
assert!(actual.is_ok());versus an exact variant/value assertion must remain distinguishable in oracle strength.
Suspected root area
- test/evidence source-role filtering before probe seeding;
- Rust assertion/oracle extraction and normalized assertion shape;
- helper/control-flow fact extraction;
- production-gap denominator aggregation;
- governed fixtures/goldens and mutation/removal tests.
Fix plan
- Build a table-driven fixture corpus over the same production owner, inputs, and expected observable using equivalent harness forms:
assert!
assert_eq! / assert_ne!
if ... return Err(...)
match ... { wrong => Err(...), _ => Ok(()) }
Result<()> with ? / map_err
assert_cmd chains
.contains() / exact output checks
helper function inside evidence role
- Define the semantic projection used for equality: production subject inventory, owner/relation identity, activation/discriminator facts, oracle kind/strength, limitations, and actionable production gaps.
- Prove harness-role functions/control flow never enter the production subject inventory under the supported source roles.
- Normalize equivalent assertion evidence only when the same comparison/observable is structurally established. Do not infer exactness from messages or names.
- Retain negative controls for broad
is_ok/contains/status-only assertions, wrong target, unrelated strong assertion, opaque helper, and changed expected value. - Add removal experiments that re-enable probe seeding for evidence-role functions or make assertion syntax drive denominator changes; the corpus must fail.
- Keep production controls with identical syntax eligible for normal findings.
- Preserve unknown/opaque states where helper semantics cannot be resolved.
Acceptance tests
- Equivalent exact-value/variant assertions across supported forms produce the same production subject inventory and actionable-gap count.
Result<()>, terminalOk(()),?,map_err, assertion-driver calls, and harness-only.contains()do not create recursive production obligations.- Adding a focused test can reduce or leave unchanged the production gap count; harness plumbing alone cannot increase it.
- Broad versus exact oracle forms remain different where semantics differ.
- Wrong-target and unrelated-strong-assertion controls remain non-crediting.
- Production-source functions using the same
if,?,map_err, or return shapes remain ordinary production subjects. - Opaque/custom helpers remain limited rather than guessed equivalent.
- Removal experiments fail for evidence-role probe leakage and syntax-dependent denominator drift.
Non-goals
- No claim that all assertion forms are semantically equivalent.
- No arbitrary custom matcher interpretation.
- No output/gate source-role disclosure; S4 owns convergence.
- No downstream suppression removal before publication.
- No threshold relaxation or support promotion.
Dependencies / sequencing
- Depends on analysis(rust): classify Cargo test, bench, and confirmed test-convention targets as evidence role #3283 and accepted PR fix(rust): classify cfg(test) helpers as evidence #3273 behavior.
- Must land before S4 end-to-end projection/downstream closeout.
- Its corpus becomes downstream acceptance for perl-lsp-swarm test(repo-policy): two shell tests break on current GitHub-hosted runner image (bad-interpreter exit code; stubborn descendant kill) #9907.
Risk / rollback
Risk is over-normalizing assertions and crediting a weak oracle as exact. Require structural equality of owner, input, comparison, expected observable, and target; keep broad/opaque controls. Rollback removes normalization/corpus changes while retaining producer source role.
Verification notes
Run focused assertion/oracle and source-role tests, the governed equivalence corpus, goldens, evidence-promotion honesty, full Rust analyzer tests, formatting, Clippy, dogfood, and cargo xtask check-pr. Inspect semantic fixture diffs rather than only aggregate counts.
Claim boundary
Completion proves the supported production-gap denominator and oracle meaning do not depend on equivalent test-harness syntax. It does not expose the role consistently across every public surface or remove downstream suppressions.
Activity
coderabbitai commentedon Aug 15, 2026
🔗 Related PRs
#3167 - test(product): prove equality-boundary repair closes [merged]
#3190 - fix(output): keep mixed health repairs visible [merged]
#3193 - test(fixtures): isolate unchanged proof identity [merged]
#3203 - test(gate): reject vacuous non-promotion charters [merged]
#3273 - fix(rust): classify cfg(test) helpers as evidence [open]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
fix(analysis): keep guard-condition scanning on char boundaries (#3284)
feat(analysis): keep production-gap accounting invariant across asser…