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
4 changes: 2 additions & 2 deletions .trinity/seals/claw_ClawCheckLatest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
{
"spec": "specs/claw/queue_cost.t27",
"spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e"
"spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106"
},
{
"spec": "specs/claw/text.t27",
Expand All @@ -22,7 +22,7 @@
"module": "ClawCheckLatest",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T00:52:44Z",
"sealed_at": "2026-10-19T01:46:13Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:2de14a373379d1a5acc19fffeb4123c951dc6f36caffb883fb5a8a406be65d58",
"spec_path": "specs/claw/check_latest.t27",
Expand Down
4 changes: 2 additions & 2 deletions .trinity/seals/claw_ClawCheckState.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"closure": [
{
"spec": "specs/claw/queue_cost.t27",
"spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e"
"spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106"
},
{
"spec": "specs/claw/text.t27",
Expand All @@ -18,7 +18,7 @@
"module": "ClawCheckState",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T00:52:41Z",
"sealed_at": "2026-10-19T01:46:14Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:bd3aa36047755e7b95144ca4bbdb760aa971ceeb94b7e0728dd4db49b842ead6",
"spec_path": "specs/claw/check_state.t27",
Expand Down
4 changes: 2 additions & 2 deletions .trinity/seals/claw_ClawMergeLane.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
{
"spec": "specs/claw/queue_cost.t27",
"spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e"
"spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106"
},
{
"spec": "specs/claw/text.t27",
Expand All @@ -22,7 +22,7 @@
"module": "ClawMergeLane",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T00:52:43Z",
"sealed_at": "2026-10-19T01:46:14Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:3ebb5dbd29a60d877506ea11512d091d043a223e441d1668d4be9cfbf027602c",
"spec_path": "specs/claw/merge_lane.t27",
Expand Down
16 changes: 8 additions & 8 deletions .trinity/seals/claw_ClawQueueCost.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:b2e8310b04602772ae4c26f782651814781f800ad546dda08aad328eae380a7d",
"gen_hash_rust": "sha256:2139d76ca0e026b76e2d306c1fb4ace20241826dc9faa24b78c85672732afdf3",
"gen_hash_verilog": "sha256:d444d186653d294157ee175cafc704c5dbae2039d327fe5861bb372f67ec2cbd",
"gen_hash_zig": "sha256:23901c784d363d5d67ac4c8d2ed4e8e864fc7dd984a4aa49633222e5b66a4eb4",
"gen_hash_c": "sha256:5518a451c87946600d44194170093905e6bbcdb068d7a7ca957d5a9a5df217bf",
"gen_hash_rust": "sha256:51e28ad80b5d4afa5439232d210d72e80847bb44430420bc92e577c370fb6395",
"gen_hash_verilog": "sha256:aee185a40054556ddea7f7941154a7ad32d9f3c6fe5d6635b6cf7b0fa071a115",
"gen_hash_zig": "sha256:ab90f1efa8bea0484a59a885d06671bf89cdf4e377b87a8c456f4b9f152d5403",
"module": "ClawQueueCost",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T00:13:56Z",
"sealed_at": "2026-10-19T01:46:13Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e",
"spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106",
"spec_path": "specs/claw/queue_cost.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 13,
"total": 13,
"passed": 23,
"total": 23,
"vacuous": 0
},
"toolchain": {
Expand Down
18 changes: 9 additions & 9 deletions .trinity/seals/claw_ClawRequiredRed.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@
},
{
"spec": "specs/claw/queue_cost.t27",
"spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e"
"spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106"
},
{
"spec": "specs/claw/text.t27",
"spec_hash": "sha256:968755ec1917f766eb2cdd0ab4c0c48aef028a0e7d69e191911695e925b286ad"
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:c717b993844f5ea9e505638b7dfae7c8e471b554d6b2a210ab05576aa54ed8f3",
"gen_hash_rust": "sha256:70d7923ef8e74fc126f6316f1fe4937e39c40dbe2fbd9e9e2561c71cda0c194a",
"gen_hash_verilog": "sha256:9fbeec197b7b09796269f91e84dd050683379b0e82cc9215afb1bdf4b128134c",
"gen_hash_zig": "sha256:fa1b7c3383c64c7c111598dc9dca071f2208c152fd51a55c64733d422d2b83c3",
"gen_hash_c": "sha256:f08559d0d75f0cb4b6c76c9dcc6c60751228158ac07fc9fd7dd211c6ab57d01f",
"gen_hash_rust": "sha256:36b9e6e53cffb74f56be7db41a3997fb8ccb5f8d66b5212284ac3465e2e94409",
"gen_hash_verilog": "sha256:82a838c971f8e40658108e73e64e534618ec7198255ff4382178c5105bbc17bf",
"gen_hash_zig": "sha256:56a4d64802576e2532df7cb016086e500697a863d90a4884f314f1bd22dd57ef",
"module": "ClawRequiredRed",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T00:52:44Z",
"sealed_at": "2026-10-19T01:47:29Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:ad8660400d420444a1a3c8858866b4cf7447f60027e27e1bb333a9463e1decea",
"spec_hash": "sha256:585ddbdea9f98d3b4a45700e47cf6706528339874d1adfce796828b6804b5866",
"spec_path": "specs/claw/required_red.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 9,
"total": 9,
"passed": 11,
"total": 11,
"vacuous": 0
},
"toolchain": {
Expand Down
18 changes: 9 additions & 9 deletions .trinity/seals/claw_ClawShapeRace.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
"closure": [
{
"spec": "specs/claw/queue_cost.t27",
"spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e"
"spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106"
},
{
"spec": "specs/claw/text.t27",
"spec_hash": "sha256:968755ec1917f766eb2cdd0ab4c0c48aef028a0e7d69e191911695e925b286ad"
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:3624f66398f6a65a3ff3e9b6c09c19bac643bb3cff3cd04142e9732ab608935a",
"gen_hash_rust": "sha256:198fd96b5a9645304cb54ee2afef389dc4d24efc6599e18d93bc474306fe74e6",
"gen_hash_verilog": "sha256:4aa8ecfad528d16f9d3dac176d76f8c8d5be9121ce84beb33e29e8140422ba06",
"gen_hash_zig": "sha256:a81683ac1fc254972ee0e9c787a3f1c08a4948791ec8d08dec8fde4020c67ee1",
"gen_hash_c": "sha256:976643ecc232da66baaf7c2250f4fcca8da5fe6bc3727d432e4c6625ff4bcae1",
"gen_hash_rust": "sha256:d999644b88cdf157cead4084cc11c06e80041c4fefeb0e7283f8b6030bff36f4",
"gen_hash_verilog": "sha256:95078930e8a7aa7409e18001a2f90a2574309cf773090940f09d4c0386e071c2",
"gen_hash_zig": "sha256:d82360d4cd406e5cfcb5ee7c999fe4c1d9da338bf692bd8f1f2bd88e8450014a",
"module": "ClawShapeRace",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T00:13:59Z",
"sealed_at": "2026-10-19T01:56:02Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:c8a0cdfe7dc74400419616f8b6b22e3b3291fba6dd8d8def1b5c9952fce978ec",
"spec_hash": "sha256:8fa56fbbb52fde151ed84c59bfc8d279c8a3b48dc82713b6405824a738bf56c5",
"spec_path": "specs/claw/shape_race.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 16,
"total": 16,
"passed": 19,
"total": 19,
"vacuous": 0
},
"toolchain": {
Expand Down
113 changes: 113 additions & 0 deletions specs/claw/queue_cost.t27
Original file line number Diff line number Diff line change
Expand Up @@ -546,3 +546,116 @@ fn t_has_line(out : []const u8, n : usize, b : u8) -> bool {
}
return false;
}

// The tests below were written against a mutation sweep of this file: each one fails under at
// least one mutant of the code above that the earlier tests let through.

test t_has_line_finds_a_line_start_and_only_a_line_start {
assert t_has_line("H", 1, 'H') == true;
assert t_has_line("M\nH", 3, 'H') == true;
assert t_has_line("MH\n", 3, 'H') == false;
assert t_has_line("M\nH", 2, 'H') == false;
}

test splitting_into_zero_fields_fails_closed {
var f : [4]usize = undefined;
assert qc_split("", 0, 0, &f, 0) == false;
assert qc_split("a", 0, 1, &f, 0) == false;
}

test a_sha_is_forty_lowercase_hex_digits_at_the_range_bounds {
assert qc_sha_ok("0123456789abcdef0123456789abcdef01234567", 0, 40) == true;
assert qc_sha_ok("9999999999ffffffffff00000000000aaaaaaaaa", 0, 40) == true;
assert qc_sha_ok("/123456789abcdef0123456789abcdef01234567", 0, 40) == false;
assert qc_sha_ok(":123456789abcdef0123456789abcdef01234567", 0, 40) == false;
assert qc_sha_ok("`123456789abcdef0123456789abcdef01234567", 0, 40) == false;
assert qc_sha_ok("g123456789abcdef0123456789abcdef01234567", 0, 40) == false;
assert qc_sha_ok("A123456789abcdef0123456789abcdef01234567", 0, 40) == false;
}

test negative_control_one_bad_sha_of_two_makes_the_run_unreadable {
var r : [256]u8 = undefined;
var n : usize = put_str(&r, 256, 0, "pull_request\tOPEN\tfalse\t", 24);
n = t_sha(&r, 256, n, 'a');
n = put_str(&r, 256, n, "\tabc\npull_request\tOPEN\tfalse\tabc\t", 33);
n = t_sha(&r, 256, n, 'a');
n = qc_put_byte(&r, 256, n, '\n');
var out : [512]u8 = undefined;
const d : usize = class_plan(&r, n, &out, 512);
assert buf_has(&out, d, " 0 superseded head, ", 20) == true;
assert buf_has(&out, d, " 2 unreadable\n", 14) == true;
}

test a_blank_line_is_not_a_row_in_either_answer {
var out : [512]u8 = undefined;
var d : usize = cost_plan("a\t60\n\nb\t60\n", 11, &out, 512);
assert buf_has(&out, d, " in 2 jobs, 0 unreadable\n", 25) == true;
d = class_plan("push\t-\t-\t-\t-\n\npush\t-\t-\t-\t-\n", 27, &out, 512);
assert buf_has(&out, d, " 2 other event, 0 unreadable\n", 29) == true;
}

test exactly_half_the_time_is_named_as_the_lever {
var out : [512]u8 = undefined;
const d : usize = cost_plan("a\t60\nb\t60\n", 10, &out, 512);
assert buf_has(&out, d, "H\ta\t50\n", 7) == true;
assert buf_has(&out, d, "one workflow holds 50% of job time", 34) == true;
}

test a_last_row_without_a_newline_is_still_read {
var out : [512]u8 = undefined;
const d : usize = cost_plan("w\t120", 5, &out, 512);
assert buf_has(&out, d, " in 1 jobs, 0 unreadable\n", 25) == true;
assert buf_has(&out, d, "H\tw\t100\n", 8) == true;
}

test an_answer_that_ends_exactly_at_cap_is_not_written_past_it {
var out : [56]u8 = undefined;
const d : usize = cost_plan("w\t120\n", 6, &out, 56);
assert d > 56;
assert out[0] == 'M';
assert out[55] == '\n';
}

test the_row_cap_is_exact_in_both_answers {
var r : [53300]u8 = undefined;
var out : [512]u8 = undefined;
var n : usize = 0;
var i : u32 = 0;
while (i < 4096) {
n = put_str(&r, 53300, n, "a\t1\n", 4);
i += 1;
}
var d : usize = cost_plan(&r, n, &out, 512);
assert buf_has(&out, d, " in 4096 jobs, 0 unreadable\n", 28) == true;
n = put_str(&r, 53300, n, "a\t1\n", 4);
d = cost_plan(&r, n, &out, 512);
assert buf_has(&out, d, " in 4096 jobs, 1 unreadable\n", 28) == true;
n = t_runs(&r, 53300, 0, C_OTHER, 4097);
assert n == 53261;
d = class_plan(&r, n, &out, 512);
assert buf_has(&out, d, " 4096 other event, 1 unreadable\n", 32) == true;
}

test negative_control_the_workflow_table_holds_sixty_four_names {
var r : [1024]u8 = undefined;
var out : [512]u8 = undefined;
var n : usize = 0;
var i : u32 = 0;
while (i < 65) {
n = put_count(&r, 1024, n, i);
n = put_str(&r, 1024, n, "\t1\n", 3);
i += 1;
}
n = put_str(&r, 1024, n, "0\t1\n", 4);
var d : usize = cost_plan(&r, n, &out, 512);
assert buf_has(&out, d, " in 65 jobs, 1 unreadable\n", 26) == true;
n = 0;
i = 0;
while (i < 64) {
n = put_str(&r, 1024, n, "a\t1\n", 4);
i += 1;
}
n = put_str(&r, 1024, n, "b\t1\n", 4);
d = cost_plan(&r, n, &out, 512);
assert buf_has(&out, d, " in 65 jobs, 0 unreadable\n", 26) == true;
}
32 changes: 32 additions & 0 deletions specs/claw/required_red.t27
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,35 @@ test a_clipped_plan_still_advances_the_cursor {
var out : [128]u8 = undefined;
assert required_plan(&raw, n, &out, 40) == 87;
}

// The tests below were written against a mutation sweep of this file: each one fails under a
// mutant of required_counts that the earlier tests let through.

test a_blank_line_is_not_a_row {
var raw : [128]u8 = undefined;
var x : usize = put_str(&raw, 128, 0, "CI/validate\t11\tCOMPLETED\tSUCCESS\n\n", 34);
x = put_str(&raw, 128, x, "Own/own-language\t13\tCOMPLETED\tSUCCESS\n", 38);
var st : [5]u32 = undefined;
assert required_counts(&raw, x, &st) == 2;
assert st[K_PASS] == 2;
assert st[K_BAD] == 0;
assert required_flag(&raw, x) == RR_FALSE;
}

test negative_control_the_row_past_the_cap_is_unreadable_and_the_last_one_in_it_is_read {
var raw : [40000]u8 = undefined;
var st : [5]u32 = undefined;
var x : usize = t_rows(&raw, 40000, 0, "Claw/claw-sarif\t14\tCOMPLETED\tSUCCESS\n", 37, 1023);
x = put_str(&raw, 40000, x, "CI/validate\t11\tCOMPLETED\tSUCCESS\n", 33);
assert required_counts(&raw, x, &st) == 1024;
assert st[K_PASS] == 1;
assert st[K_BAD] == 0;
x = t_rows(&raw, 40000, 0, "Claw/claw-sarif\t14\tCOMPLETED\tSUCCESS\n", 37, 1024);
x = put_str(&raw, 40000, x, "CI/validate\t11\tCOMPLETED\tSUCCESS\n", 33);
assert x == 37921;
assert required_counts(&raw, x, &st) == 1025;
assert st[K_PASS] == 0;
assert st[K_BAD] == 1;
assert st[RR_MISSING] == 4;
assert required_flag(&raw, x) == RR_UNKNOWN;
}
23 changes: 23 additions & 0 deletions specs/claw/shape_race.t27
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,26 @@ test the_plan_prints_each_reading_its_own_end {
assert buf_has(&out, w, "ends stuck; live leaves it wrong after 0 runs, ends right\n", 58) == true;
assert n == 45;
}

// The tests below were written against a mutation sweep of this file: each one fails under at
// least one mutant of the code above that the earlier tests let through.

test a_blank_line_is_not_an_event {
assert sr_verdict("5\t9\t1\n\n6\t9\t1\n", 13) == SR_CLEAN;
var out : [200]u8 = undefined;
const w : usize = race_plan("5\t9\t1\n\n6\t9\t1\n", 13, &out, 200);
assert buf_has(&out, w, "R\tshape-race: 2 events, 0 cancelled, 0 unreadable;", 50) == true;
}

test second_zero_is_a_real_second {
assert sr_verdict("0\t9\t1\n", 6) == SR_CLEAN;
assert t_replay("0\t0\t0\n", 6, false) == 0;
assert t_replay("0\t0\t0\n", 6, true) == 0;
}

test negative_control_jobs_in_the_same_second_replay_in_input_order {
// Row 0 closes at 5. Both later jobs run at 50: the failing edit closes again, then the passing
// edit, whose old label is row 0's close, reopens. In the other order the issue ends stuck.
assert t_replay("1\t5\t0\n10\t50\t0\n20\t50\t1\n", 22, false) == 10;
assert t_replay("1\t5\t0\n20\t50\t1\n10\t50\t0\n", 22, false) == 11;
}
Loading