@azx-pbc/axiom-builder 0.0.0-stage → 0.0.1

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 (231) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +648 -2
  3. package/dist/cards/selectors.d.ts +70 -0
  4. package/dist/cards/selectors.d.ts.map +1 -0
  5. package/dist/cards/selectors.js +194 -0
  6. package/dist/cards/selectors.js.map +1 -0
  7. package/dist/definition.d.ts +36 -0
  8. package/dist/definition.d.ts.map +1 -0
  9. package/dist/definition.js +48 -0
  10. package/dist/definition.js.map +1 -0
  11. package/dist/evidence/cases.d.ts +44 -0
  12. package/dist/evidence/cases.d.ts.map +1 -0
  13. package/dist/evidence/cases.js +578 -0
  14. package/dist/evidence/cases.js.map +1 -0
  15. package/dist/evidence/repairs.d.ts +99 -0
  16. package/dist/evidence/repairs.d.ts.map +1 -0
  17. package/dist/evidence/repairs.js +181 -0
  18. package/dist/evidence/repairs.js.map +1 -0
  19. package/dist/evidence/summary.d.ts +35 -0
  20. package/dist/evidence/summary.d.ts.map +1 -0
  21. package/dist/evidence/summary.js +38 -0
  22. package/dist/evidence/summary.js.map +1 -0
  23. package/dist/i18n/gaps.d.ts +3 -0
  24. package/dist/i18n/gaps.d.ts.map +1 -0
  25. package/dist/i18n/gaps.js +2 -0
  26. package/dist/i18n/gaps.js.map +1 -0
  27. package/dist/i18n/message-slots.d.ts +19 -0
  28. package/dist/i18n/message-slots.d.ts.map +1 -0
  29. package/dist/i18n/message-slots.js +101 -0
  30. package/dist/i18n/message-slots.js.map +1 -0
  31. package/dist/i18n/text-locale.d.ts +13 -0
  32. package/dist/i18n/text-locale.d.ts.map +1 -0
  33. package/dist/i18n/text-locale.js +14 -0
  34. package/dist/i18n/text-locale.js.map +1 -0
  35. package/dist/i18n/translations.d.ts +56 -0
  36. package/dist/i18n/translations.d.ts.map +1 -0
  37. package/dist/i18n/translations.js +103 -0
  38. package/dist/i18n/translations.js.map +1 -0
  39. package/dist/impact/references.d.ts +143 -0
  40. package/dist/impact/references.d.ts.map +1 -0
  41. package/dist/impact/references.js +429 -0
  42. package/dist/impact/references.js.map +1 -0
  43. package/dist/index.d.ts +86 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +58 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/preview/compile-preview.d.ts +67 -0
  48. package/dist/preview/compile-preview.d.ts.map +1 -0
  49. package/dist/preview/compile-preview.js +286 -0
  50. package/dist/preview/compile-preview.js.map +1 -0
  51. package/dist/preview/handle.d.ts +119 -0
  52. package/dist/preview/handle.d.ts.map +1 -0
  53. package/dist/preview/handle.js +2 -0
  54. package/dist/preview/handle.js.map +1 -0
  55. package/dist/preview/held.d.ts +39 -0
  56. package/dist/preview/held.d.ts.map +1 -0
  57. package/dist/preview/held.js +15 -0
  58. package/dist/preview/held.js.map +1 -0
  59. package/dist/preview/measurement.d.ts +5 -0
  60. package/dist/preview/measurement.d.ts.map +1 -0
  61. package/dist/preview/measurement.js +18 -0
  62. package/dist/preview/measurement.js.map +1 -0
  63. package/dist/publish/build.d.ts +33 -0
  64. package/dist/publish/build.d.ts.map +1 -0
  65. package/dist/publish/build.js +15 -0
  66. package/dist/publish/build.js.map +1 -0
  67. package/dist/publish/diff.d.ts +208 -0
  68. package/dist/publish/diff.d.ts.map +1 -0
  69. package/dist/publish/diff.js +227 -0
  70. package/dist/publish/diff.js.map +1 -0
  71. package/dist/publish/review.d.ts +41 -0
  72. package/dist/publish/review.d.ts.map +1 -0
  73. package/dist/publish/review.js +22 -0
  74. package/dist/publish/review.js.map +1 -0
  75. package/dist/schema/dataset-input.d.ts +30 -0
  76. package/dist/schema/dataset-input.d.ts.map +1 -0
  77. package/dist/schema/dataset-input.js +58 -0
  78. package/dist/schema/dataset-input.js.map +1 -0
  79. package/dist/schema/dataset.d.ts +166 -0
  80. package/dist/schema/dataset.d.ts.map +1 -0
  81. package/dist/schema/dataset.js +281 -0
  82. package/dist/schema/dataset.js.map +1 -0
  83. package/dist/schema/declarations.d.ts +15 -0
  84. package/dist/schema/declarations.d.ts.map +1 -0
  85. package/dist/schema/declarations.js +47 -0
  86. package/dist/schema/declarations.js.map +1 -0
  87. package/dist/schema/document.d.ts +504 -0
  88. package/dist/schema/document.d.ts.map +1 -0
  89. package/dist/schema/document.js +337 -0
  90. package/dist/schema/document.js.map +1 -0
  91. package/dist/schema/error.d.ts +15 -0
  92. package/dist/schema/error.d.ts.map +1 -0
  93. package/dist/schema/error.js +18 -0
  94. package/dist/schema/error.js.map +1 -0
  95. package/dist/schema/field-id.d.ts +8 -0
  96. package/dist/schema/field-id.d.ts.map +1 -0
  97. package/dist/schema/field-id.js +47 -0
  98. package/dist/schema/field-id.js.map +1 -0
  99. package/dist/schema/layout.d.ts +118 -0
  100. package/dist/schema/layout.d.ts.map +1 -0
  101. package/dist/schema/layout.js +101 -0
  102. package/dist/schema/layout.js.map +1 -0
  103. package/dist/schema/palette.d.ts +103 -0
  104. package/dist/schema/palette.d.ts.map +1 -0
  105. package/dist/schema/palette.js +140 -0
  106. package/dist/schema/palette.js.map +1 -0
  107. package/dist/schema/read.d.ts +49 -0
  108. package/dist/schema/read.d.ts.map +1 -0
  109. package/dist/schema/read.js +942 -0
  110. package/dist/schema/read.js.map +1 -0
  111. package/dist/store/apply-dataset.d.ts +14 -0
  112. package/dist/store/apply-dataset.d.ts.map +1 -0
  113. package/dist/store/apply-dataset.js +513 -0
  114. package/dist/store/apply-dataset.js.map +1 -0
  115. package/dist/store/apply.d.ts +37 -0
  116. package/dist/store/apply.d.ts.map +1 -0
  117. package/dist/store/apply.js +2269 -0
  118. package/dist/store/apply.js.map +1 -0
  119. package/dist/store/candidate.d.ts +37 -0
  120. package/dist/store/candidate.d.ts.map +1 -0
  121. package/dist/store/candidate.js +178 -0
  122. package/dist/store/candidate.js.map +1 -0
  123. package/dist/store/commands/coverage.d.ts +58 -0
  124. package/dist/store/commands/coverage.d.ts.map +1 -0
  125. package/dist/store/commands/coverage.js +354 -0
  126. package/dist/store/commands/coverage.js.map +1 -0
  127. package/dist/store/commands/dataset.d.ts +26 -0
  128. package/dist/store/commands/dataset.d.ts.map +1 -0
  129. package/dist/store/commands/dataset.js +368 -0
  130. package/dist/store/commands/dataset.js.map +1 -0
  131. package/dist/store/commands/document.d.ts +21 -0
  132. package/dist/store/commands/document.d.ts.map +1 -0
  133. package/dist/store/commands/document.js +160 -0
  134. package/dist/store/commands/document.js.map +1 -0
  135. package/dist/store/commands/field.d.ts +32 -0
  136. package/dist/store/commands/field.d.ts.map +1 -0
  137. package/dist/store/commands/field.js +572 -0
  138. package/dist/store/commands/field.js.map +1 -0
  139. package/dist/store/commands/layout.d.ts +16 -0
  140. package/dist/store/commands/layout.d.ts.map +1 -0
  141. package/dist/store/commands/layout.js +70 -0
  142. package/dist/store/commands/layout.js.map +1 -0
  143. package/dist/store/commands/parse.d.ts +19 -0
  144. package/dist/store/commands/parse.d.ts.map +1 -0
  145. package/dist/store/commands/parse.js +328 -0
  146. package/dist/store/commands/parse.js.map +1 -0
  147. package/dist/store/commands/readers.d.ts +198 -0
  148. package/dist/store/commands/readers.d.ts.map +1 -0
  149. package/dist/store/commands/readers.js +711 -0
  150. package/dist/store/commands/readers.js.map +1 -0
  151. package/dist/store/commands/rule.d.ts +24 -0
  152. package/dist/store/commands/rule.d.ts.map +1 -0
  153. package/dist/store/commands/rule.js +379 -0
  154. package/dist/store/commands/rule.js.map +1 -0
  155. package/dist/store/commands/shapes.d.ts +900 -0
  156. package/dist/store/commands/shapes.d.ts.map +1 -0
  157. package/dist/store/commands/shapes.js +166 -0
  158. package/dist/store/commands/shapes.js.map +1 -0
  159. package/dist/store/commands/suggestions.d.ts +37 -0
  160. package/dist/store/commands/suggestions.d.ts.map +1 -0
  161. package/dist/store/commands/suggestions.js +177 -0
  162. package/dist/store/commands/suggestions.js.map +1 -0
  163. package/dist/store/commands.d.ts +16 -0
  164. package/dist/store/commands.d.ts.map +1 -0
  165. package/dist/store/commands.js +13 -0
  166. package/dist/store/commands.js.map +1 -0
  167. package/dist/store/dataset-candidate.d.ts +33 -0
  168. package/dist/store/dataset-candidate.d.ts.map +1 -0
  169. package/dist/store/dataset-candidate.js +31 -0
  170. package/dist/store/dataset-candidate.js.map +1 -0
  171. package/dist/store/dataset-pin.d.ts +93 -0
  172. package/dist/store/dataset-pin.d.ts.map +1 -0
  173. package/dist/store/dataset-pin.js +86 -0
  174. package/dist/store/dataset-pin.js.map +1 -0
  175. package/dist/store/dataset-store.d.ts +96 -0
  176. package/dist/store/dataset-store.d.ts.map +1 -0
  177. package/dist/store/dataset-store.js +112 -0
  178. package/dist/store/dataset-store.js.map +1 -0
  179. package/dist/store/history.d.ts +149 -0
  180. package/dist/store/history.d.ts.map +1 -0
  181. package/dist/store/history.js +173 -0
  182. package/dist/store/history.js.map +1 -0
  183. package/dist/store/measurement.d.ts +5 -0
  184. package/dist/store/measurement.d.ts.map +1 -0
  185. package/dist/store/measurement.js +20 -0
  186. package/dist/store/measurement.js.map +1 -0
  187. package/dist/store/notify.d.ts +11 -0
  188. package/dist/store/notify.d.ts.map +1 -0
  189. package/dist/store/notify.js +26 -0
  190. package/dist/store/notify.js.map +1 -0
  191. package/dist/store/published.d.ts +50 -0
  192. package/dist/store/published.d.ts.map +1 -0
  193. package/dist/store/published.js +27 -0
  194. package/dist/store/published.js.map +1 -0
  195. package/dist/store/refusals.d.ts +175 -0
  196. package/dist/store/refusals.d.ts.map +1 -0
  197. package/dist/store/refusals.js +160 -0
  198. package/dist/store/refusals.js.map +1 -0
  199. package/dist/store/steps.d.ts +14 -0
  200. package/dist/store/steps.d.ts.map +1 -0
  201. package/dist/store/steps.js +124 -0
  202. package/dist/store/steps.js.map +1 -0
  203. package/dist/store/store.d.ts +142 -0
  204. package/dist/store/store.d.ts.map +1 -0
  205. package/dist/store/store.js +136 -0
  206. package/dist/store/store.js.map +1 -0
  207. package/dist/store/unchanged.d.ts +12 -0
  208. package/dist/store/unchanged.d.ts.map +1 -0
  209. package/dist/store/unchanged.js +35 -0
  210. package/dist/store/unchanged.js.map +1 -0
  211. package/dist/visual/emit.d.ts +21 -0
  212. package/dist/visual/emit.d.ts.map +1 -0
  213. package/dist/visual/emit.js +133 -0
  214. package/dist/visual/emit.js.map +1 -0
  215. package/dist/visual/parse.d.ts +32 -0
  216. package/dist/visual/parse.d.ts.map +1 -0
  217. package/dist/visual/parse.js +330 -0
  218. package/dist/visual/parse.js.map +1 -0
  219. package/dist/visual/project.d.ts +40 -0
  220. package/dist/visual/project.d.ts.map +1 -0
  221. package/dist/visual/project.js +349 -0
  222. package/dist/visual/project.js.map +1 -0
  223. package/dist/visual/represent.d.ts +50 -0
  224. package/dist/visual/represent.d.ts.map +1 -0
  225. package/dist/visual/represent.js +66 -0
  226. package/dist/visual/represent.js.map +1 -0
  227. package/dist/visual/vocabulary.d.ts +121 -0
  228. package/dist/visual/vocabulary.d.ts.map +1 -0
  229. package/dist/visual/vocabulary.js +32 -0
  230. package/dist/visual/vocabulary.js.map +1 -0
  231. package/package.json +52 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cases.js","sourceRoot":"","sources":["../../src/evidence/cases.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAoDhC,yFAAyF;AACzF,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,uGAAuG;AACvG,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B;;;;;;;;GAQG;AACH,SAAS,mBAAmB,CAAC,MAAsB;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC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EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC;AAClG,CAAC","sourcesContent":["import {\n AxiomError,\n DATASET_BUILTINS,\n DEFAULT_EVIDENCE_TIER,\n andAll,\n asDecimalString,\n assertNever,\n evaluateForm,\n firingBranch,\n isRecord,\n isWireValue,\n subtractDecimalTexts,\n sumDecimalTexts,\n} from '@azx-pbc/axiom-runtime';\nimport type {\n CompiledField,\n CompiledRule,\n CompiledSchema,\n ExprNode,\n Observation,\n WireValue,\n} from '@azx-pbc/axiom-runtime';\n\n/**\n * Deriving the case a declared gap is asking for.\n *\n * A repair is only evidence if the case it writes holds. An embedded case is a record of values\n * plus the outcome the artifact decides for them, so both members have to come from the artifact:\n * the values from a search over the fields the rule reads, and the expectation from evaluating\n * those values and reading the rule's own result back. This module is that derivation, kept\n * apart from the sentence a repair states so a host can prove the search directly.\n *\n * The search is bounded on purpose. A rule can name context, a table or a capability that a\n * record cannot carry in `values`; a large rule can read more fields than a synchronously\n * requested repair can vary. Both are reported as the reason no case was written rather than\n * papered over with an expectation the rule never reaches — the author is told the check cannot\n * be proved by a test instead of being handed a button that cannot succeed.\n */\n\n/** The two branches publishing asks a rule's own evidence to prove. */\nexport type EvidenceBranch = 'firing' | 'non_firing';\n\n/** The values one embedded case submits, keyed by top-level field id. */\ntype CaseValues = Readonly<Record<string, WireValue>>;\n\n/** One case the repair can write: complete, runnable and expected to hold. */\ninterface SynthesizedCase {\n readonly caseId: string;\n /** What the rule decides for `values`, read back from an evaluation of the artifact. */\n readonly expected: WireValue;\n readonly values: CaseValues;\n}\n\n/** The case for one branch, or the reason no case writes that branch. */\nexport type CaseSearch =\n | { readonly ok: true; readonly testCase: SynthesizedCase }\n | { readonly ok: false; readonly reason: string };\n\n/** One declared field a case can vary, with the top-level path it travels under. */\ninterface LeafField {\n readonly field: CompiledField;\n /** The declared path, `['f_site_access', 'f_access_contact']` for a record member. */\n readonly path: readonly string[];\n}\n\n/** The number of evaluations one rule's search may spend before it states its budget. */\nconst MAX_EVALUATIONS = 512;\n\n/** The number of leaves whose values the search enumerates in full; beyond it, singly and pairwise. */\nconst FULL_PRODUCT_LEAVES = 3;\n\n/**\n * The declarations a writer owns, which a case must not submit as an input.\n *\n * A `compute` rule produces its target and a `defaultCompute` rule keeps its override's stored\n * value instead of producing one — a case that supplied either would be claiming the record\n * already held what the artifact decides. Leaving them out is also what keeps a writer's case\n * creditable: the vector path refuses a retained stored value as evidence, so a case that\n * supplied the override field would pass without proving the branch.\n */\nfunction writerOwnedFieldIds(schema: CompiledSchema): ReadonlySet<string> {\n const ids = new Set<string>();\n for (const rule of schema.rules ?? []) {\n if (rule.kind !== 'compute' && rule.kind !== 'defaultCompute') continue;\n if (rule.fieldId !== undefined) ids.add(rule.fieldId);\n if (rule.overrideFieldId !== undefined) ids.add(rule.overrideFieldId);\n }\n return ids;\n}\n\n/**\n * Every scalar declaration a case can supply, flattened to the path it travels under.\n *\n * A record's members are the fields a case supplies inside the record; a scalar array is one\n * value. A record array is left out: a case that varies its rows needs row identity, which this\n * search does not invent. A field a writer owns is left out too (`writerOwnedFieldIds`).\n */\nfunction leafFields(\n fields: readonly CompiledField[],\n excluded: ReadonlySet<string>,\n prefix: readonly string[] = [],\n): LeafField[] {\n const leaves: LeafField[] = [];\n for (const field of fields) {\n const path = [...prefix, field.fieldId];\n // A record array is rows whose identity a case would have to invent, so it is not a leaf the\n // search varies. A record's members are: they travel inside the record the case supplies.\n if (field.primitive === 'array' && field.fields !== undefined) continue;\n if (field.fields !== undefined) {\n leaves.push(...leafFields(field.fields, excluded, path));\n continue;\n }\n if (excluded.has(field.fieldId)) continue;\n leaves.push({ field, path });\n }\n return leaves;\n}\n\n/** One expression's path operands and calls, without a second walk per question. */\ninterface ExpressionFacts {\n readonly paths: readonly string[];\n readonly calls: readonly { readonly op: string; readonly args: readonly ExprNode[] }[];\n}\n\nfunction expressionFacts(expressions: readonly ExprNode[]): ExpressionFacts {\n const paths: string[] = [];\n const calls: { readonly op: string; readonly args: readonly ExprNode[] }[] = [];\n const visit = (node: ExprNode): void => {\n switch (node.kind) {\n case 'literal':\n return;\n case 'path':\n paths.push(node.path);\n return;\n case 'list':\n for (const item of node.items) visit(item);\n return;\n case 'and':\n case 'or':\n case 'coalesce':\n for (const arg of node.args) visit(arg);\n return;\n case 'not':\n visit(node.args[0]);\n return;\n case 'compare':\n visit(node.args[0]);\n visit(node.args[1]);\n return;\n case 'if':\n for (const arg of node.args) visit(arg);\n return;\n case 'call':\n calls.push({ op: node.op, args: node.args });\n for (const arg of node.args) visit(arg);\n return;\n case 'comprehension':\n visit(node.source);\n if (node.valueExpr !== undefined) visit(node.valueExpr);\n if (node.predicate !== undefined) visit(node.predicate);\n return;\n default:\n return assertNever(node);\n }\n };\n for (const expression of expressions) visit(expression);\n return { paths, calls };\n}\n\n/** Every literal value an expression states, with the domain it states it in. */\ninterface LiteralValue {\n readonly domain: string;\n readonly value: WireValue;\n}\n\nfunction literalValues(expressions: readonly ExprNode[]): readonly LiteralValue[] {\n const literals: LiteralValue[] = [];\n const visit = (node: ExprNode): void => {\n switch (node.kind) {\n case 'literal':\n literals.push({ domain: node.domain, value: node.value });\n return;\n case 'path':\n return;\n case 'list':\n for (const item of node.items) visit(item);\n return;\n case 'and':\n case 'or':\n case 'coalesce':\n for (const arg of node.args) visit(arg);\n return;\n case 'not':\n visit(node.args[0]);\n return;\n case 'compare':\n visit(node.args[0]);\n visit(node.args[1]);\n return;\n case 'if':\n for (const arg of node.args) visit(arg);\n return;\n case 'call':\n for (const arg of node.args) visit(arg);\n return;\n case 'comprehension':\n visit(node.source);\n if (node.valueExpr !== undefined) visit(node.valueExpr);\n if (node.predicate !== undefined) visit(node.predicate);\n return;\n default:\n return assertNever(node);\n }\n };\n for (const expression of expressions) visit(expression);\n return literals;\n}\n\n/** Every expression slot of one rule, including the items and reasons a composing kind carries. */\nfunction ruleExpressionsOf(rule: CompiledRule): readonly ExprNode[] {\n return [\n rule.expr,\n ...(rule.referWhen === undefined ? [] : [rule.referWhen]),\n ...Object.values(rule.params ?? {}),\n ...(rule.kind === 'screen' ? (rule.reasons ?? []).map((reason) => reason.when) : []),\n ...(rule.gate?.activeWhen === undefined ? [] : [rule.gate.activeWhen]),\n ...(rule.gate?.items ?? []).flatMap((item) => [item.expr, ...Object.values(item.params ?? {})]),\n ];\n}\n\n/** The rule IDs an expression reads through `rule_ok`, so their own inputs stay in the search. */\nfunction referencedRuleIds(facts: ExpressionFacts): readonly string[] {\n const ids: string[] = [];\n for (const call of facts.calls) {\n if (call.op !== 'rule_ok') continue;\n const [first] = call.args;\n if (first?.kind === 'literal' && typeof first.value === 'string') ids.push(first.value);\n }\n return ids;\n}\n\n/** Whether an expression folds a whole step or a sibling rule, so every declaration matters. */\nfunction foldsOtherRules(facts: ExpressionFacts): boolean {\n return facts.calls.some(\n (call) => call.op === 'rule_ok_in' || call.op === 'no_blocking_in' || call.op === 'required_in',\n );\n}\n\n/**\n * The leaves a rule's outcome can depend on.\n *\n * The walk follows the two ways one rule reads another: `rule_ok` reads a sibling rule's verdict,\n * and a path naming a writer's target reads the value that writer produces. Both are followed\n * transitively, so a validate over a computed total searches the inputs the writer reads rather\n * than declaring the total impossible to vary.\n */\nfunction dependencyLeaves(\n schema: CompiledSchema,\n rule: CompiledRule,\n leaves: readonly LeafField[],\n): readonly LeafField[] {\n const rules = schema.rules ?? [];\n const writers = new Map<string, CompiledRule>();\n for (const candidate of rules) {\n if (candidate.kind !== 'compute' && candidate.kind !== 'defaultCompute') continue;\n if (candidate.fieldId !== undefined) writers.set(candidate.fieldId, candidate);\n }\n const facts = expressionFacts(ruleExpressionsOf(rule));\n if (rule.kind === 'gate' || rule.kind === 'screen' || foldsOtherRules(facts)) return leaves;\n const wanted = new Set<string>();\n const visitRule = (current: CompiledRule, seen: ReadonlySet<string>): void => {\n if (seen.has(current.ruleId)) return;\n const next = new Set(seen);\n next.add(current.ruleId);\n const currentFacts = expressionFacts(ruleExpressionsOf(current));\n if (currentFacts.calls.some((call) => call.op === 'rule_ok_in'))\n for (const leaf of leaves) wanted.add(leaf.field.fieldId);\n for (const path of currentFacts.paths) {\n const match = leaves.find((leaf) => leaf.path.join('.') === path);\n if (match !== undefined) {\n wanted.add(match.field.fieldId);\n continue;\n }\n const writer = writers.get(path);\n if (writer !== undefined) visitRule(writer, next);\n }\n for (const id of referencedRuleIds(currentFacts)) {\n const referenced = rules.find((candidate) => candidate.ruleId === id);\n if (referenced !== undefined) visitRule(referenced, next);\n }\n };\n visitRule(rule, new Set());\n const target = rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;\n if (target !== undefined) {\n const match = leaves.find((leaf) => leaf.field.fieldId === target);\n if (match !== undefined) wanted.add(match.field.fieldId);\n }\n return leaves.filter((leaf) => wanted.has(leaf.field.fieldId));\n}\n\n/** The field IDs an `is_email` call reads, so their preferred value is a valid address. */\nfunction emailFieldsOf(\n expressions: readonly ExprNode[],\n leaves: readonly LeafField[],\n): Set<string> {\n const fields = new Set<string>();\n const facts = expressionFacts(expressions);\n for (const call of facts.calls) {\n if (call.op !== 'is_email') continue;\n for (const path of expressionFacts(call.args).paths) {\n const match = leaves.find((leaf) => leaf.path.join('.') === path);\n if (match !== undefined) fields.add(match.field.fieldId);\n }\n }\n return fields;\n}\n\n/** The expression's context roots, for the sentence that says a record cannot supply them. */\nfunction contextPathsOf(\n schema: CompiledSchema,\n expressions: readonly ExprNode[],\n): readonly string[] {\n const declared = new Set((schema.context?.roots ?? []).map((root) => `context.${root.path}`));\n return expressionFacts(expressions).paths.filter(\n (path) => path.startsWith('context.') || declared.has(path),\n );\n}\n\n/** The tables an expression reads, for the same sentence. */\nfunction tableIdsOf(expressions: readonly ExprNode[]): readonly string[] {\n const tables = new Set<string>();\n for (const call of expressionFacts(expressions).calls) {\n if (!DATASET_BUILTINS.has(call.op)) continue;\n const [first] = call.args;\n if (first?.kind === 'path') tables.add(first.path);\n }\n return [...tables];\n}\n\n/** A stable key for a candidate, so a dedupe cannot lose a value two spellings share. */\nfunction valueKey(value: WireValue | undefined): string {\n return value === undefined ? 'absent' : JSON.stringify(value);\n}\n\n/** The preferred value for one field: the one a plain \"all answers supplied\" case uses. */\nfunction preferredValue(\n field: CompiledField,\n emailFields: ReadonlySet<string>,\n): WireValue | undefined {\n switch (field.primitive) {\n case 'boolean':\n return true;\n case 'integer':\n return 1;\n case 'string':\n if (field.options !== undefined) return field.options[0]?.code ?? 'x';\n return emailFields.has(field.fieldId) ? 'a@example.co' : 'x';\n case 'array':\n return [];\n case 'timeslot':\n // A slot is a closed record, not a scalar the search can adapt. One well-formed slot is\n // enough to prove a presence check's passing branch; a rule that needs a particular\n // window states that dependency in its own literals.\n return {\n slotId: 'slot_case',\n localDate: '2026-09-02',\n start: '2026-09-02T09:00:00.000Z',\n end: '2026-09-02T11:00:00.000Z',\n };\n case 'decimal':\n case 'money':\n case 'date':\n case 'instant':\n case 'time':\n case 'media_ref':\n case 'signature_ref':\n case 'quantity':\n case 'duration':\n case 'address':\n case 'coordinate':\n case 'record':\n return undefined;\n default:\n return assertNever(field.primitive);\n }\n}\n\n/** The values one field may take in the search, preferred first, `undefined` meaning absent. */\nfunction candidateValues(\n field: CompiledField,\n literals: readonly LiteralValue[],\n emailFields: ReadonlySet<string>,\n): readonly (WireValue | undefined)[] {\n const preferred = preferredValue(field, emailFields);\n const sameDomain = literals\n .filter((literal) => literal.domain === field.primitive)\n .map((literal) => literal.value);\n const options = (field.options ?? []).map((option) => option.code);\n const strings = [\n ...sameDomain,\n ...options,\n ...(emailFields.has(field.fieldId) ? ['a@example.co'] : []),\n 'a@example.co',\n 'x',\n '',\n ];\n const numbers = sameDomain.filter(\n (value): value is number => typeof value === 'number' && Number.isSafeInteger(value),\n );\n const candidates: (WireValue | undefined)[] = [preferred, undefined];\n switch (field.primitive) {\n case 'boolean':\n for (const value of [true, false]) candidates.push(value);\n break;\n case 'integer':\n for (const value of [0, 1, -1, ...numbers, ...numbers.flatMap((n) => [n + 1, n - 1])]) {\n candidates.push(value);\n }\n break;\n case 'string':\n for (const value of strings) candidates.push(value);\n break;\n case 'array':\n candidates.push([]);\n break;\n case 'decimal':\n for (const value of sameDomain) {\n candidates.push(value);\n // A threshold is the operand a comparison reads, so the value just past it is the one\n // that decides the other branch. `sumDecimalTexts` keeps the literal's scale and sign.\n if (typeof value === 'string') {\n try {\n candidates.push(sumDecimalTexts([asDecimalString(value), asDecimalString('1')]));\n candidates.push(subtractDecimalTexts(asDecimalString(value), asDecimalString('1')));\n } catch {\n // A literal this constructor refuses is not one the search can step past.\n }\n }\n }\n break;\n case 'money':\n case 'date':\n case 'instant':\n case 'time':\n case 'media_ref':\n case 'signature_ref':\n case 'timeslot':\n case 'quantity':\n case 'duration':\n case 'address':\n case 'coordinate':\n for (const value of sameDomain) candidates.push(value);\n break;\n case 'record':\n break;\n default:\n return assertNever(field.primitive);\n }\n const seen = new Set<string>();\n return candidates.filter((value) => {\n if (value !== undefined && !isWireValue(value)) return false;\n const key = valueKey(value);\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n}\n\n/** A values tree with one leaf set, or removed when the candidate is absent. */\nfunction withLeaf(\n values: Readonly<Record<string, WireValue>>,\n path: readonly string[],\n value: WireValue | undefined,\n): Record<string, WireValue> {\n const [head, ...rest] = path;\n if (head === undefined) return { ...values };\n const next: Record<string, WireValue> = { ...values };\n if (rest.length === 0) {\n if (value === undefined) delete next[head];\n else next[head] = value;\n return next;\n }\n const existing = next[head];\n const nested = isRecord(existing) ? existing : {};\n const child = withLeaf(nested, rest, value);\n if (Object.keys(child).length === 0) delete next[head];\n else next[head] = child;\n return next;\n}\n\n/** One assignment's identity, so two routes to the same values spend one evaluation. */\nfunction valuesKey(values: Readonly<Record<string, WireValue>>): string {\n return JSON.stringify(\n Object.keys(values)\n .sort()\n .map((key) => [key, values[key]]),\n );\n}\n\n/**\n * The values assignments the search tries, simplest first.\n *\n * The empty record and the all-preferred record come first because they are the two cases an\n * author would write by hand. Every single-field variation follows: one field is almost always\n * what moves a rule from one branch to the other. A pair and, for a small rule, the whole\n * cross-product follow where a conjunction needs two operands set together. The order is the\n * search's budget: the first assignment that reaches the branch is the case it writes, so the\n * simplest values that prove the branch win.\n */\nfunction assignmentsOf(\n leaves: readonly LeafField[],\n candidates: ReadonlyMap<string, readonly (WireValue | undefined)[]>,\n): readonly Readonly<Record<string, WireValue>>[] {\n const assignments: Readonly<Record<string, WireValue>>[] = [];\n const seen = new Set<string>();\n const push = (values: Readonly<Record<string, WireValue>>): void => {\n if (assignments.length >= MAX_EVALUATIONS) return;\n const key = valuesKey(values);\n if (seen.has(key)) return;\n seen.add(key);\n assignments.push(values);\n };\n push({});\n let base: Record<string, WireValue> = {};\n for (const leaf of leaves) {\n const preferred = candidates.get(leaf.field.fieldId)?.[0];\n if (preferred !== undefined) base = withLeaf(base, leaf.path, preferred);\n }\n push(base);\n\n for (const leaf of leaves) {\n for (const value of candidates.get(leaf.field.fieldId) ?? []) {\n push(withLeaf(base, leaf.path, value));\n }\n }\n\n for (let first = 0; first < leaves.length; first += 1) {\n for (let second = first + 1; second < leaves.length; second += 1) {\n const left = leaves[first];\n const right = leaves[second];\n if (left === undefined || right === undefined) continue;\n const leftValues = (candidates.get(left.field.fieldId) ?? []).slice(0, 4);\n const rightValues = (candidates.get(right.field.fieldId) ?? []).slice(0, 4);\n for (const leftValue of leftValues) {\n for (const rightValue of rightValues) {\n push(withLeaf(withLeaf(base, left.path, leftValue), right.path, rightValue));\n }\n }\n }\n }\n\n if (leaves.length > 0 && leaves.length <= FULL_PRODUCT_LEAVES) {\n let product: Record<string, WireValue>[] = [{}];\n for (const leaf of leaves) {\n const next: Record<string, WireValue>[] = [];\n for (const values of product) {\n for (const value of (candidates.get(leaf.field.fieldId) ?? []).slice(0, 4)) {\n next.push(withLeaf(values, leaf.path, value));\n }\n }\n product = next.slice(0, MAX_EVALUATIONS);\n }\n for (const values of product) push(values);\n }\n return assignments;\n}\n\n/** What one evaluation decided about the rule, and the expectation that states it. */\ninterface ObservationOfRule {\n readonly observation: Observation;\n readonly expected: WireValue;\n}\n\n/**\n * The rule's own result and the `expected` a case states for it.\n *\n * This is the whole reason a generated case can hold: the expectation is read from the\n * evaluation rather than chosen for the branch. A screen states its own five-state outcome, a\n * writer states the value it produced (`null` included), and every other kind states the folded\n * four-state outcome the report carries.\n */\nfunction observeRule(\n schema: CompiledSchema,\n rule: CompiledRule,\n values: CaseValues,\n): ObservationOfRule | undefined {\n let snapshot: ReturnType<typeof evaluateForm>;\n try {\n snapshot = evaluateForm(schema, { values }, { tier: DEFAULT_EVIDENCE_TIER });\n } catch (error) {\n if (!(error instanceof AxiomError)) throw error;\n return undefined;\n }\n if (\n snapshot.report.diagnostics.some(\n (diagnostic) => diagnostic.code === 'ENGINE_ERROR' && diagnostic.ruleId === rule.ruleId,\n )\n ) {\n return undefined;\n }\n if (rule.kind === 'screen') {\n const outcome = snapshot.report.screens?.[rule.ruleId]?.outcome;\n if (outcome === undefined) return undefined;\n return { observation: { kind: 'screen', outcome }, expected: outcome };\n }\n const results = snapshot.report.rules.filter((result) => result.ruleId === rule.ruleId);\n if (results.length === 0) return undefined;\n const status = andAll(results.map((result) => result.status));\n if (rule.kind === 'compute' || rule.kind === 'defaultCompute') {\n const [only] = results;\n if (status === 'PASS' && results.length === 1 && only !== undefined) {\n const value = only.value ?? null;\n return { observation: { kind: 'value', value }, expected: value };\n }\n return { observation: { kind: 'outcome', outcome: status }, expected: status };\n }\n return { observation: { kind: 'outcome', outcome: status }, expected: status };\n}\n\n/** The sentence that says why this rule's branch cannot be written as an embedded case. */\nfunction impossibleReason(\n schema: CompiledSchema,\n rule: CompiledRule,\n leaves: readonly LeafField[],\n branch: EvidenceBranch,\n expressions: readonly ExprNode[],\n): string {\n const contexts = contextPathsOf(schema, expressions);\n if (contexts.length > 0) {\n return `it depends on host-supplied context \\`${contexts[0] ?? ''}\\`, which an embedded case's \\`values\\` cannot carry`;\n }\n const tables = tableIdsOf(expressions);\n if (tables.length > 0) {\n return `it depends on table \\`${tables[0] ?? ''}\\`, which a case's values do not resolve`;\n }\n if (expressionFacts(expressions).calls.some((call) => call.op === 'has_cap')) {\n return 'it depends on a host capability, which a case states as an environment member rather than a value';\n }\n if (rule.scope === 'item') {\n return `it decides one row of \\`${rule.fieldId ?? 'an array'}\\`, and a case that varies rows needs row identity this repair does not invent`;\n }\n if (leaves.length === 0) {\n return 'it reads no declared field, so no value a case can supply changes its answer';\n }\n return `no values among the ${String(leaves.length)} ${leaves.length === 1 ? 'field' : 'fields'} it reads make a \\`${rule.kind}\\` rule ${branch === 'firing' ? 'fire' : 'not fire'}`;\n}\n\n/**\n * The case that proves one branch of one rule, or the reason no case does.\n *\n * `caseId` is the caller's: an authoring document identifies one vector by it, and the repair\n * walk owns the naming so a second click cannot mint a second id for the same branch.\n */\nexport function synthesizeRuleCase(\n schema: CompiledSchema,\n rule: CompiledRule,\n branch: EvidenceBranch,\n caseId: string,\n): CaseSearch {\n const leaves = leafFields(schema.fields, writerOwnedFieldIds(schema));\n const dependencies = dependencyLeaves(schema, rule, leaves);\n // A gate or a screen decides through the rules its items and conditions name, so its literals\n // and the fields an `is_email` call reads belong to those rules too. Reading only the composing\n // rule's own expression would miss the valid address its item delegates to another rule.\n const ownExpressions = ruleExpressionsOf(rule);\n const expressions =\n rule.kind === 'gate' || rule.kind === 'screen'\n ? [...ownExpressions, ...(schema.rules ?? []).flatMap(ruleExpressionsOf)]\n : ownExpressions;\n const literals = literalValues(expressions);\n const emailFields = emailFieldsOf(expressions, leaves);\n const candidates = new Map(\n dependencies.map((leaf) => [\n leaf.field.fieldId,\n candidateValues(leaf.field, literals, emailFields),\n ]),\n );\n for (const values of assignmentsOf(dependencies, candidates)) {\n const observed = observeRule(schema, rule, values);\n if (observed === undefined) continue;\n if (firingBranch(rule.kind, observed.observation) !== (branch === 'firing')) continue;\n return { ok: true, testCase: { caseId, expected: observed.expected, values } };\n }\n return { ok: false, reason: impossibleReason(schema, rule, dependencies, branch, expressions) };\n}\n"]}
@@ -0,0 +1,99 @@
1
+ import type { DeclaredEvidence, DeclaredGap, ObservedOnly } from '@azx-pbc/axiom-compiler';
2
+ import type { CompiledSchema, RuleKind, WireValue } from '@azx-pbc/axiom-runtime';
3
+ /**
4
+ * What a publish gap asks an author to write, in the form the suite or the rule states it.
5
+ *
6
+ * A compile executes nothing, so `declaredEvidence.gaps` names the branches a rule's own vectors
7
+ * leave. Every rule reports `$.rules[i].testCases`, and no verdict assertion an author would
8
+ * write satisfies a gate, so the report tells the author nothing they can act on. This module
9
+ * turns each gap into the exact case or assertion that closes it, using the metaschema's own
10
+ * members rather than a parallel shape.
11
+ *
12
+ * A case is only evidence if it holds, so the case is not written from the branch alone. The
13
+ * search in `cases.ts` finds values under which the rule actually decides the branch, and the
14
+ * `expected` is that decision read back from an evaluation of the artifact. A rule no embedded
15
+ * case can prove — one that reads host context or a table, or whose branch no value reaches — is
16
+ * stated as such and gets no case, rather than an invented expectation the verifier will refuse.
17
+ * The cost is that this walk evaluates the form, so a host asks it for the gaps it is about to
18
+ * display rather than for every rule on every keystroke.
19
+ *
20
+ * A gate's verdict assertion (`expect.gates`) earns `not_causal`: it proves what the form did, not
21
+ * which item of the gate decided it. `notCausalRepairs` answers that with the item assertions the
22
+ * gate can be credited through, naming the gate's own `itemId`s.
23
+ */
24
+ /** One assertion a scenario suite states about a rule's branch. */
25
+ export interface EvidenceAssertion {
26
+ readonly kind: 'rule';
27
+ readonly ruleId: string;
28
+ /**
29
+ * The outcome or value the branch is expected to produce. `Outcome` is four strings that
30
+ * `WireValue` already admits, so the union is `WireValue`.
31
+ */
32
+ readonly expected: WireValue;
33
+ }
34
+ /**
35
+ * One embedded case that closes a gap: the values to submit and what the rule decides for them.
36
+ *
37
+ * The values are not a convenience. A case without the record it judges states nothing about the
38
+ * rule, and an expectation chosen for the branch instead of read from the artifact can contradict
39
+ * the rule — the defect that made a repair fail the very check it was meant to prove. Both
40
+ * members are derived from one evaluation, so a host that writes this case verbatim writes one
41
+ * that holds.
42
+ */
43
+ export interface SuggestedCase {
44
+ readonly caseId: string;
45
+ /** The outcome or value the case is expected to produce; see `EvidenceAssertion.expected`. */
46
+ readonly expected: WireValue;
47
+ /** The record the case submits, keyed by top-level field id. */
48
+ readonly values: Readonly<Record<string, WireValue>>;
49
+ }
50
+ /** One declared gap, with the exact evidence that closes it. */
51
+ export interface EvidenceRepair {
52
+ readonly gap: DeclaredGap;
53
+ readonly ruleId: string;
54
+ readonly kind: RuleKind;
55
+ /** The suite assertions that credit the missing branch, when one can be stated. */
56
+ readonly assertions: readonly EvidenceAssertion[];
57
+ /** The embedded cases that close the gap, when the expected value can be stated. */
58
+ readonly testCases: readonly SuggestedCase[];
59
+ /**
60
+ * Why a branch the gap names cannot be written as an embedded case, when it cannot.
61
+ *
62
+ * Empty beside a complete repair. When set, `testCases` holds only the branches a case can
63
+ * prove, and the sentence names the cause rather than offering a button that cannot succeed.
64
+ */
65
+ readonly unprovable?: readonly string[];
66
+ /** What to write instead, naming the rule, the branch and the member. */
67
+ readonly repair: string;
68
+ }
69
+ /** One passing gate-verdict assertion, which earns no branch, and the rule assertions that do. */
70
+ export interface NotCausalRepair {
71
+ readonly ruleId: string;
72
+ readonly target: 'gateStatus' | 'gateOutcome' | 'gateUndeterminedItem';
73
+ readonly assertions: readonly EvidenceAssertion[];
74
+ readonly repair: string;
75
+ }
76
+ /** The observed-only entries of a verification or a stored report. */
77
+ export interface VerifiedEvidence {
78
+ readonly observedOnly: readonly ObservedOnly[];
79
+ }
80
+ /**
81
+ * Every declared gap with the exact evidence that closes it.
82
+ *
83
+ * A gap that names no rule of the artifact is left out: it is not a branch an author can add.
84
+ * Each returned case has been executed against `schema` and held; a branch no such case reaches
85
+ * is reported in `unprovable` and carries no `testCases`, so a host that offers a button only
86
+ * when `testCases` is non-empty never offers one that cannot succeed.
87
+ */
88
+ export declare function declaredEvidenceRepairs(evidence: DeclaredEvidence, schema: CompiledSchema): readonly EvidenceRepair[];
89
+ /**
90
+ * The rule assertion a gate-verdict assertion cannot give.
91
+ *
92
+ * A `gateStatus` or `gateOutcome` assertion passed without proving a branch, which the run reports
93
+ * as `not_causal` in `observedOnly`. A `gateItems` assertion credits one item but the publish fold
94
+ * deliberately does not count it as the gate's own branch — a gate can report `PASS` while one item
95
+ * is undecided. The only assertion that proves the gate rule is an explicit `expect.rules` entry,
96
+ * so that is what this names, with both branches a publisher needs.
97
+ */
98
+ export declare function notCausalRepairs(evidence: VerifiedEvidence, schema: CompiledSchema): readonly NotCausalRepair[];
99
+ //# sourceMappingURL=repairs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repairs.d.ts","sourceRoot":"","sources":["../../src/evidence/repairs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,KAAK,EAAgB,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKhG;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mEAAmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACtD;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,kGAAkG;AAClG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,GAAG,sBAAsB,CAAC;IACvE,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAID,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,SAAS,YAAY,EAAE,CAAC;CAChD;AAgJD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,cAAc,GACrB,SAAS,cAAc,EAAE,CAK3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,cAAc,GACrB,SAAS,eAAe,EAAE,CA0B5B"}
@@ -0,0 +1,181 @@
1
+ import { isRecord, unreachableBranchOf } from '@azx-pbc/axiom-runtime';
2
+ import { synthesizeRuleCase } from './cases.js';
3
+ /** The branches publishing still needs for one rule. */
4
+ function missingBranches(gap, rule) {
5
+ if (gap.kind === 'unreadable_expectation')
6
+ return [];
7
+ if (gap.kind === 'no_firing')
8
+ return ['firing'];
9
+ if (gap.kind === 'no_non_firing')
10
+ return ['non_firing'];
11
+ const unreachable = unreachableBranchOf(rule);
12
+ return unreachable === undefined
13
+ ? ['firing', 'non_firing']
14
+ : unreachable === 'firing'
15
+ ? ['non_firing']
16
+ : ['firing'];
17
+ }
18
+ /** One rule's term in a repair sentence. */
19
+ function branchText(kind, branch) {
20
+ if (kind === 'gate')
21
+ return branch === 'firing' ? 'a `FAIL` gate verdict' : 'a `PASS` gate verdict';
22
+ return `a case where the \`${kind}\` rule ${branch === 'firing' ? 'fires' : 'does not fire'}`;
23
+ }
24
+ /** The case ID a branch writes, moved past any id the rule already embeds. */
25
+ function caseIdFor(rule, branch, used) {
26
+ const base = `${rule.ruleId}_${branch}`;
27
+ if (!used.has(base))
28
+ return base;
29
+ let suffix = 2;
30
+ while (used.has(`${base}_${String(suffix)}`))
31
+ suffix += 1;
32
+ return `${base}_${String(suffix)}`;
33
+ }
34
+ /** The case IDs one rule already carries, whatever shape a hand-edited artifact gave them. */
35
+ function caseIdsOf(rule) {
36
+ const ids = new Set();
37
+ for (const entry of rule.testCases ?? []) {
38
+ if (!isRecord(entry))
39
+ continue;
40
+ const caseId = entry['caseId'];
41
+ if (typeof caseId === 'string')
42
+ ids.add(caseId);
43
+ }
44
+ return ids;
45
+ }
46
+ /** One case as an author reads it: the record it submits and what it expects. */
47
+ function caseText(testCase) {
48
+ return `\`${JSON.stringify(testCase.values)}\` expecting \`${JSON.stringify(testCase.expected)}\``;
49
+ }
50
+ /** The sentence that asks for the cases a search proved. */
51
+ function casesText(rule, branches, testCases, path) {
52
+ const what = branches.map((branch) => branchText(rule.kind, branch)).join(' and ');
53
+ const count = testCases.length === 1 ? 'case' : 'cases';
54
+ return `add the ${count} at ${path} for \`${rule.ruleId}\` (${what}): ${testCases.map(caseText).join('; ')}`;
55
+ }
56
+ /** The sentence that names a rule no embedded case can prove. */
57
+ function unprovableText(reasons) {
58
+ return `This check cannot be proved by a test: ${reasons.join('; ')}`;
59
+ }
60
+ /** What a suite can still write when an embedded case cannot be stated. */
61
+ function suiteHint(kind) {
62
+ if (kind === 'gate')
63
+ return 'assert its branch with `expect.rules` in a scenario suite; an `expect.gates` status or outcome assertion earns no credit, and a `gateItems` assertion proves one item rather than the gate’s own branch';
64
+ return 'assert the same branch with `expect.rules` in a scenario suite, where the scenario’s `given` can state what a case’s `values` cannot';
65
+ }
66
+ function ruleRepair(schema, rule, gap, branches) {
67
+ const assertions = [];
68
+ const testCases = [];
69
+ const proved = [];
70
+ const unprovable = [];
71
+ const used = caseIdsOf(rule);
72
+ if (gap.kind !== 'unreadable_expectation') {
73
+ for (const branch of branches) {
74
+ const caseId = caseIdFor(rule, branch, used);
75
+ const search = synthesizeRuleCase(schema, rule, branch, caseId);
76
+ if (!search.ok) {
77
+ unprovable.push(search.reason);
78
+ continue;
79
+ }
80
+ used.add(caseId);
81
+ proved.push(branch);
82
+ testCases.push(search.testCase);
83
+ // The suite assertion states the value the same evaluation produced, so a host that
84
+ // writes either form of the evidence writes the branch the rule actually decides.
85
+ assertions.push({ kind: 'rule', ruleId: rule.ruleId, expected: search.testCase.expected });
86
+ }
87
+ }
88
+ const path = gap.path;
89
+ if (gap.kind === 'unreadable_expectation') {
90
+ return {
91
+ gap,
92
+ ruleId: rule.ruleId,
93
+ kind: rule.kind,
94
+ assertions,
95
+ testCases,
96
+ repair: `rewrite the \`expected\` of the vector at ${path} so it states what a \`${rule.kind}\` rule produces: ${branchText(rule.kind, 'firing')} or ${branchText(rule.kind, 'non_firing')}`,
97
+ };
98
+ }
99
+ const reasons = [...new Set(unprovable)];
100
+ const parts = [];
101
+ if (testCases.length > 0)
102
+ parts.push(casesText(rule, proved, testCases, path));
103
+ if (reasons.length > 0) {
104
+ parts.push(unprovableText(reasons));
105
+ parts.push(suiteHint(rule.kind));
106
+ }
107
+ else if (testCases.length > 0) {
108
+ parts.push(rule.kind === 'gate'
109
+ ? 'or state the same branch with `expect.rules` in a scenario suite; an `expect.gates` status or outcome assertion earns no credit, and a `gateItems` assertion proves one item rather than the gate’s own branch'
110
+ : 'or state the same branch with `expect.rules` in a scenario suite');
111
+ }
112
+ return {
113
+ gap,
114
+ ruleId: rule.ruleId,
115
+ kind: rule.kind,
116
+ assertions,
117
+ testCases,
118
+ ...(reasons.length === 0 ? {} : { unprovable: reasons }),
119
+ repair: parts.join('. '),
120
+ };
121
+ }
122
+ /** One declared gap turned into the evidence that closes it, or `undefined` when it names no rule. */
123
+ function repairOf(gap, schema) {
124
+ if (gap.ruleId === undefined)
125
+ return undefined;
126
+ const rule = (schema.rules ?? []).find((declared) => declared.ruleId === gap.ruleId);
127
+ if (rule === undefined)
128
+ return undefined;
129
+ return ruleRepair(schema, rule, gap, missingBranches(gap, rule));
130
+ }
131
+ /**
132
+ * Every declared gap with the exact evidence that closes it.
133
+ *
134
+ * A gap that names no rule of the artifact is left out: it is not a branch an author can add.
135
+ * Each returned case has been executed against `schema` and held; a branch no such case reaches
136
+ * is reported in `unprovable` and carries no `testCases`, so a host that offers a button only
137
+ * when `testCases` is non-empty never offers one that cannot succeed.
138
+ */
139
+ export function declaredEvidenceRepairs(evidence, schema) {
140
+ return evidence.gaps.flatMap((gap) => {
141
+ const repair = repairOf(gap, schema);
142
+ return repair === undefined ? [] : [repair];
143
+ });
144
+ }
145
+ /**
146
+ * The rule assertion a gate-verdict assertion cannot give.
147
+ *
148
+ * A `gateStatus` or `gateOutcome` assertion passed without proving a branch, which the run reports
149
+ * as `not_causal` in `observedOnly`. A `gateItems` assertion credits one item but the publish fold
150
+ * deliberately does not count it as the gate's own branch — a gate can report `PASS` while one item
151
+ * is undecided. The only assertion that proves the gate rule is an explicit `expect.rules` entry,
152
+ * so that is what this names, with both branches a publisher needs.
153
+ */
154
+ export function notCausalRepairs(evidence, schema) {
155
+ return evidence.observedOnly.flatMap((entry) => {
156
+ if (entry.refusal !== 'not_causal')
157
+ return [];
158
+ const { target } = entry;
159
+ if (target.kind !== 'gateStatus' &&
160
+ target.kind !== 'gateOutcome' &&
161
+ target.kind !== 'gateUndeterminedItem') {
162
+ return [];
163
+ }
164
+ const rule = (schema.rules ?? []).find((declared) => declared.ruleId === target.ruleId);
165
+ if (rule === undefined || rule.kind !== 'gate')
166
+ return [];
167
+ const assertions = [
168
+ { kind: 'rule', ruleId: rule.ruleId, expected: 'FAIL' },
169
+ { kind: 'rule', ruleId: rule.ruleId, expected: 'PASS' },
170
+ ];
171
+ return [
172
+ {
173
+ ruleId: rule.ruleId,
174
+ target: target.kind,
175
+ assertions,
176
+ repair: `assert \`expect.rules\` for \`${rule.ruleId}\` with one \`FAIL\` and one \`PASS\` outcome; \`expect.gates\` reports the gate's verdict, which no one item owns, and a \`gateItems\` assertion proves one item rather than the gate's own branch`,
177
+ },
178
+ ];
179
+ });
180
+ }
181
+ //# sourceMappingURL=repairs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repairs.js","sourceRoot":"","sources":["../../src/evidence/repairs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAwFhD,wDAAwD;AACxD,SAAS,eAAe,CAAC,GAAgB,EAAE,IAAkB;IAC3D,IAAI,GAAG,CAAC,IAAI,KAAK,wBAAwB;QAAE,OAAO,EAAE,CAAC;IACrD,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,eAAe;QAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACxD,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,WAAW,KAAK,SAAS;QAC9B,CAAC,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC;QAC1B,CAAC,CAAC,WAAW,KAAK,QAAQ;YACxB,CAAC,CAAC,CAAC,YAAY,CAAC;YAChB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACnB,CAAC;AAED,4CAA4C;AAC5C,SAAS,UAAU,CAAC,IAAc,EAAE,MAAc;IAChD,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M,EAAE,QAAQ,EAAE,MAAM,EAAE;YACvD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;SACxD,CAAC;QACF,OAAO;YACL;gBACE,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,UAAU;gBACV,MAAM,EAAE,iCAAiC,IAAI,CAAC,MAAM,qMAAqM;aAC1P;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DeclaredEvidence, DeclaredGap, ObservedOnly } from '@azx-pbc/axiom-compiler';\nimport type { CompiledRule, CompiledSchema, RuleKind, WireValue } from '@azx-pbc/axiom-runtime';\nimport { isRecord, unreachableBranchOf } from '@azx-pbc/axiom-runtime';\nimport { synthesizeRuleCase } from './cases.js';\nimport type { EvidenceBranch } from './cases.js';\n\n/**\n * What a publish gap asks an author to write, in the form the suite or the rule states it.\n *\n * A compile executes nothing, so `declaredEvidence.gaps` names the branches a rule's own vectors\n * leave. Every rule reports `$.rules[i].testCases`, and no verdict assertion an author would\n * write satisfies a gate, so the report tells the author nothing they can act on. This module\n * turns each gap into the exact case or assertion that closes it, using the metaschema's own\n * members rather than a parallel shape.\n *\n * A case is only evidence if it holds, so the case is not written from the branch alone. The\n * search in `cases.ts` finds values under which the rule actually decides the branch, and the\n * `expected` is that decision read back from an evaluation of the artifact. A rule no embedded\n * case can prove — one that reads host context or a table, or whose branch no value reaches — is\n * stated as such and gets no case, rather than an invented expectation the verifier will refuse.\n * The cost is that this walk evaluates the form, so a host asks it for the gaps it is about to\n * display rather than for every rule on every keystroke.\n *\n * A gate's verdict assertion (`expect.gates`) earns `not_causal`: it proves what the form did, not\n * which item of the gate decided it. `notCausalRepairs` answers that with the item assertions the\n * gate can be credited through, naming the gate's own `itemId`s.\n */\n\n/** One assertion a scenario suite states about a rule's branch. */\nexport interface EvidenceAssertion {\n readonly kind: 'rule';\n readonly ruleId: string;\n /**\n * The outcome or value the branch is expected to produce. `Outcome` is four strings that\n * `WireValue` already admits, so the union is `WireValue`.\n */\n readonly expected: WireValue;\n}\n\n/**\n * One embedded case that closes a gap: the values to submit and what the rule decides for them.\n *\n * The values are not a convenience. A case without the record it judges states nothing about the\n * rule, and an expectation chosen for the branch instead of read from the artifact can contradict\n * the rule — the defect that made a repair fail the very check it was meant to prove. Both\n * members are derived from one evaluation, so a host that writes this case verbatim writes one\n * that holds.\n */\nexport interface SuggestedCase {\n readonly caseId: string;\n /** The outcome or value the case is expected to produce; see `EvidenceAssertion.expected`. */\n readonly expected: WireValue;\n /** The record the case submits, keyed by top-level field id. */\n readonly values: Readonly<Record<string, WireValue>>;\n}\n\n/** One declared gap, with the exact evidence that closes it. */\nexport interface EvidenceRepair {\n readonly gap: DeclaredGap;\n readonly ruleId: string;\n readonly kind: RuleKind;\n /** The suite assertions that credit the missing branch, when one can be stated. */\n readonly assertions: readonly EvidenceAssertion[];\n /** The embedded cases that close the gap, when the expected value can be stated. */\n readonly testCases: readonly SuggestedCase[];\n /**\n * Why a branch the gap names cannot be written as an embedded case, when it cannot.\n *\n * Empty beside a complete repair. When set, `testCases` holds only the branches a case can\n * prove, and the sentence names the cause rather than offering a button that cannot succeed.\n */\n readonly unprovable?: readonly string[];\n /** What to write instead, naming the rule, the branch and the member. */\n readonly repair: string;\n}\n\n/** One passing gate-verdict assertion, which earns no branch, and the rule assertions that do. */\nexport interface NotCausalRepair {\n readonly ruleId: string;\n readonly target: 'gateStatus' | 'gateOutcome' | 'gateUndeterminedItem';\n readonly assertions: readonly EvidenceAssertion[];\n readonly repair: string;\n}\n\ntype Branch = 'firing' | 'non_firing';\n\n/** The observed-only entries of a verification or a stored report. */\nexport interface VerifiedEvidence {\n readonly observedOnly: readonly ObservedOnly[];\n}\n\n/** The branches publishing still needs for one rule. */\nfunction missingBranches(gap: DeclaredGap, rule: CompiledRule): readonly Branch[] {\n if (gap.kind === 'unreadable_expectation') return [];\n if (gap.kind === 'no_firing') return ['firing'];\n if (gap.kind === 'no_non_firing') return ['non_firing'];\n const unreachable = unreachableBranchOf(rule);\n return unreachable === undefined\n ? ['firing', 'non_firing']\n : unreachable === 'firing'\n ? ['non_firing']\n : ['firing'];\n}\n\n/** One rule's term in a repair sentence. */\nfunction branchText(kind: RuleKind, branch: Branch): string {\n if (kind === 'gate')\n return branch === 'firing' ? 'a `FAIL` gate verdict' : 'a `PASS` gate verdict';\n return `a case where the \\`${kind}\\` rule ${branch === 'firing' ? 'fires' : 'does not fire'}`;\n}\n\n/** The case ID a branch writes, moved past any id the rule already embeds. */\nfunction caseIdFor(rule: CompiledRule, branch: EvidenceBranch, used: ReadonlySet<string>): string {\n const base = `${rule.ruleId}_${branch}`;\n if (!used.has(base)) return base;\n let suffix = 2;\n while (used.has(`${base}_${String(suffix)}`)) suffix += 1;\n return `${base}_${String(suffix)}`;\n}\n\n/** The case IDs one rule already carries, whatever shape a hand-edited artifact gave them. */\nfunction caseIdsOf(rule: CompiledRule): Set<string> {\n const ids = new Set<string>();\n for (const entry of rule.testCases ?? []) {\n if (!isRecord(entry)) continue;\n const caseId = entry['caseId'];\n if (typeof caseId === 'string') ids.add(caseId);\n }\n return ids;\n}\n\n/** One case as an author reads it: the record it submits and what it expects. */\nfunction caseText(testCase: SuggestedCase): string {\n return `\\`${JSON.stringify(testCase.values)}\\` expecting \\`${JSON.stringify(testCase.expected)}\\``;\n}\n\n/** The sentence that asks for the cases a search proved. */\nfunction casesText(\n rule: CompiledRule,\n branches: readonly Branch[],\n testCases: readonly SuggestedCase[],\n path: string,\n): string {\n const what = branches.map((branch) => branchText(rule.kind, branch)).join(' and ');\n const count = testCases.length === 1 ? 'case' : 'cases';\n return `add the ${count} at ${path} for \\`${rule.ruleId}\\` (${what}): ${testCases.map(caseText).join('; ')}`;\n}\n\n/** The sentence that names a rule no embedded case can prove. */\nfunction unprovableText(reasons: readonly string[]): string {\n return `This check cannot be proved by a test: ${reasons.join('; ')}`;\n}\n\n/** What a suite can still write when an embedded case cannot be stated. */\nfunction suiteHint(kind: RuleKind): string {\n if (kind === 'gate')\n return 'assert its branch with `expect.rules` in a scenario suite; an `expect.gates` status or outcome assertion earns no credit, and a `gateItems` assertion proves one item rather than the gate’s own branch';\n return 'assert the same branch with `expect.rules` in a scenario suite, where the scenario’s `given` can state what a case’s `values` cannot';\n}\n\nfunction ruleRepair(\n schema: CompiledSchema,\n rule: CompiledRule,\n gap: DeclaredGap,\n branches: readonly Branch[],\n): EvidenceRepair {\n const assertions: EvidenceAssertion[] = [];\n const testCases: SuggestedCase[] = [];\n const proved: Branch[] = [];\n const unprovable: string[] = [];\n const used = caseIdsOf(rule);\n\n if (gap.kind !== 'unreadable_expectation') {\n for (const branch of branches) {\n const caseId = caseIdFor(rule, branch, used);\n const search = synthesizeRuleCase(schema, rule, branch, caseId);\n if (!search.ok) {\n unprovable.push(search.reason);\n continue;\n }\n used.add(caseId);\n proved.push(branch);\n testCases.push(search.testCase);\n // The suite assertion states the value the same evaluation produced, so a host that\n // writes either form of the evidence writes the branch the rule actually decides.\n assertions.push({ kind: 'rule', ruleId: rule.ruleId, expected: search.testCase.expected });\n }\n }\n\n const path = gap.path;\n if (gap.kind === 'unreadable_expectation') {\n return {\n gap,\n ruleId: rule.ruleId,\n kind: rule.kind,\n assertions,\n testCases,\n repair: `rewrite the \\`expected\\` of the vector at ${path} so it states what a \\`${rule.kind}\\` rule produces: ${branchText(rule.kind, 'firing')} or ${branchText(rule.kind, 'non_firing')}`,\n };\n }\n\n const reasons = [...new Set(unprovable)];\n const parts: string[] = [];\n if (testCases.length > 0) parts.push(casesText(rule, proved, testCases, path));\n if (reasons.length > 0) {\n parts.push(unprovableText(reasons));\n parts.push(suiteHint(rule.kind));\n } else if (testCases.length > 0) {\n parts.push(\n rule.kind === 'gate'\n ? 'or state the same branch with `expect.rules` in a scenario suite; an `expect.gates` status or outcome assertion earns no credit, and a `gateItems` assertion proves one item rather than the gate’s own branch'\n : 'or state the same branch with `expect.rules` in a scenario suite',\n );\n }\n return {\n gap,\n ruleId: rule.ruleId,\n kind: rule.kind,\n assertions,\n testCases,\n ...(reasons.length === 0 ? {} : { unprovable: reasons }),\n repair: parts.join('. '),\n };\n}\n\n/** One declared gap turned into the evidence that closes it, or `undefined` when it names no rule. */\nfunction repairOf(gap: DeclaredGap, schema: CompiledSchema): EvidenceRepair | undefined {\n if (gap.ruleId === undefined) return undefined;\n const rule = (schema.rules ?? []).find((declared) => declared.ruleId === gap.ruleId);\n if (rule === undefined) return undefined;\n return ruleRepair(schema, rule, gap, missingBranches(gap, rule));\n}\n\n/**\n * Every declared gap with the exact evidence that closes it.\n *\n * A gap that names no rule of the artifact is left out: it is not a branch an author can add.\n * Each returned case has been executed against `schema` and held; a branch no such case reaches\n * is reported in `unprovable` and carries no `testCases`, so a host that offers a button only\n * when `testCases` is non-empty never offers one that cannot succeed.\n */\nexport function declaredEvidenceRepairs(\n evidence: DeclaredEvidence,\n schema: CompiledSchema,\n): readonly EvidenceRepair[] {\n return evidence.gaps.flatMap((gap) => {\n const repair = repairOf(gap, schema);\n return repair === undefined ? [] : [repair];\n });\n}\n\n/**\n * The rule assertion a gate-verdict assertion cannot give.\n *\n * A `gateStatus` or `gateOutcome` assertion passed without proving a branch, which the run reports\n * as `not_causal` in `observedOnly`. A `gateItems` assertion credits one item but the publish fold\n * deliberately does not count it as the gate's own branch — a gate can report `PASS` while one item\n * is undecided. The only assertion that proves the gate rule is an explicit `expect.rules` entry,\n * so that is what this names, with both branches a publisher needs.\n */\nexport function notCausalRepairs(\n evidence: VerifiedEvidence,\n schema: CompiledSchema,\n): readonly NotCausalRepair[] {\n return evidence.observedOnly.flatMap((entry) => {\n if (entry.refusal !== 'not_causal') return [];\n const { target } = entry;\n if (\n target.kind !== 'gateStatus' &&\n target.kind !== 'gateOutcome' &&\n target.kind !== 'gateUndeterminedItem'\n ) {\n return [];\n }\n const rule = (schema.rules ?? []).find((declared) => declared.ruleId === target.ruleId);\n if (rule === undefined || rule.kind !== 'gate') return [];\n const assertions: EvidenceAssertion[] = [\n { kind: 'rule', ruleId: rule.ruleId, expected: 'FAIL' },\n { kind: 'rule', ruleId: rule.ruleId, expected: 'PASS' },\n ];\n return [\n {\n ruleId: rule.ruleId,\n target: target.kind,\n assertions,\n repair: `assert \\`expect.rules\\` for \\`${rule.ruleId}\\` with one \\`FAIL\\` and one \\`PASS\\` outcome; \\`expect.gates\\` reports the gate's verdict, which no one item owns, and a \\`gateItems\\` assertion proves one item rather than the gate's own branch`,\n },\n ];\n });\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import type { PublishVerification } from '@azx-pbc/axiom-compiler';
2
+ import type { CompiledSchema } from '@azx-pbc/axiom-runtime';
3
+ /**
4
+ * The one count a Tests panel and a Publish section can both read.
5
+ *
6
+ * The defect this replaces was two answers derived from two runs: a scenario replay reported
7
+ * "all tests passed" over the one suite it executed while the publish fold reported the cases and
8
+ * branches that suite never touched. A reader could not tell which answer was wrong, because both
9
+ * were true of different evidence. This summary is derived from one `verifyPublishReadiness` run,
10
+ * which executed every embedded vector and every supplied suite, so "all passed" and "ready to
11
+ * publish" are the same fact.
12
+ *
13
+ * `unverified` is what keeps a stale answer out of the panel: a run refused before it executed
14
+ * anything still holds an artifact whose cases exist, and those cases have no verdict. Counting
15
+ * them is the difference between "nothing failed" and "everything that exists held".
16
+ */
17
+ export interface EvidenceSummary {
18
+ /** Cases the run executed: every embedded vector plus every scenario of every suite. */
19
+ readonly cases: number;
20
+ /** Executed cases whose claim did not hold. */
21
+ readonly failed: number;
22
+ /** Reasons publishing still refuses the artifact, exactly the Publish section's count. */
23
+ readonly pending: number;
24
+ /** Cases the artifact declares that this run did not execute. */
25
+ readonly unverified: number;
26
+ /**
27
+ * Whether every existing case executed, every one held, and every branch publishing asks for is
28
+ * proved. True only when `verifyPublishReadiness` says `ready`, so the panel cannot claim more
29
+ * than the publisher.
30
+ */
31
+ readonly allPassed: boolean;
32
+ }
33
+ /** One run's executed evidence, as both the Tests panel and the Publish section read it. */
34
+ export declare function evidenceSummary(schema: CompiledSchema, verification: PublishVerification): EvidenceSummary;
35
+ //# sourceMappingURL=summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/evidence/summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B,wFAAwF;IACxF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAqBD,4FAA4F;AAC5F,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,mBAAmB,GAChC,eAAe,CAsBjB"}
@@ -0,0 +1,38 @@
1
+ /** The cases one artifact declares on its rules, including a declaration's compiled evidence. */
2
+ function declaredCases(schema) {
3
+ return (schema.rules ?? []).reduce((total, rule) => total + (rule.testCases?.length ?? 0), 0);
4
+ }
5
+ /** The verdict of one executed scenario, and whether its suite ran at all. */
6
+ function suiteCounts(suite) {
7
+ if (suite.status === 'invalid')
8
+ return { cases: 0, failed: 0, refused: true };
9
+ return {
10
+ cases: suite.scenarios.length,
11
+ failed: suite.scenarios.filter((scenario) => scenario.status === 'failed').length,
12
+ refused: false,
13
+ };
14
+ }
15
+ /** One run's executed evidence, as both the Tests panel and the Publish section read it. */
16
+ export function evidenceSummary(schema, verification) {
17
+ const vectorFailures = verification.vectors.filter((vector) => !vector.verdict.ok).length;
18
+ const suites = verification.suites.map(suiteCounts);
19
+ const scenarios = suites.reduce((total, suite) => total + suite.cases, 0);
20
+ const scenarioFailures = suites.reduce((total, suite) => total + suite.failed, 0);
21
+ const refusedSuite = suites.some((suite) => suite.refused);
22
+ const cases = verification.vectors.length + scenarios;
23
+ const pending = verification.ready ? 0 : verification.gaps.length;
24
+ const unverified = Math.max(0, declaredCases(schema) - verification.vectors.length);
25
+ return {
26
+ cases,
27
+ failed: vectorFailures + scenarioFailures,
28
+ pending,
29
+ unverified,
30
+ allPassed: verification.ready &&
31
+ cases > 0 &&
32
+ vectorFailures === 0 &&
33
+ scenarioFailures === 0 &&
34
+ unverified === 0 &&
35
+ !refusedSuite,
36
+ };
37
+ }
38
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/evidence/summary.ts"],"names":[],"mappings":"AAkCA,iGAAiG;AACjG,SAAS,aAAa,CAAC,MAAsB;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,KAA4C;IAK/D,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9E,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;QAC7B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAA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AAC;YACpB,gBAAgB,KAAK,CAAC;YACtB,UAAU,KAAK,CAAC;YAChB,CAAC,YAAY;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import type { PublishVerification } from '@azx-pbc/axiom-compiler';\nimport type { CompiledSchema } from '@azx-pbc/axiom-runtime';\n\n/**\n * The one count a Tests panel and a Publish section can both read.\n *\n * The defect this replaces was two answers derived from two runs: a scenario replay reported\n * \"all tests passed\" over the one suite it executed while the publish fold reported the cases and\n * branches that suite never touched. A reader could not tell which answer was wrong, because both\n * were true of different evidence. This summary is derived from one `verifyPublishReadiness` run,\n * which executed every embedded vector and every supplied suite, so \"all passed\" and \"ready to\n * publish\" are the same fact.\n *\n * `unverified` is what keeps a stale answer out of the panel: a run refused before it executed\n * anything still holds an artifact whose cases exist, and those cases have no verdict. Counting\n * them is the difference between \"nothing failed\" and \"everything that exists held\".\n */\nexport interface EvidenceSummary {\n /** Cases the run executed: every embedded vector plus every scenario of every suite. */\n readonly cases: number;\n /** Executed cases whose claim did not hold. */\n readonly failed: number;\n /** Reasons publishing still refuses the artifact, exactly the Publish section's count. */\n readonly pending: number;\n /** Cases the artifact declares that this run did not execute. */\n readonly unverified: number;\n /**\n * Whether every existing case executed, every one held, and every branch publishing asks for is\n * proved. True only when `verifyPublishReadiness` says `ready`, so the panel cannot claim more\n * than the publisher.\n */\n readonly allPassed: boolean;\n}\n\n/** The cases one artifact declares on its rules, including a declaration's compiled evidence. */\nfunction declaredCases(schema: CompiledSchema): number {\n return (schema.rules ?? []).reduce((total, rule) => total + (rule.testCases?.length ?? 0), 0);\n}\n\n/** The verdict of one executed scenario, and whether its suite ran at all. */\nfunction suiteCounts(suite: PublishVerification['suites'][number]): {\n readonly cases: number;\n readonly failed: number;\n readonly refused: boolean;\n} {\n if (suite.status === 'invalid') return { cases: 0, failed: 0, refused: true };\n return {\n cases: suite.scenarios.length,\n failed: suite.scenarios.filter((scenario) => scenario.status === 'failed').length,\n refused: false,\n };\n}\n\n/** One run's executed evidence, as both the Tests panel and the Publish section read it. */\nexport function evidenceSummary(\n schema: CompiledSchema,\n verification: PublishVerification,\n): EvidenceSummary {\n const vectorFailures = verification.vectors.filter((vector) => !vector.verdict.ok).length;\n const suites = verification.suites.map(suiteCounts);\n const scenarios = suites.reduce((total, suite) => total + suite.cases, 0);\n const scenarioFailures = suites.reduce((total, suite) => total + suite.failed, 0);\n const refusedSuite = suites.some((suite) => suite.refused);\n const cases = verification.vectors.length + scenarios;\n const pending = verification.ready ? 0 : verification.gaps.length;\n const unverified = Math.max(0, declaredCases(schema) - verification.vectors.length);\n return {\n cases,\n failed: vectorFailures + scenarioFailures,\n pending,\n unverified,\n allPassed:\n verification.ready &&\n cases > 0 &&\n vectorFailures === 0 &&\n scenarioFailures === 0 &&\n unverified === 0 &&\n !refusedSuite,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { missingTranslations as translationGaps } from '@azx-pbc/axiom-compiler';
2
+ export type { TranslationGap } from '@azx-pbc/axiom-compiler';
3
+ //# sourceMappingURL=gaps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gaps.d.ts","sourceRoot":"","sources":["../../src/i18n/gaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { missingTranslations as translationGaps } from '@azx-pbc/axiom-compiler';
2
+ //# sourceMappingURL=gaps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gaps.js","sourceRoot":"","sources":["../../src/i18n/gaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { missingTranslations as translationGaps } from '@azx-pbc/axiom-compiler';\nexport type { TranslationGap } from '@azx-pbc/axiom-compiler';\n"]}
@@ -0,0 +1,19 @@
1
+ import type { AuthoringDocument } from '../schema/document.js';
2
+ /**
3
+ * Every message key this draft names, with the number of declaring members that name it.
4
+ *
5
+ * The catalogue is not consulted: this is the answer to "does something render this key", and a
6
+ * caller that wants "can this key be written" adds the entries the catalogue already holds, so a
7
+ * document loaded from disk can still correct a text it carries. The count lets an edit tell a key
8
+ * that is a slot's own from one another member also names: two members naming one key are two
9
+ * renderings of one sentence, so neither may rewrite it on the other's behalf.
10
+ */
11
+ export declare function namedMessageKeyCounts(document: AuthoringDocument): ReadonlyMap<string, number>;
12
+ /**
13
+ * Every message key this draft names, from its declarations, its rules and its layout.
14
+ *
15
+ * The set is the count map's keys: a member that names a key makes it renderable, however many
16
+ * members name it.
17
+ */
18
+ export declare function namedMessageKeys(document: AuthoringDocument): ReadonlySet<string>;
19
+ //# sourceMappingURL=message-slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-slots.d.ts","sourceRoot":"","sources":["../../src/i18n/message-slots.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAqD/D;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CA0B9F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAC,CAEjF"}