Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .trinity/seals/t27os_labs.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"built_by": "t27c-bootstrap@0.5.2+4bde0df9a",
"built_by": "t27c-bootstrap@0.5.2+d8ec9a40c",
"closure": [],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:07444b414dbf4bf63325402d754ddc0b7aa8162522ae9c6681efb578e2eb98f9",
"gen_hash_rust": "sha256:680ac182c6868e75a2b9c2d72a90aa7352883fe9f2ea725966460fa03df3f288",
"gen_hash_verilog": "sha256:72d35d35c3f6ae9172916ef551f47da56a8c81d177ccdbd580043f8a83f9fa43",
"gen_hash_zig": "sha256:ec98d5f33a81ef74a815b84a53530987e876147ab478206a980f43b5cf735729",
"gen_hash_c": "sha256:c31db997edeac98c0afd1807d7ed8dea26efeeb3e31afa80f3ec36ef72a08b31",
"gen_hash_rust": "sha256:55074157851c8994e2998e7efe497ef7ad6c750dd5b6906de5688cacaa95da4e",
"gen_hash_verilog": "sha256:9eb6ced3ce6acf4126c8758e16c169b6158aa1618f5eea139eeed41f02a70d4b",
"gen_hash_zig": "sha256:b31dc25ef7b9947df4433c57827f12aa2b474e4f31ccb947ea2956d266bce380",
"module": "labs",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-24T19:33:00Z",
"sealed_at": "2026-10-24T21:12:11Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:d90c3fdc52572a2aaa1820e82e5379f39f61906a74d7c75f1092c6266bbf1e8a",
"spec_hash": "sha256:06e5cf825aa67afa47cfa1f953e5c8bd2bc36b8a93fe35f5f096ddedf65fe066",
"spec_path": "specs/t27os/labs.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 9,
"total": 9,
"passed": 12,
"total": 12,
"vacuous": 0
},
"toolchain": {
Expand Down
86 changes: 86 additions & 0 deletions specs/t27os/labs.t27
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,59 @@ pub fn all_gates_pass(results: [9]bool) -> bool {
return true;
}

// --- the executor's surface steps (t27os#10: receipts lost) ----------------

// The executor (t27os .github/workflows/lab.yml, proposed by TRI CLAW from
// this law) measures the named specs, then runs optional surfaces, then
// writes the receipt. Three measured ways a run lost its receipt: the
// encoder fetch ran on every dispatch and died on a third-party CDN (~40%);
// a surface failure skipped the receipt step after the measurement had
// already run (run 39987596010); a full sha went through an unauthenticated
// API lookup that answered null (run 39993710023).
pub const SURF_ENCODER_FETCH : u8 = 0;
pub const SURF_M6 : u8 = 1;
pub const SURF_WASM : u8 = 2;
pub const SURF_COUNT : u8 = 3;
pub const SHA_HEX_LEN : u32 = 40;

// surface_runs(s, m6, wasm): the encoder fetch belongs to M6 -- a dispatch
// with m6 off never touches the encoder CDN. Out-of-range surfaces never run.
pub fn surface_runs(s: u8, m6: bool, wasm: bool) -> bool {
if (s == SURF_ENCODER_FETCH or s == SURF_M6) {
return m6;
}
if (s == SURF_WASM) {
return wasm;
}
return false;
}

// receipt_written(measured, surface_failed): once the measurement step ran,
// the receipt is written whatever a later surface did -- the failure goes
// INTO the receipt, it does not erase it. No measurement, no receipt.
pub fn receipt_written(measured: bool, surface_failed: bool) -> bool {
if (surface_failed and measured) {
return true;
}
return measured;
}

// sha_needs_lookup(len, lower_hex): a ref that is already 40 lowercase hex is
// the sha; only a short sha, a branch or an empty ref goes to the API.
pub fn sha_needs_lookup(len: u32, lower_hex: bool) -> bool {
if (len == SHA_HEX_LEN and lower_hex) {
return false;
}
return true;
}

// sha_resolved_ok(len, lower_hex): the lookup's answer is accepted only when
// it is 40 hex; anything else (null, a rate-limit body) fails the step with
// the body printed, never checks out a branch named "null".
pub fn sha_resolved_ok(len: u32, lower_hex: bool) -> bool {
return len == SHA_HEX_LEN and lower_hex;
}

// --- tests ---------------------------------------------------------------

test step_names_are_nine {
Expand Down Expand Up @@ -247,3 +300,36 @@ test receipt_verdict_red_on_omitted_blocked_failed_vacuous {
// every asked spec reported, none blocked, failed or vacuous
assert receipt_verdict(4, 4, 0, 0, 0) == RUN_OK;
}

// t27os#10: an m6=false dispatch never runs the encoder fetch (the CDN that
// killed ~40% of runs); with m6 on it does; wasm follows its own flag.
test encoder_fetch_runs_only_with_m6 {
assert surface_runs(SURF_ENCODER_FETCH, false, false) == false;
assert surface_runs(SURF_ENCODER_FETCH, false, true) == false;
assert surface_runs(SURF_ENCODER_FETCH, true, false) == true;
assert surface_runs(SURF_M6, false, true) == false;
assert surface_runs(SURF_WASM, false, true) == true;
assert surface_runs(SURF_WASM, true, false) == false;
assert surface_runs(SURF_COUNT, true, true) == false;
}

// run 39987596010: step 7 measured kernel 10/10 and lanes_view 42/42, M6
// failed, and no receipt was written. The law: that run writes its receipt.
test a_surface_failure_keeps_the_receipt {
assert receipt_written(true, true) == true;
assert receipt_written(true, false) == true;
assert receipt_written(false, true) == false;
assert receipt_written(false, false) == false;
}

// run 39993710023: a full 40-hex sha went to the API and came back null.
test a_full_sha_is_used_as_is {
assert sha_needs_lookup(40, true) == false;
assert sha_needs_lookup(9, true) == true;
assert sha_needs_lookup(40, false) == true;
assert sha_needs_lookup(0, false) == true;
// "null" is 4 bytes, not 40 hex: the step fails instead of checking it out
assert sha_resolved_ok(4, false) == false;
assert sha_resolved_ok(40, true) == true;
assert sha_resolved_ok(40, false) == false;
}
Loading