iterate-kernel 0.1.4 → 0.1.6

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.
Files changed (55) hide show
  1. package/README.md +16 -7
  2. package/dist/convergence.d.ts +90 -0
  3. package/dist/convergence.d.ts.map +1 -0
  4. package/dist/convergence.js +97 -0
  5. package/dist/convergence.js.map +1 -0
  6. package/dist/decision-log-entry.d.ts +46 -0
  7. package/dist/decision-log-entry.d.ts.map +1 -1
  8. package/dist/decision-log-entry.js +44 -1
  9. package/dist/decision-log-entry.js.map +1 -1
  10. package/dist/decision-log-transcribe.d.ts +77 -0
  11. package/dist/decision-log-transcribe.d.ts.map +1 -0
  12. package/dist/decision-log-transcribe.js +200 -0
  13. package/dist/decision-log-transcribe.js.map +1 -0
  14. package/dist/decision-log.d.ts +16 -0
  15. package/dist/decision-log.d.ts.map +1 -1
  16. package/dist/decision-log.js +12 -0
  17. package/dist/decision-log.js.map +1 -1
  18. package/dist/dimension-context.d.ts +10 -10
  19. package/dist/errors.d.ts +15 -0
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +7 -0
  22. package/dist/errors.js.map +1 -1
  23. package/dist/evidence-pack.d.ts +38 -38
  24. package/dist/index.d.ts +7 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +7 -3
  27. package/dist/index.js.map +1 -1
  28. package/dist/invariant-report.d.ts +271 -0
  29. package/dist/invariant-report.d.ts.map +1 -0
  30. package/dist/invariant-report.js +145 -0
  31. package/dist/invariant-report.js.map +1 -0
  32. package/dist/parse.d.ts +7 -0
  33. package/dist/parse.d.ts.map +1 -1
  34. package/dist/parse.js +18 -10
  35. package/dist/parse.js.map +1 -1
  36. package/dist/provider-registration.d.ts +132 -0
  37. package/dist/provider-registration.d.ts.map +1 -0
  38. package/dist/provider-registration.js +119 -0
  39. package/dist/provider-registration.js.map +1 -0
  40. package/dist/schemas.d.ts +8 -0
  41. package/dist/schemas.d.ts.map +1 -1
  42. package/dist/schemas.js +8 -0
  43. package/dist/schemas.js.map +1 -1
  44. package/fixtures/convergence.ok-01.json +252 -0
  45. package/fixtures/decision-log-entry.ok-02.json +20 -0
  46. package/fixtures/decision-record-transcription.ok-01.json +260 -0
  47. package/fixtures/invariant-report.ok-01.json +306 -0
  48. package/fixtures/provider-registration.ok-01.json +309 -0
  49. package/fixtures/run-plan.ok-01.json +1 -1
  50. package/package.json +17 -1
  51. package/schemas/convergence-round-state.schema.json +37 -0
  52. package/schemas/decision-log-entry.schema.json +20 -0
  53. package/schemas/invariant-report.schema.json +108 -0
  54. package/schemas/provider-registration.schema.json +63 -0
  55. package/schemas/reverification-request.schema.json +89 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-registration.d.ts","sourceRoot":"","sources":["../src/provider-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAG,sBAA+B,CAAC;AAEvE,eAAO,MAAM,mBAAmB,QAA+B,CAAC;AAChE,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,eAAO,MAAM,kBAAkB,iEAA+D,CAAC;AAC/F,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;IAE/B;;;;OAIG;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;;;IAMnC,6EAA6E;;;;QAf/E;;;;WAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BD,CAAC;AACL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEtF,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAO1F;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAE9E,wBAAgB,qBAAqB,IAAI,gBAAgB,CAExD;AAOD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,oBAAoB,GAC7B,gBAAgB,CAelB;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,GAAG,oBAAoB,CAW5F;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,gBAAgB,EAC1B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,cAAc,CAYhB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAEtF"}
@@ -0,0 +1,119 @@
1
+ import { z } from "zod";
2
+ import { schemaErrorFrom } from "./errors.js";
3
+ /**
4
+ * The AE-provider registration contract (5.7 R40 scenario 5): a judgement producer
5
+ * registers once, and both harnesses consume it through the same shape.
6
+ *
7
+ * Why this is in the kernel rather than in each product: the alternative is two
8
+ * registries that describe the same provider differently, and the first time they
9
+ * disagree the run keeps going with whichever one happened to be consulted. The
10
+ * registration is metadata — who provides what, and what they need to do it — never
11
+ * the judgement itself, which stays in the engine and the reviewers.
12
+ */
13
+ export const PROVIDER_SCHEMA_VERSION = "iterate.provider/0.1";
14
+ export const PROVIDER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
15
+ export const PROVIDER_ID_MAX_LENGTH = 64;
16
+ export const PROVIDER_METHOD_MAX = 32;
17
+ export const ProviderKindSchema = z.enum(["ae-diagnosis", "report-render", "evidence-source"]);
18
+ export const ProviderMethodSchema = z.strictObject({
19
+ name: z.string().regex(PROVIDER_ID_PATTERN).max(PROVIDER_ID_MAX_LENGTH),
20
+ /**
21
+ * What this method needs to run: capability names, not booleans per capability,
22
+ * so adding one does not require widening a schema on both sides. An empty list
23
+ * means "no prerequisites", which is a claim the provider has to make.
24
+ */
25
+ requires: z.array(z.string().regex(PROVIDER_ID_PATTERN).max(PROVIDER_ID_MAX_LENGTH)).max(16)
26
+ });
27
+ export const ProviderRegistrationSchema = z
28
+ .strictObject({
29
+ schemaVersion: z.literal(PROVIDER_SCHEMA_VERSION),
30
+ id: z.string().regex(PROVIDER_ID_PATTERN).max(PROVIDER_ID_MAX_LENGTH),
31
+ kind: ProviderKindSchema,
32
+ version: z.string().min(1).max(64),
33
+ /** Where it came from, so a consumer can tell first-party from installed. */
34
+ origin: z.enum(["kernel", "glasspane", "iterate", "plugin"]).optional(),
35
+ methods: z.array(ProviderMethodSchema).min(1).max(PROVIDER_METHOD_MAX)
36
+ })
37
+ .superRefine((provider, ctx) => {
38
+ const seen = new Set();
39
+ provider.methods.forEach((method, index) => {
40
+ if (seen.has(method.name)) {
41
+ ctx.addIssue({
42
+ code: z.ZodIssueCode.custom,
43
+ path: ["methods", index, "name"],
44
+ message: `method "${method.name}" is declared twice; a second declaration cannot override the first silently`
45
+ });
46
+ }
47
+ seen.add(method.name);
48
+ });
49
+ });
50
+ export const PROVIDER_CODES = {
51
+ duplicateId: "KERNEL_E_PROVIDER_DUPLICATE",
52
+ unknown: "KERNEL_E_PROVIDER_UNKNOWN",
53
+ missingMethod: "KERNEL_E_PROVIDER_METHOD"
54
+ };
55
+ export class KernelProviderError extends Error {
56
+ code;
57
+ providerId;
58
+ remedy;
59
+ constructor(code, providerId, message, remedy) {
60
+ super(`${code}: ${message}`);
61
+ this.name = "KernelProviderError";
62
+ this.code = code;
63
+ this.providerId = providerId;
64
+ this.remedy = remedy;
65
+ }
66
+ }
67
+ export function emptyProviderRegistry() {
68
+ return {};
69
+ }
70
+ function registeredIds(registry) {
71
+ const ids = Object.keys(registry).sort();
72
+ return ids.length > 0 ? ids.join(", ") : "(none registered)";
73
+ }
74
+ /**
75
+ * Add a provider, refusing to overwrite one.
76
+ *
77
+ * Returns a new registry rather than mutating: a half-applied registration (added to
78
+ * one map, rejected by the next) is how a provider disappears between two shells.
79
+ * Overwriting is refused rather than last-write-wins, because in a two-harness
80
+ * ecosystem a silent override means one product runs a provider the other never saw.
81
+ */
82
+ export function registerProvider(registry, provider) {
83
+ const checked = ProviderRegistrationSchema.safeParse(provider);
84
+ if (!checked.success) {
85
+ throw schemaErrorFrom("provider registration", checked.error);
86
+ }
87
+ const parsed = checked.data;
88
+ if (Object.prototype.hasOwnProperty.call(registry, parsed.id)) {
89
+ throw new KernelProviderError(PROVIDER_CODES.duplicateId, parsed.id, `provider "${parsed.id}" is already registered`, "choose a distinct id, or replace the registration explicitly rather than by order of appearance");
90
+ }
91
+ return { ...registry, [parsed.id]: parsed };
92
+ }
93
+ /** Look a provider up. No default, no fuzzy match, no "the only one registered". */
94
+ export function resolveProvider(registry, id) {
95
+ const provider = registry[id];
96
+ if (!provider) {
97
+ throw new KernelProviderError(PROVIDER_CODES.unknown, id, `no provider registered under "${id}"`, `registered: ${registeredIds(registry)}`);
98
+ }
99
+ return provider;
100
+ }
101
+ export function requireMethod(registry, id, method) {
102
+ const provider = resolveProvider(registry, id);
103
+ const found = provider.methods.find((entry) => entry.name === method);
104
+ if (!found) {
105
+ throw new KernelProviderError(PROVIDER_CODES.missingMethod, id, `provider "${id}" does not offer "${method}"`, `it offers: ${provider.methods.map((entry) => entry.name).join(", ")}`);
106
+ }
107
+ return found;
108
+ }
109
+ /**
110
+ * Assert two registries do not shadow each other.
111
+ *
112
+ * Each harness keeps its own providers; what must not happen is the same id meaning
113
+ * two different things across the boundary, because then "the AE provider" names a
114
+ * different judgement in each product while both look satisfied.
115
+ */
116
+ export function providerIdsInCommon(a, b) {
117
+ return Object.keys(a).filter((id) => Object.prototype.hasOwnProperty.call(b, id)).sort();
118
+ }
119
+ //# sourceMappingURL=provider-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-registration.js","sourceRoot":"","sources":["../src/provider-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAA+B,CAAC;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAG/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACvE;;;;OAIG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CA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AAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAmB,EAAE,CAAmB;IAC1E,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3F,CAAC"}
package/dist/schemas.d.ts CHANGED
@@ -2,6 +2,10 @@ export declare const EVIDENCE_PACK_SCHEMA_ID: "https://schemas.iterate.dev/evide
2
2
  export declare const DECISION_LOG_ENTRY_SCHEMA_ID: "https://schemas.iterate.dev/decision-log-entry-0.1-draft.json";
3
3
  export declare const RECIPE_CONFIG_SCHEMA_ID: "https://schemas.iterate.dev/recipe-config-0.1-draft.json";
4
4
  export declare const RUN_PLAN_SCHEMA_ID: "https://schemas.iterate.dev/run-plan-0.1.json";
5
+ export declare const INVARIANT_REPORT_SCHEMA_ID: "https://schemas.iterate.dev/invariant-report-0.1.json";
6
+ export declare const REVERIFICATION_REQUEST_SCHEMA_ID: "https://schemas.iterate.dev/reverification-request-0.1.json";
7
+ export declare const CONVERGENCE_ROUND_STATE_SCHEMA_ID: "https://schemas.iterate.dev/convergence-round-state-0.1.json";
8
+ export declare const PROVIDER_REGISTRATION_SCHEMA_ID: "https://schemas.iterate.dev/provider-registration-0.1.json";
5
9
  export interface JsonSchemaObject {
6
10
  readonly $id: string;
7
11
  readonly [key: string]: unknown;
@@ -10,4 +14,8 @@ export declare const EVIDENCE_PACK_JSON_SCHEMA: JsonSchemaObject;
10
14
  export declare const DECISION_LOG_ENTRY_JSON_SCHEMA: JsonSchemaObject;
11
15
  export declare const RECIPE_CONFIG_JSON_SCHEMA: JsonSchemaObject;
12
16
  export declare const RUN_PLAN_JSON_SCHEMA: JsonSchemaObject;
17
+ export declare const INVARIANT_REPORT_JSON_SCHEMA: JsonSchemaObject;
18
+ export declare const REVERIFICATION_REQUEST_JSON_SCHEMA: JsonSchemaObject;
19
+ export declare const CONVERGENCE_ROUND_STATE_JSON_SCHEMA: JsonSchemaObject;
20
+ export declare const PROVIDER_REGISTRATION_JSON_SCHEMA: JsonSchemaObject;
13
21
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB,EAClC,oDAA6D,CAAC;AAChE,eAAO,MAAM,4BAA4B,EACvC,+DAAwE,CAAC;AAC3E,eAAO,MAAM,uBAAuB,EAClC,0DAAmE,CAAC;AACtE,eAAO,MAAM,kBAAkB,EAC7B,+CAAwD,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAMD,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,gBAE5C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,gBAElC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,uBAAuB,EAClC,oDAA6D,CAAC;AAChE,eAAO,MAAM,4BAA4B,EACvC,+DAAwE,CAAC;AAC3E,eAAO,MAAM,uBAAuB,EAClC,0DAAmE,CAAC;AACtE,eAAO,MAAM,kBAAkB,EAC7B,+CAAwD,CAAC;AAC3D,eAAO,MAAM,0BAA0B,EACrC,uDAAgE,CAAC;AACnE,eAAO,MAAM,gCAAgC,EAC3C,6DAAsE,CAAC;AACzE,eAAO,MAAM,iCAAiC,EAC5C,8DAAuE,CAAC;AAC1E,eAAO,MAAM,+BAA+B,EAC1C,4DAAqE,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAMD,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,gBAE5C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBAEvC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,gBAElC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,gBAE1C,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,gBAEhD,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,gBAEjD,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,gBAE/C,CAAC"}
package/dist/schemas.js CHANGED
@@ -11,6 +11,10 @@ export const EVIDENCE_PACK_SCHEMA_ID = "https://schemas.iterate.dev/evidence-pac
11
11
  export const DECISION_LOG_ENTRY_SCHEMA_ID = "https://schemas.iterate.dev/decision-log-entry-0.1-draft.json";
12
12
  export const RECIPE_CONFIG_SCHEMA_ID = "https://schemas.iterate.dev/recipe-config-0.1-draft.json";
13
13
  export const RUN_PLAN_SCHEMA_ID = "https://schemas.iterate.dev/run-plan-0.1.json";
14
+ export const INVARIANT_REPORT_SCHEMA_ID = "https://schemas.iterate.dev/invariant-report-0.1.json";
15
+ export const REVERIFICATION_REQUEST_SCHEMA_ID = "https://schemas.iterate.dev/reverification-request-0.1.json";
16
+ export const CONVERGENCE_ROUND_STATE_SCHEMA_ID = "https://schemas.iterate.dev/convergence-round-state-0.1.json";
17
+ export const PROVIDER_REGISTRATION_SCHEMA_ID = "https://schemas.iterate.dev/provider-registration-0.1.json";
14
18
  function loadSchema(relativePath) {
15
19
  return nodeRequire(relativePath);
16
20
  }
@@ -18,4 +22,8 @@ export const EVIDENCE_PACK_JSON_SCHEMA = loadSchema("../schemas/evidence-pack.sc
18
22
  export const DECISION_LOG_ENTRY_JSON_SCHEMA = loadSchema("../schemas/decision-log-entry.schema.json");
19
23
  export const RECIPE_CONFIG_JSON_SCHEMA = loadSchema("../schemas/recipe-config.schema.json");
20
24
  export const RUN_PLAN_JSON_SCHEMA = loadSchema("../schemas/run-plan.schema.json");
25
+ export const INVARIANT_REPORT_JSON_SCHEMA = loadSchema("../schemas/invariant-report.schema.json");
26
+ export const REVERIFICATION_REQUEST_JSON_SCHEMA = loadSchema("../schemas/reverification-request.schema.json");
27
+ export const CONVERGENCE_ROUND_STATE_JSON_SCHEMA = loadSchema("../schemas/convergence-round-state.schema.json");
28
+ export const PROVIDER_REGISTRATION_JSON_SCHEMA = loadSchema("../schemas/provider-registration.schema.json");
21
29
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,uBAAuB,GAClC,oDAA6D,CAAC;AAChE,MAAM,CAAC,MAAM,4BAA4B,GACvC,+DAAwE,CAAC;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAClC,0DAAmE,CAAC;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,+CAAwD,CAAC;AAO3D,SAAS,UAAU,CAAC,YAAoB;IACtC,OAAO,WAAW,CAAC,YAAY,CAAqB,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAqB,UAAU,CACnE,sCAAsC,CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAqB,UAAU,CACxE,2CAA2C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tE,yCAAyC,CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAqB,UAAU,CAC5E,+CAA+C,CAChD,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAqB,UAAU,CAC7E,gDAAgD,CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAqB,UAAU,CAC3E,8CAA8C,CAC/C,CAAC"}
@@ -0,0 +1,252 @@
1
+ {
2
+ "comment": "Cross-implementation anchor for the convergence rules (kernel/src/convergence.ts): given what a round states about itself, what the loop does next (5.7 R40 scenario 4). This is policy arithmetic over verdicts somebody else produced — nothing here verifies anything. Rules a second implementation must reproduce, stated here so it need not read the TypeScript: (1) the input object is `iterate.convergence/0.1` (the version key is optional) with required `round` (integer >=1), `maxRounds` (integer >=1), `invariantState` in `pass|fail|error|unmeasured`, `openFindings` (integer >=0), `evidenceComplete` (boolean), `breakerLevel` (integer 0..3, where 3 is tripped); no other keys. (2) PRECEDENCE, first match wins: breakerLevel >= 3 -> halt, reason `circuit-breaker-tripped`; round >= maxRounds -> halt, reason `round-budget-exhausted`; invariantState `error` -> halt, reason `invariant-check-errored`; openFindings > 0 -> fix, reason `open-findings`; invariantState `fail` -> fix, reason `invariants-failed`; evidenceComplete false -> verify, reason `evidence-incomplete`; invariantState `unmeasured` -> verify, reason `invariants-unmeasured`; otherwise -> converged, reason `all-gates-green`. (3) WHY that order: a limit the harness set on itself is not the app's failure, so the breaker halts before anything is counted; the budget is checked before the work so a run cannot buy another round by re-reporting findings it already had; a check that errored yields no verdict, and retrying it is the runner's job, not the loop's; `verify` rather than `converged` for unlooked-or-unmeasured states is the whole point — 'we could not look' and 'we looked and it holds' must not collapse into the same line. (4) The decision echoes `round` and `maxRounds` unchanged, so a ledger line says which round was judged. (5) `breakerLevel` is the engine's own circuit-breaker level for the run; 3 is the policy limit, which is why the range stops there. PROVENANCE: max_rounds 7 is the repo's own `config/iterate.config.yaml`; the breaker ceiling of 3 is `CircuitBreakerLevelSchema` in the evidence-pack contract; each case below states its inputs and the reason the precedence gives, and the expected values were derived from the rule text in this file — not by running the TypeScript.",
3
+ "input": {
4
+ "schemaVersion": "iterate.convergence/0.1",
5
+ "round": 3,
6
+ "maxRounds": 7,
7
+ "invariantState": "pass",
8
+ "openFindings": 0,
9
+ "evidenceComplete": true,
10
+ "breakerLevel": 0
11
+ },
12
+ "expectedDecision": {
13
+ "action": "converged",
14
+ "reason": "all-gates-green",
15
+ "round": 3,
16
+ "maxRounds": 7
17
+ },
18
+ "cases": [
19
+ {
20
+ "name": "breaker-tripped-beats-a-clean-round",
21
+ "state": {
22
+ "round": 1,
23
+ "maxRounds": 7,
24
+ "invariantState": "pass",
25
+ "openFindings": 0,
26
+ "evidenceComplete": true,
27
+ "breakerLevel": 3
28
+ },
29
+ "expect": {
30
+ "action": "halt",
31
+ "reason": "circuit-breaker-tripped",
32
+ "round": 1,
33
+ "maxRounds": 7
34
+ }
35
+ },
36
+ {
37
+ "name": "budget-spent-beats-open-findings",
38
+ "state": {
39
+ "round": 7,
40
+ "maxRounds": 7,
41
+ "invariantState": "fail",
42
+ "openFindings": 2,
43
+ "evidenceComplete": true,
44
+ "breakerLevel": 0
45
+ },
46
+ "expect": {
47
+ "action": "halt",
48
+ "reason": "round-budget-exhausted",
49
+ "round": 7,
50
+ "maxRounds": 7
51
+ }
52
+ },
53
+ {
54
+ "name": "errored-check-beats-open-findings",
55
+ "state": {
56
+ "round": 3,
57
+ "maxRounds": 7,
58
+ "invariantState": "error",
59
+ "openFindings": 1,
60
+ "evidenceComplete": false,
61
+ "breakerLevel": 0
62
+ },
63
+ "expect": {
64
+ "action": "halt",
65
+ "reason": "invariant-check-errored",
66
+ "round": 3,
67
+ "maxRounds": 7
68
+ }
69
+ },
70
+ {
71
+ "name": "open-findings-beats-failed-invariants",
72
+ "state": {
73
+ "round": 2,
74
+ "maxRounds": 7,
75
+ "invariantState": "fail",
76
+ "openFindings": 1,
77
+ "evidenceComplete": true,
78
+ "breakerLevel": 0
79
+ },
80
+ "expect": {
81
+ "action": "fix",
82
+ "reason": "open-findings",
83
+ "round": 2,
84
+ "maxRounds": 7
85
+ }
86
+ },
87
+ {
88
+ "name": "failed-invariants-with-no-findings-still-fix",
89
+ "state": {
90
+ "round": 2,
91
+ "maxRounds": 7,
92
+ "invariantState": "fail",
93
+ "openFindings": 0,
94
+ "evidenceComplete": true,
95
+ "breakerLevel": 0
96
+ },
97
+ "expect": {
98
+ "action": "fix",
99
+ "reason": "invariants-failed",
100
+ "round": 2,
101
+ "maxRounds": 7
102
+ }
103
+ },
104
+ {
105
+ "name": "pass-with-incomplete-evidence-is-not-converged",
106
+ "state": {
107
+ "round": 2,
108
+ "maxRounds": 7,
109
+ "invariantState": "pass",
110
+ "openFindings": 0,
111
+ "evidenceComplete": false,
112
+ "breakerLevel": 0
113
+ },
114
+ "expect": {
115
+ "action": "verify",
116
+ "reason": "evidence-incomplete",
117
+ "round": 2,
118
+ "maxRounds": 7
119
+ }
120
+ },
121
+ {
122
+ "name": "incomplete-evidence-beats-unmeasured-invariants",
123
+ "state": {
124
+ "round": 2,
125
+ "maxRounds": 7,
126
+ "invariantState": "unmeasured",
127
+ "openFindings": 0,
128
+ "evidenceComplete": false,
129
+ "breakerLevel": 0
130
+ },
131
+ "expect": {
132
+ "action": "verify",
133
+ "reason": "evidence-incomplete",
134
+ "round": 2,
135
+ "maxRounds": 7
136
+ }
137
+ },
138
+ {
139
+ "name": "unmeasured-invariants-with-evidence",
140
+ "state": {
141
+ "round": 2,
142
+ "maxRounds": 7,
143
+ "invariantState": "unmeasured",
144
+ "openFindings": 0,
145
+ "evidenceComplete": true,
146
+ "breakerLevel": 0
147
+ },
148
+ "expect": {
149
+ "action": "verify",
150
+ "reason": "invariants-unmeasured",
151
+ "round": 2,
152
+ "maxRounds": 7
153
+ }
154
+ },
155
+ {
156
+ "name": "breaker-level-two-is-not-tripped",
157
+ "state": {
158
+ "round": 2,
159
+ "maxRounds": 7,
160
+ "invariantState": "pass",
161
+ "openFindings": 0,
162
+ "evidenceComplete": true,
163
+ "breakerLevel": 2
164
+ },
165
+ "expect": {
166
+ "action": "converged",
167
+ "reason": "all-gates-green",
168
+ "round": 2,
169
+ "maxRounds": 7
170
+ }
171
+ },
172
+ {
173
+ "name": "zero-round",
174
+ "state": {
175
+ "round": 0,
176
+ "maxRounds": 7,
177
+ "invariantState": "pass",
178
+ "openFindings": 0,
179
+ "evidenceComplete": true,
180
+ "breakerLevel": 0
181
+ },
182
+ "expect": "refused",
183
+ "path": "round"
184
+ },
185
+ {
186
+ "name": "breaker-level-out-of-range",
187
+ "state": {
188
+ "round": 1,
189
+ "maxRounds": 7,
190
+ "invariantState": "pass",
191
+ "openFindings": 0,
192
+ "evidenceComplete": true,
193
+ "breakerLevel": 4
194
+ },
195
+ "expect": "refused",
196
+ "path": "breakerLevel"
197
+ },
198
+ {
199
+ "name": "unknown-invariant-state",
200
+ "state": {
201
+ "round": 1,
202
+ "maxRounds": 7,
203
+ "invariantState": "probably",
204
+ "openFindings": 0,
205
+ "evidenceComplete": true,
206
+ "breakerLevel": 0
207
+ },
208
+ "expect": "refused",
209
+ "path": "invariantState"
210
+ },
211
+ {
212
+ "name": "missing-evidence-complete",
213
+ "state": {
214
+ "round": 1,
215
+ "maxRounds": 7,
216
+ "invariantState": "pass",
217
+ "openFindings": 0,
218
+ "breakerLevel": 0
219
+ },
220
+ "expect": "refused",
221
+ "path": "evidenceComplete"
222
+ },
223
+ {
224
+ "name": "negative-findings",
225
+ "state": {
226
+ "round": 1,
227
+ "maxRounds": 7,
228
+ "invariantState": "pass",
229
+ "openFindings": -1,
230
+ "evidenceComplete": true,
231
+ "breakerLevel": 0
232
+ },
233
+ "expect": "refused",
234
+ "path": "openFindings"
235
+ },
236
+ {
237
+ "name": "invented-key",
238
+ "state": {
239
+ "round": 1,
240
+ "maxRounds": 7,
241
+ "invariantState": "pass",
242
+ "openFindings": 0,
243
+ "evidenceComplete": true,
244
+ "breakerLevel": 0,
245
+ "confidence": 0.9
246
+ },
247
+ "expect": "refused",
248
+ "path": "",
249
+ "messageIncludes": "confidence"
250
+ }
251
+ ]
252
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "entryId": "dl_0123456789ABCDEFGHJKMNPQRT",
3
+ "sequence": 2,
4
+ "prevEntryHash": "5f9c1e7b0a3d6c8e2b4f1a0c3d5e7f9a1b3c5d7e9f0a2b4c6d8e0f1a3b5c7d9e",
5
+ "operationId": "op_0123456789ABCDEFGHJKMNPQRT",
6
+ "summary": "review_result(round 3): 2 findings, 1 blocking, across 2 dimensions",
7
+ "outcome": "fail",
8
+ "createdAt": "2026-10-11T02:28:11.042Z",
9
+ "kind": "review_result",
10
+ "round": 3,
11
+ "dimension": "ui-consistency",
12
+ "payload": {
13
+ "findings": [
14
+ { "dimension": "ui-consistency", "file": "src/client/index.ts", "severity": "medium", "summary": "hard-coded colour outside the token set" },
15
+ { "dimension": "accessibility", "file": "src/client/index.ts", "severity": "blocking", "summary": "focus ring removed" }
16
+ ],
17
+ "blocking": 1,
18
+ "dimensionsWithoutFindings": ["performance"]
19
+ }
20
+ }