Skip to content

feat(t27b): run invariant blocks like tests, report them apart (Refs #5977) - #5992

Merged
gHashTag merged 1 commit into
masterfrom
claude/t27b-coverage
Oct 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/t27b-coverage

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Summary

invariant blocks are now lowered and run by t27b, natively, through the same machinery as test blocks:

  • An invariant block lowers exactly like a test: a parameterless body under the test binding rule, with the same trap sites.
  • They are reported apart from tests, as INVARIANT PASS / INVARIANT FAIL, plus a line invariants N held, M broken, K not checked.
  • If the front-end discarded an invariant's body (a forall, or a clause it could not parse), the invariant is reported as NOT CHECKED. It is never reported as held.
  • A partially parsed invariant is rejected with a precise unsupported construct InvariantBlock message. Partially parsed tests were already rejected this way.
  • Clause-form blocks carry no line number on any node, so their header line is looked up in the source text.

t27c's Zig backend emits an invariant as comptime { ... }, so a broken invariant is a compile error there. t27b runs it at test time instead.

Numbers

t27b corpus specs/ over 1184 specs:

before after
supported 37 48
pass 36 47
real spec failures 1 1 (ternary_model, a bug in the spec)
JIT/interpreter mismatches 0 0

The differential test (random programs, JIT vs interpreter) found 0 mismatches over 2500 programs in each overflow mode.

New tests are in cli/t27b/tests/source.rs. They cover invariants that hold, break, overflow or are quantified, plus the rejection of a partially parsed invariant.

Refs #5977. Part of #5905.

🤖 Generated with Claude Code

An `invariant` block lowers exactly like a `test` (a parameterless body,
the test binding rule) and runs through the same trap machinery. t27c's
Zig backend emits it as `comptime { ... }`, so a broken invariant is a
compile error there; t27b runs it at test time and prints INVARIANT
PASS / INVARIANT FAIL, plus an `invariants N held, M broken, K not
checked` line. An invariant whose body the front-end discarded (a
`forall`, an unparseable clause) is NOT CHECKED, never "held"; a
partially parsed one is rejected, as a partial test already was.

Clause-form blocks carry no line on any node, so their header line is
looked up in the source text.

Corpus: 48 supported (47 pass, 1 spec failure), was 37; 0 mismatches.
Differential: 0 mismatches, 2500 programs per mode.

Refs #5977

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 10:16:20 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 43
PRs with All Checks Green 7
READY 2
FAILING 43
PENDING 0
NO CHECKS YET 1

These columns do not partition: 2 + 43 + 0 + 1 = 46, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=2bb99f4036f1 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

This was referenced Oct 4, 2026
@gHashTag
gHashTag merged commit d7686d9 into master Oct 4, 2026
31 of 32 checks passed
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