@gate-forge/core 0.1.0

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 (242) hide show
  1. package/LICENSE +202 -0
  2. package/dist/baselines/adoption.d.ts +76 -0
  3. package/dist/baselines/adoption.d.ts.map +1 -0
  4. package/dist/baselines/adoption.js +163 -0
  5. package/dist/baselines/adoption.js.map +1 -0
  6. package/dist/baselines/index.d.ts +102 -0
  7. package/dist/baselines/index.d.ts.map +1 -0
  8. package/dist/baselines/index.js +186 -0
  9. package/dist/baselines/index.js.map +1 -0
  10. package/dist/canonical-json.d.ts +51 -0
  11. package/dist/canonical-json.d.ts.map +1 -0
  12. package/dist/canonical-json.js +112 -0
  13. package/dist/canonical-json.js.map +1 -0
  14. package/dist/classifier/bind.d.ts +64 -0
  15. package/dist/classifier/bind.d.ts.map +1 -0
  16. package/dist/classifier/bind.js +188 -0
  17. package/dist/classifier/bind.js.map +1 -0
  18. package/dist/classifier/classify.d.ts +154 -0
  19. package/dist/classifier/classify.d.ts.map +1 -0
  20. package/dist/classifier/classify.js +1207 -0
  21. package/dist/classifier/classify.js.map +1 -0
  22. package/dist/classifier/glob.d.ts +48 -0
  23. package/dist/classifier/glob.d.ts.map +1 -0
  24. package/dist/classifier/glob.js +104 -0
  25. package/dist/classifier/glob.js.map +1 -0
  26. package/dist/classifier/index.d.ts +10 -0
  27. package/dist/classifier/index.d.ts.map +1 -0
  28. package/dist/classifier/index.js +21 -0
  29. package/dist/classifier/index.js.map +1 -0
  30. package/dist/classifier/schema.d.ts +150 -0
  31. package/dist/classifier/schema.d.ts.map +1 -0
  32. package/dist/classifier/schema.js +139 -0
  33. package/dist/classifier/schema.js.map +1 -0
  34. package/dist/config/index.d.ts +259 -0
  35. package/dist/config/index.d.ts.map +1 -0
  36. package/dist/config/index.js +523 -0
  37. package/dist/config/index.js.map +1 -0
  38. package/dist/fingerprints.d.ts +56 -0
  39. package/dist/fingerprints.d.ts.map +1 -0
  40. package/dist/fingerprints.js +59 -0
  41. package/dist/fingerprints.js.map +1 -0
  42. package/dist/graph/build.d.ts +16 -0
  43. package/dist/graph/build.d.ts.map +1 -0
  44. package/dist/graph/build.js +423 -0
  45. package/dist/graph/build.js.map +1 -0
  46. package/dist/graph/index.d.ts +12 -0
  47. package/dist/graph/index.d.ts.map +1 -0
  48. package/dist/graph/index.js +10 -0
  49. package/dist/graph/index.js.map +1 -0
  50. package/dist/graph/schema.d.ts +448 -0
  51. package/dist/graph/schema.d.ts.map +1 -0
  52. package/dist/graph/schema.js +237 -0
  53. package/dist/graph/schema.js.map +1 -0
  54. package/dist/graph/symbols.d.ts +129 -0
  55. package/dist/graph/symbols.d.ts.map +1 -0
  56. package/dist/graph/symbols.js +177 -0
  57. package/dist/graph/symbols.js.map +1 -0
  58. package/dist/graph/util.d.ts +40 -0
  59. package/dist/graph/util.d.ts.map +1 -0
  60. package/dist/graph/util.js +41 -0
  61. package/dist/graph/util.js.map +1 -0
  62. package/dist/index.d.ts +683 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +563 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/mapping/resolve.d.ts +177 -0
  67. package/dist/mapping/resolve.d.ts.map +1 -0
  68. package/dist/mapping/resolve.js +523 -0
  69. package/dist/mapping/resolve.js.map +1 -0
  70. package/dist/policy/coverage.d.ts +79 -0
  71. package/dist/policy/coverage.d.ts.map +1 -0
  72. package/dist/policy/coverage.js +119 -0
  73. package/dist/policy/coverage.js.map +1 -0
  74. package/dist/policy/evaluate.d.ts +275 -0
  75. package/dist/policy/evaluate.d.ts.map +1 -0
  76. package/dist/policy/evaluate.js +382 -0
  77. package/dist/policy/evaluate.js.map +1 -0
  78. package/dist/policy/index.d.ts +15 -0
  79. package/dist/policy/index.d.ts.map +1 -0
  80. package/dist/policy/index.js +14 -0
  81. package/dist/policy/index.js.map +1 -0
  82. package/dist/policy/trusted.d.ts +59 -0
  83. package/dist/policy/trusted.d.ts.map +1 -0
  84. package/dist/policy/trusted.js +96 -0
  85. package/dist/policy/trusted.js.map +1 -0
  86. package/dist/provenance.d.ts +170 -0
  87. package/dist/provenance.d.ts.map +1 -0
  88. package/dist/provenance.js +306 -0
  89. package/dist/provenance.js.map +1 -0
  90. package/dist/receipt/index.d.ts +74 -0
  91. package/dist/receipt/index.d.ts.map +1 -0
  92. package/dist/receipt/index.js +154 -0
  93. package/dist/receipt/index.js.map +1 -0
  94. package/dist/report/index.d.ts +100 -0
  95. package/dist/report/index.d.ts.map +1 -0
  96. package/dist/report/index.js +355 -0
  97. package/dist/report/index.js.map +1 -0
  98. package/dist/schemas/adoption.d.ts +40 -0
  99. package/dist/schemas/adoption.d.ts.map +1 -0
  100. package/dist/schemas/adoption.js +87 -0
  101. package/dist/schemas/adoption.js.map +1 -0
  102. package/dist/schemas/baseline.d.ts +19 -0
  103. package/dist/schemas/baseline.d.ts.map +1 -0
  104. package/dist/schemas/baseline.js +45 -0
  105. package/dist/schemas/baseline.js.map +1 -0
  106. package/dist/schemas/claim.d.ts +32 -0
  107. package/dist/schemas/claim.d.ts.map +1 -0
  108. package/dist/schemas/claim.js +34 -0
  109. package/dist/schemas/claim.js.map +1 -0
  110. package/dist/schemas/classification-policy.d.ts +84 -0
  111. package/dist/schemas/classification-policy.d.ts.map +1 -0
  112. package/dist/schemas/classification-policy.js +130 -0
  113. package/dist/schemas/classification-policy.js.map +1 -0
  114. package/dist/schemas/classification-signal.d.ts +125 -0
  115. package/dist/schemas/classification-signal.d.ts.map +1 -0
  116. package/dist/schemas/classification-signal.js +126 -0
  117. package/dist/schemas/classification-signal.js.map +1 -0
  118. package/dist/schemas/classification.d.ts +120 -0
  119. package/dist/schemas/classification.d.ts.map +1 -0
  120. package/dist/schemas/classification.js +154 -0
  121. package/dist/schemas/classification.js.map +1 -0
  122. package/dist/schemas/common.d.ts +73 -0
  123. package/dist/schemas/common.d.ts.map +1 -0
  124. package/dist/schemas/common.js +60 -0
  125. package/dist/schemas/common.js.map +1 -0
  126. package/dist/schemas/coverage-policy.d.ts +89 -0
  127. package/dist/schemas/coverage-policy.d.ts.map +1 -0
  128. package/dist/schemas/coverage-policy.js +81 -0
  129. package/dist/schemas/coverage-policy.js.map +1 -0
  130. package/dist/schemas/evidence.d.ts +65 -0
  131. package/dist/schemas/evidence.d.ts.map +1 -0
  132. package/dist/schemas/evidence.js +64 -0
  133. package/dist/schemas/evidence.js.map +1 -0
  134. package/dist/schemas/execution-result.d.ts +214 -0
  135. package/dist/schemas/execution-result.d.ts.map +1 -0
  136. package/dist/schemas/execution-result.js +240 -0
  137. package/dist/schemas/execution-result.js.map +1 -0
  138. package/dist/schemas/gate-receipt.d.ts +86 -0
  139. package/dist/schemas/gate-receipt.d.ts.map +1 -0
  140. package/dist/schemas/gate-receipt.js +193 -0
  141. package/dist/schemas/gate-receipt.js.map +1 -0
  142. package/dist/schemas/index.d.ts +22 -0
  143. package/dist/schemas/index.d.ts.map +1 -0
  144. package/dist/schemas/index.js +22 -0
  145. package/dist/schemas/index.js.map +1 -0
  146. package/dist/schemas/obligation.d.ts +37 -0
  147. package/dist/schemas/obligation.d.ts.map +1 -0
  148. package/dist/schemas/obligation.js +46 -0
  149. package/dist/schemas/obligation.js.map +1 -0
  150. package/dist/schemas/plugin.d.ts +19 -0
  151. package/dist/schemas/plugin.d.ts.map +1 -0
  152. package/dist/schemas/plugin.js +20 -0
  153. package/dist/schemas/plugin.js.map +1 -0
  154. package/dist/schemas/policy.d.ts +73 -0
  155. package/dist/schemas/policy.d.ts.map +1 -0
  156. package/dist/schemas/policy.js +46 -0
  157. package/dist/schemas/policy.js.map +1 -0
  158. package/dist/schemas/resource.d.ts +26 -0
  159. package/dist/schemas/resource.d.ts.map +1 -0
  160. package/dist/schemas/resource.js +29 -0
  161. package/dist/schemas/resource.js.map +1 -0
  162. package/dist/schemas/run-manifest.d.ts +72 -0
  163. package/dist/schemas/run-manifest.d.ts.map +1 -0
  164. package/dist/schemas/run-manifest.js +125 -0
  165. package/dist/schemas/run-manifest.js.map +1 -0
  166. package/dist/schemas/runner-adapter.d.ts +169 -0
  167. package/dist/schemas/runner-adapter.d.ts.map +1 -0
  168. package/dist/schemas/runner-adapter.js +2 -0
  169. package/dist/schemas/runner-adapter.js.map +1 -0
  170. package/dist/schemas/test-catalog.d.ts +472 -0
  171. package/dist/schemas/test-catalog.d.ts.map +1 -0
  172. package/dist/schemas/test-catalog.js +311 -0
  173. package/dist/schemas/test-catalog.js.map +1 -0
  174. package/dist/schemas/test-map.d.ts +99 -0
  175. package/dist/schemas/test-map.d.ts.map +1 -0
  176. package/dist/schemas/test-map.js +103 -0
  177. package/dist/schemas/test-map.js.map +1 -0
  178. package/dist/schemas/verdict.d.ts +73 -0
  179. package/dist/schemas/verdict.d.ts.map +1 -0
  180. package/dist/schemas/verdict.js +92 -0
  181. package/dist/schemas/verdict.js.map +1 -0
  182. package/dist/schemas/waiver.d.ts +36 -0
  183. package/dist/schemas/waiver.d.ts.map +1 -0
  184. package/dist/schemas/waiver.js +42 -0
  185. package/dist/schemas/waiver.js.map +1 -0
  186. package/dist/supervision/index.d.ts +170 -0
  187. package/dist/supervision/index.d.ts.map +1 -0
  188. package/dist/supervision/index.js +354 -0
  189. package/dist/supervision/index.js.map +1 -0
  190. package/dist/testing/clock.d.ts +50 -0
  191. package/dist/testing/clock.d.ts.map +1 -0
  192. package/dist/testing/clock.js +75 -0
  193. package/dist/testing/clock.js.map +1 -0
  194. package/dist/testing/env.d.ts +66 -0
  195. package/dist/testing/env.d.ts.map +1 -0
  196. package/dist/testing/env.js +106 -0
  197. package/dist/testing/env.js.map +1 -0
  198. package/dist/testing/gate-runner.d.ts +141 -0
  199. package/dist/testing/gate-runner.d.ts.map +1 -0
  200. package/dist/testing/gate-runner.js +173 -0
  201. package/dist/testing/gate-runner.js.map +1 -0
  202. package/dist/testing/gf19.d.ts +106 -0
  203. package/dist/testing/gf19.d.ts.map +1 -0
  204. package/dist/testing/gf19.js +282 -0
  205. package/dist/testing/gf19.js.map +1 -0
  206. package/dist/testing/index.d.ts +20 -0
  207. package/dist/testing/index.d.ts.map +1 -0
  208. package/dist/testing/index.js +14 -0
  209. package/dist/testing/index.js.map +1 -0
  210. package/dist/testing/red-probe.d.ts +138 -0
  211. package/dist/testing/red-probe.d.ts.map +1 -0
  212. package/dist/testing/red-probe.js +251 -0
  213. package/dist/testing/red-probe.js.map +1 -0
  214. package/dist/testing/temp-repo.d.ts +126 -0
  215. package/dist/testing/temp-repo.d.ts.map +1 -0
  216. package/dist/testing/temp-repo.js +214 -0
  217. package/dist/testing/temp-repo.js.map +1 -0
  218. package/dist/verdict/cause.d.ts +99 -0
  219. package/dist/verdict/cause.d.ts.map +1 -0
  220. package/dist/verdict/cause.js +206 -0
  221. package/dist/verdict/cause.js.map +1 -0
  222. package/dist/verdict/evaluate.d.ts +135 -0
  223. package/dist/verdict/evaluate.d.ts.map +1 -0
  224. package/dist/verdict/evaluate.js +1513 -0
  225. package/dist/verdict/evaluate.js.map +1 -0
  226. package/dist/verdict/index.d.ts +21 -0
  227. package/dist/verdict/index.d.ts.map +1 -0
  228. package/dist/verdict/index.js +20 -0
  229. package/dist/verdict/index.js.map +1 -0
  230. package/dist/verdict/pack-verifiers.d.ts +97 -0
  231. package/dist/verdict/pack-verifiers.d.ts.map +1 -0
  232. package/dist/verdict/pack-verifiers.js +763 -0
  233. package/dist/verdict/pack-verifiers.js.map +1 -0
  234. package/dist/verdict/registry.d.ts +180 -0
  235. package/dist/verdict/registry.d.ts.map +1 -0
  236. package/dist/verdict/registry.js +67 -0
  237. package/dist/verdict/registry.js.map +1 -0
  238. package/dist/waivers/index.d.ts +103 -0
  239. package/dist/waivers/index.d.ts.map +1 -0
  240. package/dist/waivers/index.js +192 -0
  241. package/dist/waivers/index.js.map +1 -0
  242. package/package.json +40 -0
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Verdict + UnresolvedReason schemas (ADR 0001 seven verdicts, pin #5
3
+ * unresolved-entry shape). The pure evaluator itself lives in
4
+ * `src/verdict` (G3); these are the frozen data shapes it speaks.
5
+ */
6
+ import { z } from 'zod';
7
+ import { LocationSchema } from './common.js';
8
+ /**
9
+ * The seven verdicts. Blocking (non-clean) verdicts: `missing`,
10
+ * `invalid`, `unclassified`, `unresolved`, `stale`. Clean: `satisfied`,
11
+ * `waived`.
12
+ */
13
+ export const VerdictSchema = z.enum([
14
+ 'satisfied',
15
+ 'missing',
16
+ 'invalid',
17
+ 'unclassified',
18
+ 'unresolved',
19
+ 'waived',
20
+ 'stale',
21
+ ]);
22
+ /** Machine-readable reason attached to `unresolved` verdicts. */
23
+ export const UnresolvedReasonSchema = z
24
+ .object({
25
+ /** Short stable code, e.g. `no_tablename_source`, `E_TIMEOUT`. */
26
+ code: z.string().min(1),
27
+ /** Single-cause human explanation (no stack dumps). */
28
+ detail: z.string().min(1),
29
+ /** Source location the reason points at. */
30
+ location: LocationSchema,
31
+ })
32
+ .strict();
33
+ /**
34
+ * Stable cause codes for the shared report model (plan §5.4, ADR 0005).
35
+ * Blocking-obligation causes name WHY an obligation is not satisfied and
36
+ * select its next action; the three `DIAGNOSTIC_*` codes are advisory
37
+ * result causes for the separate diagnostic run (plan §3.5) — never
38
+ * obligation verdicts. The seven verdict VALUES are unchanged; causes
39
+ * enrich them without weakening any contract.
40
+ */
41
+ export const CauseCodeSchema = z.enum([
42
+ 'TEST_INVENTORY_INCOMPLETE',
43
+ 'TEST_KIND_UNKNOWN',
44
+ 'TEST_MAPPING_MISSING',
45
+ 'TEST_MAPPING_AMBIGUOUS',
46
+ 'TEST_MAPPING_STALE',
47
+ 'EVIDENCE_NOT_COLLECTED',
48
+ 'VERIFIER_UNSUPPORTED',
49
+ 'TEST_NOT_EXECUTED',
50
+ 'TEST_FAILED',
51
+ 'RUN_INCOMPLETE',
52
+ 'EVIDENCE_STALE',
53
+ 'CHANGE_UNMAPPED',
54
+ 'EVIDENCE_SCOPE_INCOMPLETE',
55
+ 'ENFORCEMENT_UNTRUSTED',
56
+ 'EVIDENCE_VALUE_MISMATCH',
57
+ 'SERVER_PROBE_UNAVAILABLE',
58
+ 'CRUD_COVERAGE_MISSING',
59
+ 'DIAGNOSTIC_TEST_FAILURE',
60
+ 'DIAGNOSTIC_RUN_INCOMPLETE',
61
+ 'DIAGNOSTIC_RESULT_STALE',
62
+ ]);
63
+ /**
64
+ * The plan §5.4 next action per cause code. Text, JSON, and SARIF
65
+ * renderings all carry the same strings so every surface agrees on what
66
+ * to do next.
67
+ */
68
+ export const CAUSE_NEXT_ACTIONS = Object.freeze({
69
+ TEST_INVENTORY_INCOMPLETE: 'Repair discovery or register a supported adapter',
70
+ TEST_KIND_UNKNOWN: 'Inspect and declare its kind',
71
+ TEST_MAPPING_MISSING: 'Run `gateforge tests suggest`, mark the matching test (`gateforge tests mark` / .gateforge/test-map.yml), ' +
72
+ 'map backend-only tables server-e2e, or waive it (`gateforge waive`) — docs/guides/new-table-playbook.md',
73
+ TEST_MAPPING_AMBIGUOUS: 'Correct the exact mapping',
74
+ TEST_MAPPING_STALE: 'Correct the exact mapping',
75
+ EVIDENCE_NOT_COLLECTED: 'Add observation hooks to that test',
76
+ VERIFIER_UNSUPPORTED: 'Implement/configure the observer; do not add duplicate tests',
77
+ TEST_NOT_EXECUTED: 'Run or repair the selected suite',
78
+ TEST_FAILED: 'Run or repair the selected suite',
79
+ RUN_INCOMPLETE: 'Run or repair the selected suite',
80
+ EVIDENCE_STALE: 'Rerun for the exact candidate',
81
+ CHANGE_UNMAPPED: 'Map the behavior or repair detection',
82
+ EVIDENCE_SCOPE_INCOMPLETE: 'Map a test to the uncovered obligation (`gateforge tests mark`) or run full scope ' +
83
+ '(`test-gates --changed` without `--scope changed`)',
84
+ ENFORCEMENT_UNTRUSTED: 'Repair enforcement setup',
85
+ EVIDENCE_VALUE_MISMATCH: 'Fix the mutation path or correct the mapping',
86
+ SERVER_PROBE_UNAVAILABLE: 'Export/repair the adapter server probe (probeServer) so the witness can observe the database engine-side',
87
+ CRUD_COVERAGE_MISSING: 'Connect/mark existing journeys, add the missing journey, or record an owner disposition',
88
+ DIAGNOSTIC_TEST_FAILURE: 'Inspect the named test, assertion, and relevant application code',
89
+ DIAGNOSTIC_RUN_INCOMPLETE: 'Repair the run; an incomplete diagnostic run never displays as passing',
90
+ DIAGNOSTIC_RESULT_STALE: 'Rerun the diagnostic suite for the exact candidate',
91
+ });
92
+ //# sourceMappingURL=verdict.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verdict.js","sourceRoot":"","sources":["../../src/schemas/verdict.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC;IAClC,WAAW;IACX,SAAS;IACT,SAAS;IACT,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,OAAO;CACR,CAAC,CAAC;AAKH,iEAAiE;AACjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,kEAAkE;IAClE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,uDAAuD;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,4CAA4C;IAC5C,QAAQ,EAAE,cAAc;CACzB,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,2BAA2B;IAC3B,mBAAmB;IACnB,sBAAsB;IACtB,wBAAwB;IACxB,oBAAoB;IACpB,wBAAwB;IACxB,sBAAsB;IACtB,mBAAmB;IACnB,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,2BAA2B;IAC3B,uBAAuB;IACvB,yBAAyB;IACzB,0BAA0B;IAC1B,uBAAuB;IACvB,yBAAyB;IACzB,2BAA2B;IAC3B,yBAAyB;CAC1B,CAAC,CAAC;AAKH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwC,MAAM,CAAC,MAAM,CAAC;IACnF,yBAAyB,EAAE,kDAAkD;IAC7E,iBAAiB,EAAE,8BAA8B;IACjD,oBAAoB,EAClB,4GAA4G;QAC5G,yGAAyG;IAC3G,sBAAsB,EAAE,2BAA2B;IACnD,kBAAkB,EAAE,2BAA2B;IAC/C,sBAAsB,EAAE,oCAAoC;IAC5D,oBAAoB,EAAE,8DAA8D;IACpF,iBAAiB,EAAE,kCAAkC;IACrD,WAAW,EAAE,kCAAkC;IAC/C,cAAc,EAAE,kCAAkC;IAClD,cAAc,EAAE,+BAA+B;IAC/C,eAAe,EAAE,sCAAsC;IACvD,yBAAyB,EACvB,oFAAoF;QACpF,oDAAoD;IACtD,qBAAqB,EAAE,0BAA0B;IACjD,uBAAuB,EAAE,8CAA8C;IACvE,wBAAwB,EACtB,0GAA0G;IAC5G,qBAAqB,EACnB,yFAAyF;IAC3F,uBAAuB,EAAE,kEAAkE;IAC3F,yBAAyB,EACvB,wEAAwE;IAC1E,uBAAuB,EAAE,oDAAoD;CAC9E,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Waiver schema (ADR 0001): a time-bounded, justified exception to one
3
+ * exact obligation identity. ALL FIVE mandatory fields are required —
4
+ * a waiver missing any of them is a configuration error, never a
5
+ * partially-applied exception.
6
+ *
7
+ * The five fields: `owner`, `justificationUrl`, `approver`,
8
+ * `scope` (exact `resourceId` + `fingerprint` pair), `expiresAt`.
9
+ * Expired waivers do NOT produce `waived` — they produce `invalid`
10
+ * (verdict engine, pin #9).
11
+ */
12
+ import { z } from 'zod';
13
+ /** Exact-scope reference: one fingerprint of one resource/contract pair. */
14
+ export declare const WaiverScopeSchema: z.ZodObject<{
15
+ kind: z.ZodLiteral<"exact">;
16
+ resourceId: z.ZodString;
17
+ fingerprint: z.ZodString;
18
+ }, z.core.$strict>;
19
+ /** Inferred waiver-scope shape. */
20
+ export type WaiverScope = z.infer<typeof WaiverScopeSchema>;
21
+ /** A fully-specified waiver. */
22
+ export declare const WaiverSchema: z.ZodObject<{
23
+ schemaVersion: z.ZodLiteral<1>;
24
+ owner: z.ZodString;
25
+ justificationUrl: z.ZodURL;
26
+ approver: z.ZodString;
27
+ scope: z.ZodObject<{
28
+ kind: z.ZodLiteral<"exact">;
29
+ resourceId: z.ZodString;
30
+ fingerprint: z.ZodString;
31
+ }, z.core.$strict>;
32
+ expiresAt: z.ZodISODateTime;
33
+ }, z.core.$strict>;
34
+ /** Inferred waiver shape. */
35
+ export type Waiver = z.infer<typeof WaiverSchema>;
36
+ //# sourceMappingURL=waiver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waiver.d.ts","sourceRoot":"","sources":["../../src/schemas/waiver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB;;;;kBAUnB,CAAC;AAEZ,mCAAmC;AACnC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,gCAAgC;AAChC,eAAO,MAAM,YAAY;;;;;;;;;;;kBAcd,CAAC;AAEZ,6BAA6B;AAC7B,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Waiver schema (ADR 0001): a time-bounded, justified exception to one
3
+ * exact obligation identity. ALL FIVE mandatory fields are required —
4
+ * a waiver missing any of them is a configuration error, never a
5
+ * partially-applied exception.
6
+ *
7
+ * The five fields: `owner`, `justificationUrl`, `approver`,
8
+ * `scope` (exact `resourceId` + `fingerprint` pair), `expiresAt`.
9
+ * Expired waivers do NOT produce `waived` — they produce `invalid`
10
+ * (verdict engine, pin #9).
11
+ */
12
+ import { z } from 'zod';
13
+ import { SchemaVersionField } from './common.js';
14
+ /** Exact-scope reference: one fingerprint of one resource/contract pair. */
15
+ export const WaiverScopeSchema = z
16
+ .object({
17
+ kind: z.literal('exact'),
18
+ /** Resource whose obligation is waived. */
19
+ resourceId: z.string().min(1),
20
+ /** Exact obligation fingerprint (pin #2) being waived. */
21
+ fingerprint: z
22
+ .string()
23
+ .regex(/^[0-9a-f]{64}$/, 'fingerprint must be a 64-char lowercase sha256 hex'),
24
+ })
25
+ .strict();
26
+ /** A fully-specified waiver. */
27
+ export const WaiverSchema = z
28
+ .object({
29
+ schemaVersion: SchemaVersionField,
30
+ /** Person/team accountable for the waived obligation. */
31
+ owner: z.string().min(1),
32
+ /** Link to the written justification (ticket, ADR, review). */
33
+ justificationUrl: z.url(),
34
+ /** Named approver who accepted the risk. */
35
+ approver: z.string().min(1),
36
+ /** Exact obligation identity being waived. */
37
+ scope: WaiverScopeSchema,
38
+ /** Expiry instant (ISO-8601); after this the obligation is `invalid`. */
39
+ expiresAt: z.iso.datetime(),
40
+ })
41
+ .strict();
42
+ //# sourceMappingURL=waiver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waiver.js","sourceRoot":"","sources":["../../src/schemas/waiver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,2CAA2C;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,KAAK,CAAC,gBAAgB,EAAE,oDAAoD,CAAC;CACjF,CAAC;KACD,MAAM,EAAE,CAAC;AAKZ,gCAAgC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,aAAa,EAAE,kBAAkB;IACjC,yDAAyD;IACzD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,+DAA+D;IAC/D,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE;IACzB,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,8CAA8C;IAC9C,KAAK,EAAE,iBAAiB;IACxB,yEAAyE;IACzE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CAC5B,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,170 @@
1
+ /** A planned instance (the expected set, fixed before the run). */ export interface PlannedInstanceInput {
2
+ /** Stable logical key (§5.2). */
3
+ logicalKey: string;
4
+ /** Runner project, or null when no enumeration bound one. */
5
+ project: string | null;
6
+ /** Repo-relative posix file (the identity join key). */
7
+ file: string;
8
+ /** Full title path (the identity join key). */
9
+ titlePath: readonly string[];
10
+ /** Blocking annotations observed pre-run (`.skip` / `.only` / `.fixme`). */
11
+ blockingAnnotations: readonly string[];
12
+ /** Present when the runner never enumerated this case (static-only row). */
13
+ unenumeratedReason?: string;
14
+ }
15
+ /** One executed instance outcome (reporter data = input only). */
16
+ export interface ExecutedOutcomeInput {
17
+ /** Stable logical key the executed instance resolved to. */
18
+ logicalKey: string;
19
+ /** Runner project, or null when the runner did not report one. */
20
+ project: string | null;
21
+ /** Repo-relative posix file (the identity join key). */
22
+ file: string;
23
+ /** Full title path (the identity join key). */
24
+ titlePath: readonly string[];
25
+ /** Observed outcome on this attempt. */
26
+ status: 'passed' | 'failed' | 'skipped' | 'fixme' | 'not-run';
27
+ /** Attempt number (1 = first attempt; required retries are zero). */
28
+ attempt: number;
29
+ /** True when the instance was an expected failure (never proves behavior). */
30
+ expectedFailure: boolean;
31
+ }
32
+ /**
33
+ * One witness-recorded session of an expected test (the execution
34
+ * authority, enforcement-review fix 2b). Sessions are minted ONLY by the
35
+ * witness's supervisor channel and sealed at the observed test end, so
36
+ * the suite cannot mint, forge, or unseal one after the fact.
37
+ */
38
+ export interface TracedSession {
39
+ /** Witness-issued session id (UUID). */
40
+ sessionId: string;
41
+ /** Witness-monotonic tick at open. */
42
+ openedTick: number;
43
+ /** Witness-monotonic tick at seal (null = never sealed — blocking). */
44
+ sealedTick: number | null;
45
+ /** The outcome the supervisor observed at close (null = unknown). */
46
+ outcome: string | null;
47
+ /**
48
+ * Witness-side activity bound to THIS session (diagnostic only): the
49
+ * number of session-bound observations the witness itself made —
50
+ * ledger records issued under the session, recorded UI-action
51
+ * intervals, and engine-observed proxy exchanges attributed to the
52
+ * session. This count is CORROBORATION, never a gate: execution
53
+ * authority is the supervisor-observed lifecycle itself (trusted
54
+ * reporter channel over the exact expected set), because a genuine
55
+ * passing test that never touches the witness is still executed, and
56
+ * a fabricated session with activity is still fabricated. Only the
57
+ * witness can produce this count.
58
+ */
59
+ activity: number;
60
+ }
61
+ /** The witness-side session trace for ONE expected test. */
62
+ export interface TracedTest {
63
+ /** The runner-assigned id the session was opened under (diagnostic). */
64
+ testId: string | null;
65
+ /** Registered runner project (the expected-set identity join key). */
66
+ project: string | null;
67
+ /** Registered repo-relative posix file (the identity join key). */
68
+ file: string;
69
+ /** Registered full title path (the identity join key). */
70
+ titlePath: readonly string[];
71
+ /** Every session the witness recorded for this expected test. */
72
+ sessions: readonly TracedSession[];
73
+ }
74
+ /** The structured execution envelope the supervised adapter returns. */
75
+ export interface SupervisionEnvelopeInput {
76
+ /** Framework process exit code (supplementary, never decisive). */
77
+ processExit: number | null;
78
+ /** Whether the adapter itself judged the run complete. */
79
+ complete: boolean;
80
+ /** Single-cause detail when the adapter judged the run incomplete. */
81
+ incompleteDetail?: string;
82
+ /** Executed instance outcomes (multiset: one row per project instance). */
83
+ outcomes: readonly ExecutedOutcomeInput[];
84
+ /** Setup/teardown/runner-body outcome observed by the supervisor. */
85
+ fixtureOutcome: 'passed' | 'failed' | 'unknown';
86
+ /** Shard verification, or null when the runner reports none. */
87
+ shards: {
88
+ complete: boolean;
89
+ detail: string;
90
+ } | null;
91
+ /** True when a retry-assisted execution was detected (config or attempts). */
92
+ retriesDetected: boolean;
93
+ /** Detail describing the retry detection (when detected). */
94
+ retriesDetail?: string;
95
+ /**
96
+ * The witness-side session trace (enforcement-review fix 2b) — the
97
+ * EXECUTION AUTHORITY. Three states:
98
+ * - `undefined`: no trace was supplied (no witness wired); grading
99
+ * falls back to the runner-reported outcomes (test seam only — the
100
+ * supervised CLI always supplies a trace).
101
+ * - `null`: the witness was wired but the trace could not be fetched —
102
+ * fail closed with a typed RUN_INCOMPLETE (a missing authority is
103
+ * never success).
104
+ * - an array: the authority; every expected test must have sealed
105
+ * passing session(s) and every traced test must be in the expected
106
+ * set, regardless of what the runner-reported outcomes claim.
107
+ */
108
+ sessionTrace?: readonly TracedTest[] | null;
109
+ }
110
+ /** One typed supervision finding (plan §5.4 run rows). */
111
+ export interface SupervisionFinding {
112
+ /** Stable cause code. */
113
+ cause: 'TEST_NOT_EXECUTED' | 'TEST_FAILED' | 'RUN_INCOMPLETE';
114
+ /** Single-cause human explanation. */
115
+ detail: string;
116
+ /** The logical key the finding is scoped to, or null for run-scoped. */
117
+ logicalKey: string | null;
118
+ }
119
+ /** The supervision verdict for one run. */
120
+ export interface SupervisionResult {
121
+ /** True only when the complete expected set passed on first attempts. */
122
+ complete: boolean;
123
+ /** Typed findings (empty only when complete). */
124
+ findings: SupervisionFinding[];
125
+ }
126
+ /**
127
+ * Enforces the expected test set (ADR 0005 D2). Findings cover, in
128
+ * deterministic order: zero selected tests, `.only`/`.skip`/`.fixme` in
129
+ * the required selection, cases the runner never enumerated, retry-
130
+ * assisted execution, planned instances that never executed, unexpected
131
+ * executed instances outside the expected set, failed instances,
132
+ * expected failures, skipped/fixme outcomes, teardown/fixture failures,
133
+ * shard incompleteness, adapter-judged incompleteness, and a nonzero
134
+ * runner exit. All are blocking; `complete` is true only when none fired.
135
+ *
136
+ * Args:
137
+ * planned: the expected set fixed BEFORE the run.
138
+ * envelope: the structured execution envelope (input only).
139
+ *
140
+ * Returns:
141
+ * SupervisionResult: complete flag plus typed findings.
142
+ */
143
+ export declare function superviseExecution(planned: readonly PlannedInstanceInput[], envelope: SupervisionEnvelopeInput): SupervisionResult;
144
+ /** Domain tag separating expected-set (enumeration) digests from every other hash. */
145
+ export declare const ENUMERATION_DOMAIN = "gateforge.enumeration.v1";
146
+ /** One expected test registered with the witness before the run. */
147
+ export interface ExpectedTestInput {
148
+ /** The runner-assigned test id when enumeration bound one (diagnostic). */
149
+ testId?: string | null;
150
+ /** Runner project, or null when the runner reports none. */
151
+ project: string | null;
152
+ /** Repo-relative posix file (the identity join key). */
153
+ file: string;
154
+ /** Full title path (the identity join key). */
155
+ titlePath: readonly string[];
156
+ }
157
+ /**
158
+ * Computes the domain-separated enumeration digest over the expected set
159
+ * registered with the witness BEFORE the run (enforcement-review fix 2d):
160
+ * the execution result binds this digest so a receipt names the exact
161
+ * expected set the witness enforced.
162
+ *
163
+ * Args:
164
+ * tests: the expected tests (sorted/deduplicated by this function).
165
+ *
166
+ * Returns:
167
+ * string: 64-char lowercase hex digest.
168
+ */
169
+ export declare function enumerationDigestOf(tests: readonly ExpectedTestInput[]): string;
170
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/supervision/index.ts"],"names":[],"mappings":"AAiCA,mEAAmE,CAAA,MAAM,WAAW,oBAAoB;IACtG,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAA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