From 31299008bc11fc14c8fbccc187061e4e96ead23b Mon Sep 17 00:00:00 2001 From: Hayt <41ea58f1e64c243627e8acde7c89be667052ee6e17d8f021c1195be4324ebf04@buzz.block.builderlab.xyz> Date: Sat, 8 Aug 2026 16:03:02 -0400 Subject: [PATCH] test(desktop): add harness integration fixture test for kind-9 parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Embeds the exact kind-9 content string produced by buzz-acp's build_sentinel_pending_payload (captured via kind9_content_fixture_structural_invariants in crates/buzz-acp/src/acp.rs). Verifies that extractPermissionRequest and isPermissionRequestSentinel accept the bytes the harness actually emits, closing the harness→desktop wire boundary check. Two new tests in the 'harness integration fixture' suite: - test_harness_kind9_content_parses_to_pending_payload - test_harness_kind9_content_identified_as_sentinel Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- .../src/shared/lib/permissionRequest.test.mjs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/desktop/src/shared/lib/permissionRequest.test.mjs b/desktop/src/shared/lib/permissionRequest.test.mjs index 2697604e1..3adc7a16f 100644 --- a/desktop/src/shared/lib/permissionRequest.test.mjs +++ b/desktop/src/shared/lib/permissionRequest.test.mjs @@ -369,3 +369,37 @@ describe("isPermissionRequestSentinel", () => { ); }); }); + +// ── Harness integration fixture ─────────────────────────────────────────────── +// This exact string is produced by `build_sentinel_pending_payload` in +// crates/buzz-acp/src/acp.rs (captured by `kind9_content_fixture_structural_invariants`). +// It validates that the Desktop parser accepts the exact bytes the harness emits. +describe("harness integration fixture", () => { + // The em-dash character in durableRuleNote is U+2014 — identical to harness output + const HARNESS_KIND9_CONTENT = + '{"durableRuleNote":"Includes an \'Always allow\' option \u2014 creates a machine-wide durable rule in Codex.","expiresAt":1700000300,"hasDurableRule":true,"labels":{"opt-allow":"Allow once","opt-always":"Always allow","opt-reject":"Reject"},"optionIds":["opt-allow","opt-reject","opt-always"],"requestNonce":"test-nonce-fixture-abc123","sessionId":"sess-fixture-001","state":"pending","turnId":"turn-fixture-xyz","v":1}'; + + it("test_harness_kind9_content_parses_to_pending_payload", () => { + const result = extractPermissionRequest(HARNESS_KIND9_CONTENT); + assert.ok( + result !== null, + "harness fixture must parse to a non-null payload", + ); + assert.equal(result.state, "pending"); + assert.equal(result.v, 1); + assert.equal(result.requestNonce, "test-nonce-fixture-abc123"); + assert.equal(result.expiresAt, 1700000300); + assert.deepEqual(result.optionIds, [ + "opt-allow", + "opt-reject", + "opt-always", + ]); + assert.equal(result.hasDurableRule, true); + assert.equal(result.sessionId, "sess-fixture-001"); + assert.equal(result.turnId, "turn-fixture-xyz"); + }); + + it("test_harness_kind9_content_identified_as_sentinel", () => { + assert.equal(isPermissionRequestSentinel(HARNESS_KIND9_CONTENT), true); + }); +});