iterate-kernel 0.1.9 → 0.1.12
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.
- package/dist/canonical-json.d.ts +45 -0
- package/dist/canonical-json.d.ts.map +1 -1
- package/dist/canonical-json.js +99 -7
- package/dist/canonical-json.js.map +1 -1
- package/dist/convergence.d.ts +36 -44
- package/dist/convergence.d.ts.map +1 -1
- package/dist/decision-log-entry.d.ts +45 -28
- package/dist/decision-log-entry.d.ts.map +1 -1
- package/dist/decision-log-entry.js +71 -1
- package/dist/decision-log-entry.js.map +1 -1
- package/dist/decision-log-transcribe.d.ts.map +1 -1
- package/dist/decision-log-transcribe.js +59 -4
- package/dist/decision-log-transcribe.js.map +1 -1
- package/dist/decision-log.d.ts +13 -30
- package/dist/decision-log.d.ts.map +1 -1
- package/dist/decision-log.js +29 -5
- package/dist/decision-log.js.map +1 -1
- package/dist/dimension-context.d.ts +39 -223
- package/dist/dimension-context.d.ts.map +1 -1
- package/dist/dimension-context.js +37 -5
- package/dist/dimension-context.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -1
- package/dist/errors.js.map +1 -1
- package/dist/evidence-decision.d.ts +1 -35
- package/dist/evidence-decision.d.ts.map +1 -1
- package/dist/evidence-decision.js +28 -8
- package/dist/evidence-decision.js.map +1 -1
- package/dist/evidence-pack.d.ts +256 -1595
- package/dist/evidence-pack.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/invariant-report.d.ts +53 -189
- package/dist/invariant-report.d.ts.map +1 -1
- package/dist/invariant-report.js +18 -0
- package/dist/invariant-report.js.map +1 -1
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +12 -2
- package/dist/parse.js.map +1 -1
- package/dist/provider-registration.d.ts +22 -72
- package/dist/provider-registration.d.ts.map +1 -1
- package/dist/provider-registration.js +22 -2
- package/dist/provider-registration.js.map +1 -1
- package/dist/recipe-config.d.ts +21 -32
- package/dist/recipe-config.d.ts.map +1 -1
- package/dist/run-plan.d.ts +23 -82
- package/dist/run-plan.d.ts.map +1 -1
- package/fixtures/decision-record-transcription.ok-01.json +41 -1
- package/package.json +7 -2
- package/schemas/convergence-round-state.schema.json +7 -4
- package/schemas/decision-log-entry.schema.json +4 -2
- package/schemas/evidence-pack.schema.json +10 -6
- package/schemas/invariant-report.schema.json +5 -3
- package/schemas/provider-registration.schema.json +1 -1
- package/schemas/reverification-request.schema.json +1 -1
- package/schemas/run-plan.schema.json +1 -0
package/dist/canonical-json.d.ts
CHANGED
|
@@ -12,10 +12,55 @@
|
|
|
12
12
|
* - scalars quoted exactly as `JSON.stringify` does (control chars as
|
|
13
13
|
* `\u00xx`, `/` and non-ASCII left raw).
|
|
14
14
|
*
|
|
15
|
+
* THE FORM IS PARTIAL, AND SAYS SO. `JSON.stringify` accepts anything and
|
|
16
|
+
* silently invents a token for it: `undefined`, a function and a symbol all
|
|
17
|
+
* print as the bare word `undefined`, `NaN` and `Infinity` print as `null`, a
|
|
18
|
+
* `Date` prints as a quoted string, a class instance prints as `{}`. Each of
|
|
19
|
+
* those would be a digest over bytes that are not JSON — the ledger line no
|
|
20
|
+
* reader can `JSON.parse`, two different values sharing one digest, and a
|
|
21
|
+
* Swift or Python recomputation that disagrees with the bytes on disk. So a
|
|
22
|
+
* value with no JSON representation is refused with a code and a remedy
|
|
23
|
+
* instead of being re-imagined, which is the same rule the Python half of this
|
|
24
|
+
* contract already implements (`canonical_json.py` raises
|
|
25
|
+
* `CANONICAL_JSON_E_VALUE` for anything it cannot name).
|
|
26
|
+
*
|
|
15
27
|
* The decision log hashes this form (see `decision-log.ts`), so the digest of
|
|
16
28
|
* an entry is reproducible from TypeScript, Swift, or `printf … | sha256sum`
|
|
17
29
|
* given the same bytes. That property is the point: an audit chain nobody else
|
|
18
30
|
* can recompute is a claim, not evidence.
|
|
19
31
|
*/
|
|
32
|
+
export declare const CANONICAL_JSON_CODES: {
|
|
33
|
+
readonly value: "KERNEL_E_CANONICAL_VALUE";
|
|
34
|
+
readonly depth: "KERNEL_E_CANONICAL_DEPTH";
|
|
35
|
+
};
|
|
36
|
+
export type KernelCanonicalJsonCode = (typeof CANONICAL_JSON_CODES)[keyof typeof CANONICAL_JSON_CODES];
|
|
37
|
+
/**
|
|
38
|
+
* Every failure carries `code` + `message` + `remedy`, like the rest of this package.
|
|
39
|
+
*/
|
|
40
|
+
export declare class KernelCanonicalJsonError extends Error {
|
|
41
|
+
readonly code: KernelCanonicalJsonCode;
|
|
42
|
+
readonly remedy: string;
|
|
43
|
+
constructor(code: KernelCanonicalJsonCode, message: string, remedy: string);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ceiling on nesting depth. The bound exists so that "too deep to canonicalise"
|
|
47
|
+
* is a refusal with a remedy rather than a `RangeError` from the call stack: the
|
|
48
|
+
* deepest document any contract here can carry is a `payload` inside the 8192
|
|
49
|
+
* character canonical bound, and the shortest way to spend 8192 characters is
|
|
50
|
+
* one key per level, which is under 4100 levels — 512 is comfortably above
|
|
51
|
+
* anything the contracts describe and far below what overflows a stack.
|
|
52
|
+
*/
|
|
53
|
+
export declare const CANONICAL_JSON_MAX_DEPTH = 512;
|
|
54
|
+
/**
|
|
55
|
+
* The integer range this form can print identically everywhere.
|
|
56
|
+
*
|
|
57
|
+
* Above it, ECMAScript renders `1e21` as `1e+21` while Python prints
|
|
58
|
+
* `1000000000000000000000`: one document, two byte sequences, two digests. The
|
|
59
|
+
* published schemas state this as `minimum`/`maximum` on every integer field and
|
|
60
|
+
* the zod mirrors enforce it with `.int()`, so a schema-only reader and a
|
|
61
|
+
* validator-based one refuse the same document.
|
|
62
|
+
*/
|
|
63
|
+
export declare const KERNEL_SAFE_INTEGER_MAX: number;
|
|
64
|
+
export declare const KERNEL_SAFE_INTEGER_MIN: number;
|
|
20
65
|
export declare function canonicalJson(value: unknown): string;
|
|
21
66
|
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,eAAO,MAAM,oBAAoB;;;CAGvB,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEvG;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAM3E;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,QAA0B,CAAC;AAC/D,eAAO,MAAM,uBAAuB,QAA2B,CAAC;AAEhE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
|
package/dist/canonical-json.js
CHANGED
|
@@ -12,20 +12,112 @@
|
|
|
12
12
|
* - scalars quoted exactly as `JSON.stringify` does (control chars as
|
|
13
13
|
* `\u00xx`, `/` and non-ASCII left raw).
|
|
14
14
|
*
|
|
15
|
+
* THE FORM IS PARTIAL, AND SAYS SO. `JSON.stringify` accepts anything and
|
|
16
|
+
* silently invents a token for it: `undefined`, a function and a symbol all
|
|
17
|
+
* print as the bare word `undefined`, `NaN` and `Infinity` print as `null`, a
|
|
18
|
+
* `Date` prints as a quoted string, a class instance prints as `{}`. Each of
|
|
19
|
+
* those would be a digest over bytes that are not JSON — the ledger line no
|
|
20
|
+
* reader can `JSON.parse`, two different values sharing one digest, and a
|
|
21
|
+
* Swift or Python recomputation that disagrees with the bytes on disk. So a
|
|
22
|
+
* value with no JSON representation is refused with a code and a remedy
|
|
23
|
+
* instead of being re-imagined, which is the same rule the Python half of this
|
|
24
|
+
* contract already implements (`canonical_json.py` raises
|
|
25
|
+
* `CANONICAL_JSON_E_VALUE` for anything it cannot name).
|
|
26
|
+
*
|
|
15
27
|
* The decision log hashes this form (see `decision-log.ts`), so the digest of
|
|
16
28
|
* an entry is reproducible from TypeScript, Swift, or `printf … | sha256sum`
|
|
17
29
|
* given the same bytes. That property is the point: an audit chain nobody else
|
|
18
30
|
* can recompute is a claim, not evidence.
|
|
19
31
|
*/
|
|
32
|
+
export const CANONICAL_JSON_CODES = {
|
|
33
|
+
value: "KERNEL_E_CANONICAL_VALUE",
|
|
34
|
+
depth: "KERNEL_E_CANONICAL_DEPTH"
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Every failure carries `code` + `message` + `remedy`, like the rest of this package.
|
|
38
|
+
*/
|
|
39
|
+
export class KernelCanonicalJsonError extends Error {
|
|
40
|
+
code;
|
|
41
|
+
remedy;
|
|
42
|
+
constructor(code, message, remedy) {
|
|
43
|
+
super(`${code}: ${message}`);
|
|
44
|
+
this.name = "KernelCanonicalJsonError";
|
|
45
|
+
this.code = code;
|
|
46
|
+
this.remedy = remedy;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Ceiling on nesting depth. The bound exists so that "too deep to canonicalise"
|
|
51
|
+
* is a refusal with a remedy rather than a `RangeError` from the call stack: the
|
|
52
|
+
* deepest document any contract here can carry is a `payload` inside the 8192
|
|
53
|
+
* character canonical bound, and the shortest way to spend 8192 characters is
|
|
54
|
+
* one key per level, which is under 4100 levels — 512 is comfortably above
|
|
55
|
+
* anything the contracts describe and far below what overflows a stack.
|
|
56
|
+
*/
|
|
57
|
+
export const CANONICAL_JSON_MAX_DEPTH = 512;
|
|
58
|
+
/**
|
|
59
|
+
* The integer range this form can print identically everywhere.
|
|
60
|
+
*
|
|
61
|
+
* Above it, ECMAScript renders `1e21` as `1e+21` while Python prints
|
|
62
|
+
* `1000000000000000000000`: one document, two byte sequences, two digests. The
|
|
63
|
+
* published schemas state this as `minimum`/`maximum` on every integer field and
|
|
64
|
+
* the zod mirrors enforce it with `.int()`, so a schema-only reader and a
|
|
65
|
+
* validator-based one refuse the same document.
|
|
66
|
+
*/
|
|
67
|
+
export const KERNEL_SAFE_INTEGER_MAX = Number.MAX_SAFE_INTEGER;
|
|
68
|
+
export const KERNEL_SAFE_INTEGER_MIN = -Number.MAX_SAFE_INTEGER;
|
|
20
69
|
export function canonicalJson(value) {
|
|
21
|
-
|
|
22
|
-
|
|
70
|
+
return write(value, 0);
|
|
71
|
+
}
|
|
72
|
+
function write(value, depth) {
|
|
73
|
+
if (depth > CANONICAL_JSON_MAX_DEPTH) {
|
|
74
|
+
throw new KernelCanonicalJsonError(CANONICAL_JSON_CODES.depth, `value is nested deeper than ${CANONICAL_JSON_MAX_DEPTH} levels`, "flatten what is being recorded: a digest over a structure this deep cannot be recomputed by a reader that streams the form, and no contract in this package describes nesting this deep");
|
|
75
|
+
}
|
|
76
|
+
if (value === null)
|
|
77
|
+
return "null";
|
|
78
|
+
switch (typeof value) {
|
|
79
|
+
case "string":
|
|
80
|
+
case "boolean":
|
|
81
|
+
return JSON.stringify(value);
|
|
82
|
+
case "number":
|
|
83
|
+
if (!Number.isFinite(value)) {
|
|
84
|
+
throw new KernelCanonicalJsonError(CANONICAL_JSON_CODES.value, `${String(value)} has no JSON representation, and JSON.stringify would print it as \`null\``, "record the number the measurement produced, or record the absence of one; a digest that collapses NaN, Infinity and null into the same bytes cannot tell a failed measurement from an absent one");
|
|
85
|
+
}
|
|
86
|
+
return JSON.stringify(value);
|
|
87
|
+
case "object": {
|
|
88
|
+
if (Array.isArray(value)) {
|
|
89
|
+
const items = [];
|
|
90
|
+
for (let i = 0; i < value.length; i++) {
|
|
91
|
+
if (!Object.hasOwn(value, String(i))) {
|
|
92
|
+
throw new KernelCanonicalJsonError(CANONICAL_JSON_CODES.value, `array index ${i} is a hole, which JSON has no token for`, "fill the position with null or drop it; a sparse array would serialise to a missing element between commas, which is not JSON at all");
|
|
93
|
+
}
|
|
94
|
+
items.push(write(value[i], depth + 1));
|
|
95
|
+
}
|
|
96
|
+
return "[" + items.join(",") + "]";
|
|
97
|
+
}
|
|
98
|
+
if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
|
|
99
|
+
throw new KernelCanonicalJsonError(CANONICAL_JSON_CODES.value, `a ${value instanceof Date ? "Date" : "value whose prototype is not Object.prototype"} has no place in the canonical form; JSON.stringify would print it as a string or as an empty object`, "convert it to the fields the contract states before digesting it — a class instance's own enumerable properties are not a documented shape, so two runtimes would print two different byte sequences for it");
|
|
100
|
+
}
|
|
101
|
+
const record = value;
|
|
102
|
+
const keys = Object.keys(record).sort();
|
|
103
|
+
return "{" + keys.map((key) => JSON.stringify(key) + ":" + write(record[key], depth + 1)).join(",") + "}";
|
|
104
|
+
}
|
|
105
|
+
default:
|
|
106
|
+
throw new KernelCanonicalJsonError(CANONICAL_JSON_CODES.value, `cannot canonicalise ${typeName(value)}: JSON.stringify would print it as the bare word \`undefined\`, which is not JSON`, "undefined, functions, symbols and bigints are not values this form can name; omit the key or put the value the producer actually has");
|
|
23
107
|
}
|
|
24
|
-
|
|
25
|
-
|
|
108
|
+
}
|
|
109
|
+
function typeName(value) {
|
|
110
|
+
switch (typeof value) {
|
|
111
|
+
case "function":
|
|
112
|
+
return "a function";
|
|
113
|
+
case "symbol":
|
|
114
|
+
return "a symbol";
|
|
115
|
+
case "bigint":
|
|
116
|
+
return "a bigint";
|
|
117
|
+
case "undefined":
|
|
118
|
+
return "an undefined value";
|
|
119
|
+
default:
|
|
120
|
+
return `a ${typeof value}`;
|
|
26
121
|
}
|
|
27
|
-
const record = value;
|
|
28
|
-
const keys = Object.keys(record).sort();
|
|
29
|
-
return "{" + keys.map((key) => JSON.stringify(key) + ":" + canonicalJson(record[key])).join(",") + "}";
|
|
30
122
|
}
|
|
31
123
|
//# sourceMappingURL=canonical-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-json.js","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"canonical-json.js","sourceRoot":"","sources":["../src/canonical-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,0BAA0B;IACjC,KAAK,EAAE,0BAA0B;CACzB,CAAC;AAIX;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACxC,IAAI,CAA0B;IAC9B,MAAM,CAAS;IAExB,YAAY,IAA6B,EAAE,OAAe,EAAE,MAAc;QACxE,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC;AAEhE,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,KAAK,CAAC,KAAc,EAAE,KAAa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AAC;AACH,CAAC"}
|
package/dist/convergence.d.ts
CHANGED
|
@@ -10,47 +10,35 @@ import { z } from "zod";
|
|
|
10
10
|
* asymmetry that makes a loop stop in one product and keep running in the other.
|
|
11
11
|
*/
|
|
12
12
|
export declare const CONVERGENCE_SCHEMA_VERSION: "iterate.convergence/0.1";
|
|
13
|
-
export declare const InvariantStateSchema: z.ZodEnum<
|
|
13
|
+
export declare const InvariantStateSchema: z.ZodEnum<{
|
|
14
|
+
pass: "pass";
|
|
15
|
+
fail: "fail";
|
|
16
|
+
error: "error";
|
|
17
|
+
unmeasured: "unmeasured";
|
|
18
|
+
}>;
|
|
14
19
|
export type InvariantState = z.infer<typeof InvariantStateSchema>;
|
|
15
20
|
/** What a caller states about the round that just finished. */
|
|
16
21
|
export declare const RoundStateSchema: z.ZodObject<{
|
|
17
22
|
schemaVersion: z.ZodOptional<z.ZodLiteral<"iterate.convergence/0.1">>;
|
|
18
23
|
round: z.ZodNumber;
|
|
19
24
|
maxRounds: z.ZodNumber;
|
|
20
|
-
invariantState: z.ZodEnum<
|
|
25
|
+
invariantState: z.ZodEnum<{
|
|
26
|
+
pass: "pass";
|
|
27
|
+
fail: "fail";
|
|
28
|
+
error: "error";
|
|
29
|
+
unmeasured: "unmeasured";
|
|
30
|
+
}>;
|
|
21
31
|
openFindings: z.ZodNumber;
|
|
22
|
-
/** False when the engine never got to evidence something (refused, crashed, unattached). */
|
|
23
32
|
evidenceComplete: z.ZodBoolean;
|
|
24
|
-
/**
|
|
25
|
-
* The engine's own circuit-breaker level for this run; 3 is tripped.
|
|
26
|
-
*
|
|
27
|
-
* OPTIONAL, and absence is not the same claim as 0. `0` says "a breaker exists and it has
|
|
28
|
-
* not tripped"; absence says "this run has no breaker channel at all" — which is the normal
|
|
29
|
-
* shape of an iterate loop that never touched the GUI engine. The distinction changes no
|
|
30
|
-
* verdict today (only `>= 3` halts), but collapsing it would force a producer that never
|
|
31
|
-
* looked to assert a measurement it did not take, and that is the exact failure this
|
|
32
|
-
* contract's `unmeasured` state exists to prevent.
|
|
33
|
-
*/
|
|
34
33
|
breakerLevel: z.ZodOptional<z.ZodNumber>;
|
|
35
|
-
},
|
|
36
|
-
round: number;
|
|
37
|
-
maxRounds: number;
|
|
38
|
-
invariantState: "pass" | "fail" | "error" | "unmeasured";
|
|
39
|
-
openFindings: number;
|
|
40
|
-
evidenceComplete: boolean;
|
|
41
|
-
schemaVersion?: "iterate.convergence/0.1" | undefined;
|
|
42
|
-
breakerLevel?: number | undefined;
|
|
43
|
-
}, {
|
|
44
|
-
round: number;
|
|
45
|
-
maxRounds: number;
|
|
46
|
-
invariantState: "pass" | "fail" | "error" | "unmeasured";
|
|
47
|
-
openFindings: number;
|
|
48
|
-
evidenceComplete: boolean;
|
|
49
|
-
schemaVersion?: "iterate.convergence/0.1" | undefined;
|
|
50
|
-
breakerLevel?: number | undefined;
|
|
51
|
-
}>;
|
|
34
|
+
}, z.core.$strict>;
|
|
52
35
|
export type RoundState = z.infer<typeof RoundStateSchema>;
|
|
53
|
-
export declare const ConvergenceActionSchema: z.ZodEnum<
|
|
36
|
+
export declare const ConvergenceActionSchema: z.ZodEnum<{
|
|
37
|
+
fix: "fix";
|
|
38
|
+
verify: "verify";
|
|
39
|
+
converged: "converged";
|
|
40
|
+
halt: "halt";
|
|
41
|
+
}>;
|
|
54
42
|
export type ConvergenceAction = z.infer<typeof ConvergenceActionSchema>;
|
|
55
43
|
export declare const CONVERGENCE_REASONS: {
|
|
56
44
|
readonly breakerTripped: "circuit-breaker-tripped";
|
|
@@ -64,21 +52,25 @@ export declare const CONVERGENCE_REASONS: {
|
|
|
64
52
|
};
|
|
65
53
|
export type ConvergenceReason = (typeof CONVERGENCE_REASONS)[keyof typeof CONVERGENCE_REASONS];
|
|
66
54
|
export declare const ConvergenceDecisionSchema: z.ZodObject<{
|
|
67
|
-
action: z.ZodEnum<
|
|
68
|
-
|
|
55
|
+
action: z.ZodEnum<{
|
|
56
|
+
fix: "fix";
|
|
57
|
+
verify: "verify";
|
|
58
|
+
converged: "converged";
|
|
59
|
+
halt: "halt";
|
|
60
|
+
}>;
|
|
61
|
+
reason: z.ZodEnum<{
|
|
62
|
+
"circuit-breaker-tripped": "circuit-breaker-tripped";
|
|
63
|
+
"round-budget-exhausted": "round-budget-exhausted";
|
|
64
|
+
"invariant-check-errored": "invariant-check-errored";
|
|
65
|
+
"open-findings": "open-findings";
|
|
66
|
+
"invariants-failed": "invariants-failed";
|
|
67
|
+
"evidence-incomplete": "evidence-incomplete";
|
|
68
|
+
"invariants-unmeasured": "invariants-unmeasured";
|
|
69
|
+
"all-gates-green": "all-gates-green";
|
|
70
|
+
}>;
|
|
69
71
|
round: z.ZodNumber;
|
|
70
72
|
maxRounds: z.ZodNumber;
|
|
71
|
-
},
|
|
72
|
-
round: number;
|
|
73
|
-
maxRounds: number;
|
|
74
|
-
action: "fix" | "verify" | "converged" | "halt";
|
|
75
|
-
reason: "circuit-breaker-tripped" | "round-budget-exhausted" | "invariant-check-errored" | "open-findings" | "invariants-failed" | "evidence-incomplete" | "invariants-unmeasured" | "all-gates-green";
|
|
76
|
-
}, {
|
|
77
|
-
round: number;
|
|
78
|
-
maxRounds: number;
|
|
79
|
-
action: "fix" | "verify" | "converged" | "halt";
|
|
80
|
-
reason: "circuit-breaker-tripped" | "round-budget-exhausted" | "invariant-check-errored" | "open-findings" | "invariants-failed" | "evidence-incomplete" | "invariants-unmeasured" | "all-gates-green";
|
|
81
|
-
}>;
|
|
73
|
+
}, z.core.$strict>;
|
|
82
74
|
export type ConvergenceDecision = z.infer<typeof ConvergenceDecisionSchema>;
|
|
83
75
|
/**
|
|
84
76
|
* Precedence, and why it is this order:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convergence.d.ts","sourceRoot":"","sources":["../src/convergence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,EAAG,yBAAkC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"convergence.d.ts","sourceRoot":"","sources":["../src/convergence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,EAAG,yBAAkC,CAAC;AAE7E,eAAO,MAAM,oBAAoB;;;;;EAAkD,CAAC;AACpF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;kBAmB3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,uBAAuB;;;;;EAAiD,CAAC;AACtF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,mBAAmB;;;;;;;;;CAStB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAE/F,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;kBAcpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,CAyB1E"}
|
|
@@ -26,7 +26,43 @@ export declare const DECISION_KIND_PATTERN: RegExp;
|
|
|
26
26
|
* state it (see the documented divergence in `schemas/decision-log-entry.schema.json`).
|
|
27
27
|
*/
|
|
28
28
|
export declare const PAYLOAD_MAX_CANONICAL_LENGTH = 8192;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Payload keys the JavaScript object model reinterprets instead of storing.
|
|
31
|
+
*
|
|
32
|
+
* `{"__proto__": …}` is a key a JSON reader can hand this package — Python's
|
|
33
|
+
* `json.loads` produces it as an own property, and a Swift decoder names it the
|
|
34
|
+
* same way — but `z.record` copies values with `out[k] = value`, which invokes
|
|
35
|
+
* the `Object.prototype.__proto__` accessor rather than defining the property:
|
|
36
|
+
* the key silently vanishes from the entry, and so from the bytes the digest
|
|
37
|
+
* covers. `prototype` and `constructor` are NOT in this list on purpose — a plain
|
|
38
|
+
* `{}` has no inherited accessor by either name, so assigning them defines an own
|
|
39
|
+
* property and they survive as data. Only the key that is actually lost is refused.
|
|
40
|
+
*
|
|
41
|
+
* Rule 3 of the transcription contract says the payload is carried in full, so the
|
|
42
|
+
* honest alternatives were to preserve the key or refuse it. Refusing is what this
|
|
43
|
+
* package does everywhere else with a field it cannot carry (`DecisionLogDraftSchema`
|
|
44
|
+
* refuses an unknown key rather than dropping it), and it is the only one of the two
|
|
45
|
+
* that does not put a key named `__proto__` back into an object another consumer
|
|
46
|
+
* will merge.
|
|
47
|
+
*/
|
|
48
|
+
export declare const PAYLOAD_RESERVED_KEYS: readonly ["__proto__"];
|
|
49
|
+
/**
|
|
50
|
+
* Which keys of a RAW payload value this package cannot carry as data.
|
|
51
|
+
*
|
|
52
|
+
* The check has to see the input before `z.record` copies it: zod 4's record
|
|
53
|
+
* assigns with `out[key] = value` and, for `__proto__` specifically, does not even
|
|
54
|
+
* run the key schema — the key disappears from the parsed object, so a refinement
|
|
55
|
+
* placed after it can only ever see the two keys that assignment does store.
|
|
56
|
+
* `buildDecisionLogEntry` and `parseDecisionLogEntry` therefore check the raw
|
|
57
|
+
* value, and this module's schema keeps the refinement for the rest.
|
|
58
|
+
*/
|
|
59
|
+
export declare function reservedPayloadKeys(value: unknown): string[];
|
|
60
|
+
export declare const DecisionOutcomeSchema: z.ZodEnum<{
|
|
61
|
+
pass: "pass";
|
|
62
|
+
fail: "fail";
|
|
63
|
+
blocked: "blocked";
|
|
64
|
+
inconclusive: "inconclusive";
|
|
65
|
+
}>;
|
|
30
66
|
export type DecisionOutcome = z.infer<typeof DecisionOutcomeSchema>;
|
|
31
67
|
/**
|
|
32
68
|
* One line of the audit chain.
|
|
@@ -45,36 +81,17 @@ export declare const DecisionLogEntrySchema: z.ZodObject<{
|
|
|
45
81
|
prevEntryHash: z.ZodString;
|
|
46
82
|
operationId: z.ZodOptional<z.ZodString>;
|
|
47
83
|
summary: z.ZodString;
|
|
48
|
-
outcome: z.ZodEnum<
|
|
84
|
+
outcome: z.ZodEnum<{
|
|
85
|
+
pass: "pass";
|
|
86
|
+
fail: "fail";
|
|
87
|
+
blocked: "blocked";
|
|
88
|
+
inconclusive: "inconclusive";
|
|
89
|
+
}>;
|
|
49
90
|
createdAt: z.ZodString;
|
|
50
91
|
kind: z.ZodOptional<z.ZodString>;
|
|
51
92
|
round: z.ZodOptional<z.ZodNumber>;
|
|
52
93
|
dimension: z.ZodOptional<z.ZodString>;
|
|
53
|
-
payload: z.
|
|
54
|
-
},
|
|
55
|
-
createdAt: string;
|
|
56
|
-
entryId: string;
|
|
57
|
-
sequence: number;
|
|
58
|
-
prevEntryHash: string;
|
|
59
|
-
summary: string;
|
|
60
|
-
outcome: "pass" | "fail" | "blocked" | "inconclusive";
|
|
61
|
-
round?: number | undefined;
|
|
62
|
-
kind?: string | undefined;
|
|
63
|
-
operationId?: string | undefined;
|
|
64
|
-
dimension?: string | undefined;
|
|
65
|
-
payload?: Record<string, unknown> | undefined;
|
|
66
|
-
}, {
|
|
67
|
-
createdAt: string;
|
|
68
|
-
entryId: string;
|
|
69
|
-
sequence: number;
|
|
70
|
-
prevEntryHash: string;
|
|
71
|
-
summary: string;
|
|
72
|
-
outcome: "pass" | "fail" | "blocked" | "inconclusive";
|
|
73
|
-
round?: number | undefined;
|
|
74
|
-
kind?: string | undefined;
|
|
75
|
-
operationId?: string | undefined;
|
|
76
|
-
dimension?: string | undefined;
|
|
77
|
-
payload?: Record<string, unknown> | undefined;
|
|
78
|
-
}>;
|
|
94
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
79
96
|
export type DecisionLogEntry = z.infer<typeof DecisionLogEntrySchema>;
|
|
80
97
|
//# sourceMappingURL=decision-log-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-log-entry.d.ts","sourceRoot":"","sources":["../src/decision-log-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AAEvE,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,QAAsB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,QAA2B,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"decision-log-entry.d.ts","sourceRoot":"","sources":["../src/decision-log-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AAEvE,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,QAAsB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,QAA2B,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,wBAAyB,CAAC;AAE5D;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI5D;AAED,eAAO,MAAM,qBAAqB;;;;;EAAsD,CAAC;AACzF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;kBA+CjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -29,6 +29,42 @@ export const DECISION_KIND_PATTERN = /^[a-z][a-z0-9_]{0,31}$/;
|
|
|
29
29
|
* state it (see the documented divergence in `schemas/decision-log-entry.schema.json`).
|
|
30
30
|
*/
|
|
31
31
|
export const PAYLOAD_MAX_CANONICAL_LENGTH = 8192;
|
|
32
|
+
/**
|
|
33
|
+
* Payload keys the JavaScript object model reinterprets instead of storing.
|
|
34
|
+
*
|
|
35
|
+
* `{"__proto__": …}` is a key a JSON reader can hand this package — Python's
|
|
36
|
+
* `json.loads` produces it as an own property, and a Swift decoder names it the
|
|
37
|
+
* same way — but `z.record` copies values with `out[k] = value`, which invokes
|
|
38
|
+
* the `Object.prototype.__proto__` accessor rather than defining the property:
|
|
39
|
+
* the key silently vanishes from the entry, and so from the bytes the digest
|
|
40
|
+
* covers. `prototype` and `constructor` are NOT in this list on purpose — a plain
|
|
41
|
+
* `{}` has no inherited accessor by either name, so assigning them defines an own
|
|
42
|
+
* property and they survive as data. Only the key that is actually lost is refused.
|
|
43
|
+
*
|
|
44
|
+
* Rule 3 of the transcription contract says the payload is carried in full, so the
|
|
45
|
+
* honest alternatives were to preserve the key or refuse it. Refusing is what this
|
|
46
|
+
* package does everywhere else with a field it cannot carry (`DecisionLogDraftSchema`
|
|
47
|
+
* refuses an unknown key rather than dropping it), and it is the only one of the two
|
|
48
|
+
* that does not put a key named `__proto__` back into an object another consumer
|
|
49
|
+
* will merge.
|
|
50
|
+
*/
|
|
51
|
+
export const PAYLOAD_RESERVED_KEYS = ["__proto__"];
|
|
52
|
+
/**
|
|
53
|
+
* Which keys of a RAW payload value this package cannot carry as data.
|
|
54
|
+
*
|
|
55
|
+
* The check has to see the input before `z.record` copies it: zod 4's record
|
|
56
|
+
* assigns with `out[key] = value` and, for `__proto__` specifically, does not even
|
|
57
|
+
* run the key schema — the key disappears from the parsed object, so a refinement
|
|
58
|
+
* placed after it can only ever see the two keys that assignment does store.
|
|
59
|
+
* `buildDecisionLogEntry` and `parseDecisionLogEntry` therefore check the raw
|
|
60
|
+
* value, and this module's schema keeps the refinement for the rest.
|
|
61
|
+
*/
|
|
62
|
+
export function reservedPayloadKeys(value) {
|
|
63
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
64
|
+
return [];
|
|
65
|
+
const keys = Object.keys(value);
|
|
66
|
+
return keys.filter((key) => PAYLOAD_RESERVED_KEYS.includes(key));
|
|
67
|
+
}
|
|
32
68
|
export const DecisionOutcomeSchema = z.enum(["pass", "fail", "blocked", "inconclusive"]);
|
|
33
69
|
/**
|
|
34
70
|
* One line of the audit chain.
|
|
@@ -55,6 +91,40 @@ export const DecisionLogEntrySchema = z.strictObject({
|
|
|
55
91
|
payload: z
|
|
56
92
|
.record(z.string(), z.unknown())
|
|
57
93
|
.optional()
|
|
58
|
-
.
|
|
94
|
+
.superRefine((value, ctx) => {
|
|
95
|
+
if (value === undefined)
|
|
96
|
+
return;
|
|
97
|
+
for (const key of Object.keys(value)) {
|
|
98
|
+
if (PAYLOAD_RESERVED_KEYS.includes(key)) {
|
|
99
|
+
ctx.addIssue({
|
|
100
|
+
code: z.ZodIssueCode.custom,
|
|
101
|
+
path: ["payload", key],
|
|
102
|
+
message: `\`payload\` cannot carry the key "${key}": assigning it in JavaScript rewrites the object instead of storing a value, so the key would disappear from the canonical bytes this entry is hashed over`
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// The canonical form is partial, and a value it cannot name has to be
|
|
107
|
+
// refused here rather than at write time: `canonicalJson` would raise, but
|
|
108
|
+
// by then the ledger is what carries the news.
|
|
109
|
+
let canonical;
|
|
110
|
+
try {
|
|
111
|
+
canonical = canonicalJson(value);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
ctx.addIssue({
|
|
115
|
+
code: z.ZodIssueCode.custom,
|
|
116
|
+
path: ["payload"],
|
|
117
|
+
message: error instanceof Error ? error.message : "payload contains a value with no JSON representation"
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (canonical.length > PAYLOAD_MAX_CANONICAL_LENGTH) {
|
|
122
|
+
ctx.addIssue({
|
|
123
|
+
code: z.ZodIssueCode.custom,
|
|
124
|
+
path: ["payload"],
|
|
125
|
+
message: `payload must stay within ${PAYLOAD_MAX_CANONICAL_LENGTH} characters of canonical JSON`
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
})
|
|
59
129
|
});
|
|
60
130
|
//# sourceMappingURL=decision-log-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-log-entry.js","sourceRoot":"","sources":["../src/decision-log-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AAEvE,wFAAwF;AACxF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D;;;;;;GAMG;AACH,MA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C,IAAI,EAAE,OAAO,GAAG,OAAO,CAM7D;AAGD,2FAA2F;AAC3F,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,CAAC"}
|
|
@@ -73,25 +73,80 @@ const SUMMARY_FIELDS = ["summary", "message", "reason"];
|
|
|
73
73
|
* transcriber that leaned on the host parser would produce two different ledgers from one
|
|
74
74
|
* record, and a ledger whose dates depend on which runtime converted it is not evidence.
|
|
75
75
|
*/
|
|
76
|
-
const ISO_8601_WITH_ZONE =
|
|
76
|
+
const ISO_8601_WITH_ZONE = /^(?<y>\d{4})-(?<mo>\d{2})-(?<d>\d{2})T(?<h>\d{2}):(?<mi>\d{2}):(?<s>\d{2})(?<frac>\.\d{1,9})?(?<zone>Z|(?<sign>[+-])(?<oh>\d{2}):(?<om>\d{2}))$/;
|
|
77
77
|
function refuse(code, message, remedy) {
|
|
78
78
|
throw new KernelDecisionTranscribeError(code, message, remedy);
|
|
79
79
|
}
|
|
80
80
|
function isOutcome(value) {
|
|
81
81
|
return typeof value === "string" && OUTCOMES.includes(value);
|
|
82
82
|
}
|
|
83
|
+
function isLeapYear(year) {
|
|
84
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
85
|
+
}
|
|
86
|
+
function daysInMonth(year, month) {
|
|
87
|
+
if (month === 2)
|
|
88
|
+
return isLeapYear(year) ? 29 : 28;
|
|
89
|
+
return month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Days from the civil calendar to the Unix epoch, proleptic Gregorian, for any
|
|
93
|
+
* year — the conversion `Date.UTC` cannot do for a four-digit year below 100,
|
|
94
|
+
* which it maps into the 1900s. Same arithmetic as the Python half's
|
|
95
|
+
* `datetime(...)`, and stated here so a third implementation can check it.
|
|
96
|
+
*/
|
|
97
|
+
function daysFromCivil(year, month, day) {
|
|
98
|
+
const shifted = month <= 2 ? year - 1 : year;
|
|
99
|
+
const era = Math.floor(shifted / 400);
|
|
100
|
+
const yearOfEra = shifted - era * 400;
|
|
101
|
+
const dayOfYear = Math.floor((153 * (month + (month > 2 ? -3 : 9)) + 2) / 5) + day - 1;
|
|
102
|
+
const dayOfEra = yearOfEra * 365 +
|
|
103
|
+
Math.floor(yearOfEra / 4) -
|
|
104
|
+
Math.floor(yearOfEra / 100) +
|
|
105
|
+
dayOfYear;
|
|
106
|
+
return era * 146097 + dayOfEra - 719468;
|
|
107
|
+
}
|
|
83
108
|
/** Rule 4: normalize any ISO-8601-looking timestamp the legacy logs contain to UTC millis. */
|
|
84
109
|
function toIsoMillis(raw) {
|
|
85
110
|
if (typeof raw !== "string" || raw.length === 0) {
|
|
86
111
|
refuse(DECISION_TRANSCRIBE_CODES.timestamp, "the record's `timestamp` is not a non-empty string", "the producer must stamp the record itself; transcription will not substitute the current time, because that would date a decision to when someone converted the file");
|
|
87
112
|
}
|
|
88
|
-
|
|
113
|
+
const parts = ISO_8601_WITH_ZONE.exec(raw)?.groups;
|
|
114
|
+
if (parts === undefined) {
|
|
89
115
|
refuse(DECISION_TRANSCRIBE_CODES.timestamp, `\`${raw}\` is not ISO-8601 with an explicit zone (Z or ±HH:MM)`, "emit the offset the producer actually has; a spelling the host parser has to guess at (11/10/2026, a bare date, local time without an offset) parses differently in each runtime, and a ledger dated by guesswork cannot be audited");
|
|
90
116
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
117
|
+
const year = Number(parts.y);
|
|
118
|
+
const month = Number(parts.mo);
|
|
119
|
+
const day = Number(parts.d);
|
|
120
|
+
const hour = Number(parts.h);
|
|
121
|
+
const minute = Number(parts.mi);
|
|
122
|
+
const second = Number(parts.s);
|
|
123
|
+
const offsetHour = parts.oh === undefined ? 0 : Number(parts.oh);
|
|
124
|
+
const offsetMinute = parts.om === undefined ? 0 : Number(parts.om);
|
|
125
|
+
// WHY THIS IS DONE HERE AND NOT LEFT TO `Date.parse`. V8 rolls an impossible
|
|
126
|
+
// calendar date over instead of refusing it — `2026-02-31` becomes `2026-03-03`
|
|
127
|
+
// — while the Python half constructs `datetime(year, month, day, …)` and raises.
|
|
128
|
+
// One record then becomes two different ledgers depending on which runtime read
|
|
129
|
+
// the file, which is the exact thing the pattern above exists to prevent; the
|
|
130
|
+
// pattern only bounds the *spelling*, so the calendar has to be checked too.
|
|
131
|
+
const calendar = year >= 1 &&
|
|
132
|
+
month >= 1 &&
|
|
133
|
+
month <= 12 &&
|
|
134
|
+
day >= 1 &&
|
|
135
|
+
day <= daysInMonth(year, month) &&
|
|
136
|
+
hour <= 23 &&
|
|
137
|
+
minute <= 59 &&
|
|
138
|
+
second <= 59 &&
|
|
139
|
+
offsetHour <= 23 &&
|
|
140
|
+
offsetMinute <= 59;
|
|
141
|
+
if (!calendar) {
|
|
93
142
|
refuse(DECISION_TRANSCRIBE_CODES.timestamp, `\`${raw}\` is not a real instant`, "check the producer's clock formatting: an ISO-shaped string that is not a valid date (month 13, day 32) is a bug worth stopping the migration for");
|
|
94
143
|
}
|
|
144
|
+
// Fractional seconds TRUNCATE toward zero: drop the tail, never round up.
|
|
145
|
+
const millis = Number(`${(parts.frac ?? ".0").slice(1, 4)}00`.slice(0, 3));
|
|
146
|
+
const offsetMinutes = (offsetHour * 60 + offsetMinute) * (parts.sign === "-" ? 1 : -1);
|
|
147
|
+
const ms = ((daysFromCivil(year, month, day) * 24 + hour) * 60 + minute + offsetMinutes) * 60_000 +
|
|
148
|
+
second * 1_000 +
|
|
149
|
+
millis;
|
|
95
150
|
const iso = new Date(ms).toISOString();
|
|
96
151
|
if (!ISO_MILLIS_PATTERN.test(iso)) {
|
|
97
152
|
refuse(DECISION_TRANSCRIBE_CODES.timestamp, `\`${raw}\` normalized to \`${iso}\`, which is not ISO-8601 millisecond UTC`, "the ledger stores second-precision-free UTC; check whether the producer emitted a year outside the representable range");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decision-log-transcribe.js","sourceRoot":"","sources":["../src/decision-log-transcribe.ts"],"names":[],"mappings":"AAAA,O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