@azx-pbc/axiom-compiler 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.
- package/LICENSE +21 -0
- package/README.md +415 -2
- package/dist/article.d.ts +12 -0
- package/dist/article.d.ts.map +1 -0
- package/dist/article.js +16 -0
- package/dist/article.js.map +1 -0
- package/dist/cli/args.d.ts +101 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +158 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +33 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/compile.d.ts +2 -0
- package/dist/cli/compile.d.ts.map +1 -0
- package/dist/cli/compile.js +43 -0
- package/dist/cli/compile.js.map +1 -0
- package/dist/cli/count.d.ts +15 -0
- package/dist/cli/count.d.ts.map +1 -0
- package/dist/cli/count.js +21 -0
- package/dist/cli/count.js.map +1 -0
- package/dist/cli/dataset.d.ts +28 -0
- package/dist/cli/dataset.d.ts.map +1 -0
- package/dist/cli/dataset.js +115 -0
- package/dist/cli/dataset.js.map +1 -0
- package/dist/cli/diff.d.ts +2 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +297 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/explain.d.ts +2 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +95 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fields.d.ts +11 -0
- package/dist/cli/fields.d.ts.map +1 -0
- package/dist/cli/fields.js +13 -0
- package/dist/cli/fields.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +40 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/read.d.ts +56 -0
- package/dist/cli/read.d.ts.map +1 -0
- package/dist/cli/read.js +179 -0
- package/dist/cli/read.js.map +1 -0
- package/dist/cli/render.d.ts +58 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +422 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/schema.d.ts +28 -0
- package/dist/cli/schema.d.ts.map +1 -0
- package/dist/cli/schema.js +46 -0
- package/dist/cli/schema.js.map +1 -0
- package/dist/cli/suite-report.d.ts +18 -0
- package/dist/cli/suite-report.d.ts.map +1 -0
- package/dist/cli/suite-report.js +58 -0
- package/dist/cli/suite-report.js.map +1 -0
- package/dist/cli/suites.d.ts +25 -0
- package/dist/cli/suites.d.ts.map +1 -0
- package/dist/cli/suites.js +67 -0
- package/dist/cli/suites.js.map +1 -0
- package/dist/cli/terminal.d.ts +45 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +119 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/test.d.ts +12 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +199 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/usage.d.ts +15 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +95 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +51 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile/artifact-members.d.ts +57 -0
- package/dist/compile/artifact-members.d.ts.map +1 -0
- package/dist/compile/artifact-members.js +130 -0
- package/dist/compile/artifact-members.js.map +1 -0
- package/dist/compile/artifact.d.ts +20 -0
- package/dist/compile/artifact.d.ts.map +1 -0
- package/dist/compile/artifact.js +87 -0
- package/dist/compile/artifact.js.map +1 -0
- package/dist/compile/compilation.d.ts +46 -0
- package/dist/compile/compilation.d.ts.map +1 -0
- package/dist/compile/compilation.js +4 -0
- package/dist/compile/compilation.js.map +1 -0
- package/dist/compile/computed.d.ts +22 -0
- package/dist/compile/computed.d.ts.map +1 -0
- package/dist/compile/computed.js +245 -0
- package/dist/compile/computed.js.map +1 -0
- package/dist/compile/condition-warnings.d.ts +12 -0
- package/dist/compile/condition-warnings.d.ts.map +1 -0
- package/dist/compile/condition-warnings.js +26 -0
- package/dist/compile/condition-warnings.js.map +1 -0
- package/dist/compile/conditions.d.ts +18 -0
- package/dist/compile/conditions.d.ts.map +1 -0
- package/dist/compile/conditions.js +22 -0
- package/dist/compile/conditions.js.map +1 -0
- package/dist/compile/cross-checks.d.ts +67 -0
- package/dist/compile/cross-checks.d.ts.map +1 -0
- package/dist/compile/cross-checks.js +238 -0
- package/dist/compile/cross-checks.js.map +1 -0
- package/dist/compile/datasets.d.ts +52 -0
- package/dist/compile/datasets.d.ts.map +1 -0
- package/dist/compile/datasets.js +183 -0
- package/dist/compile/datasets.js.map +1 -0
- package/dist/compile/dead-weight.d.ts +26 -0
- package/dist/compile/dead-weight.d.ts.map +1 -0
- package/dist/compile/dead-weight.js +244 -0
- package/dist/compile/dead-weight.js.map +1 -0
- package/dist/compile/declaration-rules.d.ts +54 -0
- package/dist/compile/declaration-rules.d.ts.map +1 -0
- package/dist/compile/declaration-rules.js +510 -0
- package/dist/compile/declaration-rules.js.map +1 -0
- package/dist/compile/declarations.d.ts +44 -0
- package/dist/compile/declarations.d.ts.map +1 -0
- package/dist/compile/declarations.js +160 -0
- package/dist/compile/declarations.js.map +1 -0
- package/dist/compile/document.d.ts +4 -0
- package/dist/compile/document.d.ts.map +1 -0
- package/dist/compile/document.js +13 -0
- package/dist/compile/document.js.map +1 -0
- package/dist/compile/expression.d.ts +38 -0
- package/dist/compile/expression.d.ts.map +1 -0
- package/dist/compile/expression.js +288 -0
- package/dist/compile/expression.js.map +1 -0
- package/dist/compile/hashes.d.ts +26 -0
- package/dist/compile/hashes.d.ts.map +1 -0
- package/dist/compile/hashes.js +96 -0
- package/dist/compile/hashes.js.map +1 -0
- package/dist/compile/item-targets.d.ts +12 -0
- package/dist/compile/item-targets.d.ts.map +1 -0
- package/dist/compile/item-targets.js +287 -0
- package/dist/compile/item-targets.js.map +1 -0
- package/dist/compile/messages.d.ts +8 -0
- package/dist/compile/messages.d.ts.map +1 -0
- package/dist/compile/messages.js +62 -0
- package/dist/compile/messages.js.map +1 -0
- package/dist/compile/option-availability.d.ts +51 -0
- package/dist/compile/option-availability.d.ts.map +1 -0
- package/dist/compile/option-availability.js +171 -0
- package/dist/compile/option-availability.js.map +1 -0
- package/dist/compile/option-codes.d.ts +27 -0
- package/dist/compile/option-codes.d.ts.map +1 -0
- package/dist/compile/option-codes.js +212 -0
- package/dist/compile/option-codes.js.map +1 -0
- package/dist/compile/references.d.ts +14 -0
- package/dist/compile/references.d.ts.map +1 -0
- package/dist/compile/references.js +126 -0
- package/dist/compile/references.js.map +1 -0
- package/dist/compile/rows-from.d.ts +27 -0
- package/dist/compile/rows-from.d.ts.map +1 -0
- package/dist/compile/rows-from.js +164 -0
- package/dist/compile/rows-from.js.map +1 -0
- package/dist/compile/rules.d.ts +58 -0
- package/dist/compile/rules.d.ts.map +1 -0
- package/dist/compile/rules.js +327 -0
- package/dist/compile/rules.js.map +1 -0
- package/dist/compile/suggestions.d.ts +52 -0
- package/dist/compile/suggestions.d.ts.map +1 -0
- package/dist/compile/suggestions.js +633 -0
- package/dist/compile/suggestions.js.map +1 -0
- package/dist/compile/targets.d.ts +22 -0
- package/dist/compile/targets.d.ts.map +1 -0
- package/dist/compile/targets.js +125 -0
- package/dist/compile/targets.js.map +1 -0
- package/dist/compile/types.d.ts +84 -0
- package/dist/compile/types.d.ts.map +1 -0
- package/dist/compile/types.js +2 -0
- package/dist/compile/types.js.map +1 -0
- package/dist/compile/warning.d.ts +45 -0
- package/dist/compile/warning.d.ts.map +1 -0
- package/dist/compile/warning.js +2 -0
- package/dist/compile/warning.js.map +1 -0
- package/dist/compile-yaml.d.ts +23 -0
- package/dist/compile-yaml.d.ts.map +1 -0
- package/dist/compile-yaml.js +30 -0
- package/dist/compile-yaml.js.map +1 -0
- package/dist/compile.d.ts +78 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +372 -0
- package/dist/compile.js.map +1 -0
- package/dist/csv/limits.d.ts +43 -0
- package/dist/csv/limits.d.ts.map +1 -0
- package/dist/csv/limits.js +51 -0
- package/dist/csv/limits.js.map +1 -0
- package/dist/csv/scalar.d.ts +33 -0
- package/dist/csv/scalar.d.ts.map +1 -0
- package/dist/csv/scalar.js +77 -0
- package/dist/csv/scalar.js.map +1 -0
- package/dist/datasets/csv.d.ts +46 -0
- package/dist/datasets/csv.d.ts.map +1 -0
- package/dist/datasets/csv.js +293 -0
- package/dist/datasets/csv.js.map +1 -0
- package/dist/datasets/declaration.d.ts +16 -0
- package/dist/datasets/declaration.d.ts.map +1 -0
- package/dist/datasets/declaration.js +104 -0
- package/dist/datasets/declaration.js.map +1 -0
- package/dist/datasets/diagnostics.d.ts +65 -0
- package/dist/datasets/diagnostics.d.ts.map +1 -0
- package/dist/datasets/diagnostics.js +2 -0
- package/dist/datasets/diagnostics.js.map +1 -0
- package/dist/datasets/diff.d.ts +46 -0
- package/dist/datasets/diff.d.ts.map +1 -0
- package/dist/datasets/diff.js +84 -0
- package/dist/datasets/diff.js.map +1 -0
- package/dist/datasets/document.d.ts +12 -0
- package/dist/datasets/document.d.ts.map +1 -0
- package/dist/datasets/document.js +382 -0
- package/dist/datasets/document.js.map +1 -0
- package/dist/datasets/index.d.ts +43 -0
- package/dist/datasets/index.d.ts.map +1 -0
- package/dist/datasets/index.js +68 -0
- package/dist/datasets/index.js.map +1 -0
- package/dist/datasets/repair.d.ts +26 -0
- package/dist/datasets/repair.d.ts.map +1 -0
- package/dist/datasets/repair.js +60 -0
- package/dist/datasets/repair.js.map +1 -0
- package/dist/document-path.d.ts +62 -0
- package/dist/document-path.d.ts.map +1 -0
- package/dist/document-path.js +200 -0
- package/dist/document-path.js.map +1 -0
- package/dist/expr/boundary.d.ts +8 -0
- package/dist/expr/boundary.d.ts.map +1 -0
- package/dist/expr/boundary.js +243 -0
- package/dist/expr/boundary.js.map +1 -0
- package/dist/expr/compile-expr.d.ts +35 -0
- package/dist/expr/compile-expr.d.ts.map +1 -0
- package/dist/expr/compile-expr.js +66 -0
- package/dist/expr/compile-expr.js.map +1 -0
- package/dist/expr/deprecation.d.ts +23 -0
- package/dist/expr/deprecation.d.ts.map +1 -0
- package/dist/expr/deprecation.js +28 -0
- package/dist/expr/deprecation.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +31 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +34 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/lexer.d.ts +49 -0
- package/dist/expr/lexer.d.ts.map +1 -0
- package/dist/expr/lexer.js +277 -0
- package/dist/expr/lexer.js.map +1 -0
- package/dist/expr/lint-warnings.d.ts +11 -0
- package/dist/expr/lint-warnings.d.ts.map +1 -0
- package/dist/expr/lint-warnings.js +20 -0
- package/dist/expr/lint-warnings.js.map +1 -0
- package/dist/expr/lint.d.ts +41 -0
- package/dist/expr/lint.d.ts.map +1 -0
- package/dist/expr/lint.js +1034 -0
- package/dist/expr/lint.js.map +1 -0
- package/dist/expr/parse/aggregates.d.ts +13 -0
- package/dist/expr/parse/aggregates.d.ts.map +1 -0
- package/dist/expr/parse/aggregates.js +48 -0
- package/dist/expr/parse/aggregates.js.map +1 -0
- package/dist/expr/parse/budget.d.ts +11 -0
- package/dist/expr/parse/budget.d.ts.map +1 -0
- package/dist/expr/parse/budget.js +57 -0
- package/dist/expr/parse/budget.js.map +1 -0
- package/dist/expr/parse/grammar.d.ts +9 -0
- package/dist/expr/parse/grammar.d.ts.map +1 -0
- package/dist/expr/parse/grammar.js +699 -0
- package/dist/expr/parse/grammar.js.map +1 -0
- package/dist/expr/parse/literals.d.ts +20 -0
- package/dist/expr/parse/literals.d.ts.map +1 -0
- package/dist/expr/parse/literals.js +132 -0
- package/dist/expr/parse/literals.js.map +1 -0
- package/dist/expr/parse/stream.d.ts +60 -0
- package/dist/expr/parse/stream.d.ts.map +1 -0
- package/dist/expr/parse/stream.js +151 -0
- package/dist/expr/parse/stream.js.map +1 -0
- package/dist/expr/parser.d.ts +45 -0
- package/dist/expr/parser.d.ts.map +1 -0
- package/dist/expr/parser.js +110 -0
- package/dist/expr/parser.js.map +1 -0
- package/dist/expr/print/spell.d.ts +78 -0
- package/dist/expr/print/spell.d.ts.map +1 -0
- package/dist/expr/print/spell.js +592 -0
- package/dist/expr/print/spell.js.map +1 -0
- package/dist/expr/print.d.ts +20 -0
- package/dist/expr/print.d.ts.map +1 -0
- package/dist/expr/print.js +102 -0
- package/dist/expr/print.js.map +1 -0
- package/dist/expr/suggest.d.ts +26 -0
- package/dist/expr/suggest.d.ts.map +1 -0
- package/dist/expr/suggest.js +77 -0
- package/dist/expr/suggest.js.map +1 -0
- package/dist/expr/typecheck/aggregates.d.ts +8 -0
- package/dist/expr/typecheck/aggregates.d.ts.map +1 -0
- package/dist/expr/typecheck/aggregates.js +334 -0
- package/dist/expr/typecheck/aggregates.js.map +1 -0
- package/dist/expr/typecheck/arithmetic.d.ts +6 -0
- package/dist/expr/typecheck/arithmetic.d.ts.map +1 -0
- package/dist/expr/typecheck/arithmetic.js +258 -0
- package/dist/expr/typecheck/arithmetic.js.map +1 -0
- package/dist/expr/typecheck/arity.d.ts +38 -0
- package/dist/expr/typecheck/arity.d.ts.map +1 -0
- package/dist/expr/typecheck/arity.js +173 -0
- package/dist/expr/typecheck/arity.js.map +1 -0
- package/dist/expr/typecheck/calls.d.ts +6 -0
- package/dist/expr/typecheck/calls.d.ts.map +1 -0
- package/dist/expr/typecheck/calls.js +137 -0
- package/dist/expr/typecheck/calls.js.map +1 -0
- package/dist/expr/typecheck/comparison.d.ts +13 -0
- package/dist/expr/typecheck/comparison.d.ts.map +1 -0
- package/dist/expr/typecheck/comparison.js +200 -0
- package/dist/expr/typecheck/comparison.js.map +1 -0
- package/dist/expr/typecheck/compound.d.ts +24 -0
- package/dist/expr/typecheck/compound.d.ts.map +1 -0
- package/dist/expr/typecheck/compound.js +175 -0
- package/dist/expr/typecheck/compound.js.map +1 -0
- package/dist/expr/typecheck/context.d.ts +44 -0
- package/dist/expr/typecheck/context.d.ts.map +1 -0
- package/dist/expr/typecheck/context.js +2 -0
- package/dist/expr/typecheck/context.js.map +1 -0
- package/dist/expr/typecheck/datasets.d.ts +17 -0
- package/dist/expr/typecheck/datasets.d.ts.map +1 -0
- package/dist/expr/typecheck/datasets.js +136 -0
- package/dist/expr/typecheck/datasets.js.map +1 -0
- package/dist/expr/typecheck/digest.d.ts +7 -0
- package/dist/expr/typecheck/digest.d.ts.map +1 -0
- package/dist/expr/typecheck/digest.js +44 -0
- package/dist/expr/typecheck/digest.js.map +1 -0
- package/dist/expr/typecheck/fold.d.ts +41 -0
- package/dist/expr/typecheck/fold.d.ts.map +1 -0
- package/dist/expr/typecheck/fold.js +71 -0
- package/dist/expr/typecheck/fold.js.map +1 -0
- package/dist/expr/typecheck/gate-folds.d.ts +22 -0
- package/dist/expr/typecheck/gate-folds.d.ts.map +1 -0
- package/dist/expr/typecheck/gate-folds.js +40 -0
- package/dist/expr/typecheck/gate-folds.js.map +1 -0
- package/dist/expr/typecheck/guards.d.ts +6 -0
- package/dist/expr/typecheck/guards.d.ts.map +1 -0
- package/dist/expr/typecheck/guards.js +38 -0
- package/dist/expr/typecheck/guards.js.map +1 -0
- package/dist/expr/typecheck/member.d.ts +17 -0
- package/dist/expr/typecheck/member.d.ts.map +1 -0
- package/dist/expr/typecheck/member.js +46 -0
- package/dist/expr/typecheck/member.js.map +1 -0
- package/dist/expr/typecheck/money.d.ts +8 -0
- package/dist/expr/typecheck/money.d.ts.map +1 -0
- package/dist/expr/typecheck/money.js +49 -0
- package/dist/expr/typecheck/money.js.map +1 -0
- package/dist/expr/typecheck/numeric.d.ts +8 -0
- package/dist/expr/typecheck/numeric.d.ts.map +1 -0
- package/dist/expr/typecheck/numeric.js +84 -0
- package/dist/expr/typecheck/numeric.js.map +1 -0
- package/dist/expr/typecheck/operands.d.ts +27 -0
- package/dist/expr/typecheck/operands.d.ts.map +1 -0
- package/dist/expr/typecheck/operands.js +106 -0
- package/dist/expr/typecheck/operands.js.map +1 -0
- package/dist/expr/typecheck/paths.d.ts +21 -0
- package/dist/expr/typecheck/paths.d.ts.map +1 -0
- package/dist/expr/typecheck/paths.js +321 -0
- package/dist/expr/typecheck/paths.js.map +1 -0
- package/dist/expr/typecheck/records.d.ts +24 -0
- package/dist/expr/typecheck/records.d.ts.map +1 -0
- package/dist/expr/typecheck/records.js +53 -0
- package/dist/expr/typecheck/records.js.map +1 -0
- package/dist/expr/typecheck/sequences.d.ts +15 -0
- package/dist/expr/typecheck/sequences.d.ts.map +1 -0
- package/dist/expr/typecheck/sequences.js +55 -0
- package/dist/expr/typecheck/sequences.js.map +1 -0
- package/dist/expr/typecheck/strings.d.ts +8 -0
- package/dist/expr/typecheck/strings.d.ts.map +1 -0
- package/dist/expr/typecheck/strings.js +188 -0
- package/dist/expr/typecheck/strings.js.map +1 -0
- package/dist/expr/typecheck/temporal.d.ts +7 -0
- package/dist/expr/typecheck/temporal.d.ts.map +1 -0
- package/dist/expr/typecheck/temporal.js +80 -0
- package/dist/expr/typecheck/temporal.js.map +1 -0
- package/dist/expr/typecheck/types.d.ts +163 -0
- package/dist/expr/typecheck/types.d.ts.map +1 -0
- package/dist/expr/typecheck/types.js +404 -0
- package/dist/expr/typecheck/types.js.map +1 -0
- package/dist/expr/typecheck.d.ts +75 -0
- package/dist/expr/typecheck.d.ts.map +1 -0
- package/dist/expr/typecheck.js +242 -0
- package/dist/expr/typecheck.js.map +1 -0
- package/dist/expr/undecided.d.ts +13 -0
- package/dist/expr/undecided.d.ts.map +1 -0
- package/dist/expr/undecided.js +58 -0
- package/dist/expr/undecided.js.map +1 -0
- package/dist/expr/values/code-points.d.ts +13 -0
- package/dist/expr/values/code-points.d.ts.map +1 -0
- package/dist/expr/values/code-points.js +25 -0
- package/dist/expr/values/code-points.js.map +1 -0
- package/dist/expr/values/inline.d.ts +77 -0
- package/dist/expr/values/inline.d.ts.map +1 -0
- package/dist/expr/values/inline.js +404 -0
- package/dist/expr/values/inline.js.map +1 -0
- package/dist/expr/values/interval.d.ts +19 -0
- package/dist/expr/values/interval.d.ts.map +1 -0
- package/dist/expr/values/interval.js +1180 -0
- package/dist/expr/values/interval.js.map +1 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/document.d.ts +58 -0
- package/dist/ingest/document.d.ts.map +1 -0
- package/dist/ingest/document.js +83 -0
- package/dist/ingest/document.js.map +1 -0
- package/dist/ingest/yaml-document.d.ts +15 -0
- package/dist/ingest/yaml-document.d.ts.map +1 -0
- package/dist/ingest/yaml-document.js +42 -0
- package/dist/ingest/yaml-document.js.map +1 -0
- package/dist/ingest/yaml.d.ts +51 -0
- package/dist/ingest/yaml.d.ts.map +1 -0
- package/dist/ingest/yaml.js +340 -0
- package/dist/ingest/yaml.js.map +1 -0
- package/dist/layout/compile.d.ts +6 -0
- package/dist/layout/compile.d.ts.map +1 -0
- package/dist/layout/compile.js +224 -0
- package/dist/layout/compile.js.map +1 -0
- package/dist/layout/context.d.ts +12 -0
- package/dist/layout/context.d.ts.map +1 -0
- package/dist/layout/context.js +26 -0
- package/dist/layout/context.js.map +1 -0
- package/dist/layout/grammar.d.ts +34 -0
- package/dist/layout/grammar.d.ts.map +1 -0
- package/dist/layout/grammar.js +171 -0
- package/dist/layout/grammar.js.map +1 -0
- package/dist/layout/read.d.ts +54 -0
- package/dist/layout/read.d.ts.map +1 -0
- package/dist/layout/read.js +101 -0
- package/dist/layout/read.js.map +1 -0
- package/dist/layout/shape.d.ts +34 -0
- package/dist/layout/shape.d.ts.map +1 -0
- package/dist/layout/shape.js +149 -0
- package/dist/layout/shape.js.map +1 -0
- package/dist/messages/compile.d.ts +47 -0
- package/dist/messages/compile.d.ts.map +1 -0
- package/dist/messages/compile.js +202 -0
- package/dist/messages/compile.js.map +1 -0
- package/dist/messages/locale.d.ts +18 -0
- package/dist/messages/locale.d.ts.map +1 -0
- package/dist/messages/locale.js +33 -0
- package/dist/messages/locale.js.map +1 -0
- package/dist/messages/slots.d.ts +54 -0
- package/dist/messages/slots.d.ts.map +1 -0
- package/dist/messages/slots.js +137 -0
- package/dist/messages/slots.js.map +1 -0
- package/dist/overlay/compile-overlay.d.ts +29 -0
- package/dist/overlay/compile-overlay.d.ts.map +1 -0
- package/dist/overlay/compile-overlay.js +120 -0
- package/dist/overlay/compile-overlay.js.map +1 -0
- package/dist/overlay/compose.d.ts +26 -0
- package/dist/overlay/compose.d.ts.map +1 -0
- package/dist/overlay/compose.js +674 -0
- package/dist/overlay/compose.js.map +1 -0
- package/dist/overlay/types.d.ts +41 -0
- package/dist/overlay/types.d.ts.map +1 -0
- package/dist/overlay/types.js +2 -0
- package/dist/overlay/types.js.map +1 -0
- package/dist/publish/classify.d.ts +50 -0
- package/dist/publish/classify.d.ts.map +1 -0
- package/dist/publish/classify.js +85 -0
- package/dist/publish/classify.js.map +1 -0
- package/dist/publish/environment.d.ts +15 -0
- package/dist/publish/environment.d.ts.map +1 -0
- package/dist/publish/environment.js +2 -0
- package/dist/publish/environment.js.map +1 -0
- package/dist/publish/migrations.d.ts +108 -0
- package/dist/publish/migrations.d.ts.map +1 -0
- package/dist/publish/migrations.js +166 -0
- package/dist/publish/migrations.js.map +1 -0
- package/dist/publish/observation.d.ts +29 -0
- package/dist/publish/observation.d.ts.map +1 -0
- package/dist/publish/observation.js +43 -0
- package/dist/publish/observation.js.map +1 -0
- package/dist/publish/readiness.d.ts +197 -0
- package/dist/publish/readiness.d.ts.map +1 -0
- package/dist/publish/readiness.js +239 -0
- package/dist/publish/readiness.js.map +1 -0
- package/dist/publish/vectors.d.ts +50 -0
- package/dist/publish/vectors.d.ts.map +1 -0
- package/dist/publish/vectors.js +306 -0
- package/dist/publish/vectors.js.map +1 -0
- package/dist/publish/verify.d.ts +146 -0
- package/dist/publish/verify.d.ts.map +1 -0
- package/dist/publish/verify.js +548 -0
- package/dist/publish/verify.js.map +1 -0
- package/dist/scenarios/branch.d.ts +36 -0
- package/dist/scenarios/branch.d.ts.map +1 -0
- package/dist/scenarios/branch.js +30 -0
- package/dist/scenarios/branch.js.map +1 -0
- package/dist/scenarios/capture.d.ts +89 -0
- package/dist/scenarios/capture.d.ts.map +1 -0
- package/dist/scenarios/capture.js +443 -0
- package/dist/scenarios/capture.js.map +1 -0
- package/dist/scenarios/classifier.d.ts +20 -0
- package/dist/scenarios/classifier.d.ts.map +1 -0
- package/dist/scenarios/classifier.js +88 -0
- package/dist/scenarios/classifier.js.map +1 -0
- package/dist/scenarios/credit.d.ts +33 -0
- package/dist/scenarios/credit.d.ts.map +1 -0
- package/dist/scenarios/credit.js +330 -0
- package/dist/scenarios/credit.js.map +1 -0
- package/dist/scenarios/csv.d.ts +34 -0
- package/dist/scenarios/csv.d.ts.map +1 -0
- package/dist/scenarios/csv.js +1047 -0
- package/dist/scenarios/csv.js.map +1 -0
- package/dist/scenarios/data-identity.d.ts +39 -0
- package/dist/scenarios/data-identity.d.ts.map +1 -0
- package/dist/scenarios/data-identity.js +28 -0
- package/dist/scenarios/data-identity.js.map +1 -0
- package/dist/scenarios/document.d.ts +148 -0
- package/dist/scenarios/document.d.ts.map +1 -0
- package/dist/scenarios/document.js +513 -0
- package/dist/scenarios/document.js.map +1 -0
- package/dist/scenarios/environment.d.ts +64 -0
- package/dist/scenarios/environment.d.ts.map +1 -0
- package/dist/scenarios/environment.js +106 -0
- package/dist/scenarios/environment.js.map +1 -0
- package/dist/scenarios/evidence.d.ts +128 -0
- package/dist/scenarios/evidence.d.ts.map +1 -0
- package/dist/scenarios/evidence.js +179 -0
- package/dist/scenarios/evidence.js.map +1 -0
- package/dist/scenarios/expectations.d.ts +63 -0
- package/dist/scenarios/expectations.d.ts.map +1 -0
- package/dist/scenarios/expectations.js +490 -0
- package/dist/scenarios/expectations.js.map +1 -0
- package/dist/scenarios/references.d.ts +15 -0
- package/dist/scenarios/references.d.ts.map +1 -0
- package/dist/scenarios/references.js +239 -0
- package/dist/scenarios/references.js.map +1 -0
- package/dist/scenarios/report.d.ts +216 -0
- package/dist/scenarios/report.d.ts.map +1 -0
- package/dist/scenarios/report.js +54 -0
- package/dist/scenarios/report.js.map +1 -0
- package/dist/scenarios/runner.d.ts +55 -0
- package/dist/scenarios/runner.d.ts.map +1 -0
- package/dist/scenarios/runner.js +205 -0
- package/dist/scenarios/runner.js.map +1 -0
- package/dist/scenarios/vocabulary.d.ts +19 -0
- package/dist/scenarios/vocabulary.d.ts.map +1 -0
- package/dist/scenarios/vocabulary.js +56 -0
- package/dist/scenarios/vocabulary.js.map +1 -0
- package/dist/schema/catalogue.d.ts +54 -0
- package/dist/schema/catalogue.d.ts.map +1 -0
- package/dist/schema/catalogue.js +221 -0
- package/dist/schema/catalogue.js.map +1 -0
- package/dist/schema/check.d.ts +22 -0
- package/dist/schema/check.d.ts.map +1 -0
- package/dist/schema/check.js +30 -0
- package/dist/schema/check.js.map +1 -0
- package/dist/schema/closed.d.ts +19 -0
- package/dist/schema/closed.d.ts.map +1 -0
- package/dist/schema/closed.js +33 -0
- package/dist/schema/closed.js.map +1 -0
- package/dist/schema/collapse.d.ts +27 -0
- package/dist/schema/collapse.d.ts.map +1 -0
- package/dist/schema/collapse.js +143 -0
- package/dist/schema/collapse.js.map +1 -0
- package/dist/schema/controls.d.ts +46 -0
- package/dist/schema/controls.d.ts.map +1 -0
- package/dist/schema/controls.js +75 -0
- package/dist/schema/controls.js.map +1 -0
- package/dist/schema/dataset-declaration.d.ts +11 -0
- package/dist/schema/dataset-declaration.d.ts.map +1 -0
- package/dist/schema/dataset-declaration.js +11 -0
- package/dist/schema/dataset-declaration.js.map +1 -0
- package/dist/schema/declaration-warnings.d.ts +14 -0
- package/dist/schema/declaration-warnings.d.ts.map +1 -0
- package/dist/schema/declaration-warnings.js +77 -0
- package/dist/schema/declaration-warnings.js.map +1 -0
- package/dist/schema/declarations.d.ts +41 -0
- package/dist/schema/declarations.d.ts.map +1 -0
- package/dist/schema/declarations.js +1299 -0
- package/dist/schema/declarations.js.map +1 -0
- package/dist/schema/diagnostic.d.ts +118 -0
- package/dist/schema/diagnostic.d.ts.map +1 -0
- package/dist/schema/diagnostic.js +39 -0
- package/dist/schema/diagnostic.js.map +1 -0
- package/dist/schema/document.d.ts +93 -0
- package/dist/schema/document.d.ts.map +1 -0
- package/dist/schema/document.js +507 -0
- package/dist/schema/document.js.map +1 -0
- package/dist/schema/fields.d.ts +11 -0
- package/dist/schema/fields.d.ts.map +1 -0
- package/dist/schema/fields.js +265 -0
- package/dist/schema/fields.js.map +1 -0
- package/dist/schema/gates.d.ts +4 -0
- package/dist/schema/gates.d.ts.map +1 -0
- package/dist/schema/gates.js +68 -0
- package/dist/schema/gates.js.map +1 -0
- package/dist/schema/located.d.ts +27 -0
- package/dist/schema/located.d.ts.map +1 -0
- package/dist/schema/located.js +56 -0
- package/dist/schema/located.js.map +1 -0
- package/dist/schema/measurement.d.ts +9 -0
- package/dist/schema/measurement.d.ts.map +1 -0
- package/dist/schema/measurement.js +38 -0
- package/dist/schema/measurement.js.map +1 -0
- package/dist/schema/member-wording.d.ts +35 -0
- package/dist/schema/member-wording.d.ts.map +1 -0
- package/dist/schema/member-wording.js +286 -0
- package/dist/schema/member-wording.js.map +1 -0
- package/dist/schema/metaschema.d.ts +20 -0
- package/dist/schema/metaschema.d.ts.map +1 -0
- package/dist/schema/metaschema.js +476 -0
- package/dist/schema/metaschema.js.map +1 -0
- package/dist/schema/pointer.d.ts +31 -0
- package/dist/schema/pointer.d.ts.map +1 -0
- package/dist/schema/pointer.js +73 -0
- package/dist/schema/pointer.js.map +1 -0
- package/dist/schema/primary.d.ts +29 -0
- package/dist/schema/primary.d.ts.map +1 -0
- package/dist/schema/primary.js +48 -0
- package/dist/schema/primary.js.map +1 -0
- package/dist/schema/publish-vector.d.ts +17 -0
- package/dist/schema/publish-vector.d.ts.map +1 -0
- package/dist/schema/publish-vector.js +34 -0
- package/dist/schema/publish-vector.js.map +1 -0
- package/dist/schema/repair.d.ts +34 -0
- package/dist/schema/repair.d.ts.map +1 -0
- package/dist/schema/repair.js +163 -0
- package/dist/schema/repair.js.map +1 -0
- package/dist/schema/schema-v1.generated.d.ts +14 -0
- package/dist/schema/schema-v1.generated.d.ts.map +1 -0
- package/dist/schema/schema-v1.generated.js +7089 -0
- package/dist/schema/schema-v1.generated.js.map +1 -0
- package/dist/schema/screens.d.ts +4 -0
- package/dist/schema/screens.d.ts.map +1 -0
- package/dist/schema/screens.js +28 -0
- package/dist/schema/screens.js.map +1 -0
- package/dist/schema/test-values.d.ts +12 -0
- package/dist/schema/test-values.d.ts.map +1 -0
- package/dist/schema/test-values.js +97 -0
- package/dist/schema/test-values.js.map +1 -0
- package/dist/schema/unions.d.ts +46 -0
- package/dist/schema/unions.d.ts.map +1 -0
- package/dist/schema/unions.js +131 -0
- package/dist/schema/unions.js.map +1 -0
- package/dist/schema/validate-yaml.d.ts +14 -0
- package/dist/schema/validate-yaml.d.ts.map +1 -0
- package/dist/schema/validate-yaml.js +17 -0
- package/dist/schema/validate-yaml.js.map +1 -0
- package/dist/schema/validate.d.ts +46 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +186 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/testing.d.ts +21 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +28 -0
- package/dist/testing.js.map +1 -0
- package/dist/vocabulary.d.ts +6 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +26 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +66 -3
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { andAll, assertNever, AxiomError, canonicalizeRestricted, compareCodePoints, DEFAULT_EVIDENCE_TIER, deriveFormState, evaluateForm, isRecord, isTier, isWireValue, sameWireValue, sealReport, } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { classifyScenario } from './classifier.js';
|
|
3
|
+
import { projectScenarioSubmission, submissionCarriesValue, valueSubjectOf } from './evidence.js';
|
|
4
|
+
import { parseScenarioSuite } from './document.js';
|
|
5
|
+
import { validateReferences } from './references.js';
|
|
6
|
+
/**
|
|
7
|
+
* Captures one evaluated record as a one-scenario suite.
|
|
8
|
+
*
|
|
9
|
+
* The capture evaluates once, so the assertions, the hashes and the replay all describe one
|
|
10
|
+
* answer. A target that names something the artifact does not declare or that produced no result
|
|
11
|
+
* is refused with its reason, because there is no observation to record. A target that observed
|
|
12
|
+
* a fact earning no coverage credit is recorded and listed in `observedOnly`: the capture is a
|
|
13
|
+
* recording of what happened, and refusing it would hide the stale or deferred evidence a
|
|
14
|
+
* publisher most needs to read.
|
|
15
|
+
*/
|
|
16
|
+
export function captureScenario(compiled, input, env, options) {
|
|
17
|
+
// A flattened access projection is a first-class evaluation input, but the suite contract
|
|
18
|
+
// carries access as the overlay the host resolved it from. Capturing this record would write
|
|
19
|
+
// a suite that replays under no access at all, so the evaluations would disagree while the
|
|
20
|
+
// returned hash claimed one of them — refused rather than silently narrowed.
|
|
21
|
+
if (input.access !== undefined) {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
diagnostics: [
|
|
25
|
+
{
|
|
26
|
+
code: 'SCENARIOS_INVALID',
|
|
27
|
+
path: '$.scenarios[0].given',
|
|
28
|
+
detail: 'the record states a resolved access projection, which a scenario suite cannot carry: state the `accessOverlay` the host resolved instead',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// Without an overlay there is no suite member that can carry a non-zero standalone access
|
|
34
|
+
// version. Zero is the replay default; anything else would bind the capture to a report the
|
|
35
|
+
// written suite cannot reproduce.
|
|
36
|
+
if (input.overlay === undefined && env.accessVersion !== undefined && env.accessVersion !== 0) {
|
|
37
|
+
return {
|
|
38
|
+
ok: false,
|
|
39
|
+
diagnostics: [
|
|
40
|
+
{
|
|
41
|
+
code: 'SCENARIOS_INVALID',
|
|
42
|
+
path: '$.scenarios[0].given',
|
|
43
|
+
detail: 'the environment states `accessVersion` without an overlay the suite can carry it in',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// A suite runs on the evidence default tier unless it says otherwise, so the capture evaluates the
|
|
49
|
+
// tier its own document states rather than one the replay would infer. A tier outside the pair
|
|
50
|
+
// is refused here for the same reason the runner refuses it: a JavaScript caller bypassed the
|
|
51
|
+
// type, and no evaluation knows that tier.
|
|
52
|
+
const tier = env.tier ?? DEFAULT_EVIDENCE_TIER;
|
|
53
|
+
if (!isTier(tier)) {
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
diagnostics: [
|
|
57
|
+
{
|
|
58
|
+
code: 'SCENARIOS_INVALID',
|
|
59
|
+
path: '$.scenarios[0].given.tier',
|
|
60
|
+
detail: `\`${String(tier)}\` is not a tier: a run judges at \`server\` or \`client\``,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const declared = new Set(compiled.fields.map((field) => field.fieldId));
|
|
66
|
+
const foreign = Object.keys(input.values).find((fieldId) => !declared.has(fieldId));
|
|
67
|
+
if (foreign !== undefined) {
|
|
68
|
+
return {
|
|
69
|
+
ok: false,
|
|
70
|
+
diagnostics: [
|
|
71
|
+
{
|
|
72
|
+
code: 'SCENARIOS_INVALID',
|
|
73
|
+
path: `$.scenarios[0].given.values.${foreign}`,
|
|
74
|
+
detail: `the artifact declares no field \`${foreign}\`, so the suite cannot state it`,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const resolved = { ...env, tier };
|
|
80
|
+
// A committed suite must not carry a value the submission withholds: a masked or redacted
|
|
81
|
+
// member the overlay kept out of the export would otherwise be written into the file a team
|
|
82
|
+
// commits. When the projection changes any supplied value, the record the suite states is the
|
|
83
|
+
// record's submission — the values the artifact itself says leave the form — and the capture
|
|
84
|
+
// re-evaluates that record so the assertions, the hash and the replay describe one answer.
|
|
85
|
+
// When it changes nothing supplied, the caller's own record is written unchanged.
|
|
86
|
+
const first = evaluateForm(compiled, input, resolved);
|
|
87
|
+
const firstState = deriveFormState(compiled, first);
|
|
88
|
+
const submission = projectScenarioSubmission({
|
|
89
|
+
compiled,
|
|
90
|
+
input,
|
|
91
|
+
snapshot: first,
|
|
92
|
+
state: firstState,
|
|
93
|
+
});
|
|
94
|
+
if (submission.kind === 'refused') {
|
|
95
|
+
return {
|
|
96
|
+
ok: false,
|
|
97
|
+
diagnostics: [
|
|
98
|
+
{
|
|
99
|
+
code: 'SCENARIOS_INVALID',
|
|
100
|
+
path: '$.scenarios[0].given.values',
|
|
101
|
+
detail: `the record's submission is refused (${submission.code}): a signature would travel without a value it binds, so there is no record the suite could state`,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
let recorded = input;
|
|
107
|
+
let snapshot = first;
|
|
108
|
+
let state = firstState;
|
|
109
|
+
let projection = submission;
|
|
110
|
+
if (!carriesSuppliedValues(input.values, submission.values)) {
|
|
111
|
+
recorded = { ...input, values: submission.values };
|
|
112
|
+
snapshot = evaluateForm(compiled, recorded, resolved);
|
|
113
|
+
state = deriveFormState(compiled, snapshot);
|
|
114
|
+
const replay = projectScenarioSubmission({ compiled, input: recorded, snapshot, state });
|
|
115
|
+
if (replay.kind !== 'values' ||
|
|
116
|
+
canonicalizeRestricted(replay.values) !== canonicalizeRestricted(submission.values)) {
|
|
117
|
+
// The record the suite can state must be a fixed point of the projection: a record whose
|
|
118
|
+
// exported values project to something else is one whose replay would decide a different
|
|
119
|
+
// record, so the capture would hand back a report hash the suite never reaches. That happens
|
|
120
|
+
// when a rule reads a value the submission withholds, which no committed record can carry.
|
|
121
|
+
return {
|
|
122
|
+
ok: false,
|
|
123
|
+
diagnostics: [
|
|
124
|
+
{
|
|
125
|
+
code: 'SCENARIOS_INVALID',
|
|
126
|
+
path: '$.scenarios[0].given.values',
|
|
127
|
+
detail: 'the submission withholds a value this record decides on: its exported values project to a different record, so no suite could replay the decision a capture would report',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
projection = replay;
|
|
133
|
+
}
|
|
134
|
+
const evidence = { compiled, input: recorded, snapshot, state };
|
|
135
|
+
const captured = captureAssertions(compiled, snapshot.report, state, options.targets);
|
|
136
|
+
if (captured.diagnostics.length > 0)
|
|
137
|
+
return { ok: false, diagnostics: captured.diagnostics };
|
|
138
|
+
const withheldTargets = withheldValueTargets(compiled, projection, captured.assertions);
|
|
139
|
+
if (withheldTargets.length > 0)
|
|
140
|
+
return { ok: false, diagnostics: withheldTargets };
|
|
141
|
+
const classification = classifyScenario(evidence, captured.assertions, projection);
|
|
142
|
+
// A captured assertion that holds on replay but proves nothing is recorded, not refused: the
|
|
143
|
+
// suite states what the run observed, and this list states what that observation is worth. A
|
|
144
|
+
// consumer counting publish credit skips it; a consumer replaying the record keeps it.
|
|
145
|
+
const observedOnly = classification.assertions.flatMap((assertion) => assertion.passed && !assertion.credit.coverageEligible
|
|
146
|
+
? [{ target: assertion.target, refusal: assertion.credit.refusal }]
|
|
147
|
+
: []);
|
|
148
|
+
const document = suiteDocument(snapshot.report, recorded, resolved, tier, options, captured.assertions);
|
|
149
|
+
let text;
|
|
150
|
+
try {
|
|
151
|
+
text = canonicalizeRestricted(document);
|
|
152
|
+
}
|
|
153
|
+
catch (cause) {
|
|
154
|
+
if (!(cause instanceof AxiomError))
|
|
155
|
+
throw cause;
|
|
156
|
+
return {
|
|
157
|
+
ok: false,
|
|
158
|
+
diagnostics: [{ code: 'SCENARIOS_INVALID', path: cause.path ?? '$', detail: cause.message }],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const parsed = parseScenarioSuite(text);
|
|
162
|
+
if (!parsed.ok)
|
|
163
|
+
return parsed;
|
|
164
|
+
// A capture that wrote a suite naming a reference the artifact does not declare would ship
|
|
165
|
+
// evidence nothing can replay, so the capture checks its own output before returning it.
|
|
166
|
+
const invalid = validateReferences(compiled, parsed.suite);
|
|
167
|
+
if (invalid.length > 0)
|
|
168
|
+
return { ok: false, diagnostics: invalid };
|
|
169
|
+
return {
|
|
170
|
+
ok: true,
|
|
171
|
+
suite: parsed.suite,
|
|
172
|
+
text,
|
|
173
|
+
reportHash: sealReport(snapshot.report).reportHash,
|
|
174
|
+
observedOnly,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/** The assertions the observed answer supports for the chosen targets, or why one cannot be. */
|
|
178
|
+
function captureAssertions(compiled, report, state, targets) {
|
|
179
|
+
const assertions = [];
|
|
180
|
+
const diagnostics = [];
|
|
181
|
+
for (const [index, target] of targets.entries()) {
|
|
182
|
+
const captured = captureAssertion(compiled, report, state, target);
|
|
183
|
+
if ('detail' in captured) {
|
|
184
|
+
diagnostics.push({
|
|
185
|
+
code: 'SCENARIOS_INVALID',
|
|
186
|
+
path: `$.targets[${String(index)}]`,
|
|
187
|
+
detail: captured.detail,
|
|
188
|
+
});
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
assertions.push(captured.assertion);
|
|
192
|
+
}
|
|
193
|
+
return { assertions, diagnostics };
|
|
194
|
+
}
|
|
195
|
+
function captureAssertion(compiled, report, state, target) {
|
|
196
|
+
switch (target.kind) {
|
|
197
|
+
case 'rule': {
|
|
198
|
+
const rule = (compiled.rules ?? []).find((entry) => entry.ruleId === target.ruleId);
|
|
199
|
+
if (rule === undefined)
|
|
200
|
+
return { detail: `the artifact declares no rule \`${target.ruleId}\`` };
|
|
201
|
+
const results = report.rules.filter((result) => result.ruleId === target.ruleId &&
|
|
202
|
+
(target.rowKey === undefined || result.rowKey === target.rowKey));
|
|
203
|
+
const observation = captureObservation(report, rule, results);
|
|
204
|
+
if (observation === undefined) {
|
|
205
|
+
return { detail: `\`${target.ruleId}\` produced no result to capture` };
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
assertion: {
|
|
209
|
+
kind: 'rule',
|
|
210
|
+
ruleId: target.ruleId,
|
|
211
|
+
...(target.rowKey === undefined ? {} : { rowKey: target.rowKey }),
|
|
212
|
+
observation,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
case 'gateItem': {
|
|
217
|
+
const item = state.gates
|
|
218
|
+
.find((gate) => gate.gateId === target.ruleId)
|
|
219
|
+
?.items.find((entry) => entry.itemId === target.itemId);
|
|
220
|
+
if (item === undefined) {
|
|
221
|
+
return { detail: `gate \`${target.ruleId}\` declares no item \`${target.itemId}\`` };
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
assertion: {
|
|
225
|
+
kind: 'gateItem',
|
|
226
|
+
ruleId: target.ruleId,
|
|
227
|
+
itemId: target.itemId,
|
|
228
|
+
observation: { kind: 'outcome', outcome: item.status },
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
case 'computed': {
|
|
233
|
+
const writer = (compiled.rules ?? []).find((rule) => rule.scope !== 'item' &&
|
|
234
|
+
rule.fieldId === target.fieldId &&
|
|
235
|
+
(rule.kind === 'compute' || rule.kind === 'defaultCompute'));
|
|
236
|
+
const result = writer === undefined
|
|
237
|
+
? undefined
|
|
238
|
+
: report.rules.find((entry) => entry.ruleId === writer.ruleId);
|
|
239
|
+
if (writer === undefined || result === undefined || result.status !== 'PASS') {
|
|
240
|
+
return { detail: `\`${target.fieldId}\` holds no decided computed value to capture` };
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
assertion: { kind: 'computed', fieldId: target.fieldId, expected: result.value ?? null },
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
case 'hiddenField': {
|
|
247
|
+
const field = state.fields.find((entry) => entry.fieldId === target.fieldId);
|
|
248
|
+
if (field === undefined) {
|
|
249
|
+
return { detail: `the artifact declares no field \`${target.fieldId}\`` };
|
|
250
|
+
}
|
|
251
|
+
if (field.visible) {
|
|
252
|
+
return { detail: `\`${target.fieldId}\` is visible, so it is no evidence of a refusal` };
|
|
253
|
+
}
|
|
254
|
+
return { assertion: { kind: 'fieldHidden', fieldId: target.fieldId } };
|
|
255
|
+
}
|
|
256
|
+
default:
|
|
257
|
+
return { detail: `unhandled capture target ${JSON.stringify(target)}` };
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Whether the submission carries every value the record supplied, unchanged.
|
|
262
|
+
*
|
|
263
|
+
* A projection that adds a member — a computed output the record did not supply — is not a change
|
|
264
|
+
* to the record: the compute rule decides it either way. A supplied value that is withheld,
|
|
265
|
+
* rewritten or dropped is, and then the suite must state the submission instead.
|
|
266
|
+
*/
|
|
267
|
+
function carriesSuppliedValues(supplied, projected) {
|
|
268
|
+
if (Array.isArray(supplied)) {
|
|
269
|
+
if (!Array.isArray(projected) || projected.length !== supplied.length)
|
|
270
|
+
return false;
|
|
271
|
+
return supplied.every((item, index) => carriesSuppliedValues(item, projected[index]));
|
|
272
|
+
}
|
|
273
|
+
if (isRecord(supplied)) {
|
|
274
|
+
return (isRecord(projected) &&
|
|
275
|
+
Object.keys(supplied).every((key) => Object.hasOwn(projected, key) && carriesSuppliedValues(supplied[key], projected[key])));
|
|
276
|
+
}
|
|
277
|
+
return isWireValue(supplied) && isWireValue(projected) && sameWireValue(supplied, projected);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The targets whose stated value the submission withholds, as the refusals a capture returns.
|
|
281
|
+
*
|
|
282
|
+
* A writer's result is not the record's to export when a policy keeps the field out of the
|
|
283
|
+
* submission, and an assertion that spells it would put the value in the committed suite and in
|
|
284
|
+
* every failure detail. The target is refused rather than redacted because a capture is evidence
|
|
285
|
+
* a replay must reproduce: an assertion whose expected value is not the record's answer proves
|
|
286
|
+
* nothing on replay.
|
|
287
|
+
*/
|
|
288
|
+
function withheldValueTargets(compiled, projection, assertions) {
|
|
289
|
+
const diagnostics = [];
|
|
290
|
+
for (const [index, assertion] of assertions.entries()) {
|
|
291
|
+
const subject = statedValueSubject(compiled, assertion);
|
|
292
|
+
if (subject === undefined)
|
|
293
|
+
continue;
|
|
294
|
+
if (submissionCarriesValue(compiled, projection, subject) !== false)
|
|
295
|
+
continue;
|
|
296
|
+
diagnostics.push({
|
|
297
|
+
code: 'SCENARIOS_INVALID',
|
|
298
|
+
path: `$.targets[${String(index)}]`,
|
|
299
|
+
detail: `the submission withholds \`${describedSubject(subject)}\`, so a capture would publish a value the record does not export; assert an observation the submission carries, or capture a record that exports it`,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return diagnostics;
|
|
303
|
+
}
|
|
304
|
+
/** How a refusal names the value one target spells. */
|
|
305
|
+
function describedSubject(subject) {
|
|
306
|
+
return subject.kind === 'field' ? subject.fieldId : `${subject.arrayFieldId}.${subject.memberId}`;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The value one assertion spells, when it states one.
|
|
310
|
+
*
|
|
311
|
+
* A `computed` target names its field; a rule observation that states a value names what its
|
|
312
|
+
* writer produces, including the member an item-scoped writer states on each row.
|
|
313
|
+
*/
|
|
314
|
+
function statedValueSubject(compiled, assertion) {
|
|
315
|
+
switch (assertion.kind) {
|
|
316
|
+
case 'computed':
|
|
317
|
+
return { kind: 'field', fieldId: assertion.fieldId };
|
|
318
|
+
case 'rule': {
|
|
319
|
+
if (assertion.observation.kind !== 'value')
|
|
320
|
+
return undefined;
|
|
321
|
+
const rule = (compiled.rules ?? []).find((entry) => entry.ruleId === assertion.ruleId);
|
|
322
|
+
return valueSubjectOf(rule);
|
|
323
|
+
}
|
|
324
|
+
case 'gateItem':
|
|
325
|
+
case 'ready':
|
|
326
|
+
case 'fieldVisible':
|
|
327
|
+
case 'fieldHidden':
|
|
328
|
+
case 'fieldRequired':
|
|
329
|
+
case 'fieldMissingRequired':
|
|
330
|
+
case 'fieldDisabled':
|
|
331
|
+
case 'rowFact':
|
|
332
|
+
case 'gateStatus':
|
|
333
|
+
case 'gateOutcome':
|
|
334
|
+
case 'gateUndeterminedItem':
|
|
335
|
+
case 'screenOutcome':
|
|
336
|
+
case 'screenReason':
|
|
337
|
+
case 'exportIncludes':
|
|
338
|
+
case 'exportExcludes':
|
|
339
|
+
case 'exportValue':
|
|
340
|
+
case 'exportRefused':
|
|
341
|
+
return undefined;
|
|
342
|
+
default:
|
|
343
|
+
return assertNever(assertion);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/** The observation one rule's own results state, as the suite can assert it. */
|
|
347
|
+
function captureObservation(report, rule, results) {
|
|
348
|
+
if (results.length === 0)
|
|
349
|
+
return undefined;
|
|
350
|
+
if (rule.kind === 'screen') {
|
|
351
|
+
const outcome = report.screens?.[rule.ruleId]?.outcome;
|
|
352
|
+
return outcome === undefined ? undefined : { kind: 'screen', outcome };
|
|
353
|
+
}
|
|
354
|
+
// A writer states the value it produced when it produced one; an undecided writer states the
|
|
355
|
+
// outcome, which is the claim its assertion can honestly make.
|
|
356
|
+
const only = results.length === 1 ? results[0] : undefined;
|
|
357
|
+
if (only !== undefined &&
|
|
358
|
+
only.status === 'PASS' &&
|
|
359
|
+
(rule.kind === 'compute' || rule.kind === 'defaultCompute')) {
|
|
360
|
+
return { kind: 'value', value: only.value ?? null };
|
|
361
|
+
}
|
|
362
|
+
return { kind: 'outcome', outcome: andAll(results.map((result) => result.status)) };
|
|
363
|
+
}
|
|
364
|
+
/** The wire document a capture writes, in the shape the parser reads back. */
|
|
365
|
+
function suiteDocument(report, input, env, tier, options, assertions) {
|
|
366
|
+
const tables = [...new Set(report.lookups.map((lookup) => lookup.tableId))].sort(compareCodePoints);
|
|
367
|
+
return {
|
|
368
|
+
suiteVersion: 1,
|
|
369
|
+
scenarios: [
|
|
370
|
+
{
|
|
371
|
+
scenarioId: options.scenarioId,
|
|
372
|
+
...(options.description === undefined ? {} : { description: options.description }),
|
|
373
|
+
given: {
|
|
374
|
+
values: input.values,
|
|
375
|
+
...(input.context === undefined ? {} : { context: input.context }),
|
|
376
|
+
...(input.overlay === undefined ? {} : { accessOverlay: input.overlay }),
|
|
377
|
+
...(input.sessionWrites === undefined ? {} : { sessionWrites: input.sessionWrites }),
|
|
378
|
+
...(input.redacted === undefined ? {} : { redacted: input.redacted }),
|
|
379
|
+
...(env.recordDate === undefined ? {} : { recordDate: env.recordDate }),
|
|
380
|
+
...(env.capabilities === undefined ? {} : { capabilities: env.capabilities }),
|
|
381
|
+
tier,
|
|
382
|
+
...(tables.length === 0 ? {} : { datasets: tables }),
|
|
383
|
+
},
|
|
384
|
+
expect: expectationsOf(assertions),
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
/** The `expect` block the assertions say, grouped by the wire member each belongs to. */
|
|
390
|
+
function expectationsOf(assertions) {
|
|
391
|
+
const rules = [];
|
|
392
|
+
const gateItems = [];
|
|
393
|
+
const hiddenFields = [];
|
|
394
|
+
const computed = {};
|
|
395
|
+
for (const assertion of assertions) {
|
|
396
|
+
switch (assertion.kind) {
|
|
397
|
+
case 'rule':
|
|
398
|
+
rules.push({
|
|
399
|
+
ruleId: assertion.ruleId,
|
|
400
|
+
...(assertion.rowKey === undefined ? {} : { rowKey: assertion.rowKey }),
|
|
401
|
+
...observationWire(assertion.observation),
|
|
402
|
+
});
|
|
403
|
+
break;
|
|
404
|
+
case 'gateItem':
|
|
405
|
+
gateItems.push({
|
|
406
|
+
ruleId: assertion.ruleId,
|
|
407
|
+
itemId: assertion.itemId,
|
|
408
|
+
...observationWire(assertion.observation),
|
|
409
|
+
});
|
|
410
|
+
break;
|
|
411
|
+
case 'fieldHidden':
|
|
412
|
+
hiddenFields.push(assertion.fieldId);
|
|
413
|
+
break;
|
|
414
|
+
case 'computed':
|
|
415
|
+
computed[assertion.fieldId] = assertion.expected;
|
|
416
|
+
break;
|
|
417
|
+
default:
|
|
418
|
+
// Capture builds only the four target kinds above. A fifth kind that reached here would
|
|
419
|
+
// be dropped from the document while the capture still reported success, so the gap
|
|
420
|
+
// between `captureAssertions` and this writer is refused rather than written.
|
|
421
|
+
throw new Error(`capture cannot write a ${assertion.kind} expectation`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
...(rules.length === 0 ? {} : { rules }),
|
|
426
|
+
...(gateItems.length === 0 ? {} : { gateItems }),
|
|
427
|
+
...(hiddenFields.length === 0 ? {} : { hiddenFields }),
|
|
428
|
+
...(Object.keys(computed).length === 0 ? {} : { computed }),
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function observationWire(observation) {
|
|
432
|
+
switch (observation.kind) {
|
|
433
|
+
case 'outcome':
|
|
434
|
+
return { outcome: observation.outcome };
|
|
435
|
+
case 'screen':
|
|
436
|
+
return { screen: observation.outcome };
|
|
437
|
+
case 'value':
|
|
438
|
+
return { value: observation.value };
|
|
439
|
+
default:
|
|
440
|
+
return assertNever(observation);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/scenarios/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,WAAW,EACX,aAAa,EACb,UAAU,GACX,MAAM,wBAAwB,CAAC;AAYhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAElG,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAuErD;;;;;;;;;GASG;AAC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AC,GAAG,SAAS,CAAC,QAAQ,CAAC;gBACjD,MAAM;YACR;gBACE,wFAAwF;gBACxF,oFAAoF;gBACpF,8EAA8E;gBAC9E,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,CAAC,IAAI,cAAc,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACxC,GAAG,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QAChD,GAAG,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;QACtD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,WAAwB;IAC/C,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;QACzB,KAAK,SAAS;YACZ,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;QAC1C,KAAK,QAAQ;YACX,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,CAAC;QACzC,KAAK,OAAO;YACV,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC;QACtC;YACE,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;AACH,CAAC","sourcesContent":["import {\n andAll,\n assertNever,\n AxiomError,\n canonicalizeRestricted,\n compareCodePoints,\n DEFAULT_EVIDENCE_TIER,\n deriveFormState,\n evaluateForm,\n isRecord,\n isTier,\n isWireValue,\n sameWireValue,\n sealReport,\n} from '@azx-pbc/axiom-runtime';\nimport type {\n CompiledRule,\n CompiledSchema,\n EvaluationEnv,\n EvaluationInput,\n FormState,\n Observation,\n ReportFacts,\n RuleResult,\n Tier,\n} from '@azx-pbc/axiom-runtime';\nimport { classifyScenario } from './classifier.js';\nimport { projectScenarioSubmission, submissionCarriesValue, valueSubjectOf } from './evidence.js';\nimport type { SubmissionProjection, ValueSubject } from './evidence.js';\nimport { parseScenarioSuite } from './document.js';\nimport type { ScenarioAssertion, ScenarioSuiteDocument } from './document.js';\nimport { validateReferences } from './references.js';\nimport type { AssertionTarget, CreditRefusal, ScenarioDiagnostic } from './report.js';\n\n/**\n * Capturing a record as a scenario the suite can replay.\n *\n * The report is never accepted from a caller: it is derived from the same `(compiled, input,\n * env)` the captured suite will replay, so evidence minted here belongs to an evaluation that\n * actually happened. The targets are explicit for the same reason — a capture asserts what the\n * caller asked it to assert, never everything the evaluation happened to observe.\n *\n * The record the suite states never carries a value the submission withholds: a masked or\n * redacted member the overlay kept out of the export would otherwise be written into the file a\n * team commits. When the submission changes a value the caller supplied, the capture writes the\n * projected record and re-evaluates it, so the assertions, the hash and the replay describe one\n * answer; a record whose decision reads a withheld value cannot be replayed from its export and\n * is refused rather than recorded as a different decision.\n *\n * A capture is a recording, not a publish claim: a target whose observation holds but earns no\n * coverage credit — a deferred rule, a version-mismatched lookup, an overridden default — is\n * written down with the observation the run produced and reported back as uncredited, so the\n * replay states the same evidence instead of the capture refusing to record what happened. Only\n * an empty target list, a malformed expectation, a target whose value the submission withholds,\n * and a record the suite cannot state are refused, because those state nothing a replay could\n * assert without publishing something the record does not export.\n */\n\n/** One thing to assert about the captured record. */\nexport type CaptureTarget =\n | { readonly kind: 'rule'; readonly ruleId: string; readonly rowKey?: string | number }\n | { readonly kind: 'gateItem'; readonly ruleId: string; readonly itemId: string }\n | { readonly kind: 'computed'; readonly fieldId: string }\n | { readonly kind: 'hiddenField'; readonly fieldId: string };\n\n/**\n * A captured assertion that holds on replay but proves nothing about a rule's branch.\n *\n * The vocabulary the suite report uses: the target the assertion names and the reason it earns\n * no coverage credit. A consumer that reads the capture as publish evidence must skip these, and\n * one that reads it as a recording keeps them.\n */\nexport interface CapturedObservation {\n readonly target: AssertionTarget;\n readonly refusal: CreditRefusal;\n}\n\n/** What to capture: the scenario's identity and the assertions it must make. */\nexport interface CaptureOptions {\n readonly scenarioId: string;\n readonly description?: string;\n readonly targets: readonly CaptureTarget[];\n}\n\n/** A captured suite, or why the record could not become one. */\nexport type CaptureResult =\n | {\n readonly ok: true;\n /** A one-scenario suite that replays to the same decision. */\n readonly suite: ScenarioSuiteDocument;\n /** The suite's canonical text, which is the document a caller writes and reads back. */\n readonly text: string;\n /** The digest of the report this capture derived, from the same evaluation. */\n readonly reportHash: string;\n /**\n * The assertions that hold on replay but earn no coverage credit, each with the reason.\n * Empty when every captured observation is evidence; never a reason to refuse the capture.\n */\n readonly observedOnly: readonly CapturedObservation[];\n }\n | { readonly ok: false; readonly diagnostics: readonly ScenarioDiagnostic[] };\n\n/**\n * Captures one evaluated record as a one-scenario suite.\n *\n * The capture evaluates once, so the assertions, the hashes and the replay all describe one\n * answer. A target that names something the artifact does not declare or that produced no result\n * is refused with its reason, because there is no observation to record. A target that observed\n * a fact earning no coverage credit is recorded and listed in `observedOnly`: the capture is a\n * recording of what happened, and refusing it would hide the stale or deferred evidence a\n * publisher most needs to read.\n */\nexport function captureScenario(\n compiled: CompiledSchema,\n input: EvaluationInput,\n env: EvaluationEnv,\n options: CaptureOptions,\n): CaptureResult {\n // A flattened access projection is a first-class evaluation input, but the suite contract\n // carries access as the overlay the host resolved it from. Capturing this record would write\n // a suite that replays under no access at all, so the evaluations would disagree while the\n // returned hash claimed one of them — refused rather than silently narrowed.\n if (input.access !== undefined) {\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCENARIOS_INVALID',\n path: '$.scenarios[0].given',\n detail:\n 'the record states a resolved access projection, which a scenario suite cannot carry: state the `accessOverlay` the host resolved instead',\n },\n ],\n };\n }\n // Without an overlay there is no suite member that can carry a non-zero standalone access\n // version. Zero is the replay default; anything else would bind the capture to a report the\n // written suite cannot reproduce.\n if (input.overlay === undefined && env.accessVersion !== undefined && env.accessVersion !== 0) {\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCENARIOS_INVALID',\n path: '$.scenarios[0].given',\n detail:\n 'the environment states `accessVersion` without an overlay the suite can carry it in',\n },\n ],\n };\n }\n // A suite runs on the evidence default tier unless it says otherwise, so the capture evaluates the\n // tier its own document states rather than one the replay would infer. A tier outside the pair\n // is refused here for the same reason the runner refuses it: a JavaScript caller bypassed the\n // type, and no evaluation knows that tier.\n const tier = env.tier ?? DEFAULT_EVIDENCE_TIER;\n if (!isTier(tier)) {\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCENARIOS_INVALID',\n path: '$.scenarios[0].given.tier',\n detail: `\\`${String(tier)}\\` is not a tier: a run judges at \\`server\\` or \\`client\\``,\n },\n ],\n };\n }\n const declared = new Set(compiled.fields.map((field) => field.fieldId));\n const foreign = Object.keys(input.values).find((fieldId) => !declared.has(fieldId));\n if (foreign !== undefined) {\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCENARIOS_INVALID',\n path: `$.scenarios[0].given.values.${foreign}`,\n detail: `the artifact declares no field \\`${foreign}\\`, so the suite cannot state it`,\n },\n ],\n };\n }\n const resolved: EvaluationEnv = { ...env, tier };\n // A committed suite must not carry a value the submission withholds: a masked or redacted\n // member the overlay kept out of the export would otherwise be written into the file a team\n // commits. When the projection changes any supplied value, the record the suite states is the\n // record's submission — the values the artifact itself says leave the form — and the capture\n // re-evaluates that record so the assertions, the hash and the replay describe one answer.\n // When it changes nothing supplied, the caller's own record is written unchanged.\n const first = evaluateForm(compiled, input, resolved);\n const firstState = deriveFormState(compiled, first);\n const submission = projectScenarioSubmission({\n compiled,\n input,\n snapshot: first,\n state: firstState,\n });\n if (submission.kind === 'refused') {\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCENARIOS_INVALID',\n path: '$.scenarios[0].given.values',\n detail: `the record's submission is refused (${submission.code}): a signature would travel without a value it binds, so there is no record the suite could state`,\n },\n ],\n };\n }\n let recorded = input;\n let snapshot = first;\n let state = firstState;\n let projection = submission;\n if (!carriesSuppliedValues(input.values, submission.values)) {\n recorded = { ...input, values: submission.values };\n snapshot = evaluateForm(compiled, recorded, resolved);\n state = deriveFormState(compiled, snapshot);\n const replay = projectScenarioSubmission({ compiled, input: recorded, snapshot, state });\n if (\n replay.kind !== 'values' ||\n canonicalizeRestricted(replay.values) !== canonicalizeRestricted(submission.values)\n ) {\n // The record the suite can state must be a fixed point of the projection: a record whose\n // exported values project to something else is one whose replay would decide a different\n // record, so the capture would hand back a report hash the suite never reaches. That happens\n // when a rule reads a value the submission withholds, which no committed record can carry.\n return {\n ok: false,\n diagnostics: [\n {\n code: 'SCENARIOS_INVALID',\n path: '$.scenarios[0].given.values',\n detail:\n 'the submission withholds a value this record decides on: its exported values project to a different record, so no suite could replay the decision a capture would report',\n },\n ],\n };\n }\n projection = replay;\n }\n const evidence = { compiled, input: recorded, snapshot, state };\n const captured = captureAssertions(compiled, snapshot.report, state, options.targets);\n if (captured.diagnostics.length > 0) return { ok: false, diagnostics: captured.diagnostics };\n const withheldTargets = withheldValueTargets(compiled, projection, captured.assertions);\n if (withheldTargets.length > 0) return { ok: false, diagnostics: withheldTargets };\n const classification = classifyScenario(evidence, captured.assertions, projection);\n // A captured assertion that holds on replay but proves nothing is recorded, not refused: the\n // suite states what the run observed, and this list states what that observation is worth. A\n // consumer counting publish credit skips it; a consumer replaying the record keeps it.\n const observedOnly: CapturedObservation[] = classification.assertions.flatMap((assertion) =>\n assertion.passed && !assertion.credit.coverageEligible\n ? [{ target: assertion.target, refusal: assertion.credit.refusal }]\n : [],\n );\n const document = suiteDocument(\n snapshot.report,\n recorded,\n resolved,\n tier,\n options,\n captured.assertions,\n );\n let text: string;\n try {\n text = canonicalizeRestricted(document);\n } catch (cause) {\n if (!(cause instanceof AxiomError)) throw cause;\n return {\n ok: false,\n diagnostics: [{ code: 'SCENARIOS_INVALID', path: cause.path ?? '$', detail: cause.message }],\n };\n }\n const parsed = parseScenarioSuite(text);\n if (!parsed.ok) return parsed;\n // A capture that wrote a suite naming a reference the artifact does not declare would ship\n // evidence nothing can replay, so the capture checks its own output before returning it.\n const invalid = validateReferences(compiled, parsed.suite);\n if (invalid.length > 0) return { ok: false, diagnostics: invalid };\n return {\n ok: true,\n suite: parsed.suite,\n text,\n reportHash: sealReport(snapshot.report).reportHash,\n observedOnly,\n };\n}\n\n/** The assertions the observed answer supports for the chosen targets, or why one cannot be. */\nfunction captureAssertions(\n compiled: CompiledSchema,\n report: ReportFacts,\n state: FormState,\n targets: readonly CaptureTarget[],\n): {\n readonly assertions: readonly ScenarioAssertion[];\n readonly diagnostics: readonly ScenarioDiagnostic[];\n} {\n const assertions: ScenarioAssertion[] = [];\n const diagnostics: ScenarioDiagnostic[] = [];\n for (const [index, target] of targets.entries()) {\n const captured = captureAssertion(compiled, report, state, target);\n if ('detail' in captured) {\n diagnostics.push({\n code: 'SCENARIOS_INVALID',\n path: `$.targets[${String(index)}]`,\n detail: captured.detail,\n });\n continue;\n }\n assertions.push(captured.assertion);\n }\n return { assertions, diagnostics };\n}\n\nfunction captureAssertion(\n compiled: CompiledSchema,\n report: ReportFacts,\n state: FormState,\n target: CaptureTarget,\n): { readonly assertion: ScenarioAssertion } | { readonly detail: string } {\n switch (target.kind) {\n case 'rule': {\n const rule = (compiled.rules ?? []).find((entry) => entry.ruleId === target.ruleId);\n if (rule === undefined)\n return { detail: `the artifact declares no rule \\`${target.ruleId}\\`` };\n const results = report.rules.filter(\n (result) =>\n result.ruleId === target.ruleId &&\n (target.rowKey === undefined || result.rowKey === target.rowKey),\n );\n const observation = captureObservation(report, rule, results);\n if (observation === undefined) {\n return { detail: `\\`${target.ruleId}\\` produced no result to capture` };\n }\n return {\n assertion: {\n kind: 'rule',\n ruleId: target.ruleId,\n ...(target.rowKey === undefined ? {} : { rowKey: target.rowKey }),\n observation,\n },\n };\n }\n case 'gateItem': {\n const item = state.gates\n .find((gate) => gate.gateId === target.ruleId)\n ?.items.find((entry) => entry.itemId === target.itemId);\n if (item === undefined) {\n return { detail: `gate \\`${target.ruleId}\\` declares no item \\`${target.itemId}\\`` };\n }\n return {\n assertion: {\n kind: 'gateItem',\n ruleId: target.ruleId,\n itemId: target.itemId,\n observation: { kind: 'outcome', outcome: item.status },\n },\n };\n }\n case 'computed': {\n const writer = (compiled.rules ?? []).find(\n (rule) =>\n rule.scope !== 'item' &&\n rule.fieldId === target.fieldId &&\n (rule.kind === 'compute' || rule.kind === 'defaultCompute'),\n );\n const result =\n writer === undefined\n ? undefined\n : report.rules.find((entry) => entry.ruleId === writer.ruleId);\n if (writer === undefined || result === undefined || result.status !== 'PASS') {\n return { detail: `\\`${target.fieldId}\\` holds no decided computed value to capture` };\n }\n return {\n assertion: { kind: 'computed', fieldId: target.fieldId, expected: result.value ?? null },\n };\n }\n case 'hiddenField': {\n const field = state.fields.find((entry) => entry.fieldId === target.fieldId);\n if (field === undefined) {\n return { detail: `the artifact declares no field \\`${target.fieldId}\\`` };\n }\n if (field.visible) {\n return { detail: `\\`${target.fieldId}\\` is visible, so it is no evidence of a refusal` };\n }\n return { assertion: { kind: 'fieldHidden', fieldId: target.fieldId } };\n }\n default:\n return { detail: `unhandled capture target ${JSON.stringify(target)}` };\n }\n}\n\n/**\n * Whether the submission carries every value the record supplied, unchanged.\n *\n * A projection that adds a member — a computed output the record did not supply — is not a change\n * to the record: the compute rule decides it either way. A supplied value that is withheld,\n * rewritten or dropped is, and then the suite must state the submission instead.\n */\nfunction carriesSuppliedValues(supplied: unknown, projected: unknown): boolean {\n if (Array.isArray(supplied)) {\n if (!Array.isArray(projected) || projected.length !== supplied.length) return false;\n return supplied.every((item, index) => carriesSuppliedValues(item, projected[index]));\n }\n if (isRecord(supplied)) {\n return (\n isRecord(projected) &&\n Object.keys(supplied).every(\n (key) =>\n Object.hasOwn(projected, key) && carriesSuppliedValues(supplied[key], projected[key]),\n )\n );\n }\n return isWireValue(supplied) && isWireValue(projected) && sameWireValue(supplied, projected);\n}\n\n/**\n * The targets whose stated value the submission withholds, as the refusals a capture returns.\n *\n * A writer's result is not the record's to export when a policy keeps the field out of the\n * submission, and an assertion that spells it would put the value in the committed suite and in\n * every failure detail. The target is refused rather than redacted because a capture is evidence\n * a replay must reproduce: an assertion whose expected value is not the record's answer proves\n * nothing on replay.\n */\nfunction withheldValueTargets(\n compiled: CompiledSchema,\n projection: SubmissionProjection,\n assertions: readonly ScenarioAssertion[],\n): readonly ScenarioDiagnostic[] {\n const diagnostics: ScenarioDiagnostic[] = [];\n for (const [index, assertion] of assertions.entries()) {\n const subject = statedValueSubject(compiled, assertion);\n if (subject === undefined) continue;\n if (submissionCarriesValue(compiled, projection, subject) !== false) continue;\n diagnostics.push({\n code: 'SCENARIOS_INVALID',\n path: `$.targets[${String(index)}]`,\n detail: `the submission withholds \\`${describedSubject(subject)}\\`, so a capture would publish a value the record does not export; assert an observation the submission carries, or capture a record that exports it`,\n });\n }\n return diagnostics;\n}\n\n/** How a refusal names the value one target spells. */\nfunction describedSubject(subject: ValueSubject): string {\n return subject.kind === 'field' ? subject.fieldId : `${subject.arrayFieldId}.${subject.memberId}`;\n}\n\n/**\n * The value one assertion spells, when it states one.\n *\n * A `computed` target names its field; a rule observation that states a value names what its\n * writer produces, including the member an item-scoped writer states on each row.\n */\nfunction statedValueSubject(\n compiled: CompiledSchema,\n assertion: ScenarioAssertion,\n): ValueSubject | undefined {\n switch (assertion.kind) {\n case 'computed':\n return { kind: 'field', fieldId: assertion.fieldId };\n case 'rule': {\n if (assertion.observation.kind !== 'value') return undefined;\n const rule = (compiled.rules ?? []).find((entry) => entry.ruleId === assertion.ruleId);\n return valueSubjectOf(rule);\n }\n case 'gateItem':\n case 'ready':\n case 'fieldVisible':\n case 'fieldHidden':\n case 'fieldRequired':\n case 'fieldMissingRequired':\n case 'fieldDisabled':\n case 'rowFact':\n case 'gateStatus':\n case 'gateOutcome':\n case 'gateUndeterminedItem':\n case 'screenOutcome':\n case 'screenReason':\n case 'exportIncludes':\n case 'exportExcludes':\n case 'exportValue':\n case 'exportRefused':\n return undefined;\n default:\n return assertNever(assertion);\n }\n}\n\n/** The observation one rule's own results state, as the suite can assert it. */\nfunction captureObservation(\n report: ReportFacts,\n rule: CompiledRule,\n results: readonly RuleResult[],\n): Observation | undefined {\n if (results.length === 0) return undefined;\n if (rule.kind === 'screen') {\n const outcome = report.screens?.[rule.ruleId]?.outcome;\n return outcome === undefined ? undefined : { kind: 'screen', outcome };\n }\n // A writer states the value it produced when it produced one; an undecided writer states the\n // outcome, which is the claim its assertion can honestly make.\n const only = results.length === 1 ? results[0] : undefined;\n if (\n only !== undefined &&\n only.status === 'PASS' &&\n (rule.kind === 'compute' || rule.kind === 'defaultCompute')\n ) {\n return { kind: 'value', value: only.value ?? null };\n }\n return { kind: 'outcome', outcome: andAll(results.map((result) => result.status)) };\n}\n\n/** The wire document a capture writes, in the shape the parser reads back. */\nfunction suiteDocument(\n report: ReportFacts,\n input: EvaluationInput,\n env: EvaluationEnv,\n tier: Tier,\n options: CaptureOptions,\n assertions: readonly ScenarioAssertion[],\n): Record<string, unknown> {\n const tables = [...new Set(report.lookups.map((lookup) => lookup.tableId))].sort(\n compareCodePoints,\n );\n return {\n suiteVersion: 1,\n scenarios: [\n {\n scenarioId: options.scenarioId,\n ...(options.description === undefined ? {} : { description: options.description }),\n given: {\n values: input.values,\n ...(input.context === undefined ? {} : { context: input.context }),\n ...(input.overlay === undefined ? {} : { accessOverlay: input.overlay }),\n ...(input.sessionWrites === undefined ? {} : { sessionWrites: input.sessionWrites }),\n ...(input.redacted === undefined ? {} : { redacted: input.redacted }),\n ...(env.recordDate === undefined ? {} : { recordDate: env.recordDate }),\n ...(env.capabilities === undefined ? {} : { capabilities: env.capabilities }),\n tier,\n ...(tables.length === 0 ? {} : { datasets: tables }),\n },\n expect: expectationsOf(assertions),\n },\n ],\n };\n}\n\n/** The `expect` block the assertions say, grouped by the wire member each belongs to. */\nfunction expectationsOf(assertions: readonly ScenarioAssertion[]): Record<string, unknown> {\n const rules: Record<string, unknown>[] = [];\n const gateItems: Record<string, unknown>[] = [];\n const hiddenFields: string[] = [];\n const computed: Record<string, unknown> = {};\n for (const assertion of assertions) {\n switch (assertion.kind) {\n case 'rule':\n rules.push({\n ruleId: assertion.ruleId,\n ...(assertion.rowKey === undefined ? {} : { rowKey: assertion.rowKey }),\n ...observationWire(assertion.observation),\n });\n break;\n case 'gateItem':\n gateItems.push({\n ruleId: assertion.ruleId,\n itemId: assertion.itemId,\n ...observationWire(assertion.observation),\n });\n break;\n case 'fieldHidden':\n hiddenFields.push(assertion.fieldId);\n break;\n case 'computed':\n computed[assertion.fieldId] = assertion.expected;\n break;\n default:\n // Capture builds only the four target kinds above. A fifth kind that reached here would\n // be dropped from the document while the capture still reported success, so the gap\n // between `captureAssertions` and this writer is refused rather than written.\n throw new Error(`capture cannot write a ${assertion.kind} expectation`);\n }\n }\n return {\n ...(rules.length === 0 ? {} : { rules }),\n ...(gateItems.length === 0 ? {} : { gateItems }),\n ...(hiddenFields.length === 0 ? {} : { hiddenFields }),\n ...(Object.keys(computed).length === 0 ? {} : { computed }),\n };\n}\n\nfunction observationWire(observation: Observation): Record<string, unknown> {\n switch (observation.kind) {\n case 'outcome':\n return { outcome: observation.outcome };\n case 'screen':\n return { screen: observation.outcome };\n case 'value':\n return { value: observation.value };\n default:\n return assertNever(observation);\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ScenarioAssertion } from './document.js';
|
|
2
|
+
import type { ScenarioEvidence, SubmissionProjection } from './evidence.js';
|
|
3
|
+
import type { ResolvedAssertion, UnassertedObservation } from './report.js';
|
|
4
|
+
export type { ScenarioEvidence, SubmissionProjection } from './evidence.js';
|
|
5
|
+
/**
|
|
6
|
+
* One scenario's assertions, resolved against one evaluation.
|
|
7
|
+
*
|
|
8
|
+
* The classifier is the composition and nothing else: it judges each assertion, asks what a
|
|
9
|
+
* passing one is worth, and reports the firings no assertion covered. Judgement, credit and the
|
|
10
|
+
* facts they read each live in their own module, so a passing assertion cannot be credited for a
|
|
11
|
+
* firing no judge compared.
|
|
12
|
+
*/
|
|
13
|
+
/** One scenario's assertion results, and the firings no assertion covered. */
|
|
14
|
+
export interface ScenarioClassification {
|
|
15
|
+
readonly assertions: readonly ResolvedAssertion[];
|
|
16
|
+
readonly unasserted: readonly UnassertedObservation[];
|
|
17
|
+
}
|
|
18
|
+
/** Judges one scenario's assertions and reports the firings that no assertion covered. */
|
|
19
|
+
export declare function classifyScenario(evidence: ScenarioEvidence, assertions: readonly ScenarioAssertion[], projection: SubmissionProjection): ScenarioClassification;
|
|
20
|
+
//# sourceMappingURL=classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../src/scenarios/classifier.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5E;;;;;;;GAOG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACvD;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,SAAS,iBAAiB,EAAE,EACxC,UAAU,EAAE,oBAAoB,GAC/B,sBAAsB,CA4BxB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { andAll, gateItemsOf, isFiring } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { creditOf } from './credit.js';
|
|
3
|
+
import { factsOf, indexResults } from './evidence.js';
|
|
4
|
+
import { judgeAssertion } from './expectations.js';
|
|
5
|
+
/** Judges one scenario's assertions and reports the firings that no assertion covered. */
|
|
6
|
+
export function classifyScenario(evidence, assertions, projection) {
|
|
7
|
+
const facts = factsOf(evidence, projection);
|
|
8
|
+
const resolved = [];
|
|
9
|
+
const assertedRules = new Set();
|
|
10
|
+
const assertedItems = new Set();
|
|
11
|
+
for (const assertion of assertions) {
|
|
12
|
+
if (assertion.kind === 'rule')
|
|
13
|
+
assertedRules.add(assertion.ruleId);
|
|
14
|
+
if (assertion.kind === 'gateItem') {
|
|
15
|
+
assertedItems.add(itemIdentity(assertion.ruleId, assertion.itemId));
|
|
16
|
+
}
|
|
17
|
+
const { target, verdict } = judgeAssertion(facts, assertion);
|
|
18
|
+
if (!verdict.passed) {
|
|
19
|
+
resolved.push({ target, passed: false, detail: verdict.detail });
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const credit = creditOf(facts, assertion);
|
|
23
|
+
// A consequence assertion is an assertion about the rule that decided it: the suite stated
|
|
24
|
+
// the rule's work as a field or row fact, so a hint that it "was never asserted" would tell a
|
|
25
|
+
// publisher to write the case they already wrote.
|
|
26
|
+
if (credit.coverageEligible && credit.subject.kind === 'rule') {
|
|
27
|
+
assertedRules.add(credit.subject.ruleId);
|
|
28
|
+
}
|
|
29
|
+
resolved.push({ target, passed: true, credit });
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
assertions: resolved,
|
|
33
|
+
unasserted: unassertedOf(evidence, assertedRules, assertedItems),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Explicit targets whose observation fired and that no assertion covered.
|
|
38
|
+
*
|
|
39
|
+
* A hint about what the suite could have proved: it never earns credit, because nothing was
|
|
40
|
+
* asserted, but it tells a publisher which firings went unwitnessed. A rule the evaluation
|
|
41
|
+
* produced no result for has no observation at all.
|
|
42
|
+
*/
|
|
43
|
+
function unassertedOf(evidence, assertedRules, assertedItems) {
|
|
44
|
+
const results = indexResults(evidence.snapshot.report.rules);
|
|
45
|
+
const screens = new Map(evidence.state.screens.map((screen) => [screen.screenId, screen]));
|
|
46
|
+
const unasserted = [];
|
|
47
|
+
for (const rule of evidence.compiled.rules ?? []) {
|
|
48
|
+
const observed = observationOfRule(rule, results.get(rule.ruleId) ?? [], screens);
|
|
49
|
+
if (observed === undefined)
|
|
50
|
+
continue;
|
|
51
|
+
if (!assertedRules.has(rule.ruleId) && isFiring(rule.kind, observed)) {
|
|
52
|
+
unasserted.push({
|
|
53
|
+
target: { kind: 'rule', ruleId: rule.ruleId },
|
|
54
|
+
credit: { coverageEligible: false, refusal: 'unasserted' },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (rule.kind !== 'gate')
|
|
58
|
+
continue;
|
|
59
|
+
for (const item of itemsOfGate(evidence, rule.ruleId)) {
|
|
60
|
+
if (assertedItems.has(itemIdentity(rule.ruleId, item.itemId)))
|
|
61
|
+
continue;
|
|
62
|
+
if (isFiring('gate', { kind: 'outcome', outcome: item.status })) {
|
|
63
|
+
unasserted.push({
|
|
64
|
+
target: { kind: 'gateItem', ruleId: rule.ruleId, itemId: item.itemId },
|
|
65
|
+
credit: { coverageEligible: false, refusal: 'unasserted' },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return unasserted;
|
|
71
|
+
}
|
|
72
|
+
/** The observation a rule's own results state, or `undefined` when it produced none. */
|
|
73
|
+
function observationOfRule(rule, results, screens) {
|
|
74
|
+
if (rule.kind === 'screen') {
|
|
75
|
+
const outcome = screens.get(rule.ruleId)?.outcome;
|
|
76
|
+
return outcome === undefined ? undefined : { kind: 'screen', outcome };
|
|
77
|
+
}
|
|
78
|
+
if (results.length === 0)
|
|
79
|
+
return undefined;
|
|
80
|
+
return { kind: 'outcome', outcome: andAll(results.map((result) => result.status)) };
|
|
81
|
+
}
|
|
82
|
+
function itemsOfGate(evidence, gateId) {
|
|
83
|
+
return gateItemsOf(evidence.snapshot.report.gates?.[gateId]);
|
|
84
|
+
}
|
|
85
|
+
function itemIdentity(ruleId, itemId) {
|
|
86
|
+
return `${ruleId}/${itemId}`;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=classifier.js.map
|