Problem
specs/base/ops.t27 has never compiled. Its three seals record blocked: spec.zig:31:46: error: expected type 'usize', found 'i8'. It imports nothing, and 13 specs import it, so t27c frontier rebuilds all 13 on closure (epic #8095). The re-mint in #8232 skipped it, because only green specs were resealed.
There are two compile defects, both fixable in the spec alone:
- Lines 55, 62 and 70.
const idx = (@intFromEnum(a) + 1) * 3 + (@intFromEnum(b) + 1); is an i8, because Trit is enum(i8), and it indexes a table. Fix: const idx: usize = @as(usize, @intCast((@intFromEnum(a) + 1) * 3 + (@intFromEnum(b) + 1)));
- Ten test sites (lines 361, 401, 448, 486, 499, 584, 619, 644, 662 and 709).
const trits = [_]Trit{ .neg, .zero, .pos }; lowers to an anonymous tuple, and for (trits) then fails with "tuple field index must be comptime-known". Fix: const trits: [3]Trit = [3]Trit{ .neg, .zero, .pos };
With both fixes applied, measured 2026-10-09 with t27c 0.5.2 on master e3b8c51, the spec compiles and 7 of 87 tests fail. These are real failures that the compile error had hidden:
- test_trit_add_with_carry_positive_overflow
- test_trit_add_with_carry_negative_overflow
- test_trit_add_with_carry_propagation
- test_trit_min_max_antisymmetric
- test_trit_multiply_with_carry_basic
- test_trit_multiply_with_carry_with_carry
- test_trit_cond_swap_condition_true
For each one, decide whether the function or the test is wrong, using balanced-ternary arithmetic as the oracle: a + b = sum + 3 * carry, with every digit in {-1, 0, 1}. Fix the side that is wrong. Do not weaken a test to make it pass.
Acceptance criteria
t27c test-report specs/base/ops.t27 prints FAIL 0 and vacuous passes 0 of 87 or more
- each of the 7 tests above still asserts the balanced-ternary identity it names, checked against hand-computed vectors written in the test
t27c seal specs/base/ops.t27 --save succeeds without --force, and its seals carry "seal_schema": 2
Boundary
specs/base/ops.t27
User Scenarios
- Given the spec
specs/base/ops.t27 fails to compile due to an i8 index used where usize is expected and tuple literals used where arrays are required, When the two compile defects are fixed in the spec source, Then t27c test-report specs/base/ops.t27 compiles the spec and runs all 87 tests.
- Given the spec compiles after the two fixes, When the 7 failing tests are corrected by fixing the side (function or test) that violates balanced-ternary arithmetic, Then
t27c test-report specs/base/ops.t27 prints FAIL 0 and each of the 7 tests still asserts the balanced-ternary identity it names against hand-computed vectors.
Requirements
FR-001: The spec specs/base/ops.t27 MUST compile without errors after applying the two source fixes: casting the table index to usize at lines 55, 62, 70 and changing the ten tuple literals to typed array literals [3]Trit{…}.
FR-002: Each of the 7 currently failing tests MUST be fixed by correcting either the function implementation or the test expectation so that the balanced-ternary identity a + b = sum + 3 * carry (with digits in {-1,0,1}) holds for the hand-computed vectors written in the test.
FR-003: No test MUST be weakened or removed to achieve a pass; the test must continue to assert the arithmetic identity it is named for.
FR-004: t27c seal specs/base/ops.t27 --save MUST succeed without --force and the written seals MUST carry "seal_schema": 2.
Problem
specs/base/ops.t27has never compiled. Its three seals recordblocked: spec.zig:31:46: error: expected type 'usize', found 'i8'. It imports nothing, and 13 specs import it, sot27c frontierrebuilds all 13 on closure (epic #8095). The re-mint in #8232 skipped it, because only green specs were resealed.There are two compile defects, both fixable in the spec alone:
const idx = (@intFromEnum(a) + 1) * 3 + (@intFromEnum(b) + 1);is ani8, because Trit isenum(i8), and it indexes a table. Fix:const idx: usize = @as(usize, @intCast((@intFromEnum(a) + 1) * 3 + (@intFromEnum(b) + 1)));const trits = [_]Trit{ .neg, .zero, .pos };lowers to an anonymous tuple, andfor (trits)then fails with "tuple field index must be comptime-known". Fix:const trits: [3]Trit = [3]Trit{ .neg, .zero, .pos };With both fixes applied, measured 2026-10-09 with t27c 0.5.2 on master e3b8c51, the spec compiles and 7 of 87 tests fail. These are real failures that the compile error had hidden:
For each one, decide whether the function or the test is wrong, using balanced-ternary arithmetic as the oracle: a + b = sum + 3 * carry, with every digit in {-1, 0, 1}. Fix the side that is wrong. Do not weaken a test to make it pass.
Acceptance criteria
t27c test-report specs/base/ops.t27printsFAIL 0andvacuous passes 0 of 87or moret27c seal specs/base/ops.t27 --savesucceeds without --force, and its seals carry"seal_schema": 2Boundary
specs/base/ops.t27
User Scenarios
specs/base/ops.t27fails to compile due to ani8index used whereusizeis expected and tuple literals used where arrays are required, When the two compile defects are fixed in the spec source, Thent27c test-report specs/base/ops.t27compiles the spec and runs all 87 tests.t27c test-report specs/base/ops.t27printsFAIL 0and each of the 7 tests still asserts the balanced-ternary identity it names against hand-computed vectors.Requirements
FR-001: The spec
specs/base/ops.t27MUST compile without errors after applying the two source fixes: casting the table index tousizeat lines 55, 62, 70 and changing the ten tuple literals to typed array literals[3]Trit{…}.FR-002: Each of the 7 currently failing tests MUST be fixed by correcting either the function implementation or the test expectation so that the balanced-ternary identity a + b = sum + 3 * carry (with digits in {-1,0,1}) holds for the hand-computed vectors written in the test.
FR-003: No test MUST be weakened or removed to achieve a pass; the test must continue to assert the arithmetic identity it is named for.
FR-004:
t27c seal specs/base/ops.t27 --saveMUST succeed without--forceand the written seals MUST carry"seal_schema": 2.