Skip to content

074: case_regressions may leave out cases that failed within the integrity allowance - #603

Merged
bartekus merged 1 commit into
mainfrom
impl/074
Nov 25, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/074

Conversation

@bartekus

Copy link
Copy Markdown
Contributor

Summary

Spec 074 (#597), stacked on #602. Closes #597.

  • rustev-eval: case_regressions gains unresolved: "exclude_failed_within_integrity". It is refused unless the gate declares integrity.max_upstream_failures (exclude-failed-needs-integrity). The cases 065 counts as upstream failures come from one function per run kind, which the integrity counts now use too, so the two can never disagree. A case is excluded only when it would be unresolved and each side either has a known value or is excused: every gap on that side is a counted upstream failure, with no unknown measure. When both sides are excused, the case is listed under the baseline. cases.excluded is written exactly when the member is declared; a gate without it keeps its bytes. The descriptive schemas rustev.selection-gate-1 and rustev.selection-1 regenerate.
  • rustev-surface: the gate select stdout summary gains excluded when the member is declared.
  • The reproduction from 064 case_regressions: a candidate within its 065 upstream-failure allowance can never qualify #597, synthetic: a library test plus gate select goldens upstream-allowance.default.json (unknown, exit 12) and upstream-allowance.excluded.json (qualifies, exit 0). Both are harvested as conformance cases on cli and native.
  • Five mutation seeds (seeds.sh "spec 074"): 5/5 detected locally.
  • The selection gate feature page documents the rule. 074 joins make verify and the selection group.
  • Two corrections to section 5, recorded in the spec's implementation record:
    • A case failed in every run of both sides is unmeasured on both sides, so it is counted in unmeasured, not excluded.
    • The reproduction runs over the shared six-case host fixture.

Checks

make gate, the coupling check and make code pass locally.

@bartekus bartekus added the statecraft:stacked-ci Run the full CI matrix on a stacked pull request label Nov 24, 2026
@bartekus
bartekus force-pushed the impl/073-increment-2 branch 2 times, most recently from ba2a215 to 11001b0 Compare November 24, 2026 22:30
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for spec 074, which implements an opt-in to exclude cases whose every gap is a counted upstream failure from case_regressions evaluation.

Spec lifecycle change (specs/074.../spec.md): implementation: pending → complete is consistent with the amendment table in contract.md and the evidence section lists the right artifacts (unit tests, integration tests, golden files, conformance fixtures, mutation seeds).

Core logic (crates/rustev-eval/src/selection/case_regressions.rs): The excused function correctly implements 3.2.2 — it returns false immediately if all runs hold a measure, if the upstream-to-runs length does not match, or if any gap is not an upstream failure. When present.is_empty() (all runs are gaps, all are upstream failures), it returns true, which is vacuously correct per the spec ("runs that hold a measure give a known value" is vacuously true with no such runs). The spec table row "A case failed in every run of both sides: Unmeasured" is handled upstream by a pre-existing match arm (confirmed by the golden fixtures showing c6, which always fails, landing in unmeasured and not in excluded).

Exclusion guard in evaluate: (be || ce) && (be || matches!(bv, Known)) && (ce || matches!(cv, Known)) correctly requires that any non-excused side has a known value, preventing exclusion when a side has a non-upstream-failure gap.

Validation (selection.rs): SelectionGate::check refuses unresolved without integrity.max_upstream_failures, tested by the refusal tests in host_select.rs.

Serialization: Both unresolved on CaseRegressionLimit and excluded on CaseResults use skip_serializing_if = "Option::is_none", preserving byte-identical output for gates without the member (I-1).

Upstream extraction refactor (integrity.rs): evaluated_upstream_cases and host_upstream_cases are extracted from the inline count logic; the counts are now len() of the same sets used for exclusion, so they cannot diverge.

Seeds: Five seeds cover the five mutations identified in the spec; each targets an observable code path and has a corresponding test assertion that would fail under the mutation.

Conformance fixtures and goldens: Both upstream-allowance.default (exit 12, unresolved=1) and upstream-allowance.excluded (exit 0, excluded=1, unresolved=0) match the spec's reproduction description.

No concrete defects found.

{"head": "92c4bdc95d221ab3cbbc5e6f594b059324255bb3", "verdict": "no-findings", "findings": []}

Subject: 11001b0...92c4bdc, diff digest 59f0c2d8e66e84a998f1c1601bbd3a7cf019570dcb797b4ae1efd47921a64457, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR diff against spec 074 and the governance documents.

Lifecycle transition (specs/074-case-regressions-exclude-failed-within-integrity/spec.md): Changes implementation: pending → implementation: complete on an approved spec. Per the contract, approved + complete = settled. Correct.

Makefile: 074 added to VERIFIED_SPECS. Consistent with spec's Verification section now marked complete.

scripts/acceptance/verify.py: 074 added to selection group beside 064 and 065. This is scripts/acceptance/, not scripts/statecraft/, so the statecraft-review-exception approval path does not apply.

crates/rustev-eval/src/integrity.rs: evaluated_upstream_cases and host_upstream_cases extracted as named functions. The count in IntegrityCounts now comes from .len() on the same set, eliminating any possible divergence between the case set and the count.

crates/rustev-eval/src/selection/case_regressions.rs — excused function: Returns false when upstream.len() != runs.len() (safety guard) or when all runs are present. Requires that every absent run is a counted upstream failure and that the present values give Known. This correctly implements 3.2.2.

Exclusion match arm ordering: The arm _ if cases.excluded.is_some() && { ... } appears after (Unmeasured, Unmeasured), so a case that is completely unmeasured on both sides (even if all failures are counted) hits the unmeasured counter — not the exclusion path. This matches the corrected section 5 row ("A case failed in every run of both sides → counted in unmeasured").

Side assignment when both excused: Code names "baseline"; mutation seed #5 (&& false injection) confirms this is what the tests enforce.

excluded field: Written only when limit.unresolved.is_some() (i.e., the clause declared the member) — consistent with 3.4.1. Not serialized when None (skip_serializing_if).

Validation: SelectionGate::check refuses unresolved without integrity.max_upstream_failures; both "no integrity" and "integrity with only max_invalid" are rejected. Correct per 3.1.3.

Schemas (crates/rustev-eval/schema/): These are not in review.exclude; both are updated consistently with the new Rust types (UnresolvedCases, ExcludedCase, optional excluded in CaseResults).

Golden files and conformance fixtures: The two conformance cases (upstream-allowance.default, upstream-allowance.excluded) share identical base/candidate run data, differing only in gate configuration. Goldens show exit 12 / unknown for the default and exit 0 / selected for the excluded variant — consistent with test assertions.

Seeds: All five seeds target concrete mutations (applying when not declared, counting excluded as compared, excusing unknown-measure cases, excusing cases with non-upstream gaps, naming candidate when both excused), and each should be caught by the new tests.

No concrete defects found.

{"head": "750c1e8ebf74ebcdeec49ac30df5b12939e6c0ab", "verdict": "no-findings", "findings": []}

Subject: bc14ead...750c1e8, diff digest 59f0c2d8e66e84a998f1c1601bbd3a7cf019570dcb797b4ae1efd47921a64457, 1 call(s). An AI comment is not an approval.

Base automatically changed from impl/073-increment-2 to main November 25, 2026 02:06
…grity allowance

`case_regressions` gains the opt-in `unresolved:
"exclude_failed_within_integrity"`, refused unless the gate declares
`integrity.max_upstream_failures` (spec 074, 3.1). A case unresolved only
because of upstream failures that 065 counts is excluded and listed with
its side; every other unresolved case keeps 064's meaning, and a gate
without the member keeps its bytes (3.2 to 3.4). The descriptive selection
schemas regenerate. The reproduction is a library test and two `gate
select` goldens (unknown by default, qualifying with the member),
harvested as conformance cases; five mutation seeds, each detected; the
feature page documents the rule. 074 joins `make verify` and the
`selection` group.

Closes #597.
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for specs 073 (increment 2: Node binding) and 074 (upstream failure allowance).

Spec 073 Node binding (increment 2):

The index.js changes correctly extend profileInputs to refuse plan with the new fields (by adding them to withPlan) and to refuse extractRules/templates with instantiation arguments before any parse. The src/profile.rs validate function adds the same fields to its refusal list; the compile path parses them and routes accordingly. The harvest.rs surface change — expanding extraction_documents from ["cli"] to ["cli", "native"] — matches the spec 073 3.5 claim that the WebAssembly package gains nothing but the native binding joins in increment 2. The conformance runner in js/run.mjs maps --extract-rules and --template correctly.

Spec 074 upstream-failure exclusion:

The excused function correctly handles partial failures (some runs None, rest Known) and the guard correctly gates exclusion on both sides being either excused or Known. The double-call to excused in the guard vs. body is redundant (Rust guards can't export bindings) but deterministic and correct. The excluded counter only appears in stdout/output when the clause declares unresolved: "exclude_failed_within_integrity" (via skip_serializing_if), consistent with 3.4.3. The integrity.check() refusal for the member without max_upstream_failures is in place (3.1.3). Schema changes, golden files, and conformance fixtures are consistent with the implementation record.

The spec 074 section 5 table states "A case failed in every run of both sides: counted in unmeasured, not excluded." The excused function returns true via the present.is_empty() early exit for a case with all-None measurements whose every gap is an upstream failure, which would exclude rather than count such a case as unmeasured. However, failing cases produce no rubric scores and do not appear in the MetricCases structure at all, so this code path is not reachable with the data types handled by this implementation. No concrete input exists on which the change misbehaves.

Lifecycle changes (pending → complete for both specs) are correct post-implementation. VERIFIED_SPECS, verify.py groupings, seeds.py, and Makefile are consistent.

{"head": "750c1e8ebf74ebcdeec49ac30df5b12939e6c0ab", "verdict": "no-findings", "findings": []}

Subject: 1f6d91d...750c1e8, diff digest c395b384ccdb28f4f5989a149008ce1bcf329156bfd87acb3cfe1f087ca7b7d9, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the implementation of spec 074, which adds an opt-in (unresolved: "exclude_failed_within_integrity") to let case_regressions clauses leave out cases whose every gap is a counted upstream failure.

Logic in excused (case_regressions.rs): Correctly enforces the three spec conditions: at least one run lacks a measure, every missing run is an upstream failure, and all present runs give a Known value. The present.is_empty() early-return is safe because case_value on an empty pool would not produce Known; the caller's guard separately ensures the other side has a known value before the exclusion fires.

Side-naming when both sides excused: The code names "baseline" whenever excused(&bm, ...) is true, which correctly covers the both-excused case. The fifth mutation seed verifies this is caught if changed.

compared counter: The exclusion arm does not increment compared; the second seed would detect any incorrect increment. Golden files and unit-test assertions confirm the count.

Double call to excused in guard vs body: The function is pure, so this is a performance issue only, not a correctness bug.

Spec vs table row: "failed in every run on both sides": The spec correction correctly notes this case goes to unmeasured (handled by the existing (Unmeasured, Unmeasured) arm that fires before the _ if … guard), not to excluded. Consistent with the implementation record's explanation.

Integrity refactor (integrity.rs): evaluated_upstream_cases and host_upstream_cases use BTreeSet<String>, and the counts are now set.len(). Case names within a run are unique, so len() equals the previous .count() in every well-formed input; the two paths cannot disagree.

Schemas, goldens, conformance fixtures, seeds, Makefile: All internally consistent with the code changes.

No concrete defects found.

{"head": "e81075606e36cd33539b8363f599b83116120272", "verdict": "no-findings", "findings": []}

Subject: 1f6d91d...e810756, diff digest 59f0c2d8e66e84a998f1c1601bbd3a7cf019570dcb797b4ae1efd47921a64457, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 0f3291f Nov 25, 2026
55 of 63 checks passed
@bartekus
bartekus deleted the impl/074 branch November 25, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

statecraft:stacked-ci Run the full CI matrix on a stacked pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

064 case_regressions: a candidate within its 065 upstream-failure allowance can never qualify

1 participant