From 4dd1313b809a32b1bd4ca8ad9bfbac09878ec556 Mon Sep 17 00:00:00 2001 From: Dmitrii Vasilev Date: Mon, 19 Oct 2026 04:39:57 +0700 Subject: [PATCH] test(claw): kill mutation-sweep survivors in evidence, gates, preview, engine A cargo-mutants/PIT-style operator sweep over ten claw specs left 39 survivors on code lines of these four. New tests catch 20; the other 19 are equivalent (listed in the PR). seal_ok now has a test for an uppercase digit, a byte past f and another algorithm; gates pins the audit tail line and each coverage report line in full. Closes #10673 Co-Authored-By: Claude Opus 5.5 --- .trinity/seals/claw_ClawEngine.json | 12 ++++----- .trinity/seals/claw_ClawEvidence.json | 16 +++++------ .trinity/seals/claw_ClawGates.json | 20 +++++++------- .trinity/seals/claw_ClawPreview.json | 20 +++++++------- specs/claw/engine.t27 | 5 ++++ specs/claw/evidence.t27 | 38 +++++++++++++++++++++++++++ specs/claw/gates.t27 | 38 +++++++++++++++++++++++++++ specs/claw/preview.t27 | 12 +++++++++ 8 files changed, 127 insertions(+), 34 deletions(-) diff --git a/.trinity/seals/claw_ClawEngine.json b/.trinity/seals/claw_ClawEngine.json index 00a06b922c..69caa0615e 100644 --- a/.trinity/seals/claw_ClawEngine.json +++ b/.trinity/seals/claw_ClawEngine.json @@ -1,17 +1,17 @@ { - "built_by": "t27c-bootstrap@0.5.2+d2c8e7d41", + "built_by": "t27c-bootstrap@0.5.2+9448ab4be", "closure": [], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:ba9dae316b4a18a2655ac194606da107453b149e306a364f5313d77d77545bea", + "gen_hash_c": "sha256:4df4273e654139c0ad68ee6a58b94211df6fdba57c5ed9767b3eda18b3ca041e", "gen_hash_rust": "sha256:2f909e3c719e7a5f7e7cb99542e2d417f3088a2fc0cd1ec4d9a65b085c85b5d6", "gen_hash_verilog": "sha256:c005e851ad7496e69d285631e69708741e4dec56a84f8854bd98af644fede413", - "gen_hash_zig": "sha256:bf4bd4d781fce88f8b76ddfe7185f5ee5085f6fd8de4f0d9a52c59e8752c7395", + "gen_hash_zig": "sha256:4c90861c3e1e85cb0549fc62625681a17fe49279625df27ea93916eddae1ffca", "module": "ClawEngine", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-18T05:03:43Z", + "sealed_at": "2026-10-18T21:37:23Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:9bd90dcddf8a190f44d7751571f19816c6c875d4e73be90ebb4d0f48d6ecf258", + "spec_hash": "sha256:a6f7f2ac8d938f281a94422de7edaa9e1128788141dcab56630fc3e882d21ca7", "spec_path": "specs/claw/engine.t27", "tests": { "failed": 0, @@ -22,7 +22,7 @@ "vacuous": 0 }, "toolchain": { - "test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d", + "test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10", "zig": "0.16.0" } } \ No newline at end of file diff --git a/.trinity/seals/claw_ClawEvidence.json b/.trinity/seals/claw_ClawEvidence.json index 0305b2059b..0c134e8bc5 100644 --- a/.trinity/seals/claw_ClawEvidence.json +++ b/.trinity/seals/claw_ClawEvidence.json @@ -7,23 +7,23 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:bbfb20cf1fbbb543a8fe84d4ef9622fc0e87807da80333df3cbc676b7aa0eb19", - "gen_hash_rust": "sha256:8288152fa30d8dc5dfa969b69bee8bfec441abb3a45c7914d1c835d2e5699754", - "gen_hash_verilog": "sha256:4b00f9a86f368a483f6713203b4a708643b460f703c97a309cbc4fec238b922f", - "gen_hash_zig": "sha256:086ae5b1a55975b3a0d09f29d4ffbf6294f265fd304f4e45bc6aadc2a548754f", + "gen_hash_c": "sha256:eecc2c415347ad833237ed1497a113eafa86a93223218f168a9b81c9b1155055", + "gen_hash_rust": "sha256:d3f03f72c6e8ba0a3d5326ff0d3e9ccb128b7077ed73951477e053c992d019d5", + "gen_hash_verilog": "sha256:f379b6b00c567d33e038cbd0722376f4226fb0fa2ad029b6924e5a8d4e990d0b", + "gen_hash_zig": "sha256:cd4b19662aab872ff3533534ea5dc96e0fa8b0f70e1a8eb0977c6c5f83fe192a", "module": "ClawEvidence", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-18T18:53:51Z", + "sealed_at": "2026-10-18T21:37:20Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:4169daec6232a06a4ec3dceb3ebd4d49346ba02b784fb5c437bc1aab4fad344d", + "spec_hash": "sha256:d30d7ff986e9d7b46f4225cc083511c6529e9284ad40264909a9f274d793fbb2", "spec_path": "specs/claw/evidence.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 12, - "total": 12, + "passed": 16, + "total": 16, "vacuous": 0 }, "toolchain": { diff --git a/.trinity/seals/claw_ClawGates.json b/.trinity/seals/claw_ClawGates.json index 2aaeb208fc..13c30cb979 100644 --- a/.trinity/seals/claw_ClawGates.json +++ b/.trinity/seals/claw_ClawGates.json @@ -1,5 +1,5 @@ { - "built_by": "t27c-bootstrap@0.5.2+4ab200073", + "built_by": "t27c-bootstrap@0.5.2+9448ab4be", "closure": [ { "spec": "specs/claw/text.t27", @@ -7,27 +7,27 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:31f5535824c04d63b77b8df6e0a72e96fef46ff1609043a46abedd3df21684c5", - "gen_hash_rust": "sha256:811db936e27fb63042662fb804f32f6cd4bd9dfff0d816d3f597c0cdc1c178fa", - "gen_hash_verilog": "sha256:cd9116aae7e4cd6315743c6ebc05c08579284821cfbfd363c33986cf0fd96b7a", - "gen_hash_zig": "sha256:83f1b79f148d10b88c18858c57630b06540be83be4335fc8b8fb0b57bf2651f8", + "gen_hash_c": "sha256:ce0738bca2f5180ee4534277adba4c639bfbcd3f996d67aed18f8b11c046f683", + "gen_hash_rust": "sha256:39159b221533f17be9fb1ff4eb4ce7354436fb594275513c4e435fd1b2824df2", + "gen_hash_verilog": "sha256:e41e2a573f0a4bab0fe16018391059a845bd636c600364c4fdb011aa2ae6f516", + "gen_hash_zig": "sha256:9b9d65386abd4c7eaffac3508cd2881b01863d0769d2f28066cc1cd51b892dfc", "module": "ClawGates", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-18T09:41:14Z", + "sealed_at": "2026-10-18T21:37:24Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:3ae3db764f44ce4e0c45b8c7af6f17db39755e3c23be43c17a75409394a0a32d", + "spec_hash": "sha256:96a1d6b79b1832f7ee063270a9c851793fe1100b7981d6d3985c881b61e60bcb", "spec_path": "specs/claw/gates.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 18, - "total": 18, + "passed": 20, + "total": 20, "vacuous": 0 }, "toolchain": { - "test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d", + "test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10", "zig": "0.16.0" } } \ No newline at end of file diff --git a/.trinity/seals/claw_ClawPreview.json b/.trinity/seals/claw_ClawPreview.json index 7a0dedc203..64f4b9bcc6 100644 --- a/.trinity/seals/claw_ClawPreview.json +++ b/.trinity/seals/claw_ClawPreview.json @@ -1,5 +1,5 @@ { - "built_by": "t27c-bootstrap@0.5.2+4ab200073", + "built_by": "t27c-bootstrap@0.5.2+9448ab4be", "closure": [ { "spec": "specs/claw/text.t27", @@ -7,27 +7,27 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:490590a25edb3deec46a6b6d4d22464642643d07ea67bc75a8ebef99c78e79bc", - "gen_hash_rust": "sha256:c94367ba72be823b7d5cfc3b8a09f30505c1c5c9847d0960afd9bdda2ebcc862", - "gen_hash_verilog": "sha256:587efbee334390d024a1ff81d56c9a335b8acc31e29ba0ddeebebb1c4ff2c777", - "gen_hash_zig": "sha256:5329143f3ef51f6d9df8c0322f27529e44e8cf4b32de89621837dbbefa83f38a", + "gen_hash_c": "sha256:58ac5bc0978ad18f3bb6b5f78c1d6a9cb7f23ae8ba652f7b7631613ba6b38a62", + "gen_hash_rust": "sha256:d8de4137e60d81ba99c113a166b7a8a8427c58c0795ba53a437aa1b241177889", + "gen_hash_verilog": "sha256:48611735b1bd4cf393a8f28929a8c5c5c18cc601c6bb9e783c61f175ea6bb009", + "gen_hash_zig": "sha256:c7c300b09a6ccd739bec989daec32359a7b63204fdc7491366d3fe9488e88349", "module": "ClawPreview", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-18T09:41:15Z", + "sealed_at": "2026-10-18T21:37:23Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:6a27230384a6a5d8181853298347d97c7211877e0a60f2c28438e57ada5f23b2", + "spec_hash": "sha256:a21b8a900eb0e5ef8e9c1f7666fff7ff0fb957ace8fb64a34d295eaa1db9cb75", "spec_path": "specs/claw/preview.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 18, - "total": 18, + "passed": 19, + "total": 19, "vacuous": 0 }, "toolchain": { - "test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d", + "test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10", "zig": "0.16.0" } } \ No newline at end of file diff --git a/specs/claw/engine.t27 b/specs/claw/engine.t27 index 93a9212ce0..4bf673dc5d 100644 --- a/specs/claw/engine.t27 +++ b/specs/claw/engine.t27 @@ -362,6 +362,11 @@ test engine_handoff_requires_marker_sha_and_distinct_paths { var empty_source = good; empty_source.source_path = ""; assert(delegation_well_formed(empty_source) == false); + + // An empty draft differs from every source path, so only its own check refuses it. + var empty_draft = good; + empty_draft.draft_path = ""; + assert(delegation_well_formed(empty_draft) == false); } test engine_case_9277_policy_then_ratchet { diff --git a/specs/claw/evidence.t27 b/specs/claw/evidence.t27 index 25b0ba1436..ecccd8fb84 100644 --- a/specs/claw/evidence.t27 +++ b/specs/claw/evidence.t27 @@ -330,6 +330,10 @@ pub fn recheck(expected : str, expected_len : usize, readback : str, readback_le pub const SEAL_A : str = "sha256:3c2fb2a2edf20e90bc76798fb5d12690b2f60fc0f5bbf2f6052936e22d6e62e2"; pub const SEAL_B : str = "sha256:57187e7afda1d88167b2af0382ad7f0623aa6b269ba020a78e3ffeebba1161bb"; +/// SEAL_A with one byte changed each: an uppercase digit, a byte past 'f', another algorithm. +pub const SEAL_A_UPPER : str = "sha256:3C2fb2a2edf20e90bc76798fb5d12690b2f60fc0f5bbf2f6052936e22d6e62e2"; +pub const SEAL_A_PAST_F : str = "sha256:3g2fb2a2edf20e90bc76798fb5d12690b2f60fc0f5bbf2f6052936e22d6e62e2"; +pub const SEAL_A_512 : str = "sha512:3c2fb2a2edf20e90bc76798fb5d12690b2f60fc0f5bbf2f6052936e22d6e62e2"; pub const SEAL_A_SHOWN : str = "3c2fb2a2edf2"; pub const SEAL_A_SHOWN_LEN : usize = 12; pub const FIX_PATH : str = "specs/claw/sarif.t27"; @@ -558,3 +562,37 @@ test span_and_claim_text_are_required { }; assert check_record(blank) == EV_ERR_CLAIM_TEXT; } + +test r4_a_digest_is_lowercase_hex_under_sha256 { + // Full length, one byte off: each spelling is refused, so two of them never cite as one. + assert seal_ok(SEAL_A_UPPER, SEAL_LEN) == false; + assert seal_ok(SEAL_A_PAST_F, SEAL_LEN) == false; + assert seal_ok(SEAL_A_512, SEAL_LEN) == false; + assert seal_ok(SEAL_A, SEAL_LEN) == true; + assert check_record(row(SEAL_A_UPPER, SEAL_LEN, COV_COMPLETE, LABEL_EXACT)) == EV_ERR_SEAL; +} + +test one_past_each_code_table_is_refused { + // One past the last coverage or label code is no code, not the last kind. + assert coverage_valid(COV_KINDS) == false; + assert coverage_valid(COV_UNKNOWN) == true; + assert label_valid(LABEL_KINDS) == false; + assert label_valid(LABEL_KINDS - 1) == true; + assert compose_coverage(COV_KINDS, COV_COMPLETE) == COV_MISSING; + // A claim code past CL_HOLDS is refused even over the strongest proof. + assert claim_supported(CL_HOLDS + 1, PR_TEST_REPORT, 1, 0) == false; + assert claim_supported(CL_HOLDS, PR_TEST_REPORT, 1, 0) == true; +} + +test a_span_may_start_and_end_on_line_one { + assert span_ok(FIX_PATH, FIX_PATH_LEN, 1, 1) == true; + assert span_ok(FIX_PATH, FIX_PATH_LEN, 0, 1) == false; +} + +test a_refused_row_is_counted_once { + const c = cite(no_citation(), row(SEAL_A, SEAL_LEN, COV_MISSING, LABEL_EXACT)); + assert c.rows == 1; + assert c.refused == 1; + assert c.kept == 0; + assert comparable(c) == false; +} diff --git a/specs/claw/gates.t27 b/specs/claw/gates.t27 index 066636f444..f0b0256d33 100644 --- a/specs/claw/gates.t27 +++ b/specs/claw/gates.t27 @@ -559,3 +559,41 @@ test coverage_report_carries_every_class { // strings, which the zig runner executes and the gen-c backend cannot lower, // so they sit in a companion module that is never gen-c'd. A wrong number in // NAME_LENS/PREFIX_LENS/SUFFIX_LENS/*_LEN fails there, not silently here. + +test audit_tail_line_matches_the_count { + // The runner prints the report; the tail must say what the count says. + var dir : [8192]u8 = undefined; + var w : usize = 0; + for i in 0..67 { + w = put_str(&dir, 8192, w, NAMES[i], NAME_LENS[i]); + w = put_str(&dir, 8192, w, "\n", 1); + } + var out : [8192]u8 = undefined; + for i in 0..8192 { out[i] = 0; } + assert claw_status(&dir, w, &out, 8192) == 0; + assert buf_has(&out, 8192, "claw: matrix is current\n", 24) == true; + assert buf_has(&out, 8192, DRIFT_TAIL, DRIFT_TAIL_LEN) == false; + // Row 0 left out: one problem, and the tail says drift. + var gone : [8192]u8 = undefined; + var g : usize = 0; + for i in 1..67 { + g = put_str(&gone, 8192, g, NAMES[i], NAME_LENS[i]); + g = put_str(&gone, 8192, g, "\n", 1); + } + var red : [8192]u8 = undefined; + for i in 0..8192 { red[i] = 0; } + assert claw_status(&gone, g, &red, 8192) == 1; + assert buf_has(&red, 8192, DRIFT_TAIL, DRIFT_TAIL_LEN) == true; + assert buf_has(&red, 8192, OK_TAIL, OK_TAIL_LEN) == false; +} + +test coverage_report_lines_are_exact { + // Whole lines, newline included: the verdict word, the census, and the first three rows of + // each class in table order. A fourth example, a row of another class or a flipped verdict + // breaks the line. + var out : [4096]u8 = undefined; + var w : usize = claw_coverage_report(&out, 4096); + assert buf_has(&out, w, "G_BLOCKING n=62 blocking=true e.g. agent-runner-docker, bootstrap-tests, build-paper\n", 85) == true; + assert buf_has(&out, w, "G_SOFT n=3 blocking=false e.g. oracle-nightly, queen-doctor, rings-rust\n", 72) == true; + assert buf_has(&out, w, "G_REPORTING n=2 blocking=false e.g. auto-merge-ready-prs, queen-publish\n", 72) == true; +} diff --git a/specs/claw/preview.t27 b/specs/claw/preview.t27 index 0677d47c17..6a52708bde 100644 --- a/specs/claw/preview.t27 +++ b/specs/claw/preview.t27 @@ -432,3 +432,15 @@ test the_surface_slug_and_state_names_are_the_api_spelling { assert state_name(S_FAILURE) == "failure"; assert state_name(S_NONE) == ""; } + +test the_length_and_prefix_edges_are_their_own_checks { + // A path exactly the suffix ends with it; one byte shorter does not. + assert ends_with(".t27", ".t27") == true; + assert ends_with("t27", ".t27") == false; + // A needle as long as the hay is found at 0. + assert find_from("abc", "abc", 0) == 0; + // The right length and the right digits under another prefix. + assert env_name_ok(7, "t27f-preview-px-7") == false; + // A URL with repo= and path= but no sha= pins nothing. + assert url_ok("https://t27.ai/t27f/graph/?repo=gHashTag/t27&path=specs/claw/gates.t27") == false; +}