@azx-pbc/axiom-runtime 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 +714 -2
- package/dist/cache/index.d.ts +191 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +361 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/canonical/jcs.d.ts +78 -0
- package/dist/canonical/jcs.d.ts.map +1 -0
- package/dist/canonical/jcs.js +500 -0
- package/dist/canonical/jcs.js.map +1 -0
- package/dist/canonical/restricted-json.d.ts +7 -0
- package/dist/canonical/restricted-json.d.ts.map +1 -0
- package/dist/canonical/restricted-json.js +318 -0
- package/dist/canonical/restricted-json.js.map +1 -0
- package/dist/canonical/restricted-value.d.ts +59 -0
- package/dist/canonical/restricted-value.d.ts.map +1 -0
- package/dist/canonical/restricted-value.js +156 -0
- package/dist/canonical/restricted-value.js.map +1 -0
- package/dist/canonical/restricted.d.ts +85 -0
- package/dist/canonical/restricted.d.ts.map +1 -0
- package/dist/canonical/restricted.js +163 -0
- package/dist/canonical/restricted.js.map +1 -0
- package/dist/canonical/signature.d.ts +38 -0
- package/dist/canonical/signature.d.ts.map +1 -0
- package/dist/canonical/signature.js +47 -0
- package/dist/canonical/signature.js.map +1 -0
- package/dist/eval/access/delivery.d.ts +63 -0
- package/dist/eval/access/delivery.d.ts.map +1 -0
- package/dist/eval/access/delivery.js +98 -0
- package/dist/eval/access/delivery.js.map +1 -0
- package/dist/eval/access/overlay.d.ts +72 -0
- package/dist/eval/access/overlay.d.ts.map +1 -0
- package/dist/eval/access/overlay.js +402 -0
- package/dist/eval/access/overlay.js.map +1 -0
- package/dist/eval/access/projection.d.ts +159 -0
- package/dist/eval/access/projection.d.ts.map +1 -0
- package/dist/eval/access/projection.js +211 -0
- package/dist/eval/access/projection.js.map +1 -0
- package/dist/eval/access/window.d.ts +128 -0
- package/dist/eval/access/window.d.ts.map +1 -0
- package/dist/eval/access/window.js +254 -0
- package/dist/eval/access/window.js.map +1 -0
- package/dist/eval/access/write.d.ts +113 -0
- package/dist/eval/access/write.d.ts.map +1 -0
- package/dist/eval/access/write.js +119 -0
- package/dist/eval/access/write.js.map +1 -0
- package/dist/eval/addressing.d.ts +131 -0
- package/dist/eval/addressing.d.ts.map +1 -0
- package/dist/eval/addressing.js +270 -0
- package/dist/eval/addressing.js.map +1 -0
- package/dist/eval/budget.d.ts +143 -0
- package/dist/eval/budget.d.ts.map +1 -0
- package/dist/eval/budget.js +387 -0
- package/dist/eval/budget.js.map +1 -0
- package/dist/eval/computed.d.ts +46 -0
- package/dist/eval/computed.d.ts.map +1 -0
- package/dist/eval/computed.js +89 -0
- package/dist/eval/computed.js.map +1 -0
- package/dist/eval/denials.d.ts +64 -0
- package/dist/eval/denials.d.ts.map +1 -0
- package/dist/eval/denials.js +87 -0
- package/dist/eval/denials.js.map +1 -0
- package/dist/eval/engine/cancellation.d.ts +12 -0
- package/dist/eval/engine/cancellation.d.ts.map +1 -0
- package/dist/eval/engine/cancellation.js +56 -0
- package/dist/eval/engine/cancellation.js.map +1 -0
- package/dist/eval/engine/delta.d.ts +104 -0
- package/dist/eval/engine/delta.d.ts.map +1 -0
- package/dist/eval/engine/delta.js +466 -0
- package/dist/eval/engine/delta.js.map +1 -0
- package/dist/eval/engine/deps.d.ts +136 -0
- package/dist/eval/engine/deps.d.ts.map +1 -0
- package/dist/eval/engine/deps.js +345 -0
- package/dist/eval/engine/deps.js.map +1 -0
- package/dist/eval/engine/identity.d.ts +128 -0
- package/dist/eval/engine/identity.d.ts.map +1 -0
- package/dist/eval/engine/identity.js +398 -0
- package/dist/eval/engine/identity.js.map +1 -0
- package/dist/eval/engine/index.d.ts +200 -0
- package/dist/eval/engine/index.d.ts.map +1 -0
- package/dist/eval/engine/index.js +1242 -0
- package/dist/eval/engine/index.js.map +1 -0
- package/dist/eval/engine/measurement.d.ts +23 -0
- package/dist/eval/engine/measurement.d.ts.map +1 -0
- package/dist/eval/engine/measurement.js +42 -0
- package/dist/eval/engine/measurement.js.map +1 -0
- package/dist/eval/engine/naive.d.ts +19 -0
- package/dist/eval/engine/naive.d.ts.map +1 -0
- package/dist/eval/engine/naive.js +59 -0
- package/dist/eval/engine/naive.js.map +1 -0
- package/dist/eval/engine/ops.d.ts +214 -0
- package/dist/eval/engine/ops.d.ts.map +1 -0
- package/dist/eval/engine/ops.js +1422 -0
- package/dist/eval/engine/ops.js.map +1 -0
- package/dist/eval/engine/patches.d.ts +40 -0
- package/dist/eval/engine/patches.d.ts.map +1 -0
- package/dist/eval/engine/patches.js +125 -0
- package/dist/eval/engine/patches.js.map +1 -0
- package/dist/eval/engine/ports.d.ts +71 -0
- package/dist/eval/engine/ports.d.ts.map +1 -0
- package/dist/eval/engine/ports.js +2 -0
- package/dist/eval/engine/ports.js.map +1 -0
- package/dist/eval/engine/session.d.ts +116 -0
- package/dist/eval/engine/session.d.ts.map +1 -0
- package/dist/eval/engine/session.js +653 -0
- package/dist/eval/engine/session.js.map +1 -0
- package/dist/eval/engine/snapshot.d.ts +97 -0
- package/dist/eval/engine/snapshot.d.ts.map +1 -0
- package/dist/eval/engine/snapshot.js +221 -0
- package/dist/eval/engine/snapshot.js.map +1 -0
- package/dist/eval/engine/subscriptions.d.ts +47 -0
- package/dist/eval/engine/subscriptions.d.ts.map +1 -0
- package/dist/eval/engine/subscriptions.js +103 -0
- package/dist/eval/engine/subscriptions.js.map +1 -0
- package/dist/eval/engine/trace.d.ts +77 -0
- package/dist/eval/engine/trace.d.ts.map +1 -0
- package/dist/eval/engine/trace.js +140 -0
- package/dist/eval/engine/trace.js.map +1 -0
- package/dist/eval/error-diagnostic.d.ts +26 -0
- package/dist/eval/error-diagnostic.d.ts.map +1 -0
- package/dist/eval/error-diagnostic.js +63 -0
- package/dist/eval/error-diagnostic.js.map +1 -0
- package/dist/eval/evaluate-expr.d.ts +44 -0
- package/dist/eval/evaluate-expr.d.ts.map +1 -0
- package/dist/eval/evaluate-expr.js +149 -0
- package/dist/eval/evaluate-expr.js.map +1 -0
- package/dist/eval/evaluate.d.ts +282 -0
- package/dist/eval/evaluate.d.ts.map +1 -0
- package/dist/eval/evaluate.js +391 -0
- package/dist/eval/evaluate.js.map +1 -0
- package/dist/eval/evolution/relocate.d.ts +72 -0
- package/dist/eval/evolution/relocate.d.ts.map +1 -0
- package/dist/eval/evolution/relocate.js +427 -0
- package/dist/eval/evolution/relocate.js.map +1 -0
- package/dist/eval/evolution/select.d.ts +11 -0
- package/dist/eval/evolution/select.d.ts.map +1 -0
- package/dist/eval/evolution/select.js +53 -0
- package/dist/eval/evolution/select.js.map +1 -0
- package/dist/eval/evolution/upcast.d.ts +13 -0
- package/dist/eval/evolution/upcast.d.ts.map +1 -0
- package/dist/eval/evolution/upcast.js +88 -0
- package/dist/eval/evolution/upcast.js.map +1 -0
- package/dist/eval/expr/aggregates.d.ts +75 -0
- package/dist/eval/expr/aggregates.d.ts.map +1 -0
- package/dist/eval/expr/aggregates.js +991 -0
- package/dist/eval/expr/aggregates.js.map +1 -0
- package/dist/eval/expr/arithmetic.d.ts +26 -0
- package/dist/eval/expr/arithmetic.d.ts.map +1 -0
- package/dist/eval/expr/arithmetic.js +387 -0
- package/dist/eval/expr/arithmetic.js.map +1 -0
- package/dist/eval/expr/between.d.ts +17 -0
- package/dist/eval/expr/between.d.ts.map +1 -0
- package/dist/eval/expr/between.js +46 -0
- package/dist/eval/expr/between.js.map +1 -0
- package/dist/eval/expr/binder.d.ts +96 -0
- package/dist/eval/expr/binder.d.ts.map +1 -0
- package/dist/eval/expr/binder.js +253 -0
- package/dist/eval/expr/binder.js.map +1 -0
- package/dist/eval/expr/call-dispatch.d.ts +28 -0
- package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
- package/dist/eval/expr/call-dispatch.js +114 -0
- package/dist/eval/expr/call-dispatch.js.map +1 -0
- package/dist/eval/expr/collections.d.ts +20 -0
- package/dist/eval/expr/collections.d.ts.map +1 -0
- package/dist/eval/expr/collections.js +66 -0
- package/dist/eval/expr/collections.js.map +1 -0
- package/dist/eval/expr/compare.d.ts +36 -0
- package/dist/eval/expr/compare.d.ts.map +1 -0
- package/dist/eval/expr/compare.js +115 -0
- package/dist/eval/expr/compare.js.map +1 -0
- package/dist/eval/expr/datasets.d.ts +28 -0
- package/dist/eval/expr/datasets.d.ts.map +1 -0
- package/dist/eval/expr/datasets.js +304 -0
- package/dist/eval/expr/datasets.js.map +1 -0
- package/dist/eval/expr/digest.d.ts +23 -0
- package/dist/eval/expr/digest.d.ts.map +1 -0
- package/dist/eval/expr/digest.js +89 -0
- package/dist/eval/expr/digest.js.map +1 -0
- package/dist/eval/expr/domains.d.ts +19 -0
- package/dist/eval/expr/domains.d.ts.map +1 -0
- package/dist/eval/expr/domains.js +18 -0
- package/dist/eval/expr/domains.js.map +1 -0
- package/dist/eval/expr/host.d.ts +152 -0
- package/dist/eval/expr/host.d.ts.map +1 -0
- package/dist/eval/expr/host.js +36 -0
- package/dist/eval/expr/host.js.map +1 -0
- package/dist/eval/expr/lists.d.ts +24 -0
- package/dist/eval/expr/lists.d.ts.map +1 -0
- package/dist/eval/expr/lists.js +155 -0
- package/dist/eval/expr/lists.js.map +1 -0
- package/dist/eval/expr/member.d.ts +15 -0
- package/dist/eval/expr/member.d.ts.map +1 -0
- package/dist/eval/expr/member.js +32 -0
- package/dist/eval/expr/member.js.map +1 -0
- package/dist/eval/expr/money-ops.d.ts +10 -0
- package/dist/eval/expr/money-ops.d.ts.map +1 -0
- package/dist/eval/expr/money-ops.js +17 -0
- package/dist/eval/expr/money-ops.js.map +1 -0
- package/dist/eval/expr/operands.d.ts +27 -0
- package/dist/eval/expr/operands.d.ts.map +1 -0
- package/dist/eval/expr/operands.js +167 -0
- package/dist/eval/expr/operands.js.map +1 -0
- package/dist/eval/expr/presence.d.ts +27 -0
- package/dist/eval/expr/presence.d.ts.map +1 -0
- package/dist/eval/expr/presence.js +140 -0
- package/dist/eval/expr/presence.js.map +1 -0
- package/dist/eval/expr/records.d.ts +22 -0
- package/dist/eval/expr/records.d.ts.map +1 -0
- package/dist/eval/expr/records.js +101 -0
- package/dist/eval/expr/records.js.map +1 -0
- package/dist/eval/expr/rule-refs.d.ts +25 -0
- package/dist/eval/expr/rule-refs.d.ts.map +1 -0
- package/dist/eval/expr/rule-refs.js +60 -0
- package/dist/eval/expr/rule-refs.js.map +1 -0
- package/dist/eval/expr/sequences.d.ts +26 -0
- package/dist/eval/expr/sequences.d.ts.map +1 -0
- package/dist/eval/expr/sequences.js +151 -0
- package/dist/eval/expr/sequences.js.map +1 -0
- package/dist/eval/expr/value.d.ts +99 -0
- package/dist/eval/expr/value.d.ts.map +1 -0
- package/dist/eval/expr/value.js +14 -0
- package/dist/eval/expr/value.js.map +1 -0
- package/dist/eval/expression.d.ts +142 -0
- package/dist/eval/expression.d.ts.map +1 -0
- package/dist/eval/expression.js +446 -0
- package/dist/eval/expression.js.map +1 -0
- package/dist/eval/firing.d.ts +68 -0
- package/dist/eval/firing.d.ts.map +1 -0
- package/dist/eval/firing.js +222 -0
- package/dist/eval/firing.js.map +1 -0
- package/dist/eval/gate.d.ts +110 -0
- package/dist/eval/gate.d.ts.map +1 -0
- package/dist/eval/gate.js +278 -0
- package/dist/eval/gate.js.map +1 -0
- package/dist/eval/layout-visibility.d.ts +18 -0
- package/dist/eval/layout-visibility.d.ts.map +1 -0
- package/dist/eval/layout-visibility.js +61 -0
- package/dist/eval/layout-visibility.js.map +1 -0
- package/dist/eval/option-availability.d.ts +26 -0
- package/dist/eval/option-availability.d.ts.map +1 -0
- package/dist/eval/option-availability.js +580 -0
- package/dist/eval/option-availability.js.map +1 -0
- package/dist/eval/options-boundary.d.ts +15 -0
- package/dist/eval/options-boundary.d.ts.map +1 -0
- package/dist/eval/options-boundary.js +40 -0
- package/dist/eval/options-boundary.js.map +1 -0
- package/dist/eval/options.d.ts +99 -0
- package/dist/eval/options.d.ts.map +1 -0
- package/dist/eval/options.js +96 -0
- package/dist/eval/options.js.map +1 -0
- package/dist/eval/overrides.d.ts +116 -0
- package/dist/eval/overrides.d.ts.map +1 -0
- package/dist/eval/overrides.js +176 -0
- package/dist/eval/overrides.js.map +1 -0
- package/dist/eval/paths.d.ts +25 -0
- package/dist/eval/paths.d.ts.map +1 -0
- package/dist/eval/paths.js +47 -0
- package/dist/eval/paths.js.map +1 -0
- package/dist/eval/presentation-reads.d.ts +20 -0
- package/dist/eval/presentation-reads.d.ts.map +1 -0
- package/dist/eval/presentation-reads.js +2 -0
- package/dist/eval/presentation-reads.js.map +1 -0
- package/dist/eval/presentation.d.ts +122 -0
- package/dist/eval/presentation.d.ts.map +1 -0
- package/dist/eval/presentation.js +255 -0
- package/dist/eval/presentation.js.map +1 -0
- package/dist/eval/reader/context-value.d.ts +41 -0
- package/dist/eval/reader/context-value.d.ts.map +1 -0
- package/dist/eval/reader/context-value.js +129 -0
- package/dist/eval/reader/context-value.js.map +1 -0
- package/dist/eval/reader/covered.d.ts +53 -0
- package/dist/eval/reader/covered.d.ts.map +1 -0
- package/dist/eval/reader/covered.js +139 -0
- package/dist/eval/reader/covered.js.map +1 -0
- package/dist/eval/reader/declarations.d.ts +182 -0
- package/dist/eval/reader/declarations.d.ts.map +1 -0
- package/dist/eval/reader/declarations.js +153 -0
- package/dist/eval/reader/declarations.js.map +1 -0
- package/dist/eval/reader/member-access.d.ts +87 -0
- package/dist/eval/reader/member-access.d.ts.map +1 -0
- package/dist/eval/reader/member-access.js +212 -0
- package/dist/eval/reader/member-access.js.map +1 -0
- package/dist/eval/reader/memo.d.ts +34 -0
- package/dist/eval/reader/memo.d.ts.map +1 -0
- package/dist/eval/reader/memo.js +67 -0
- package/dist/eval/reader/memo.js.map +1 -0
- package/dist/eval/reader/overlay.d.ts +74 -0
- package/dist/eval/reader/overlay.d.ts.map +1 -0
- package/dist/eval/reader/overlay.js +365 -0
- package/dist/eval/reader/overlay.js.map +1 -0
- package/dist/eval/reader/questions.d.ts +37 -0
- package/dist/eval/reader/questions.d.ts.map +1 -0
- package/dist/eval/reader/questions.js +78 -0
- package/dist/eval/reader/questions.js.map +1 -0
- package/dist/eval/reader/resolve.d.ts +84 -0
- package/dist/eval/reader/resolve.d.ts.map +1 -0
- package/dist/eval/reader/resolve.js +310 -0
- package/dist/eval/reader/resolve.js.map +1 -0
- package/dist/eval/reader/value-read.d.ts +50 -0
- package/dist/eval/reader/value-read.d.ts.map +1 -0
- package/dist/eval/reader/value-read.js +133 -0
- package/dist/eval/reader/value-read.js.map +1 -0
- package/dist/eval/reader/withheld.d.ts +48 -0
- package/dist/eval/reader/withheld.d.ts.map +1 -0
- package/dist/eval/reader/withheld.js +108 -0
- package/dist/eval/reader/withheld.js.map +1 -0
- package/dist/eval/reader-paths.d.ts +24 -0
- package/dist/eval/reader-paths.d.ts.map +1 -0
- package/dist/eval/reader-paths.js +23 -0
- package/dist/eval/reader-paths.js.map +1 -0
- package/dist/eval/reader.d.ts +281 -0
- package/dist/eval/reader.d.ts.map +1 -0
- package/dist/eval/reader.js +560 -0
- package/dist/eval/reader.js.map +1 -0
- package/dist/eval/receipt.d.ts +37 -0
- package/dist/eval/receipt.d.ts.map +1 -0
- package/dist/eval/receipt.js +222 -0
- package/dist/eval/receipt.js.map +1 -0
- package/dist/eval/report/assemble.d.ts +84 -0
- package/dist/eval/report/assemble.d.ts.map +1 -0
- package/dist/eval/report/assemble.js +277 -0
- package/dist/eval/report/assemble.js.map +1 -0
- package/dist/eval/report/fold.d.ts +18 -0
- package/dist/eval/report/fold.d.ts.map +1 -0
- package/dist/eval/report/fold.js +58 -0
- package/dist/eval/report/fold.js.map +1 -0
- package/dist/eval/rule/alternatives.d.ts +23 -0
- package/dist/eval/rule/alternatives.d.ts.map +1 -0
- package/dist/eval/rule/alternatives.js +46 -0
- package/dist/eval/rule/alternatives.js.map +1 -0
- package/dist/eval/rule/behaviour.d.ts +47 -0
- package/dist/eval/rule/behaviour.d.ts.map +1 -0
- package/dist/eval/rule/behaviour.js +249 -0
- package/dist/eval/rule/behaviour.js.map +1 -0
- package/dist/eval/rule/compute.d.ts +46 -0
- package/dist/eval/rule/compute.d.ts.map +1 -0
- package/dist/eval/rule/compute.js +158 -0
- package/dist/eval/rule/compute.js.map +1 -0
- package/dist/eval/rule/create-state.d.ts +42 -0
- package/dist/eval/rule/create-state.d.ts.map +1 -0
- package/dist/eval/rule/create-state.js +134 -0
- package/dist/eval/rule/create-state.js.map +1 -0
- package/dist/eval/rule/diagnostics.d.ts +24 -0
- package/dist/eval/rule/diagnostics.d.ts.map +1 -0
- package/dist/eval/rule/diagnostics.js +45 -0
- package/dist/eval/rule/diagnostics.js.map +1 -0
- package/dist/eval/rule/execution.d.ts +24 -0
- package/dist/eval/rule/execution.d.ts.map +1 -0
- package/dist/eval/rule/execution.js +495 -0
- package/dist/eval/rule/execution.js.map +1 -0
- package/dist/eval/rule/gate.d.ts +12 -0
- package/dist/eval/rule/gate.d.ts.map +1 -0
- package/dist/eval/rule/gate.js +34 -0
- package/dist/eval/rule/gate.js.map +1 -0
- package/dist/eval/rule/item.d.ts +11 -0
- package/dist/eval/rule/item.d.ts.map +1 -0
- package/dist/eval/rule/item.js +265 -0
- package/dist/eval/rule/item.js.map +1 -0
- package/dist/eval/rule/prepare.d.ts +64 -0
- package/dist/eval/rule/prepare.d.ts.map +1 -0
- package/dist/eval/rule/prepare.js +131 -0
- package/dist/eval/rule/prepare.js.map +1 -0
- package/dist/eval/rule/result.d.ts +97 -0
- package/dist/eval/rule/result.d.ts.map +1 -0
- package/dist/eval/rule/result.js +347 -0
- package/dist/eval/rule/result.js.map +1 -0
- package/dist/eval/rule/runner.d.ts +128 -0
- package/dist/eval/rule/runner.d.ts.map +1 -0
- package/dist/eval/rule/runner.js +296 -0
- package/dist/eval/rule/runner.js.map +1 -0
- package/dist/eval/rule/screen.d.ts +32 -0
- package/dist/eval/rule/screen.d.ts.map +1 -0
- package/dist/eval/rule/screen.js +73 -0
- package/dist/eval/rule/screen.js.map +1 -0
- package/dist/eval/rule/state.d.ts +137 -0
- package/dist/eval/rule/state.d.ts.map +1 -0
- package/dist/eval/rule/state.js +2 -0
- package/dist/eval/rule/state.js.map +1 -0
- package/dist/eval/rule/steps.d.ts +44 -0
- package/dist/eval/rule/steps.d.ts.map +1 -0
- package/dist/eval/rule/steps.js +367 -0
- package/dist/eval/rule/steps.js.map +1 -0
- package/dist/eval/rule/visibility.d.ts +18 -0
- package/dist/eval/rule/visibility.d.ts.map +1 -0
- package/dist/eval/rule/visibility.js +79 -0
- package/dist/eval/rule/visibility.js.map +1 -0
- package/dist/eval/seal.d.ts +74 -0
- package/dist/eval/seal.d.ts.map +1 -0
- package/dist/eval/seal.js +154 -0
- package/dist/eval/seal.js.map +1 -0
- package/dist/eval/signature-coverage.d.ts +19 -0
- package/dist/eval/signature-coverage.d.ts.map +1 -0
- package/dist/eval/signature-coverage.js +160 -0
- package/dist/eval/signature-coverage.js.map +1 -0
- package/dist/eval/state/derive.d.ts +72 -0
- package/dist/eval/state/derive.d.ts.map +1 -0
- package/dist/eval/state/derive.js +61 -0
- package/dist/eval/state/derive.js.map +1 -0
- package/dist/eval/state/describe.d.ts +18 -0
- package/dist/eval/state/describe.d.ts.map +1 -0
- package/dist/eval/state/describe.js +19 -0
- package/dist/eval/state/describe.js.map +1 -0
- package/dist/eval/state/field-state.d.ts +471 -0
- package/dist/eval/state/field-state.d.ts.map +1 -0
- package/dist/eval/state/field-state.js +1604 -0
- package/dist/eval/state/field-state.js.map +1 -0
- package/dist/eval/state/measurement.d.ts +136 -0
- package/dist/eval/state/measurement.d.ts.map +1 -0
- package/dist/eval/state/measurement.js +209 -0
- package/dist/eval/state/measurement.js.map +1 -0
- package/dist/eval/state/options.d.ts +21 -0
- package/dist/eval/state/options.d.ts.map +1 -0
- package/dist/eval/state/options.js +3 -0
- package/dist/eval/state/options.js.map +1 -0
- package/dist/eval/state/readiness.d.ts +400 -0
- package/dist/eval/state/readiness.d.ts.map +1 -0
- package/dist/eval/state/readiness.js +1067 -0
- package/dist/eval/state/readiness.js.map +1 -0
- package/dist/eval/state/snapshot.d.ts +130 -0
- package/dist/eval/state/snapshot.d.ts.map +1 -0
- package/dist/eval/state/snapshot.js +35 -0
- package/dist/eval/state/snapshot.js.map +1 -0
- package/dist/eval/state/unavailable-options.d.ts +54 -0
- package/dist/eval/state/unavailable-options.d.ts.map +1 -0
- package/dist/eval/state/unavailable-options.js +82 -0
- package/dist/eval/state/unavailable-options.js.map +1 -0
- package/dist/eval/state/value-state.d.ts +38 -0
- package/dist/eval/state/value-state.d.ts.map +1 -0
- package/dist/eval/state/value-state.js +52 -0
- package/dist/eval/state/value-state.js.map +1 -0
- package/dist/eval/submission/admission.d.ts +50 -0
- package/dist/eval/submission/admission.d.ts.map +1 -0
- package/dist/eval/submission/admission.js +174 -0
- package/dist/eval/submission/admission.js.map +1 -0
- package/dist/eval/submission/authority.d.ts +71 -0
- package/dist/eval/submission/authority.d.ts.map +1 -0
- package/dist/eval/submission/authority.js +118 -0
- package/dist/eval/submission/authority.js.map +1 -0
- package/dist/eval/submission/datasets.d.ts +28 -0
- package/dist/eval/submission/datasets.d.ts.map +1 -0
- package/dist/eval/submission/datasets.js +109 -0
- package/dist/eval/submission/datasets.js.map +1 -0
- package/dist/eval/submission/index.d.ts +15 -0
- package/dist/eval/submission/index.d.ts.map +1 -0
- package/dist/eval/submission/index.js +13 -0
- package/dist/eval/submission/index.js.map +1 -0
- package/dist/eval/submission/refusals.d.ts +103 -0
- package/dist/eval/submission/refusals.d.ts.map +1 -0
- package/dist/eval/submission/refusals.js +15 -0
- package/dist/eval/submission/refusals.js.map +1 -0
- package/dist/eval/submission/signatures.d.ts +7 -0
- package/dist/eval/submission/signatures.d.ts.map +1 -0
- package/dist/eval/submission/signatures.js +215 -0
- package/dist/eval/submission/signatures.js.map +1 -0
- package/dist/eval/submission/writes.d.ts +51 -0
- package/dist/eval/submission/writes.d.ts.map +1 -0
- package/dist/eval/submission/writes.js +203 -0
- package/dist/eval/submission/writes.js.map +1 -0
- package/dist/eval/submission.d.ts +53 -0
- package/dist/eval/submission.d.ts.map +1 -0
- package/dist/eval/submission.js +521 -0
- package/dist/eval/submission.js.map +1 -0
- package/dist/eval/suggestions-to-engine.d.ts +18 -0
- package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
- package/dist/eval/suggestions-to-engine.js +40 -0
- package/dist/eval/suggestions-to-engine.js.map +1 -0
- package/dist/eval/suggestions.d.ts +17 -0
- package/dist/eval/suggestions.d.ts.map +1 -0
- package/dist/eval/suggestions.js +314 -0
- package/dist/eval/suggestions.js.map +1 -0
- package/dist/eval/undecided.d.ts +64 -0
- package/dist/eval/undecided.d.ts.map +1 -0
- package/dist/eval/undecided.js +101 -0
- package/dist/eval/undecided.js.map +1 -0
- package/dist/eval/verdict.d.ts +66 -0
- package/dist/eval/verdict.d.ts.map +1 -0
- package/dist/eval/verdict.js +106 -0
- package/dist/eval/verdict.js.map +1 -0
- package/dist/eval/verify-signature.d.ts +78 -0
- package/dist/eval/verify-signature.d.ts.map +1 -0
- package/dist/eval/verify-signature.js +185 -0
- package/dist/eval/verify-signature.js.map +1 -0
- package/dist/eval/version-dispatch.d.ts +38 -0
- package/dist/eval/version-dispatch.d.ts.map +1 -0
- package/dist/eval/version-dispatch.js +61 -0
- package/dist/eval/version-dispatch.js.map +1 -0
- package/dist/eval/visibility.d.ts +33 -0
- package/dist/eval/visibility.d.ts.map +1 -0
- package/dist/eval/visibility.js +83 -0
- package/dist/eval/visibility.js.map +1 -0
- package/dist/evaluate.d.ts +24 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +18 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/expr/builtin-docs.d.ts +51 -0
- package/dist/expr/builtin-docs.d.ts.map +1 -0
- package/dist/expr/builtin-docs.js +874 -0
- package/dist/expr/builtin-docs.js.map +1 -0
- package/dist/expr/builtins.d.ts +50 -0
- package/dist/expr/builtins.d.ts.map +1 -0
- package/dist/expr/builtins.js +966 -0
- package/dist/expr/builtins.js.map +1 -0
- package/dist/expr/decimal-precision.d.ts +39 -0
- package/dist/expr/decimal-precision.d.ts.map +1 -0
- package/dist/expr/decimal-precision.js +62 -0
- package/dist/expr/decimal-precision.js.map +1 -0
- package/dist/expr/decimal.d.ts +172 -0
- package/dist/expr/decimal.d.ts.map +1 -0
- package/dist/expr/decimal.js +782 -0
- package/dist/expr/decimal.js.map +1 -0
- package/dist/expr/deprecations.d.ts +34 -0
- package/dist/expr/deprecations.d.ts.map +1 -0
- package/dist/expr/deprecations.js +17 -0
- package/dist/expr/deprecations.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +21 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +231 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/direction.d.ts +30 -0
- package/dist/expr/direction.d.ts.map +1 -0
- package/dist/expr/direction.js +77 -0
- package/dist/expr/direction.js.map +1 -0
- package/dist/expr/example-expression.d.ts +62 -0
- package/dist/expr/example-expression.d.ts.map +1 -0
- package/dist/expr/example-expression.js +670 -0
- package/dist/expr/example-expression.js.map +1 -0
- package/dist/expr/instant.d.ts +49 -0
- package/dist/expr/instant.d.ts.map +1 -0
- package/dist/expr/instant.js +111 -0
- package/dist/expr/instant.js.map +1 -0
- package/dist/expr/logic.d.ts +17 -0
- package/dist/expr/logic.d.ts.map +1 -0
- package/dist/expr/logic.js +65 -0
- package/dist/expr/logic.js.map +1 -0
- package/dist/expr/messages.d.ts +45 -0
- package/dist/expr/messages.d.ts.map +1 -0
- package/dist/expr/messages.js +280 -0
- package/dist/expr/messages.js.map +1 -0
- package/dist/expr/money.d.ts +38 -0
- package/dist/expr/money.d.ts.map +1 -0
- package/dist/expr/money.js +127 -0
- package/dist/expr/money.js.map +1 -0
- package/dist/expr/ordering.d.ts +56 -0
- package/dist/expr/ordering.d.ts.map +1 -0
- package/dist/expr/ordering.js +167 -0
- package/dist/expr/ordering.js.map +1 -0
- package/dist/expr/pattern.d.ts +44 -0
- package/dist/expr/pattern.d.ts.map +1 -0
- package/dist/expr/pattern.js +458 -0
- package/dist/expr/pattern.js.map +1 -0
- package/dist/expr/plain-date.d.ts +90 -0
- package/dist/expr/plain-date.d.ts.map +1 -0
- package/dist/expr/plain-date.js +230 -0
- package/dist/expr/plain-date.js.map +1 -0
- package/dist/expr/plural-categories.d.ts +8 -0
- package/dist/expr/plural-categories.d.ts.map +1 -0
- package/dist/expr/plural-categories.js +15 -0
- package/dist/expr/plural-categories.js.map +1 -0
- package/dist/expr/plural-keys.d.ts +39 -0
- package/dist/expr/plural-keys.d.ts.map +1 -0
- package/dist/expr/plural-keys.js +46 -0
- package/dist/expr/plural-keys.js.map +1 -0
- package/dist/expr/plural.d.ts +33 -0
- package/dist/expr/plural.d.ts.map +1 -0
- package/dist/expr/plural.js +50 -0
- package/dist/expr/plural.js.map +1 -0
- package/dist/expr/quantity.d.ts +31 -0
- package/dist/expr/quantity.d.ts.map +1 -0
- package/dist/expr/quantity.js +83 -0
- package/dist/expr/quantity.js.map +1 -0
- package/dist/expr/reduce.d.ts +50 -0
- package/dist/expr/reduce.d.ts.map +1 -0
- package/dist/expr/reduce.js +236 -0
- package/dist/expr/reduce.js.map +1 -0
- package/dist/expr/regex.d.ts +108 -0
- package/dist/expr/regex.d.ts.map +1 -0
- package/dist/expr/regex.js +1207 -0
- package/dist/expr/regex.js.map +1 -0
- package/dist/expr/select-locale.d.ts +67 -0
- package/dist/expr/select-locale.d.ts.map +1 -0
- package/dist/expr/select-locale.js +219 -0
- package/dist/expr/select-locale.js.map +1 -0
- package/dist/expr/sequences.d.ts +123 -0
- package/dist/expr/sequences.d.ts.map +1 -0
- package/dist/expr/sequences.js +234 -0
- package/dist/expr/sequences.js.map +1 -0
- package/dist/expr/strings.d.ts +50 -0
- package/dist/expr/strings.d.ts.map +1 -0
- package/dist/expr/strings.js +184 -0
- package/dist/expr/strings.js.map +1 -0
- package/dist/expr/validation.d.ts +32 -0
- package/dist/expr/validation.d.ts.map +1 -0
- package/dist/expr/validation.js +182 -0
- package/dist/expr/validation.js.map +1 -0
- package/dist/graph/freeze.d.ts +4 -0
- package/dist/graph/freeze.d.ts.map +1 -0
- package/dist/graph/freeze.js +52 -0
- package/dist/graph/freeze.js.map +1 -0
- package/dist/graph/index.d.ts +15 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/inspect.d.ts +76 -0
- package/dist/graph/inspect.d.ts.map +1 -0
- package/dist/graph/inspect.js +263 -0
- package/dist/graph/inspect.js.map +1 -0
- package/dist/graph/read-walk.d.ts +101 -0
- package/dist/graph/read-walk.d.ts.map +1 -0
- package/dist/graph/read-walk.js +358 -0
- package/dist/graph/read-walk.js.map +1 -0
- package/dist/graph/record-index.d.ts +24 -0
- package/dist/graph/record-index.d.ts.map +1 -0
- package/dist/graph/record-index.js +35 -0
- package/dist/graph/record-index.js.map +1 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/lookup/digest.d.ts +51 -0
- package/dist/lookup/digest.d.ts.map +1 -0
- package/dist/lookup/digest.js +46 -0
- package/dist/lookup/digest.js.map +1 -0
- package/dist/lookup/index.d.ts +28 -0
- package/dist/lookup/index.d.ts.map +1 -0
- package/dist/lookup/index.js +27 -0
- package/dist/lookup/index.js.map +1 -0
- package/dist/lookup/install.d.ts +48 -0
- package/dist/lookup/install.d.ts.map +1 -0
- package/dist/lookup/install.js +315 -0
- package/dist/lookup/install.js.map +1 -0
- package/dist/lookup/pass.d.ts +55 -0
- package/dist/lookup/pass.d.ts.map +1 -0
- package/dist/lookup/pass.js +212 -0
- package/dist/lookup/pass.js.map +1 -0
- package/dist/lookup/pins.d.ts +34 -0
- package/dist/lookup/pins.d.ts.map +1 -0
- package/dist/lookup/pins.js +39 -0
- package/dist/lookup/pins.js.map +1 -0
- package/dist/lookup/provenance.d.ts +23 -0
- package/dist/lookup/provenance.d.ts.map +1 -0
- package/dist/lookup/provenance.js +78 -0
- package/dist/lookup/provenance.js.map +1 -0
- package/dist/lookup/readiness.d.ts +13 -0
- package/dist/lookup/readiness.d.ts.map +1 -0
- package/dist/lookup/readiness.js +57 -0
- package/dist/lookup/readiness.js.map +1 -0
- package/dist/lookup/resolve.d.ts +24 -0
- package/dist/lookup/resolve.d.ts.map +1 -0
- package/dist/lookup/resolve.js +201 -0
- package/dist/lookup/resolve.js.map +1 -0
- package/dist/lookup/store.d.ts +41 -0
- package/dist/lookup/store.d.ts.map +1 -0
- package/dist/lookup/store.js +74 -0
- package/dist/lookup/store.js.map +1 -0
- package/dist/model/access.d.ts +200 -0
- package/dist/model/access.d.ts.map +1 -0
- package/dist/model/access.js +125 -0
- package/dist/model/access.js.map +1 -0
- package/dist/model/artifact-members.d.ts +3 -0
- package/dist/model/artifact-members.d.ts.map +1 -0
- package/dist/model/artifact-members.js +38 -0
- package/dist/model/artifact-members.js.map +1 -0
- package/dist/model/composition.d.ts +47 -0
- package/dist/model/composition.d.ts.map +1 -0
- package/dist/model/composition.js +66 -0
- package/dist/model/composition.js.map +1 -0
- package/dist/model/domain.d.ts +51 -0
- package/dist/model/domain.d.ts.map +1 -0
- package/dist/model/domain.js +75 -0
- package/dist/model/domain.js.map +1 -0
- package/dist/model/duration.d.ts +31 -0
- package/dist/model/duration.d.ts.map +1 -0
- package/dist/model/duration.js +136 -0
- package/dist/model/duration.js.map +1 -0
- package/dist/model/errors.d.ts +58 -0
- package/dist/model/errors.d.ts.map +1 -0
- package/dist/model/errors.js +81 -0
- package/dist/model/errors.js.map +1 -0
- package/dist/model/evolution.d.ts +177 -0
- package/dist/model/evolution.d.ts.map +1 -0
- package/dist/model/evolution.js +5 -0
- package/dist/model/evolution.js.map +1 -0
- package/dist/model/expr-children.d.ts +15 -0
- package/dist/model/expr-children.d.ts.map +1 -0
- package/dist/model/expr-children.js +45 -0
- package/dist/model/expr-children.js.map +1 -0
- package/dist/model/guards.d.ts +9 -0
- package/dist/model/guards.d.ts.map +1 -0
- package/dist/model/guards.js +11 -0
- package/dist/model/guards.js.map +1 -0
- package/dist/model/input.d.ts +42 -0
- package/dist/model/input.d.ts.map +1 -0
- package/dist/model/input.js +26 -0
- package/dist/model/input.js.map +1 -0
- package/dist/model/integer.d.ts +14 -0
- package/dist/model/integer.d.ts.map +1 -0
- package/dist/model/integer.js +16 -0
- package/dist/model/integer.js.map +1 -0
- package/dist/model/intrinsic.d.ts +18 -0
- package/dist/model/intrinsic.d.ts.map +1 -0
- package/dist/model/intrinsic.js +21 -0
- package/dist/model/intrinsic.js.map +1 -0
- package/dist/model/layout.d.ts +129 -0
- package/dist/model/layout.d.ts.map +1 -0
- package/dist/model/layout.js +2 -0
- package/dist/model/layout.js.map +1 -0
- package/dist/model/media.d.ts +33 -0
- package/dist/model/media.d.ts.map +1 -0
- package/dist/model/media.js +86 -0
- package/dist/model/media.js.map +1 -0
- package/dist/model/members.generated.d.ts +11 -0
- package/dist/model/members.generated.d.ts.map +1 -0
- package/dist/model/members.generated.js +71 -0
- package/dist/model/members.generated.js.map +1 -0
- package/dist/model/row-address.d.ts +27 -0
- package/dist/model/row-address.d.ts.map +1 -0
- package/dist/model/row-address.js +146 -0
- package/dist/model/row-address.js.map +1 -0
- package/dist/model/schema.d.ts +108 -0
- package/dist/model/schema.d.ts.map +1 -0
- package/dist/model/schema.js +2 -0
- package/dist/model/schema.js.map +1 -0
- package/dist/model/shape.d.ts +193 -0
- package/dist/model/shape.d.ts.map +1 -0
- package/dist/model/shape.js +2 -0
- package/dist/model/shape.js.map +1 -0
- package/dist/model/time.d.ts +61 -0
- package/dist/model/time.d.ts.map +1 -0
- package/dist/model/time.js +110 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/types.d.ts +1329 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +424 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/values.d.ts +91 -0
- package/dist/model/values.d.ts.map +1 -0
- package/dist/model/values.js +195 -0
- package/dist/model/values.js.map +1 -0
- package/dist/model/wire.d.ts +356 -0
- package/dist/model/wire.d.ts.map +1 -0
- package/dist/model/wire.js +1504 -0
- package/dist/model/wire.js.map +1 -0
- package/dist/offline/index.d.ts +374 -0
- package/dist/offline/index.d.ts.map +1 -0
- package/dist/offline/index.js +422 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/testing.d.ts +30 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +42 -0
- package/dist/testing.js.map +1 -0
- package/dist/version.d.ts +30 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +116 -0
- package/dist/version.js.map +1 -0
- package/package.json +98 -3
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { andAll } from '../../expr/logic.js';
|
|
2
|
+
import { effectiveTier } from '../../model/access.js';
|
|
3
|
+
import { AxiomError, assertNever } from '../../model/errors.js';
|
|
4
|
+
import { DEFERRED, UNKNOWN } from '../../model/types.js';
|
|
5
|
+
import { isRuleKind } from '../firing.js';
|
|
6
|
+
import { gateStatusUnderPolicy } from '../gate.js';
|
|
7
|
+
import { foldScreen, screenStatus } from '../report/fold.js';
|
|
8
|
+
import { isBlocking } from '../seal.js';
|
|
9
|
+
import { markComputedUndetermined, resolveWriter } from './compute.js';
|
|
10
|
+
import { recordDiagnostic, recordEngineError } from './diagnostics.js';
|
|
11
|
+
import { ruleAlternatives } from './alternatives.js';
|
|
12
|
+
import { deferredGate, gateItem } from './gate.js';
|
|
13
|
+
import { evaluateItemRule } from './item.js';
|
|
14
|
+
import { baseResult, computedUndetermined, failedResult, fieldRefsOf, outcomeResult, paramsOf, recordAlternativeBudget, } from './result.js';
|
|
15
|
+
import { deferredScreen, derivedScreenReasons, screenReasons } from './screen.js';
|
|
16
|
+
/** The owner a rule's message payload belongs to, so a dropped payload is attributed to it. */
|
|
17
|
+
function rulePayloadOwner(rule) {
|
|
18
|
+
return { ruleId: rule.ruleId, at: `$.rules.${rule.ruleId}.params` };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One rule evaluated once for this report. `rule_ok` can ask about a rule declared later,
|
|
22
|
+
* so a rule's evaluation is memoised by identity and re-entering one in progress fails
|
|
23
|
+
* closed rather than recursing.
|
|
24
|
+
*/
|
|
25
|
+
export function evaluateRuleOnce(state, rule) {
|
|
26
|
+
const cached = state.ruleOutcomes.get(rule);
|
|
27
|
+
if (cached !== undefined)
|
|
28
|
+
return cached;
|
|
29
|
+
if (state.rulesInProgress.has(rule)) {
|
|
30
|
+
throw new AxiomError('ENGINE_ERROR', `rule ${rule.ruleId} reads its own outcome through rule_ok`, rule.ruleId);
|
|
31
|
+
}
|
|
32
|
+
state.rulesInProgress.add(rule);
|
|
33
|
+
// Counted here rather than after the body: a rule that raised still spent an evaluation, and
|
|
34
|
+
// a pass trace that only counted successes would understate the work an artifact did.
|
|
35
|
+
state.onRuleEvaluated?.(rule.ruleId);
|
|
36
|
+
const previousRule = state.currentRule;
|
|
37
|
+
const previousRowKey = state.currentRowKey;
|
|
38
|
+
const previousDiagnostics = state.currentDiagnostics;
|
|
39
|
+
// Each rule spends its own node allowance: twelve item rules over thirty thousand rows
|
|
40
|
+
// must not charge the twelfth to the first. A nested rule (`rule_ok`, `is_relevant`)
|
|
41
|
+
// starts its own allowance and restores this one when it returns.
|
|
42
|
+
const previousSpend = state.evaluator.beginRule();
|
|
43
|
+
const recorded = [];
|
|
44
|
+
state.currentRule = rule;
|
|
45
|
+
state.reader.enterRule(rule.ruleId);
|
|
46
|
+
state.currentDiagnostics = recorded;
|
|
47
|
+
// The row in force belongs to the item-scope rule that was being evaluated, not to this
|
|
48
|
+
// one: a rule evaluated because another rule asked about it (`rule_ok`, `is_relevant`)
|
|
49
|
+
// reports its own scope's row, which for every other scope is none.
|
|
50
|
+
// An item-scope rule sets the row it is working on itself.
|
|
51
|
+
state.currentRowKey = undefined;
|
|
52
|
+
try {
|
|
53
|
+
const evaluated = evaluateRuleSafely(state, rule);
|
|
54
|
+
state.ruleOutcomes.set(rule, evaluated);
|
|
55
|
+
state.ruleDiagnostics.set(rule.ruleId, recorded);
|
|
56
|
+
return evaluated;
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
state.currentRule = previousRule;
|
|
60
|
+
state.currentRowKey = previousRowKey;
|
|
61
|
+
state.currentDiagnostics = previousDiagnostics;
|
|
62
|
+
state.reader.enterRule(previousRule?.ruleId);
|
|
63
|
+
state.evaluator.endRule(previousSpend);
|
|
64
|
+
state.rulesInProgress.delete(rule);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function evaluateRuleSafely(state, rule) {
|
|
68
|
+
try {
|
|
69
|
+
const evaluated = evaluateRule(state, rule);
|
|
70
|
+
// Report entries are the pass's other bounded allocation: `rules × rows`. The count is
|
|
71
|
+
// recorded only once a rule has actually produced its results, so a rule that raised does
|
|
72
|
+
// not leave a charge for entries no report will carry. The ceiling is pass-wide, so a later
|
|
73
|
+
// rule cannot spend what an earlier one already committed.
|
|
74
|
+
state.evaluator.spendDecisions(evaluated.results.length, rule.scope === 'item' ? 'item rule' : 'rule');
|
|
75
|
+
return evaluated;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (!(error instanceof AxiomError))
|
|
79
|
+
throw error;
|
|
80
|
+
// A whole-rule refusal has no row entry to record. A compute still owns its target, so
|
|
81
|
+
// mark it undetermined here rather than letting a later read fall back to the submission.
|
|
82
|
+
if (rule.kind === 'compute')
|
|
83
|
+
markComputedUndetermined(state, rule, UNKNOWN);
|
|
84
|
+
state.reader.noteDecisionError();
|
|
85
|
+
recordEngineError(state, rule.ruleId, error);
|
|
86
|
+
return { results: [failedResult(state, rule)] };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function evaluateRule(state, rule) {
|
|
90
|
+
// A verification the artifact does not describe is refused rather than evaluated: a
|
|
91
|
+
// hand-built rule can compare a computed value with a stored digest and call the result a
|
|
92
|
+
// signature check, and no report may present that as one.
|
|
93
|
+
const refusedVerification = state.prepared.signatureRefusals.get(rule);
|
|
94
|
+
if (refusedVerification !== undefined) {
|
|
95
|
+
recordDiagnostic(state, 'ENGINE_ERROR', {
|
|
96
|
+
ruleId: rule.ruleId,
|
|
97
|
+
params: { path: refusedVerification },
|
|
98
|
+
});
|
|
99
|
+
// A `compute` the engine refuses is undetermined, never the submitted value: the write
|
|
100
|
+
// its author declared did not happen, so a read must not fall through to it.
|
|
101
|
+
if (rule.kind === 'compute')
|
|
102
|
+
markComputedUndetermined(state, rule, UNKNOWN);
|
|
103
|
+
return { results: [failedResult(state, rule)] };
|
|
104
|
+
}
|
|
105
|
+
// A server-tier rule is not evaluated on this device, so nothing about it is read
|
|
106
|
+
// here - neither its expression nor its message parameters. That
|
|
107
|
+
// includes the rows an item-scoped rule would address: reporting them would mean
|
|
108
|
+
// reading the values this tier was stripped of.
|
|
109
|
+
//
|
|
110
|
+
// Stated through the evaluation door's default: a caller that names no tier runs as the
|
|
111
|
+
// device, and `client` or a tier this version does not know defers rather than running a
|
|
112
|
+
// rule the device was never given the data or the authority to enforce. A server host names
|
|
113
|
+
// `server` explicitly, and the evidence doors default their own way.
|
|
114
|
+
if (rule.evaluateOn === 'server' && effectiveTier(state.env) !== 'server') {
|
|
115
|
+
recordDiagnostic(state, 'DEFERRED_SERVER_CHECK', {
|
|
116
|
+
ruleId: rule.ruleId,
|
|
117
|
+
...(rule.fieldId === undefined ? {} : { fieldId: rule.fieldId }),
|
|
118
|
+
});
|
|
119
|
+
// The client was never given the value: a `compute` target propagates `DEFERRED` rather
|
|
120
|
+
// than exposing one the server produces. A computed default keeps its stored value —
|
|
121
|
+
// an override may legitimately live there — so it records no entry.
|
|
122
|
+
if (rule.kind === 'compute') {
|
|
123
|
+
markComputedUndetermined(state, rule, DEFERRED);
|
|
124
|
+
}
|
|
125
|
+
const deferred = outcomeResult(state, rule, 'DEFERRED');
|
|
126
|
+
return {
|
|
127
|
+
results: [
|
|
128
|
+
rule.kind === 'compute' || rule.kind === 'defaultCompute'
|
|
129
|
+
? { ...deferred, value: null }
|
|
130
|
+
: deferred,
|
|
131
|
+
],
|
|
132
|
+
...(rule.kind === 'gate' && rule.gate !== undefined
|
|
133
|
+
? { gate: { gateId: rule.ruleId, report: deferredGate(rule.gate) } }
|
|
134
|
+
: {}),
|
|
135
|
+
...(rule.kind === 'screen' ? { screen: deferredScreen(rule) } : {}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (rule.scope === 'item') {
|
|
139
|
+
return {
|
|
140
|
+
results: evaluateItemRule(state, rule, (itemRule) => evaluateBody(state, itemRule)),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const body = evaluateBody(state, rule);
|
|
144
|
+
return {
|
|
145
|
+
results: [body.result],
|
|
146
|
+
...(body.gate === undefined ? {} : { gate: body.gate }),
|
|
147
|
+
...(body.screen === undefined ? {} : { screen: body.screen }),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* One rule at the scope it declares, `spec/semantics/rules-v1.md` section 2, and the one place the
|
|
152
|
+
* handoff a redacted input leaves is stated.
|
|
153
|
+
*
|
|
154
|
+
* An `array`-scoped rule is about the container as a whole, so it is evaluated once against the
|
|
155
|
+
* whole list; an `item`-scoped rule is dispatched per row by `evaluateItemRule`.
|
|
156
|
+
*
|
|
157
|
+
* The handoff is recorded here, where the rule's own decision is known, rather than inferred from
|
|
158
|
+
* the result: a value the record redacted reads as `DEFERRED`, a connective folds it into
|
|
159
|
+
* `UNKNOWN`, and a `warn` gate's policy then reports `PASS` for a verdict that decided nothing. The
|
|
160
|
+
* mark is taken before the body because a gate's condition is one of its own reads.
|
|
161
|
+
*/
|
|
162
|
+
function evaluateBody(state, rule) {
|
|
163
|
+
const deferredMark = state.reader.deferredMark();
|
|
164
|
+
const body = evaluateBodyAt(state, rule);
|
|
165
|
+
const undecided = body.undecided === true || body.result.status === 'UNKNOWN';
|
|
166
|
+
if (undecided && state.reader.deferredSince(deferredMark, rule.ruleId)) {
|
|
167
|
+
state.reader.noteHandoff(rule.ruleId, state.currentRowKey);
|
|
168
|
+
}
|
|
169
|
+
return body;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* One rule's body: its result and the report sections it states, with its own verdict before a gate
|
|
173
|
+
* policy weighs it.
|
|
174
|
+
*/
|
|
175
|
+
function evaluateBodyAt(state, rule) {
|
|
176
|
+
const severity = rule.severity ?? 'block';
|
|
177
|
+
const fields = fieldRefsOf(state, state.prepared.ruleFields.get(rule) ?? []);
|
|
178
|
+
const withFields = fields.length === 0 ? {} : { fields };
|
|
179
|
+
let params;
|
|
180
|
+
const result = (status, extra = {}, budgetError) => {
|
|
181
|
+
// A cost refusal from an auxiliary alternative is the rule's to state, even though the
|
|
182
|
+
// alternative was evaluated on an isolate whose diagnostics were discarded. It arrived with
|
|
183
|
+
// the alternatives rather than through a module cache, so it is this evaluation's alone.
|
|
184
|
+
if (budgetError !== undefined)
|
|
185
|
+
recordAlternativeBudget(state, rule, budgetError);
|
|
186
|
+
return {
|
|
187
|
+
...baseResult(state, rule, status, severity, params),
|
|
188
|
+
...withFields,
|
|
189
|
+
...extra,
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
// A gate whose condition decided false is not in force, so nothing it judges is read: it states
|
|
193
|
+
// `active: false` with no item verdicts, and its rule result is PASS so `rule_ok` opens on it.
|
|
194
|
+
// The result still states the rule's dependency set, as every rule result does — the condition it
|
|
195
|
+
// read is what turns the gate back on, and a consumer that recomputes from those fields must
|
|
196
|
+
// re-evaluate a gate that is currently off.
|
|
197
|
+
//
|
|
198
|
+
// The condition is one of the reads that decide the gate, so the window its read-only policy
|
|
199
|
+
// weighs opens before it: a device that could not read the field switching the gate is holding a
|
|
200
|
+
// refusal of the gate's own, and the policy decides what that means. A gate the condition switched
|
|
201
|
+
// off returns before that set is used, so switching a gate off is never turned into a refusal.
|
|
202
|
+
let conditionDenied = [];
|
|
203
|
+
if (rule.kind === 'gate' && rule.gate !== undefined) {
|
|
204
|
+
const conditionMark = state.reader.readMark();
|
|
205
|
+
const active = gateActive(state, rule);
|
|
206
|
+
conditionDenied = state.reader.deniedSince(conditionMark, rule.ruleId);
|
|
207
|
+
if (!active) {
|
|
208
|
+
return {
|
|
209
|
+
result: result('PASS'),
|
|
210
|
+
gate: { gateId: rule.ruleId, report: { active: false } },
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
params = paramsOf(state, rule.params, rulePayloadOwner(rule));
|
|
215
|
+
switch (rule.kind) {
|
|
216
|
+
case 'compute':
|
|
217
|
+
case 'defaultCompute': {
|
|
218
|
+
// A computed field is a field the evaluation considered, even though it is
|
|
219
|
+
// written rather than read. An item writer considers the member it writes in each row.
|
|
220
|
+
const written = rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;
|
|
221
|
+
if (written !== undefined)
|
|
222
|
+
state.reader.markConsidered(written);
|
|
223
|
+
let resolved;
|
|
224
|
+
try {
|
|
225
|
+
resolved = resolveWriter(state, rule);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (!(error instanceof AxiomError))
|
|
229
|
+
throw error;
|
|
230
|
+
// The writer's expression or its target declaration refused the value. It produced
|
|
231
|
+
// nothing, so its target propagates `UNKNOWN` rather than exposing a submitted value.
|
|
232
|
+
markComputedUndetermined(state, rule, UNKNOWN);
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
// A writer's own result shadows the submission for its target. A field-scope writer
|
|
236
|
+
// owns the field; an item-scope writer owns `(targetFieldId, rowKey)` for the row in
|
|
237
|
+
// force, so a sibling row is never touched by this row's answer.
|
|
238
|
+
if (resolved.overlay && written !== undefined) {
|
|
239
|
+
if (rule.scope === 'item') {
|
|
240
|
+
const rowKey = state.currentRowKey;
|
|
241
|
+
if (rowKey === undefined) {
|
|
242
|
+
throw new AxiomError('ENGINE_ERROR', 'an item-scoped computed rule wrote outside a row', rule.ruleId);
|
|
243
|
+
}
|
|
244
|
+
state.computed.setRow(written, rowKey, resolved.value);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
state.computed.set(written, resolved.value);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (resolved.value.kind === 'undetermined') {
|
|
251
|
+
const { status, extra } = computedUndetermined(resolved.value.sentinel);
|
|
252
|
+
return { result: result(status, extra) };
|
|
253
|
+
}
|
|
254
|
+
// A written value is still a value this device was given: the report may state it only
|
|
255
|
+
// where delivery would state the field, `[ACCESS-7.1.6]`. `allowMaskedRead` widens
|
|
256
|
+
// expression reads, never delivery, so the question is the resolved access rather than
|
|
257
|
+
// `mayRead`; a container the target sits under, and a host redaction, withhold it too.
|
|
258
|
+
const rowKey = rule.scope === 'item' ? state.currentRowKey : undefined;
|
|
259
|
+
const deliverable = written === undefined || writtenDeliverable(state, written, rowKey);
|
|
260
|
+
return { result: result('PASS', deliverable ? { value: resolved.value.value } : {}) };
|
|
261
|
+
}
|
|
262
|
+
case 'gate': {
|
|
263
|
+
if (rule.gate === undefined) {
|
|
264
|
+
throw new AxiomError('ENGINE_ERROR', 'gate rule declares no items', rule.ruleId);
|
|
265
|
+
}
|
|
266
|
+
// Item message arguments are payload too, so their reads stay outside the policy window
|
|
267
|
+
// just as the rule's own arguments do. Keep each result by declaration position.
|
|
268
|
+
const itemParams = rule.gate.items.map((item) => paramsOf(state, item.params, rulePayloadOwner(rule)));
|
|
269
|
+
const readMark = state.reader.readMark();
|
|
270
|
+
const items = rule.gate.items.map((item, itemIndex) => {
|
|
271
|
+
const itemFields = fieldRefsOf(state, state.prepared.gateItemFields.get(item) ?? []);
|
|
272
|
+
return gateItem(item, outcomeOf(state, rule, item.expr, item.itemId), itemParams[itemIndex], itemFields);
|
|
273
|
+
});
|
|
274
|
+
const composed = andAll([
|
|
275
|
+
outcomeOf(state, rule, rule.expr),
|
|
276
|
+
...items.map((item) => item.status),
|
|
277
|
+
]);
|
|
278
|
+
// A read-only refusal is the client's limitation, not the rule's verdict, so the gate's
|
|
279
|
+
// declared policy decides what it means here. An undeclared policy is
|
|
280
|
+
// `block`, so silence can never be read as permission.
|
|
281
|
+
// The gate's own reads, not the diagnostic stream: a field denied earlier in the
|
|
282
|
+
// evaluation yields a cache hit here and no new diagnostic, which made the verdict
|
|
283
|
+
// depend on rule declaration order. The condition's refusals are the gate's too; rule and
|
|
284
|
+
// item message parameters were evaluated before the window because a parameter is payload,
|
|
285
|
+
// and `paramsOf` reports its own refusal without replacing the verdict the expressions reached.
|
|
286
|
+
const denied = [
|
|
287
|
+
...new Set([...conditionDenied, ...state.reader.deniedSince(readMark, rule.ruleId)]),
|
|
288
|
+
];
|
|
289
|
+
state.gateDenialsByRule.set(rule.ruleId, denied);
|
|
290
|
+
const refused = denied.length > 0;
|
|
291
|
+
const status = refused
|
|
292
|
+
? gateStatusUnderPolicy(rule.gate.hard ? undefined : rule.gate.onReadOnlyError, composed)
|
|
293
|
+
: composed;
|
|
294
|
+
// An expression error inside an item leaves the gate undecided *and* names the item that
|
|
295
|
+
// raised, so both diagnostics are reported rather than one masking the other
|
|
296
|
+
//
|
|
297
|
+
// The cause is exactly as blocking as the gate that states it (`RULES-1.1.5`,
|
|
298
|
+
// `RULES-2.1.2`): a `warn` or `info` gate reports its undecided verdict without folding
|
|
299
|
+
// it, because the author opted that rule out of blocking explicitly. Recording it `block`
|
|
300
|
+
// while the rule is `warn` made `report.status` and `no_blocking("gate")` disagree about
|
|
301
|
+
// one result.
|
|
302
|
+
if (status === 'UNKNOWN') {
|
|
303
|
+
recordDiagnostic(state, 'UNDETERMINED', {
|
|
304
|
+
severity,
|
|
305
|
+
ruleId: rule.ruleId,
|
|
306
|
+
...(rule.fieldId === undefined ? {} : { fieldId: rule.fieldId }),
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return {
|
|
310
|
+
result: result(status),
|
|
311
|
+
gate: { gateId: rule.ruleId, report: { items } },
|
|
312
|
+
// Its own verdict, not the policy's: the policy governs what a refusal means, not whether
|
|
313
|
+
// the gate decided anything.
|
|
314
|
+
...(composed === 'PASS' || composed === 'FAIL' ? {} : { undecided: true }),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
case 'screen': {
|
|
318
|
+
const diagnosticMark = state.diagnostics.length;
|
|
319
|
+
const readMark = state.reader.readMark();
|
|
320
|
+
const base = outcomeOf(state, rule, rule.expr);
|
|
321
|
+
const refer = rule.referWhen === undefined ? 'FAIL' : outcomeOf(state, rule, rule.referWhen);
|
|
322
|
+
const outcome = foldScreen(base, refer);
|
|
323
|
+
// The screen's own reasons are decided before the engine's are derived, so a condition
|
|
324
|
+
// that raised becomes one of the causes the screen states rather than a diagnostic with
|
|
325
|
+
// no home. Only a definite true states an author's reason: an undecided condition claims
|
|
326
|
+
// nothing about why the record needs attention.
|
|
327
|
+
const declared = [];
|
|
328
|
+
for (const reason of rule.reasons ?? []) {
|
|
329
|
+
if (outcomeOf(state, rule, reason.when) !== 'PASS')
|
|
330
|
+
continue;
|
|
331
|
+
const reasonParams = paramsOf(state, reason.params, rulePayloadOwner(rule));
|
|
332
|
+
declared.push({
|
|
333
|
+
code: reason.code,
|
|
334
|
+
messageKey: reason.messageKey,
|
|
335
|
+
...(reasonParams === undefined ? {} : { params: reasonParams }),
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
const reasons = screenReasons(declared, derivedScreenReasons(state, rule, diagnosticMark, readMark));
|
|
339
|
+
// A screen's decision is the rule's verdict: reporting the base expression's status let
|
|
340
|
+
// base PASS + refer PASS reach the report as PASS, so `rule_ok` said true and a close-out
|
|
341
|
+
// gate could open on a record flagged for manual review. REFER is not PASS, so
|
|
342
|
+
// `SCREEN_REFER` folds to `FAIL`.
|
|
343
|
+
return {
|
|
344
|
+
result: result(screenStatus(outcome)),
|
|
345
|
+
screen: { screenId: rule.ruleId, report: { outcome, reasons } },
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
case 'validate':
|
|
349
|
+
case 'visible':
|
|
350
|
+
case 'required':
|
|
351
|
+
case 'enabled': {
|
|
352
|
+
if (rule.kind === 'validate' && rule.messageKey === undefined) {
|
|
353
|
+
throw new AxiomError('ENGINE_ERROR', 'validate rule declares no messageKey', rule.ruleId);
|
|
354
|
+
}
|
|
355
|
+
const status = statusOf(state, evalNode(state, rule.expr));
|
|
356
|
+
// A required rule that could not read its input is unsatisfied *and* says why
|
|
357
|
+
// (): silently reporting UNKNOWN would let a host read it as optional.
|
|
358
|
+
if (rule.kind === 'required' && status === 'UNKNOWN') {
|
|
359
|
+
const written = rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;
|
|
360
|
+
recordDiagnostic(state, 'REQUIRED_UNKNOWN', {
|
|
361
|
+
ruleId: rule.ruleId,
|
|
362
|
+
...(written === undefined ? {} : { fieldId: written }),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
// Alternatives are the answer to a failure, so only a decided `FAIL` evaluates them. A
|
|
366
|
+
// report states the key only when one survived the access filter: an absent member is what
|
|
367
|
+
// keeps an artifact without a viable alternative identical to one that declares none.
|
|
368
|
+
const alternatives = rule.kind === 'validate' && status === 'FAIL'
|
|
369
|
+
? ruleAlternatives(state, rule)
|
|
370
|
+
: { suggestions: [] };
|
|
371
|
+
return {
|
|
372
|
+
result: result(status, alternatives.suggestions.length === 0 ? {} : { suggestions: alternatives.suggestions }, alternatives.budgetError),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
default:
|
|
376
|
+
return assertNever(rule);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Whether the report may state the value a writer produced for one reference,
|
|
381
|
+
* `[ACCESS-7.1.6]`.
|
|
382
|
+
*
|
|
383
|
+
* A writer's result is engine output, but it is not confidential on its own: the report states
|
|
384
|
+
* it exactly where the control would show the field. The window's delivery answer is that
|
|
385
|
+
* question, resolved once for this evaluation; it weighs every declaration the target sits
|
|
386
|
+
* under and a host redaction the same way it weighs delivery.
|
|
387
|
+
*/
|
|
388
|
+
function writtenDeliverable(state, fieldId, rowKey) {
|
|
389
|
+
if (!state.prepared.fieldById.has(fieldId))
|
|
390
|
+
return true;
|
|
391
|
+
const ref = rowKey === undefined ? { fieldId } : { fieldId, rowKey };
|
|
392
|
+
return state.accessWindow.enclosingDelivers(ref);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Whether a gate is in force: only a definite `FAIL` of its `activeWhen` turns it off.
|
|
396
|
+
*
|
|
397
|
+
* An inactive gate's result is `PASS`, which is the permissive direction, so an undecided
|
|
398
|
+
* condition leaves the gate in force — the same fail-closed reading every other rule gives an
|
|
399
|
+
* undetermined guard. A condition that raises is therefore `UNKNOWN` and leaves the gate on.
|
|
400
|
+
*/
|
|
401
|
+
function gateActive(state, rule) {
|
|
402
|
+
const activeWhen = rule.gate?.activeWhen;
|
|
403
|
+
if (activeWhen === undefined)
|
|
404
|
+
return true;
|
|
405
|
+
return outcomeOf(state, rule, activeWhen) !== 'FAIL';
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* One gate item's outcome: every declared item is reported, so an
|
|
409
|
+
* expression error inside one item marks that item `UNKNOWN` with `ENGINE_ERROR` and
|
|
410
|
+
* leaves the rest of the gate's items standing.
|
|
411
|
+
*/
|
|
412
|
+
function outcomeOf(state, rule, node, itemId) {
|
|
413
|
+
try {
|
|
414
|
+
return statusOf(state, evalNode(state, node));
|
|
415
|
+
}
|
|
416
|
+
catch (error) {
|
|
417
|
+
if (!(error instanceof AxiomError))
|
|
418
|
+
throw error;
|
|
419
|
+
state.reader.noteDecisionError();
|
|
420
|
+
recordEngineError(state, rule.ruleId, error, itemId);
|
|
421
|
+
return 'UNKNOWN';
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function statusOf(state, evaluated) {
|
|
425
|
+
return state.evaluator.statusOf(evaluated);
|
|
426
|
+
}
|
|
427
|
+
function evalNode(state, node) {
|
|
428
|
+
return state.evaluator.evaluate(node);
|
|
429
|
+
}
|
|
430
|
+
/** The rule's outcome for this evaluation. */
|
|
431
|
+
export function outcomeOfRuleId(state, ruleId) {
|
|
432
|
+
const rule = state.prepared.ruleById.get(ruleId);
|
|
433
|
+
if (rule === undefined) {
|
|
434
|
+
throw new AxiomError('ENGINE_ERROR', `no rule is named ${ruleId}`, ruleId);
|
|
435
|
+
}
|
|
436
|
+
// An admission fold never asks a rule whose subject is not on the form: the respondent
|
|
437
|
+
// cannot correct a control they cannot see, and a gate that refused on it would name a
|
|
438
|
+
// condition no one can satisfy (`RULES-2.1.10`). The rule's own result stays in the report
|
|
439
|
+
// as a fact about the record; this fold is the answer about the visible form.
|
|
440
|
+
if (!isRelevantRule(state, rule))
|
|
441
|
+
return 'PASS';
|
|
442
|
+
return andAll(evaluateRuleOnce(state, rule).results.map((result) => result.status));
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Whether a rule's subject is on the form: the field it decides, or the row member it
|
|
446
|
+
* constrains, is not hidden by a `visible` rule.
|
|
447
|
+
*
|
|
448
|
+
* A `visible` rule is its own subject, so it is always relevant — asking whether the field it
|
|
449
|
+
* hides is visible would turn `rule_ok(<visible rule>)` into its own negation. A rule that
|
|
450
|
+
* decides no field is about the record and is always relevant. The access overlay is not asked:
|
|
451
|
+
* a `masked` field is still on screen, and a row-level restriction must not erase a rule about
|
|
452
|
+
* the array that holds it.
|
|
453
|
+
*/
|
|
454
|
+
export function isRelevantRule(state, rule) {
|
|
455
|
+
if (rule.kind === 'visible')
|
|
456
|
+
return true;
|
|
457
|
+
const fieldId = rule.targetFieldId ?? rule.fieldId;
|
|
458
|
+
if (fieldId === undefined)
|
|
459
|
+
return true;
|
|
460
|
+
// A hand-built artifact may name an undeclared target; that is the expression pass's refusal,
|
|
461
|
+
// not a relevance answer, so the rule stays in force here rather than silently passing.
|
|
462
|
+
if (!state.prepared.fieldById.has(fieldId))
|
|
463
|
+
return true;
|
|
464
|
+
return state.isVisible(fieldId);
|
|
465
|
+
}
|
|
466
|
+
/** Whether every `block`-severity rule of `kind` leaves nothing to block on. */
|
|
467
|
+
export function noBlockingFor(state, kind) {
|
|
468
|
+
if (!isRuleKind(kind)) {
|
|
469
|
+
throw new AxiomError('ENGINE_ERROR', `${kind} is not a rule kind`, kind);
|
|
470
|
+
}
|
|
471
|
+
for (const rule of state.compiled.rules ?? []) {
|
|
472
|
+
if (rule.kind !== kind)
|
|
473
|
+
continue;
|
|
474
|
+
if ((rule.severity ?? 'block') !== 'block')
|
|
475
|
+
continue;
|
|
476
|
+
// A rule whose subject is not on the form is not an admission condition, exactly as in
|
|
477
|
+
// `outcomeOfRuleId`.
|
|
478
|
+
if (!isRelevantRule(state, rule))
|
|
479
|
+
continue;
|
|
480
|
+
// A rule cannot answer a question about itself: the gate that asks
|
|
481
|
+
// `no_blocking('gate')` is the rule whose body is running, so its own outcome does not
|
|
482
|
+
// exist yet and folding it would re-enter the cycle guard. Every *other* block rule of
|
|
483
|
+
// the kind still has to pass — including one the evaluation is already inside, because
|
|
484
|
+
// that is a genuine cycle: the query cannot answer over a rule nobody has decided, and
|
|
485
|
+
// the cycle guard makes it fail closed rather than silently skip the rule.
|
|
486
|
+
if (rule === state.currentRule)
|
|
487
|
+
continue;
|
|
488
|
+
// The same classification the report's status folds (`RULES-1.1.9`): a `FAIL` that states
|
|
489
|
+
// a branch blocks nothing, while an undecided result blocks because nothing was decided.
|
|
490
|
+
if (evaluateRuleOnce(state, rule).results.some(isBlocking))
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
//# sourceMappingURL=execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../../src/eval/rule/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO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E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,GAAG,IAAI,qBAAqB,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QAC9C,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,SAAS;QACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,KAAK,OAAO;YAAE,SAAS;QACrD,uFAAuF;QACvF,qBAAqB;QACrB,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC;YAAE,SAAS;QAC3C,mEAAmE;QACnE,uFAAuF;QACvF,uFAAuF;QACvF,uFAAuF;QACvF,uFAAuF;QACvF,2EAA2E;QAC3E,IAAI,IAAI,KAAK,KAAK,CAAC,WAAW;YAAE,SAAS;QACzC,0FAA0F;QAC1F,yFAAyF;QACzF,IAAI,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;YAAE,OAAO,KAAK,CAAC;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { andAll } from '../../expr/logic.js';\nimport { effectiveTier } from '../../model/access.js';\nimport { AxiomError, assertNever } from '../../model/errors.js';\nimport type {\n CompiledRule,\n Diagnostic,\n ExprNode,\n FieldRef,\n Outcome,\n RuleResult,\n ScreenReason,\n Severity,\n WireValue,\n} from '../../model/types.js';\nimport { DEFERRED, UNKNOWN } from '../../model/types.js';\nimport type { BudgetExceededError } from '../budget.js';\nimport { isRuleKind } from '../firing.js';\nimport { gateStatusUnderPolicy } from '../gate.js';\nimport type { Evaluated } from '../expr/value.js';\nimport { foldScreen, screenStatus } from '../report/fold.js';\nimport { isBlocking } from '../seal.js';\nimport { markComputedUndetermined, resolveWriter } from './compute.js';\nimport { recordDiagnostic, recordEngineError } from './diagnostics.js';\nimport { ruleAlternatives } from './alternatives.js';\nimport { deferredGate, gateItem } from './gate.js';\nimport { evaluateItemRule } from './item.js';\nimport {\n baseResult,\n computedUndetermined,\n failedResult,\n fieldRefsOf,\n outcomeResult,\n paramsOf,\n recordAlternativeBudget,\n} from './result.js';\nimport type { PayloadOwner, RuleBody } from './result.js';\nimport { deferredScreen, derivedScreenReasons, screenReasons } from './screen.js';\nimport type { EvaluationState, RuleEvaluation } from './state.js';\nimport type { EvaluatedAlternatives } from '../suggestions.js';\n\n/** The owner a rule's message payload belongs to, so a dropped payload is attributed to it. */\nfunction rulePayloadOwner(rule: CompiledRule): PayloadOwner {\n return { ruleId: rule.ruleId, at: `$.rules.${rule.ruleId}.params` };\n}\n\n/**\n * One rule evaluated once for this report. `rule_ok` can ask about a rule declared later,\n * so a rule's evaluation is memoised by identity and re-entering one in progress fails\n * closed rather than recursing.\n */\nexport function evaluateRuleOnce(state: EvaluationState, rule: CompiledRule): RuleEvaluation {\n const cached = state.ruleOutcomes.get(rule);\n if (cached !== undefined) return cached;\n if (state.rulesInProgress.has(rule)) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `rule ${rule.ruleId} reads its own outcome through rule_ok`,\n rule.ruleId,\n );\n }\n state.rulesInProgress.add(rule);\n // Counted here rather than after the body: a rule that raised still spent an evaluation, and\n // a pass trace that only counted successes would understate the work an artifact did.\n state.onRuleEvaluated?.(rule.ruleId);\n const previousRule = state.currentRule;\n const previousRowKey = state.currentRowKey;\n const previousDiagnostics = state.currentDiagnostics;\n // Each rule spends its own node allowance: twelve item rules over thirty thousand rows\n // must not charge the twelfth to the first. A nested rule (`rule_ok`, `is_relevant`)\n // starts its own allowance and restores this one when it returns.\n const previousSpend = state.evaluator.beginRule();\n const recorded: Diagnostic[] = [];\n state.currentRule = rule;\n state.reader.enterRule(rule.ruleId);\n state.currentDiagnostics = recorded;\n // The row in force belongs to the item-scope rule that was being evaluated, not to this\n // one: a rule evaluated because another rule asked about it (`rule_ok`, `is_relevant`)\n // reports its own scope's row, which for every other scope is none.\n // An item-scope rule sets the row it is working on itself.\n state.currentRowKey = undefined;\n try {\n const evaluated = evaluateRuleSafely(state, rule);\n state.ruleOutcomes.set(rule, evaluated);\n state.ruleDiagnostics.set(rule.ruleId, recorded);\n return evaluated;\n } finally {\n state.currentRule = previousRule;\n state.currentRowKey = previousRowKey;\n state.currentDiagnostics = previousDiagnostics;\n state.reader.enterRule(previousRule?.ruleId);\n state.evaluator.endRule(previousSpend);\n state.rulesInProgress.delete(rule);\n }\n}\n\nfunction evaluateRuleSafely(state: EvaluationState, rule: CompiledRule): RuleEvaluation {\n try {\n const evaluated = evaluateRule(state, rule);\n // Report entries are the pass's other bounded allocation: `rules × rows`. The count is\n // recorded only once a rule has actually produced its results, so a rule that raised does\n // not leave a charge for entries no report will carry. The ceiling is pass-wide, so a later\n // rule cannot spend what an earlier one already committed.\n state.evaluator.spendDecisions(\n evaluated.results.length,\n rule.scope === 'item' ? 'item rule' : 'rule',\n );\n return evaluated;\n } catch (error) {\n if (!(error instanceof AxiomError)) throw error;\n // A whole-rule refusal has no row entry to record. A compute still owns its target, so\n // mark it undetermined here rather than letting a later read fall back to the submission.\n if (rule.kind === 'compute') markComputedUndetermined(state, rule, UNKNOWN);\n state.reader.noteDecisionError();\n recordEngineError(state, rule.ruleId, error);\n return { results: [failedResult(state, rule)] };\n }\n}\n\nfunction evaluateRule(state: EvaluationState, rule: CompiledRule): RuleEvaluation {\n // A verification the artifact does not describe is refused rather than evaluated: a\n // hand-built rule can compare a computed value with a stored digest and call the result a\n // signature check, and no report may present that as one.\n const refusedVerification = state.prepared.signatureRefusals.get(rule);\n if (refusedVerification !== undefined) {\n recordDiagnostic(state, 'ENGINE_ERROR', {\n ruleId: rule.ruleId,\n params: { path: refusedVerification },\n });\n // A `compute` the engine refuses is undetermined, never the submitted value: the write\n // its author declared did not happen, so a read must not fall through to it.\n if (rule.kind === 'compute') markComputedUndetermined(state, rule, UNKNOWN);\n return { results: [failedResult(state, rule)] };\n }\n\n // A server-tier rule is not evaluated on this device, so nothing about it is read\n // here - neither its expression nor its message parameters. That\n // includes the rows an item-scoped rule would address: reporting them would mean\n // reading the values this tier was stripped of.\n //\n // Stated through the evaluation door's default: a caller that names no tier runs as the\n // device, and `client` or a tier this version does not know defers rather than running a\n // rule the device was never given the data or the authority to enforce. A server host names\n // `server` explicitly, and the evidence doors default their own way.\n if (rule.evaluateOn === 'server' && effectiveTier(state.env) !== 'server') {\n recordDiagnostic(state, 'DEFERRED_SERVER_CHECK', {\n ruleId: rule.ruleId,\n ...(rule.fieldId === undefined ? {} : { fieldId: rule.fieldId }),\n });\n // The client was never given the value: a `compute` target propagates `DEFERRED` rather\n // than exposing one the server produces. A computed default keeps its stored value —\n // an override may legitimately live there — so it records no entry.\n if (rule.kind === 'compute') {\n markComputedUndetermined(state, rule, DEFERRED);\n }\n const deferred = outcomeResult(state, rule, 'DEFERRED');\n return {\n results: [\n rule.kind === 'compute' || rule.kind === 'defaultCompute'\n ? { ...deferred, value: null }\n : deferred,\n ],\n ...(rule.kind === 'gate' && rule.gate !== undefined\n ? { gate: { gateId: rule.ruleId, report: deferredGate(rule.gate) } }\n : {}),\n ...(rule.kind === 'screen' ? { screen: deferredScreen(rule) } : {}),\n };\n }\n\n if (rule.scope === 'item') {\n return {\n results: evaluateItemRule(state, rule, (itemRule) => evaluateBody(state, itemRule)),\n };\n }\n\n const body = evaluateBody(state, rule);\n return {\n results: [body.result],\n ...(body.gate === undefined ? {} : { gate: body.gate }),\n ...(body.screen === undefined ? {} : { screen: body.screen }),\n };\n}\n\n/**\n * One rule at the scope it declares, `spec/semantics/rules-v1.md` section 2, and the one place the\n * handoff a redacted input leaves is stated.\n *\n * An `array`-scoped rule is about the container as a whole, so it is evaluated once against the\n * whole list; an `item`-scoped rule is dispatched per row by `evaluateItemRule`.\n *\n * The handoff is recorded here, where the rule's own decision is known, rather than inferred from\n * the result: a value the record redacted reads as `DEFERRED`, a connective folds it into\n * `UNKNOWN`, and a `warn` gate's policy then reports `PASS` for a verdict that decided nothing. The\n * mark is taken before the body because a gate's condition is one of its own reads.\n */\nfunction evaluateBody(state: EvaluationState, rule: CompiledRule): RuleBody {\n const deferredMark = state.reader.deferredMark();\n const body = evaluateBodyAt(state, rule);\n const undecided = body.undecided === true || body.result.status === 'UNKNOWN';\n if (undecided && state.reader.deferredSince(deferredMark, rule.ruleId)) {\n state.reader.noteHandoff(rule.ruleId, state.currentRowKey);\n }\n return body;\n}\n\n/**\n * One rule's body: its result and the report sections it states, with its own verdict before a gate\n * policy weighs it.\n */\nfunction evaluateBodyAt(state: EvaluationState, rule: CompiledRule): RuleBody {\n const severity: Severity = rule.severity ?? 'block';\n const fields = fieldRefsOf(state, state.prepared.ruleFields.get(rule) ?? []);\n const withFields = fields.length === 0 ? {} : { fields };\n let params: Readonly<Record<string, WireValue>> | undefined;\n const result = (\n status: Outcome,\n extra: Partial<RuleResult> = {},\n budgetError?: BudgetExceededError,\n ): RuleResult => {\n // A cost refusal from an auxiliary alternative is the rule's to state, even though the\n // alternative was evaluated on an isolate whose diagnostics were discarded. It arrived with\n // the alternatives rather than through a module cache, so it is this evaluation's alone.\n if (budgetError !== undefined) recordAlternativeBudget(state, rule, budgetError);\n return {\n ...baseResult(state, rule, status, severity, params),\n ...withFields,\n ...extra,\n };\n };\n\n // A gate whose condition decided false is not in force, so nothing it judges is read: it states\n // `active: false` with no item verdicts, and its rule result is PASS so `rule_ok` opens on it.\n // The result still states the rule's dependency set, as every rule result does — the condition it\n // read is what turns the gate back on, and a consumer that recomputes from those fields must\n // re-evaluate a gate that is currently off.\n //\n // The condition is one of the reads that decide the gate, so the window its read-only policy\n // weighs opens before it: a device that could not read the field switching the gate is holding a\n // refusal of the gate's own, and the policy decides what that means. A gate the condition switched\n // off returns before that set is used, so switching a gate off is never turned into a refusal.\n let conditionDenied: readonly string[] = [];\n if (rule.kind === 'gate' && rule.gate !== undefined) {\n const conditionMark = state.reader.readMark();\n const active = gateActive(state, rule);\n conditionDenied = state.reader.deniedSince(conditionMark, rule.ruleId);\n if (!active) {\n return {\n result: result('PASS'),\n gate: { gateId: rule.ruleId, report: { active: false } },\n };\n }\n }\n\n params = paramsOf(state, rule.params, rulePayloadOwner(rule));\n\n switch (rule.kind) {\n case 'compute':\n case 'defaultCompute': {\n // A computed field is a field the evaluation considered, even though it is\n // written rather than read. An item writer considers the member it writes in each row.\n const written = rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;\n if (written !== undefined) state.reader.markConsidered(written);\n let resolved: ReturnType<typeof resolveWriter>;\n try {\n resolved = resolveWriter(state, rule);\n } catch (error) {\n if (!(error instanceof AxiomError)) throw error;\n // The writer's expression or its target declaration refused the value. It produced\n // nothing, so its target propagates `UNKNOWN` rather than exposing a submitted value.\n markComputedUndetermined(state, rule, UNKNOWN);\n throw error;\n }\n // A writer's own result shadows the submission for its target. A field-scope writer\n // owns the field; an item-scope writer owns `(targetFieldId, rowKey)` for the row in\n // force, so a sibling row is never touched by this row's answer.\n if (resolved.overlay && written !== undefined) {\n if (rule.scope === 'item') {\n const rowKey = state.currentRowKey;\n if (rowKey === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'an item-scoped computed rule wrote outside a row',\n rule.ruleId,\n );\n }\n state.computed.setRow(written, rowKey, resolved.value);\n } else {\n state.computed.set(written, resolved.value);\n }\n }\n if (resolved.value.kind === 'undetermined') {\n const { status, extra } = computedUndetermined(resolved.value.sentinel);\n return { result: result(status, extra) };\n }\n // A written value is still a value this device was given: the report may state it only\n // where delivery would state the field, `[ACCESS-7.1.6]`. `allowMaskedRead` widens\n // expression reads, never delivery, so the question is the resolved access rather than\n // `mayRead`; a container the target sits under, and a host redaction, withhold it too.\n const rowKey = rule.scope === 'item' ? state.currentRowKey : undefined;\n const deliverable = written === undefined || writtenDeliverable(state, written, rowKey);\n return { result: result('PASS', deliverable ? { value: resolved.value.value } : {}) };\n }\n case 'gate': {\n if (rule.gate === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'gate rule declares no items', rule.ruleId);\n }\n // Item message arguments are payload too, so their reads stay outside the policy window\n // just as the rule's own arguments do. Keep each result by declaration position.\n const itemParams = rule.gate.items.map((item) =>\n paramsOf(state, item.params, rulePayloadOwner(rule)),\n );\n const readMark = state.reader.readMark();\n const items = rule.gate.items.map((item, itemIndex) => {\n const itemFields = fieldRefsOf(state, state.prepared.gateItemFields.get(item) ?? []);\n return gateItem(\n item,\n outcomeOf(state, rule, item.expr, item.itemId),\n itemParams[itemIndex],\n itemFields,\n );\n });\n const composed = andAll([\n outcomeOf(state, rule, rule.expr),\n ...items.map((item) => item.status),\n ]);\n // A read-only refusal is the client's limitation, not the rule's verdict, so the gate's\n // declared policy decides what it means here. An undeclared policy is\n // `block`, so silence can never be read as permission.\n // The gate's own reads, not the diagnostic stream: a field denied earlier in the\n // evaluation yields a cache hit here and no new diagnostic, which made the verdict\n // depend on rule declaration order. The condition's refusals are the gate's too; rule and\n // item message parameters were evaluated before the window because a parameter is payload,\n // and `paramsOf` reports its own refusal without replacing the verdict the expressions reached.\n const denied = [\n ...new Set([...conditionDenied, ...state.reader.deniedSince(readMark, rule.ruleId)]),\n ];\n state.gateDenialsByRule.set(rule.ruleId, denied);\n const refused = denied.length > 0;\n const status = refused\n ? gateStatusUnderPolicy(rule.gate.hard ? undefined : rule.gate.onReadOnlyError, composed)\n : composed;\n // An expression error inside an item leaves the gate undecided *and* names the item that\n // raised, so both diagnostics are reported rather than one masking the other\n //\n // The cause is exactly as blocking as the gate that states it (`RULES-1.1.5`,\n // `RULES-2.1.2`): a `warn` or `info` gate reports its undecided verdict without folding\n // it, because the author opted that rule out of blocking explicitly. Recording it `block`\n // while the rule is `warn` made `report.status` and `no_blocking(\"gate\")` disagree about\n // one result.\n if (status === 'UNKNOWN') {\n recordDiagnostic(state, 'UNDETERMINED', {\n severity,\n ruleId: rule.ruleId,\n ...(rule.fieldId === undefined ? {} : { fieldId: rule.fieldId }),\n });\n }\n return {\n result: result(status),\n gate: { gateId: rule.ruleId, report: { items } },\n // Its own verdict, not the policy's: the policy governs what a refusal means, not whether\n // the gate decided anything.\n ...(composed === 'PASS' || composed === 'FAIL' ? {} : { undecided: true as const }),\n };\n }\n case 'screen': {\n const diagnosticMark = state.diagnostics.length;\n const readMark = state.reader.readMark();\n const base = outcomeOf(state, rule, rule.expr);\n const refer = rule.referWhen === undefined ? 'FAIL' : outcomeOf(state, rule, rule.referWhen);\n const outcome = foldScreen(base, refer);\n // The screen's own reasons are decided before the engine's are derived, so a condition\n // that raised becomes one of the causes the screen states rather than a diagnostic with\n // no home. Only a definite true states an author's reason: an undecided condition claims\n // nothing about why the record needs attention.\n const declared: ScreenReason[] = [];\n for (const reason of rule.reasons ?? []) {\n if (outcomeOf(state, rule, reason.when) !== 'PASS') continue;\n const reasonParams = paramsOf(state, reason.params, rulePayloadOwner(rule));\n declared.push({\n code: reason.code,\n messageKey: reason.messageKey,\n ...(reasonParams === undefined ? {} : { params: reasonParams }),\n });\n }\n const reasons = screenReasons(\n declared,\n derivedScreenReasons(state, rule, diagnosticMark, readMark),\n );\n // A screen's decision is the rule's verdict: reporting the base expression's status let\n // base PASS + refer PASS reach the report as PASS, so `rule_ok` said true and a close-out\n // gate could open on a record flagged for manual review. REFER is not PASS, so\n // `SCREEN_REFER` folds to `FAIL`.\n return {\n result: result(screenStatus(outcome)),\n screen: { screenId: rule.ruleId, report: { outcome, reasons } },\n };\n }\n case 'validate':\n case 'visible':\n case 'required':\n case 'enabled': {\n if (rule.kind === 'validate' && rule.messageKey === undefined) {\n throw new AxiomError('ENGINE_ERROR', 'validate rule declares no messageKey', rule.ruleId);\n }\n const status = statusOf(state, evalNode(state, rule.expr));\n // A required rule that could not read its input is unsatisfied *and* says why\n // (): silently reporting UNKNOWN would let a host read it as optional.\n if (rule.kind === 'required' && status === 'UNKNOWN') {\n const written = rule.scope === 'item' ? rule.targetFieldId : rule.fieldId;\n recordDiagnostic(state, 'REQUIRED_UNKNOWN', {\n ruleId: rule.ruleId,\n ...(written === undefined ? {} : { fieldId: written }),\n });\n }\n // Alternatives are the answer to a failure, so only a decided `FAIL` evaluates them. A\n // report states the key only when one survived the access filter: an absent member is what\n // keeps an artifact without a viable alternative identical to one that declares none.\n const alternatives: EvaluatedAlternatives =\n rule.kind === 'validate' && status === 'FAIL'\n ? ruleAlternatives(state, rule)\n : { suggestions: [] };\n return {\n result: result(\n status,\n alternatives.suggestions.length === 0 ? {} : { suggestions: alternatives.suggestions },\n alternatives.budgetError,\n ),\n };\n }\n default:\n return assertNever(rule);\n }\n}\n\n/**\n * Whether the report may state the value a writer produced for one reference,\n * `[ACCESS-7.1.6]`.\n *\n * A writer's result is engine output, but it is not confidential on its own: the report states\n * it exactly where the control would show the field. The window's delivery answer is that\n * question, resolved once for this evaluation; it weighs every declaration the target sits\n * under and a host redaction the same way it weighs delivery.\n */\nfunction writtenDeliverable(\n state: EvaluationState,\n fieldId: string,\n rowKey: string | number | undefined,\n): boolean {\n if (!state.prepared.fieldById.has(fieldId)) return true;\n const ref: FieldRef = rowKey === undefined ? { fieldId } : { fieldId, rowKey };\n return state.accessWindow.enclosingDelivers(ref);\n}\n\n/**\n * Whether a gate is in force: only a definite `FAIL` of its `activeWhen` turns it off.\n *\n * An inactive gate's result is `PASS`, which is the permissive direction, so an undecided\n * condition leaves the gate in force — the same fail-closed reading every other rule gives an\n * undetermined guard. A condition that raises is therefore `UNKNOWN` and leaves the gate on.\n */\nfunction gateActive(state: EvaluationState, rule: CompiledRule): boolean {\n const activeWhen = rule.gate?.activeWhen;\n if (activeWhen === undefined) return true;\n return outcomeOf(state, rule, activeWhen) !== 'FAIL';\n}\n\n/**\n * One gate item's outcome: every declared item is reported, so an\n * expression error inside one item marks that item `UNKNOWN` with `ENGINE_ERROR` and\n * leaves the rest of the gate's items standing.\n */\nfunction outcomeOf(\n state: EvaluationState,\n rule: CompiledRule,\n node: ExprNode,\n itemId?: string,\n): Outcome {\n try {\n return statusOf(state, evalNode(state, node));\n } catch (error) {\n if (!(error instanceof AxiomError)) throw error;\n state.reader.noteDecisionError();\n recordEngineError(state, rule.ruleId, error, itemId);\n return 'UNKNOWN';\n }\n}\n\nfunction statusOf(state: EvaluationState, evaluated: Evaluated): Outcome {\n return state.evaluator.statusOf(evaluated);\n}\n\nfunction evalNode(state: EvaluationState, node: ExprNode): Evaluated {\n return state.evaluator.evaluate(node);\n}\n\n/** The rule's outcome for this evaluation. */\nexport function outcomeOfRuleId(state: EvaluationState, ruleId: string): Outcome {\n const rule = state.prepared.ruleById.get(ruleId);\n if (rule === undefined) {\n throw new AxiomError('ENGINE_ERROR', `no rule is named ${ruleId}`, ruleId);\n }\n // An admission fold never asks a rule whose subject is not on the form: the respondent\n // cannot correct a control they cannot see, and a gate that refused on it would name a\n // condition no one can satisfy (`RULES-2.1.10`). The rule's own result stays in the report\n // as a fact about the record; this fold is the answer about the visible form.\n if (!isRelevantRule(state, rule)) return 'PASS';\n return andAll(evaluateRuleOnce(state, rule).results.map((result) => result.status));\n}\n\n/**\n * Whether a rule's subject is on the form: the field it decides, or the row member it\n * constrains, is not hidden by a `visible` rule.\n *\n * A `visible` rule is its own subject, so it is always relevant — asking whether the field it\n * hides is visible would turn `rule_ok(<visible rule>)` into its own negation. A rule that\n * decides no field is about the record and is always relevant. The access overlay is not asked:\n * a `masked` field is still on screen, and a row-level restriction must not erase a rule about\n * the array that holds it.\n */\nexport function isRelevantRule(state: EvaluationState, rule: CompiledRule): boolean {\n if (rule.kind === 'visible') return true;\n const fieldId = rule.targetFieldId ?? rule.fieldId;\n if (fieldId === undefined) return true;\n // A hand-built artifact may name an undeclared target; that is the expression pass's refusal,\n // not a relevance answer, so the rule stays in force here rather than silently passing.\n if (!state.prepared.fieldById.has(fieldId)) return true;\n return state.isVisible(fieldId);\n}\n\n/** Whether every `block`-severity rule of `kind` leaves nothing to block on. */\nexport function noBlockingFor(state: EvaluationState, kind: string): boolean {\n if (!isRuleKind(kind)) {\n throw new AxiomError('ENGINE_ERROR', `${kind} is not a rule kind`, kind);\n }\n for (const rule of state.compiled.rules ?? []) {\n if (rule.kind !== kind) continue;\n if ((rule.severity ?? 'block') !== 'block') continue;\n // A rule whose subject is not on the form is not an admission condition, exactly as in\n // `outcomeOfRuleId`.\n if (!isRelevantRule(state, rule)) continue;\n // A rule cannot answer a question about itself: the gate that asks\n // `no_blocking('gate')` is the rule whose body is running, so its own outcome does not\n // exist yet and folding it would re-enter the cycle guard. Every *other* block rule of\n // the kind still has to pass — including one the evaluation is already inside, because\n // that is a genuine cycle: the query cannot answer over a rule nobody has decided, and\n // the cycle guard makes it fail closed rather than silently skip the rule.\n if (rule === state.currentRule) continue;\n // The same classification the report's status folds (`RULES-1.1.9`): a `FAIL` that states\n // a branch blocks nothing, while an undecided result blocks because nothing was decided.\n if (evaluateRuleOnce(state, rule).results.some(isBlocking)) return false;\n }\n return true;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldRef, GateItemDeclaration, GateItemResult, GateReport, Outcome, RuleGate, WireValue } from '../../model/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The gate section a device reports for a gate rule only the server evaluates: every
|
|
4
|
+
* item's identity and message key with the one status the device can
|
|
5
|
+
* honestly give it, and no parameters — a client artifact carries nothing that states what
|
|
6
|
+
* the server checked. Without the section the report would say nothing about the gate the
|
|
7
|
+
* record must still pass, and `evaluateGate` could only report a missing gate.
|
|
8
|
+
*/
|
|
9
|
+
export declare function deferredGate(gate: RuleGate): GateReport;
|
|
10
|
+
/** One gate item's result, built the same way for an evaluated and a deferred gate. */
|
|
11
|
+
export declare function gateItem(item: GateItemDeclaration, status: Outcome, params: Readonly<Record<string, WireValue>> | undefined, fields: readonly FieldRef[]): GateItemResult;
|
|
12
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/eval/rule/gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACV,MAAM,sBAAsB,CAAC;AAE9B;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAEvD;AAaD,uFAAuF;AACvF,wBAAgB,QAAQ,CACtB,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,SAAS,EACvD,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B,cAAc,CAUhB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gate section a device reports for a gate rule only the server evaluates: every
|
|
3
|
+
* item's identity and message key with the one status the device can
|
|
4
|
+
* honestly give it, and no parameters — a client artifact carries nothing that states what
|
|
5
|
+
* the server checked. Without the section the report would say nothing about the gate the
|
|
6
|
+
* record must still pass, and `evaluateGate` could only report a missing gate.
|
|
7
|
+
*/
|
|
8
|
+
export function deferredGate(gate) {
|
|
9
|
+
return { items: gate.items.map((item) => gateItem(item, 'DEFERRED', undefined, [])) };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The rule a gate item folds, when its expression is exactly `rule_ok(<ruleId>)`. The item
|
|
13
|
+
* result names it so a consumer can map the item to the rule it decided without parsing the
|
|
14
|
+
* expression; an item that composes its own condition folds no single rule and states none.
|
|
15
|
+
*/
|
|
16
|
+
function foldedRuleOf(item) {
|
|
17
|
+
if (item.expr.kind !== 'call' || item.expr.op !== 'rule_ok')
|
|
18
|
+
return undefined;
|
|
19
|
+
const [target] = item.expr.args;
|
|
20
|
+
return target?.kind === 'literal' && typeof target.value === 'string' ? target.value : undefined;
|
|
21
|
+
}
|
|
22
|
+
/** One gate item's result, built the same way for an evaluated and a deferred gate. */
|
|
23
|
+
export function gateItem(item, status, params, fields) {
|
|
24
|
+
const ruleId = foldedRuleOf(item);
|
|
25
|
+
return {
|
|
26
|
+
itemId: item.itemId,
|
|
27
|
+
...(ruleId === undefined ? {} : { ruleId }),
|
|
28
|
+
status,
|
|
29
|
+
messageKey: item.messageKey,
|
|
30
|
+
...(params === undefined ? {} : { params }),
|
|
31
|
+
...(fields.length === 0 ? {} : { fields }),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=gate.js.map
|