From 82aab7d83ead55ffa425804cfb42b73d62e4ce22 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 11 Oct 2026 03:51:37 +0200 Subject: [PATCH] union-parity test: the canary check counts the payloads that carry it Co-Authored-By: Claude Opus 5.5 --- packages/cultcache-ts/test/union-parity.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cultcache-ts/test/union-parity.test.ts b/packages/cultcache-ts/test/union-parity.test.ts index 560b7273..a8e2e1ba 100644 --- a/packages/cultcache-ts/test/union-parity.test.ts +++ b/packages/cultcache-ts/test/union-parity.test.ts @@ -203,13 +203,14 @@ test("every outcome vector is listed and holds: refusals name the union and key, assert.equal(entries.length, 9); const document = surfaceDocument(); let refused = 0; + const carrying: string[] = []; let readOnly = 0; for (const { file, outcome: expected, unionName, key, detail } of entries) { const payload = await read(file); if (expected === "refused") { refused += 1; - assert.ok(Buffer.from(payload).includes(CANARY) || detail === "arity", `${file} carries the canary`); + if (Buffer.from(payload).includes(CANARY)) carrying.push(file); assert.throws( () => surfaceCodec.decode(decode(payload)), (error: Error) => { @@ -230,6 +231,7 @@ test("every outcome vector is listed and holds: refusals name the union and key, } } assert.deepEqual([refused, readOnly], [5, 4]); + assert.deepEqual(carrying, ["unknown-arm-field.msgpack", "unknown-arm-list.msgpack", "unknown-arm-nested.msgpack"], "the canary is in the payloads whose arm is unknown"); }); test("a refusal lists the declared keys, so a key only the outer union declares is unknown to the inner", async () => {