@agent-blueprint-protocol/verifier 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,449 +0,0 @@
1
- // Self-check battery — the corpus-independent anchors:
2
- // RFC 8785 Appendix B transcribed first-hand from the RFC (2026-08-23), the
3
- // RFC's §3.2.2→§3.2.4 canonicalization sample, the §3.2.3 sort-order fixture,
4
- // the integer-window matrix (mis-round lexeme included), the b64url strict/
5
- // lenient matrices, and Ed25519 key acceptance. Exit 0 = all pass; exit 1 +
6
- // a list = any failure.
7
- //
8
- // These run inside `verifier.agreement` (a divergence in either
9
- // implementation must surface — RFC table ↔ TS emit ↔ native stringify).
10
- import { number } from "./canonical.js";
11
- import { decode } from "./decode.js";
12
- import { encode } from "./canonical.js";
13
- import * as b64 from "./b64url.js";
14
- import { member, memberString } from "./corpus.js";
15
- import { verify as sigVerify, toCompact, signingInput, usableEd25519Key } from "./signature.js";
16
- import { createHash } from "node:crypto";
17
- import { readFileSync } from "node:fs";
18
- import { join } from "node:path";
19
- import { createPrivateKey, createPublicKey, sign as cryptoSign, verify as cryptoVerify } from "node:crypto";
20
- const failures = [];
21
- let checks = 0;
22
- function check(name, got, want) {
23
- checks++;
24
- if (got !== want)
25
- failures.push(`${name}: got ${String(got)} want ${String(want)}`);
26
- }
27
- // ---- RFC 8785 Appendix B (transcribed from the RFC, verbatim) -------------------
28
- const APPENDIX_B = [
29
- ["0000000000000000", "0"],
30
- ["8000000000000000", "0"], // minus zero
31
- ["0000000000000001", "5e-324"],
32
- ["8000000000000001", "-5e-324"],
33
- ["7fefffffffffffff", "1.7976931348623157e+308"],
34
- ["ffefffffffffffff", "-1.7976931348623157e+308"],
35
- ["4340000000000000", "9007199254740992"],
36
- ["c340000000000000", "-9007199254740992"],
37
- ["4430000000000000", "295147905179352830000"],
38
- ["7fffffffffffffff", null], // NaN — must error
39
- ["7ff0000000000000", null], // Infinity — must error
40
- ["44b52d02c7e14af5", "9.999999999999997e+22"],
41
- ["44b52d02c7e14af6", "1e+23"],
42
- ["44b52d02c7e14af7", "1.0000000000000001e+23"],
43
- ["444b1ae4d6e2ef4e", "999999999999999700000"],
44
- ["444b1ae4d6e2ef4f", "999999999999999900000"],
45
- ["444b1ae4d6e2ef50", "1e+21"],
46
- ["3eb0c6f7a0b5ed8c", "9.999999999999997e-7"],
47
- ["3eb0c6f7a0b5ed8d", "0.000001"],
48
- ["41b3de4355555553", "333333333.3333332"],
49
- ["41b3de4355555554", "333333333.33333325"],
50
- ["41b3de4355555555", "333333333.3333333"],
51
- ["41b3de4355555556", "333333333.3333334"],
52
- ["41b3de4355555557", "333333333.33333343"],
53
- ["becbf647612f3696", "-0.0000033333333333333333"],
54
- ["43143ff3c1cb0959", "1424953923781206.2"], // round to even
55
- ];
56
- for (const [hex, expected] of APPENDIX_B) {
57
- const buffer = Buffer.alloc(8);
58
- buffer.writeBigUInt64BE(BigInt("0x" + hex));
59
- const value = buffer.readDoubleBE();
60
- if (expected === null) {
61
- let errored = false;
62
- try {
63
- number(value);
64
- }
65
- catch {
66
- errored = true;
67
- }
68
- check(`appendix-b ${hex} errors`, errored, true);
69
- continue;
70
- }
71
- check(`appendix-b ${hex}`, number(value), expected);
72
- // Three-way: native stringify must agree with the RFC table too.
73
- check(`appendix-b ${hex} native`, JSON.stringify(value), expected);
74
- }
75
- // ---- RFC 8785 §3.2.2 → §3.2.4 sample --------------------------------------------
76
- const sampleInput = `{
77
- "numbers": [333333333.33333329, 1E30, 4.50,
78
- 2e-3, 0.000000000000000000000000001],
79
- "string": "\\u20ac$\\u000F\\u000aA'\\u0042\\u0022\\u005c\\\\\\"\\/",
80
- "literals": [null, true, false]
81
- }`;
82
- const sampleCanonical = '{"literals":[null,true,false],"numbers":[333333333.3333333,1e+30,4.5,0.002,1e-27],' +
83
- '"string":"€$\\u000f\\nA\'B\\"\\\\\\\\\\"/"}';
84
- const sampleHex = "7b226c69746572616c73223a5b6e756c6c2c747275652c66616c73655d2c226e756d62" +
85
- "657273223a5b3333333333333333332e333333333333332c31652b33302c342e352c" +
86
- "302e3030322c31652d32375d2c22737472696e67223a22e282ac245c75303030665c6e" +
87
- "4127425c225c5c5c5c5c222f227d";
88
- const sampleDecoded = decode(sampleInput);
89
- check("§3.2.2 sample decodes", sampleDecoded.ok, true);
90
- if (sampleDecoded.ok) {
91
- const sampleEncoded = encode(sampleDecoded.v);
92
- check("§3.2.3 canonical output", sampleEncoded.ok && sampleEncoded.v, sampleCanonical);
93
- check("§3.2.4 hex bytes", sampleEncoded.ok && Buffer.from(sampleEncoded.v, "utf8").toString("hex"), sampleHex);
94
- }
95
- // ---- RFC 8785 §3.2.3 sort-order fixture ------------------------------------------
96
- const sortInput = `{
97
- "\\u20ac": "Euro Sign",
98
- "\\r": "Carriage Return",
99
- "\\ufb33": "Hebrew Letter Dalet With Dagesh",
100
- "1": "One",
101
- "\\ud83d\\ude00": "Emoji: Grinning Face",
102
- "\\u0080": "Control",
103
- "\\u00f6": "Latin Small Letter O With Diaeresis"
104
- }`;
105
- const expectedOrder = [
106
- "Carriage Return", // \r
107
- "One", // 1
108
- "Control", // U+0080
109
- "Latin Small Letter O With Diaeresis", // U+00F6
110
- "Euro Sign", // U+20AC
111
- "Emoji: Grinning Face", // U+1F600
112
- "Hebrew Letter Dalet With Dagesh", // U+FB33
113
- ];
114
- const sortDecoded = decode(sortInput);
115
- check("§3.2.3 fixture decodes", sortDecoded.ok, true);
116
- if (sortDecoded.ok) {
117
- // Sorting happens at ENCODE (decode preserves member order) — assert the
118
- // canonical output's key order: \r < 1 < U+0080 < U+00F6 < U+20AC <
119
- // U+1F600 < U+FB33 (UTF-16 code units).
120
- const encoded = encode(sortDecoded.v);
121
- check("§3.2.3 encode succeeds", encoded.ok, true);
122
- if (encoded.ok) {
123
- // Extract values by splitting on '":"' boundaries of the flat object.
124
- const valuesInOrder = [];
125
- const body = encoded.v.slice(1, -1);
126
- for (const pair of body.split(",")) {
127
- const value = pair.slice(pair.indexOf('":') + 2);
128
- valuesInOrder.push(JSON.parse(value));
129
- }
130
- check("§3.2.3 order values", JSON.stringify(valuesInOrder), JSON.stringify(expectedOrder));
131
- }
132
- }
133
- // ---- integer-window matrix -------------------------------------------------------
134
- // [lexeme, expected] — expected is "ok:<tag>:<number-string>" or the deny code.
135
- const WINDOW = [
136
- ["9007199254740992", "ok:float:9007199254740992"],
137
- ["-9007199254740992", "ok:float:-9007199254740992"],
138
- ["9007199254740993", "number_not_double_expressible"],
139
- ["-9007199254740993", "number_not_double_expressible"],
140
- ["9007199254740994", "ok:float:9007199254740994"],
141
- ["295147905179352830000", "ok:float:295147905179352830000"],
142
- ["999999999999999700000", "ok:float:999999999999999700000"],
143
- ["999999999999999900000", "ok:float:999999999999999900000"],
144
- ["295147905179352825856", "number_not_double_expressible"],
145
- ["73639773945516200000", "ok:float:73639773945516200000"], // mis-round bits 440FEFA841F21479
146
- ["1000000000000000000000", "number_not_double_expressible"], // 1e21: canonical is exponential
147
- ["18446744073709551616", "number_not_double_expressible"],
148
- ["1e400", "invalid_number"],
149
- ["-1e400", "invalid_number"],
150
- ["1e-400", "ok:float:0"], // underflow admits as 0 (Float.parse parity)
151
- ["999999999999999999999999999999999999", "number_not_double_expressible"],
152
- ];
153
- for (const [lexeme, expected] of WINDOW) {
154
- const decoded = decode(lexeme);
155
- let got;
156
- if (!decoded.ok)
157
- got = decoded.e;
158
- else if (decoded.v.t === "float")
159
- got = "ok:float:" + number(decoded.v.v);
160
- else if (decoded.v.t === "int")
161
- got = `ok:int:${decoded.v.v}`;
162
- else
163
- got = "ok:other";
164
- check(`window ${lexeme}`, got, expected);
165
- }
166
- // ---- b64url matrices -------------------------------------------------------------
167
- function strict(input) {
168
- const decoded = b64.decodeStrict(input);
169
- return decoded.ok ? "ok:" + decoded.v.toString("latin1") : decoded.e;
170
- }
171
- check("b64 strict valid", strict("QQ"), "ok:A");
172
- check("b64 strict empty", strict(""), "ok:");
173
- check("b64 strict padded", strict("QQ=="), "base64url_padded");
174
- check("b64 strict interior pad", strict("Q=Q"), "base64url_padded");
175
- check("b64 strict bad char", strict("!!!"), "base64url_invalid");
176
- check("b64 strict impossible length", strict("A"), "base64url_invalid");
177
- check("b64 strict nonzero pad bits", strict("Qc"), "base64url_invalid"); // 0x41+0x07 → re-encode differs
178
- check("b64 strict canonical pair", strict("QUJD"), "ok:ABC");
179
- function lenient(input) {
180
- const decoded = b64.decodeLenient(input);
181
- return decoded.ok ? "ok:" + decoded.v.toString("latin1") : decoded.e;
182
- }
183
- check("b64 lenient unpadded", lenient("QQ"), "ok:A");
184
- check("b64 lenient padded", lenient("QQ=="), "ok:A"); // stdlib accepts padding
185
- check("b64 lenient bad char", lenient("!!!"), "lenient_invalid");
186
- // ---- Ed25519 key acceptance ---------------------------------------------------------
187
- // Small-order / non-canonical / off-curve encodings — the libsodium
188
- // ge25519_has_small_order list (provider constants) plus the y ∈ {1, p−1}
189
- // pair an independent review found slipping through the twin's root==0 branch.
190
- const UNUSABLE_HEX = [
191
- "0100000000000000000000000000000000000000000000000000000000000000", // identity (order 1)
192
- "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f", // order-2 point
193
- "0000000000000000000000000000000000000000000000000000000000000000", // y = 0
194
- "0000000000000000000000000000000000000000000000000000000000000080", // y = 0, sign set
195
- "26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05",
196
- "26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85",
197
- "c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a",
198
- "c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa",
199
- "0100000000000000000000000000000000000000000000000000000000000080", // identity, sign set
200
- "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", // y ≥ p
201
- "d7f0980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a", // off-curve
202
- ];
203
- for (const hex of UNUSABLE_HEX) {
204
- check(`ed25519 unusable ${hex.slice(0, 8)}…`, usableEd25519Key(Buffer.from(hex, "hex")), false);
205
- }
206
- // The RFC 8032 §7.1 TEST 1 public key — a legitimate main-subgroup point.
207
- check("ed25519 RFC8032 TEST1 pubkey usable", usableEd25519Key(Buffer.from("d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a", "hex")), true);
208
- // ---- Standard-JOSE cross-check: the stored JWS vectors ----------------------------
209
- {
210
- const vectorsBytes = readFileSync(join(import.meta.dirname, "testdata", "jose-vectors.json"));
211
- const vectors = decode(vectorsBytes);
212
- check("jose vectors decode", vectors.ok, true);
213
- if (!vectors.ok || vectors.v.t !== "obj") {
214
- check("jose vectors shape", false, true);
215
- }
216
- else {
217
- const kat = member(vectors.v, "rfc8032_test1");
218
- const seedHex = memberString(kat, "seed_hex");
219
- const pubHex = memberString(kat, "public_key_hex");
220
- const sigHex = memberString(kat, "signature_hex");
221
- // Seed import via PKCS#8 DER wrap; derived public key must equal the
222
- // RFC's published literal (KAT 1).
223
- const seed = Buffer.from(seedHex, "hex");
224
- const der = Buffer.concat([Buffer.from("302e020100300506032b657004220420", "hex"), seed]);
225
- const privateKey = createPrivateKey({ key: der, format: "der", type: "pkcs8" });
226
- const derivedJwk = createPublicKey(privateKey).export({ format: "jwk" });
227
- check("jose RFC8032 seed derives published pub", Buffer.from(derivedJwk.x, "base64url").toString("hex"), pubHex);
228
- // node's Ed25519 reproduces the RFC's published signature over the
229
- // empty TEST 1 message (KAT 2), and verifies it.
230
- const message = Buffer.from(memberString(kat, "message_hex") ?? "", "hex");
231
- const resigned = cryptoSign(null, message, privateKey);
232
- check("jose RFC8032 signature reproduced", resigned.toString("hex"), sigHex);
233
- check("jose RFC8032 verify", cryptoVerify(null, message, createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: derivedJwk.x }, format: "jwk" }), Buffer.from(sigHex, "hex")), true);
234
- // The stored entries verify through the TS twin, match their compact
235
- // forms, and reconstruct per RFC 7515 App F with stock crypto.
236
- const publicKeyB64 = memberString(vectors.v, "public_key");
237
- const stockKey = createPublicKey({
238
- key: { kty: "OKP", crv: "Ed25519", x: publicKeyB64 },
239
- format: "jwk",
240
- });
241
- const keys = [{ keyId: "test-key", key: Buffer.from(publicKeyB64, "base64url") }];
242
- const entries = member(vectors.v, "entries");
243
- check("jose entries present", entries.t === "arr" && entries.v.length >= 2, true);
244
- for (const wrapped of entries.t === "arr" ? entries.v : []) {
245
- const entry = member(wrapped, "entry");
246
- const compact = memberString(wrapped, "compact");
247
- const purpose = memberString(member(entry, "signed_attributes"), "purpose");
248
- const verified = sigVerify(entry, keys);
249
- check(`jose entry verifies (${purpose})`, verified.ok && verified.v === "verified", true);
250
- const mine = toCompact(entry);
251
- check("jose compact matches", mine.ok ? mine.v : "err", compact);
252
- const input = signingInput(entry);
253
- check("jose signing input ok", input.ok, true);
254
- if (input.ok) {
255
- check("jose standard-reconstruction verify", cryptoVerify(null, Buffer.from(input.v, "utf8"), stockKey, Buffer.from(compact.split(".")[2], "base64url")), true);
256
- }
257
- }
258
- // Tamper tripwire: a flipped signature byte must fail verification.
259
- const firstEntry = (entries.t === "arr" ? entries.v : [])[0];
260
- const tampered = flipSignatureByte(member(firstEntry, "entry"));
261
- const tamperedResult = sigVerify(tampered, keys);
262
- check("jose tampered signature denied", !tamperedResult.ok && tamperedResult.e === "signature_not_verified", true);
263
- }
264
- }
265
- function flipSignatureByte(entry) {
266
- const signature = memberString(entry, "signature");
267
- const flipped = signature.slice(0, 10) + (signature[10] === "A" ? "B" : "A") + signature.slice(11);
268
- return {
269
- t: "obj",
270
- // flipSignatureByte walks signature entries (objects) only.
271
- v: entry.v.map(([k, v]) => k === "signature" ? [k, { t: "str", v: flipped }] : [k, v]),
272
- };
273
- }
274
- // ---- bounds-algebra obligation meet (the corpus-invisible direction) ---------------
275
- //
276
- // The frozen corpus never varies an obligation bound across sources (all
277
- // five intersect cases carry identical values), so meet-direction errors are
278
- // invisible to corpus agreement. These vectors pin it: obligation families
279
- // (authority_trait/approval_trait/effect_impact_ceiling) meet at the
280
- // STRICTEST value (max lattice index), fixed and
281
- // verified against the live Elixir (both deny protected_bound_clamp_denied).
282
- {
283
- const boundsAlgebra = await import("./bounds_algebra.js");
284
- const base = (over) => Object.assign({
285
- approval_trait: "none",
286
- authority_trait: "none",
287
- classification_ceiling: { ordinal: "public", markers: [] },
288
- disclosure_ceiling: "summary",
289
- effect_impact_ceiling: "ordinary",
290
- max_attempts: 3,
291
- max_concurrency: 2,
292
- max_depth: 8,
293
- max_descendants: 64,
294
- max_elapsed_ms: 60000,
295
- max_fan_out: 4,
296
- max_tokens: 100000,
297
- max_cost: { amount: 1000, currency: "USD" },
298
- }, over);
299
- const widenedAuthority = base({ authority_trait: "external_authority_required" });
300
- const widenedApproval = base({ approval_trait: "human_required" });
301
- const r1 = boundsAlgebra.intersect(base({}), base({}), widenedAuthority, "deny");
302
- check("obligation meet: authority widening denied", r1.ok ? "ok" : r1.e, "protected_bound_clamp_denied");
303
- const r2 = boundsAlgebra.intersect(base({}), base({}), widenedApproval, "deny");
304
- check("obligation meet: approval widening denied", r2.ok ? "ok" : r2.e, "protected_bound_clamp_denied");
305
- const r3 = boundsAlgebra.intersect(base({}), base({}), widenedAuthority, "acknowledge");
306
- check("obligation meet: acknowledged clamp emitted", r3.ok ? `clamps=${r3.v.clamps.length}` : r3.e, "clamps=1");
307
- }
308
- // ---- prior-census loader mode (the compatibility-replay anchors) -----------------
309
- //
310
- // A synthetic prior-shaped census — corpus-independent, exactly as this
311
- // battery requires — proving the TS prior-census mode's red arms: the
312
- // ordinary loader still binds the registry digest; the prior mode
313
- // suspends exactly that binding (and the compiled-floor totality) while
314
- // keeping the census's OWN integrity chain. Mirrors the Elixir
315
- // corpus_test prior-census describe block.
316
- import { load, loadPriorCensus } from "./corpus.js";
317
- import * as digest from "./digest.js";
318
- import { arr, int, obj, str } from "./value.js";
319
- function sha256B64Of(bytes) {
320
- return createHash("sha256").update(bytes).digest("base64url");
321
- }
322
- // Builds a one-case census bound to a FOREIGN registry digest, with an
323
- // applicability map covering only its own cells (a prior floor's shape).
324
- function priorCensusFixture(overrides) {
325
- const klass = overrides?.caseClass ?? "valid";
326
- const caseFile = obj([
327
- ["format", str("agent-blueprint-protocol-conformance-cases")],
328
- [
329
- "cases",
330
- arr([
331
- obj([
332
- ["id", str("prior-json-" + klass)],
333
- ["surface", str("json.decode")],
334
- ["class", str(klass)],
335
- ["input", obj([["text", str("{}")]])],
336
- [
337
- "expected",
338
- obj([
339
- ["verdict", str("valid")],
340
- ["value", str("{}")],
341
- ]),
342
- ],
343
- ]),
344
- ]),
345
- ],
346
- ]);
347
- const caseBytes = encode(caseFile);
348
- if (!caseBytes.ok)
349
- throw new Error("fixture: case file must encode");
350
- const caseBytesUtf8 = caseBytes.v;
351
- const foreignRegistry = "sha-256:" + "A".repeat(43);
352
- const applicability = overrides?.applicability ??
353
- obj([
354
- [
355
- "json.decode",
356
- obj([
357
- ["valid", int(1)],
358
- ["unknown_member", obj([["n_a", str("not required at this floor")]])],
359
- ]),
360
- ],
361
- ]);
362
- const baseMembers = [
363
- ["format", str("agent-blueprint-protocol-conformance-corpus-index")],
364
- ["protocol_revision", int(1)],
365
- [
366
- "files",
367
- arr([
368
- obj([
369
- ["path", str("cases/json-decode.json")],
370
- ["sha256_base64url", str(sha256B64Of(caseBytesUtf8))],
371
- ["cases", int(1)],
372
- ]),
373
- ]),
374
- ],
375
- ["total_cases", int(1)],
376
- ["public_key_fingerprints", arr([])],
377
- ["applicability", applicability],
378
- ["registry_digest", str(foreignRegistry)],
379
- ];
380
- const withoutDigest = encode(obj(baseMembers));
381
- if (!withoutDigest.ok)
382
- throw new Error("fixture: index must encode");
383
- const corpusDigest = digest.toTagged(digest.hash("corpus_index", Buffer.from(withoutDigest.v, "utf8")));
384
- const indexBytes = encode(obj([...baseMembers, ["corpus_digest", str(corpusDigest)]]));
385
- if (!indexBytes.ok)
386
- throw new Error("fixture: index must re-encode");
387
- const map = new Map();
388
- map.set("index.json", Buffer.from(indexBytes.v, "utf8"));
389
- map.set("cases/json-decode.json", Buffer.from(caseBytesUtf8, "utf8"));
390
- return { map, corpusDigest };
391
- }
392
- {
393
- const fixture = priorCensusFixture();
394
- const ordinary = load(fixture.map);
395
- check("prior census: ordinary loader binds the registry digest (red arm)", ordinary.ok ? "ok" : ordinary.e, "corpus_index_invalid");
396
- const prior = loadPriorCensus(fixture.map);
397
- check("prior census: prior mode loads a foreign-registry census", prior.ok ? "ok" : prior.e, "ok");
398
- if (prior.ok) {
399
- check("prior census: identity is the recomputed corpus digest", prior.v.identity, fixture.corpusDigest);
400
- }
401
- // Tamper the file's BYTES while keeping it decodable (the id string),
402
- // so the per-file hash is the check that fires.
403
- const tampered = new Map(fixture.map);
404
- tampered.set("cases/json-decode.json", Buffer.from(fixture.map.get("cases/json-decode.json").toString("utf8").replace("prior-json-valid", "tampered-case-id"), "utf8"));
405
- const hashRed = loadPriorCensus(tampered);
406
- check("prior census: own per-file hashes still red", hashRed.ok ? "ok" : hashRed.e, "corpus_hash_mismatch");
407
- const shrunkFloor = priorCensusFixture({ caseClass: "a_class_the_current_floor_dropped" });
408
- const classRed = loadPriorCensus(shrunkFloor.map);
409
- check("prior census: a case outside the compiled class set still denies", classRed.ok ? "ok" : classRed.e, "corpus_case_invalid");
410
- // The census's OWN applicability, self-inconsistent: the "valid" cell is
411
- // marked n_a while the case sits in it.
412
- const inconsistent = priorCensusFixture({
413
- applicability: obj([
414
- [
415
- "json.decode",
416
- obj([
417
- ["valid", obj([["n_a", str("wrongly marked")]])],
418
- ["unknown_member", obj([["n_a", str("not required at this floor")]])],
419
- ]),
420
- ],
421
- ]),
422
- });
423
- const applicabilityRed = loadPriorCensus(inconsistent.map);
424
- check("prior census: an n_a cell carrying a case reds", applicabilityRed.ok ? "ok" : applicabilityRed.e, "corpus_applicability_incomplete");
425
- // The other census-relative direction: an observed case whose cell is
426
- // absent from the census's own applicability map (a dropped leaf).
427
- const unmarked = priorCensusFixture({
428
- applicability: obj([
429
- [
430
- "json.decode",
431
- obj([
432
- ["unknown_member", obj([["n_a", str("not required at this floor")]])],
433
- ]),
434
- ],
435
- ]),
436
- });
437
- const unmarkedRed = loadPriorCensus(unmarked.map);
438
- check("prior census: a case whose cell is absent from applicability reds", unmarkedRed.ok ? "ok" : unmarkedRed.e, "corpus_applicability_incomplete");
439
- }
440
- // ---- summary --------------------------------------------------------------------
441
- if (failures.length > 0) {
442
- process.stderr.write(`self-checks FAILED (${failures.length}/${checks}):\n`);
443
- for (const failure of failures)
444
- process.stderr.write(" " + failure + "\n");
445
- process.exitCode = 1;
446
- }
447
- else {
448
- process.stdout.write(`self-checks ok (${checks})\n`);
449
- }