Skip to content

test(owner-pin): a feature-gated test is refused for its attribute, not a macro rebinding (#8388) - #8937

Merged
EffortlessSteven merged 3 commits into
mainfrom
claude/rand-char-bad-deser
Oct 20, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
claude/rand-char-bad-deser

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Governing issue or accepted claim: #8388 (follow-up to the merged #8529: the last remaining rand "not credited" row)
Acceptance delta (one sentence): The remaining rand test_char_bad_deser "assertion not credited" row is diagnosed as a deliberate #[cfg(feature = "serde")] attribute refusal (not a macro rebinding) and pinned by a discriminating test; the guard is not loosened.

Before: after #8529, rand 94c9078 src/distr/uniform_other.rs:318 test_char_bad_deser still reported assertion not credited: ripr could not establish that it runs as the standard macro, which reads as a foreign/shadowed macro.

After: analyzer behavior is unchanged. The cause is established and pinned. (The misleading sentence itself was already made cause-neutral on main by #8920, which also updated the triage row; this PR was rebased onto it and dropped its own doc edit.)

Cause (evidence): the test carries #[test] #[cfg(feature = "serde")]. runs_body_unchanged (analysis/syntax/owner_pin.rs) refuses every attribute other than #[test] and the serial/rstest/tokio forms, so the function-level refusal is AssertionContextRefusal::TestAttribute("#[cfg(feature = \"serde\")]"). The feature may be off in the build under analysis, so the test may not run; that is not a macro question. Reproduced on a minimal crate with the same assertion shape: the identical test with #[test] only is credited (strong exact value oracle); with #[cfg(feature = "serde")] (or even #[cfg(test)]) it prints the "not credited" line. rand's core::simd::prelude::* globs are not involved (#8529 handled them). The refusal is an existing, tested design decision: is_analyzer_limit is true for it, so it withholds a gap rather than asserting one (see the existing TestAttribute("#[cfg(feature = \"std\")]") assertion in classify/owner_pin/tests.rs).

Decision: legitimately correct fail-closed behavior, so not loosened.

How: new unit test a_feature_gated_test_is_refused_for_its_attribute_not_a_macro_rebinding in analysis/classify/owner_pin/tests.rs: the gated test is refused as TestAttribute(...), is an analyzer limit, and describe() names the attribute; the same test without the gate is credited (None); an ungated test beside use rayon::prelude::*; still refuses with MacroBinding (fail-closed control). Plus changelog.d/8388-feature-gated-test-attribute-pin.md (Internal / CI). No stored facts change, so the file-fact cache schema is not bumped.

Local verification: before the rebase onto #8920: cargo test -p ripr --lib a_feature_gated_test_is_refused passed and cargo xtask precommit exit 0.

Not verified: the rebased head was not rebuilt locally (the shared host OOM-killed the compile), so hosted CI is the proof for it; cargo xtask goldens check not run locally (no golden touched); full --lib not run. Items 2 and 3 of #8388 are untouched. Admitting known-enabled attributes such as #[cfg(test)] is not done here. No independent subagent review was possible (this session has no agent tool); the diff is one test, one fragment.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AUS4vFoCEv5DiNwucKqSbC

@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 self-assigned this Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 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: Essentials
  • Run ID: a8cbfe49-4cd0-4477-8043-e310657a5d18
📥 Commits

Reviewing files that changed from the base of the PR and between 9825b15 and 9919b4c.

📒 Files selected for processing: 1
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Summary by CodeRabbit

  • Tests
    • Added regression coverage for feature-gated test attributes.
    • Confirmed that unsupported feature-gated cases are clearly reported as analyzer limitations rather than attributed to macro rebinding.
    • Verified that equivalent ungated tests continue to be accepted, while cases involving foreign glob imports remain refused.
    • Expanded refusal checks to cover multiple assertion types for more precise analyzer validation.

Walkthrough

The change parameterizes refusal checks by assertion index and adds regression coverage for feature-gated tests. It verifies analyzer-limit refusals for gated tests, admission of ungated tests, and macro-binding refusals for foreign globs. A changelog entry records the outcomes.

Changes

Test Attribute Classification

Layer / File(s) Summary
Feature-gated test classification
crates/ripr/src/analysis/classify/owner_pin/tests.rs, changelog.d/8388-feature-gated-test-attribute-pin.md
weight_refusal_nth checks assertions at a requested index while weight_refusal retains first-assertion behavior. Regression coverage verifies TestAttribute refusals for #[cfg(feature = "serde")], admission without the gate, and macro-binding refusals for a foreign glob. The changelog records these outcomes.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 9919b

No merge-blocking issue is identified; the regression test and changelog can proceed through normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description clearly explains the test change, rationale, evidence, limitations, and verification. However, it omits most required template sections, including Scope, Policy Impact, Rollback, Spec-… Complete the required template sections. Mark non-applicable sections explicitly and record the relevant scope, proof, rollback, traceability, engineering checks, and gate results.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is specific and accurately describes the main change: pinning feature-gated test refusal to the test attribute rather than macro rebinding.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files.
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.
Full details: Description check

Explanation

The description clearly explains the test change, rationale, evidence, limitations, and verification. However, it omits most required template sections, including Scope, Policy Impact, Rollback, Spec-Test-Code Traceability, Engineering Check, and Gates.

Resolution

Complete the required template sections. Mark non-applicable sections explicitly and record the relevant scope, proof, rollback, traceability, engineering checks, and gate results.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 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 reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

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

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 20, 2026 01:37
@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!

…ribute, not a macro rebinding (#8388)

rand 94c9078 uniform_other.rs test_char_bad_deser is "assertion not credited"
because it carries #[cfg(feature = "serde")], whose availability ripr cannot
evaluate; no macro is rebound. Reproduced on a minimal crate: the same test
without the gate is credited. The refusal is deliberate (analyzer limit, not a
gap), so the guard is unchanged. A unit test pins the gated refusal, the
credited ungated control and a still-refusing foreign glob. The misleading
sentence was already made cause-neutral on main (#8920).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AUS4vFoCEv5DiNwucKqSbC
@EffortlessSteven
EffortlessSteven force-pushed the claude/rand-char-bad-deser branch from d796189 to 9825b15 Compare October 20, 2026 01:49

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

Refuted

  • Test pin is tautological because runs_body_unchanged already refuses every non-test attribute via TestAttribute, so the new test does not discriminate cfg(serde) from any other unknown attr; refuted because: Pin still discriminates #8388's hypothesis: it asserts (a) refusal reason is the specific cfg gate, (b) clause names that exact gate and the analyzer-limit language, and (c) the same body without the gate is credited and still refuses under a foreign glob. Together that is a three-way pin, not a generic attr-refusal hit.
  • The test should live in a new sub-module to keep helpers private/clean; refuted because: Adjacent tests (an_outcome_settling_attribute_is_the_refusal_wherever_it_sits immediately above) already use the same weight_refusal + AssertionRefusal::describe pattern in this file; module boundary is consistent.
  • Pinning this attribute cause is overclaiming because cfg(test) and cfg(feature="std") behave identically and the triage doc only mentions feature={}; refuted because: PR explicitly scopes to #8388 follow-up; the refusal is generic across cfg(*) per existing TestAttribute("#[cfg(feature="std")]") assertion; triage doc adds the attribute cause without dropping macro cause. Overclaim risk is low and admitting cfg(test) is parked as out-of-scope follow-up.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@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 found 1 potential issue.

Devin Review

…s controls (#8388)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AUS4vFoCEv5DiNwucKqSbC
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AUS4vFoCEv5DiNwucKqSbC

@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

  • Author admits: rebased head not rebuilt locally (host OOM); cargo xtask goldens check not run; only the new test name was locally green. Need hosted CI cargo-test receipt + goldens clean before full assurance.

Refuted

  • Pin is tautological because runs_body_unchanged refuses every non-test attribute via TestAttribute, so the new test does not discriminate cfg(serde) from any other unknown attr; refuted because: Pin is three-way: (a) refuses for the specific cfg gate string, (b) same body ungated credited (None), (c) ungated under rayon glob still MacroBinding. Discrimination is across gate vs no-gate vs foreign-macro, not across arbitrary attrs.
  • Test stays in the existing module next to an_outcome_settling_attribute_is_the_refusal_wherever_it_sits; no new private sub-module is warranted for a single test using already-public helpers.
  • Helper promotes duplication risk because weight_refusal and weight_refusal_nth share setup; refuted because: Refactor is the smallest-complete fix: weight_refusal is now a 3-line wrapper calling weight_refusal_nth(.., 0); no fixture code duplicated; no new public API surface.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven merged commit ae7dd61 into main Oct 20, 2026
49 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/rand-char-bad-deser branch October 20, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants