Skip to content

feat(t27b): tri t27b reduce -- ddmin repro reducer with a reference guard (Closes #6445) - #6830

Merged
gHashTag merged 1 commit into
masterfrom
sieve/t27b-reduce
Oct 6, 2026
Merged

gHashTag merged 1 commit into
masterfrom
sieve/t27b-reduce

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Closes #6445

Refs #6488 #6063

What

tri t27b reduce SPEC [--family X | --disagree] is a delta-debugging (ddmin) reducer.

  • Levels: it works through declarations, then statements, then expressions.
  • Parsing: every candidate goes through t27c parse first, so the search spends no time on files that do not parse.
  • Interesting: a candidate is interesting when the reference (t27c test-report) passes and runs at least one test, and t27b is still blocked with the same first-blocker family. With --disagree, a reference/t27b test disagreement counts instead.
  • Fixture: the result goes to cli/t27b/tests/reduced/<family-slug>.t27. Its header names the family, the origin spec, line count and commit, the reference verdict, and the command that regenerates it.
  • Cache: it reuses the corpus --reference-cache. Each candidate is written to the spec's own path, so the cache key stays stable.

tri t27b next now prints a repro: line under every lane that has a fixture (repro in --json).

Own language first

  • Decisions in t27: every decision lives in specs/tri/t27b/reduce.t27. That covers the answer and the reference guard, the chunk arithmetic, the level order, the candidate budget and the 20-line goal. The spec has 13 tests and an invariant guard_first.
  • Generated C: gen/c/tri/t27b/reduce.c is t27c gen-c output. It is byte-identical to the Railway lab's master t27c (sha256 656176e2fbc1717f).
  • Python: scripts/tri_loop/t27b_reduce.py (632 lines) and the t27b.py wiring only do I/O: running parse and corpus, splitting the source into spans, and writing the file.

Owner approval: the owner put the label owner-approved-foreign on #6445 on 2026-10-06 and said (translated) "add the label yourself and do the work". The new Python file is listed in tools/policy/foreign-exceptions.txt, the debt is #6198, and the AGENTS.md debt line counts are updated.

Evidence

1. Blocked spec reduced under 20 lines, family kept.

  • Spec: specs/isa/ternary_encoding.t27, one of the 11 files in the top lane ExprBinary(value ignored) statement.
  • Before: 360 lines; the reference passed 11 tests and t27b was blocked.
  • After: 9 lines. The reducer judged 639 candidates: 0 were rejected by the parser, 543 by t27b, and 54 by the reference out of 98 reference runs; 44 were kept. It took about 15 minutes on the local release binaries.
  • Fixture: cli/t27b/tests/reduced/exprbinary_value_ignored_statement.t27. The reducer re-judged the file with its header before writing it.
// t27b-reduce family: ExprBinary(value ignored) statement
// origin: specs/isa/ternary_encoding.t27 (360 lines) at cb94c7cc4; reduced by tri t27b reduce (#6445)
// reference (t27c test-report): pass, 1 test(s); t27b: blocked
// regenerate: tri t27b reduce specs/isa/ternary_encoding.t27 --family "ExprBinary(value ignored) statement"
pub const IMM_FORM_COUNT : u32 = 23;
pub const SRC2_FORM_COUNT : u32 = 7;
invariant the_forms_partition_the_opcodes { IMM_FORM_COUNT + SRC2_FORM_COUNT == 30 }
test every_opcode_byte_of_the_table_is_defined {
}

A second run reduced specs/compiler/zig_value_ignored.t27 from 23 to 10 lines with the same family.

2. tri t27b next links the repro for rank 1.

     1     9     10    11     4  ExprBinary(value ignored) statement
        repro: cli/t27b/tests/reduced/exprbinary_value_ignored_statement.t27

3. Negative control: the reference guard. The input is a copy of zig_value_ignored with one function returning an undeclared name. t27b still blocks on the same family, but the reference does not pass.

tri t27b reduce: /private/tmp/t27b-negctl/zvi_ref_fails.t27 is not interesting: REFERENCE-NOT-PASS
  reference blocked, t27b blocked, first blocker ExprBinary(value ignored) statement
  the reference does not pass it: a reference bug to file, not a t27b lane (Q38)
rc 1

specs/igla/race/cordic.t27 is refused the same way. Inside the spec, the test guard_first and a mutation check show that removing the guard is caught.

4. Gates.

  • scripts/ci/test_a_t27b_tick_reads_before_it_acts.py: PASS
  • scripts/ci/test_the_t27b_steward_decides_in_t27.py: PASS (the next_lanes body is unchanged)
  • scripts/ci/loop-tools-tracked.sh: PASS
  • tools/check_now_entry_shape.py: OK
  • gitleaks: no leaks

The ledger docs/reports/t27b_expectations.json is untouched, so no ledger move is needed. No cargo build ran on the Mac.

Not done

  • --only-hash bisect: it needs changes to the Rust JIT, so it is left for a follow-up.

🤖 Generated with Claude Code

…uard (Closes #6445)

`tri t27b reduce SPEC [--family X | --disagree]` runs delta debugging over
declarations, then statements, then expressions. Every candidate is
parsed by t27c first. Every decision is specs/tri/t27b/reduce.t27
(gen-c); the Python is I/O plumbing, an owner-approved-foreign exception
(debt #6198).

- reference guard first: REFERENCE-NOT-PASS / REFERENCE-RAN-NO-TEST are
  never kept; a spec that fails it is refused (Q38: a reference bug).
- specs/isa/ternary_encoding.t27 360 -> 9 lines, family
  "ExprBinary(value ignored) statement", fixture
  cli/t27b/tests/reduced/exprbinary_value_ignored_statement.t27.
- tri t27b next links each lane's repro (`repro:` / json `repro`).
- --only-hash bisect not done (needs Rust JIT changes).

Refs #6488 #6063

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag gHashTag added the owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR label Oct 6, 2026
@gHashTag
gHashTag enabled auto-merge (squash) October 6, 2026 13:06
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-06 13:07:16 UTC

Summary

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

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=3c78f3c7ffb7 != 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).

@gHashTag
gHashTag merged commit c4dfa27 into master Oct 6, 2026
29 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27b: automatic reducer for blocked and disagreeing specs (tri t27b reduce)

1 participant