From 0fd4f8c581693905dc6d0721b86f2c395a9a2777 Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Mon, 19 Oct 2026 08:28:02 +0700 Subject: [PATCH 1/3] test(claw): kill the real required_red.t27 mutation survivors (#10763) The mutation sweep of required_red.t27 caught 24 of 28 mutants. Two of the four survivors were real: a blank line counted as an unreadable row, and the row past the 1024-row cap read instead of counted unreadable. Two tests now pin both boundaries; the other two survivors are equivalent. Co-Authored-By: Claude Opus 5.5 --- .trinity/seals/claw_ClawRequiredRed.json | 16 ++++++------ specs/claw/required_red.t27 | 32 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.trinity/seals/claw_ClawRequiredRed.json b/.trinity/seals/claw_ClawRequiredRed.json index 7c7be57c53..8d19244958 100644 --- a/.trinity/seals/claw_ClawRequiredRed.json +++ b/.trinity/seals/claw_ClawRequiredRed.json @@ -19,23 +19,23 @@ } ], "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:27:18Z", "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": { diff --git a/specs/claw/required_red.t27 b/specs/claw/required_red.t27 index e41f8aee88..f51e7502ac 100644 --- a/specs/claw/required_red.t27 +++ b/specs/claw/required_red.t27 @@ -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; +} From ef0ad8df71feed2bafed6d1fb1f253fa431612b4 Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Mon, 19 Oct 2026 08:46:59 +0700 Subject: [PATCH 2/3] test(claw): queue_cost mutation sweep -- 10 tests kill 26 of 28 survivors, 121 of 123 caught (Closes #10768) The tests cover qc_sha_ok at its range bounds, one bad sha of two, a blank line and the 4096-row cap in both answers, the 64-workflow table, the hot share at exactly 50%, an out buffer of exact size, a last row with no newline, qc_split into zero fields, and the t_has_line helper. The production code is unchanged. The 2 survivors left (lines 215 and 308) are equivalent. Six seals that record queue_cost.t27 are resealed. Co-Authored-By: Claude Opus 5.5 --- .trinity/seals/claw_ClawCheckLatest.json | 4 +- .trinity/seals/claw_ClawCheckState.json | 4 +- .trinity/seals/claw_ClawMergeLane.json | 4 +- .trinity/seals/claw_ClawQueueCost.json | 16 ++-- .trinity/seals/claw_ClawRequiredRed.json | 4 +- .trinity/seals/claw_ClawShapeRace.json | 4 +- specs/claw/queue_cost.t27 | 113 +++++++++++++++++++++++ 7 files changed, 131 insertions(+), 18 deletions(-) diff --git a/.trinity/seals/claw_ClawCheckLatest.json b/.trinity/seals/claw_ClawCheckLatest.json index c271c4ad63..57233ca013 100644 --- a/.trinity/seals/claw_ClawCheckLatest.json +++ b/.trinity/seals/claw_ClawCheckLatest.json @@ -7,7 +7,7 @@ }, { "spec": "specs/claw/queue_cost.t27", - "spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e" + "spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106" }, { "spec": "specs/claw/text.t27", @@ -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", diff --git a/.trinity/seals/claw_ClawCheckState.json b/.trinity/seals/claw_ClawCheckState.json index 4e4d6d73f5..e74daa97d6 100644 --- a/.trinity/seals/claw_ClawCheckState.json +++ b/.trinity/seals/claw_ClawCheckState.json @@ -3,7 +3,7 @@ "closure": [ { "spec": "specs/claw/queue_cost.t27", - "spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e" + "spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106" }, { "spec": "specs/claw/text.t27", @@ -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", diff --git a/.trinity/seals/claw_ClawMergeLane.json b/.trinity/seals/claw_ClawMergeLane.json index 6f9f00dc27..d8419e2bd3 100644 --- a/.trinity/seals/claw_ClawMergeLane.json +++ b/.trinity/seals/claw_ClawMergeLane.json @@ -7,7 +7,7 @@ }, { "spec": "specs/claw/queue_cost.t27", - "spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e" + "spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106" }, { "spec": "specs/claw/text.t27", @@ -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", diff --git a/.trinity/seals/claw_ClawQueueCost.json b/.trinity/seals/claw_ClawQueueCost.json index ee2fc4f904..6f1ea1b17f 100644 --- a/.trinity/seals/claw_ClawQueueCost.json +++ b/.trinity/seals/claw_ClawQueueCost.json @@ -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": { diff --git a/.trinity/seals/claw_ClawRequiredRed.json b/.trinity/seals/claw_ClawRequiredRed.json index 8d19244958..12769a8ab4 100644 --- a/.trinity/seals/claw_ClawRequiredRed.json +++ b/.trinity/seals/claw_ClawRequiredRed.json @@ -11,7 +11,7 @@ }, { "spec": "specs/claw/queue_cost.t27", - "spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e" + "spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106" }, { "spec": "specs/claw/text.t27", @@ -26,7 +26,7 @@ "module": "ClawRequiredRed", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T01:27:18Z", + "sealed_at": "2026-10-19T01:47:29Z", "sealed_by": "t27c-bootstrap@0.5.2", "spec_hash": "sha256:585ddbdea9f98d3b4a45700e47cf6706528339874d1adfce796828b6804b5866", "spec_path": "specs/claw/required_red.t27", diff --git a/.trinity/seals/claw_ClawShapeRace.json b/.trinity/seals/claw_ClawShapeRace.json index c84f84a693..2ce5cedc74 100644 --- a/.trinity/seals/claw_ClawShapeRace.json +++ b/.trinity/seals/claw_ClawShapeRace.json @@ -3,7 +3,7 @@ "closure": [ { "spec": "specs/claw/queue_cost.t27", - "spec_hash": "sha256:16789d92d878e85e3d02e56a9be4bffe0b565b5c14c270f79ddaedc6d6911f7e" + "spec_hash": "sha256:9e5cd5e46f28ac23cf36a555a4f416bcabb8858d48fdd79afaa4743aa33e4106" }, { "spec": "specs/claw/text.t27", @@ -18,7 +18,7 @@ "module": "ClawShapeRace", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T00:13:59Z", + "sealed_at": "2026-10-19T01:46:16Z", "sealed_by": "t27c-bootstrap@0.5.2", "spec_hash": "sha256:c8a0cdfe7dc74400419616f8b6b22e3b3291fba6dd8d8def1b5c9952fce978ec", "spec_path": "specs/claw/shape_race.t27", diff --git a/specs/claw/queue_cost.t27 b/specs/claw/queue_cost.t27 index 6459b96a15..db0da676d6 100644 --- a/specs/claw/queue_cost.t27 +++ b/specs/claw/queue_cost.t27 @@ -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; +} From d1d4cea7ee6481bc4c6aa1ab5490c4f34e2ec26a Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Mon, 19 Oct 2026 08:56:36 +0700 Subject: [PATCH 3/3] test(claw): shape_race mutation sweep -- 3 tests kill 4 of 6 survivors, 54 of 56 caught (Closes #10769) The tests cover a blank line between events, an event created and run at second 0, and two jobs that run in the same second, which must replay in input order. The production code is unchanged. The 2 survivors left (lines 93 and 204) are equivalent. Co-Authored-By: Claude Opus 5.5 --- .trinity/seals/claw_ClawShapeRace.json | 16 ++++++++-------- specs/claw/shape_race.t27 | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.trinity/seals/claw_ClawShapeRace.json b/.trinity/seals/claw_ClawShapeRace.json index 2ce5cedc74..4effb78044 100644 --- a/.trinity/seals/claw_ClawShapeRace.json +++ b/.trinity/seals/claw_ClawShapeRace.json @@ -11,23 +11,23 @@ } ], "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-19T01:46:16Z", + "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": { diff --git a/specs/claw/shape_race.t27 b/specs/claw/shape_race.t27 index 1a2033f76f..a66a279190 100644 --- a/specs/claw/shape_race.t27 +++ b/specs/claw/shape_race.t27 @@ -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; +}