@zxyycom/vibe-check 0.0.2 → 0.0.3
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/README.md +36 -5
- package/dist/esm/check/check.mjs +4 -0
- package/dist/esm/check/check.mjs.map +1 -1
- package/dist/esm/check/flag-enablement.mjs +32 -0
- package/dist/esm/check/flag-enablement.mjs.map +1 -0
- package/dist/esm/check/handoff-provider-identity.mjs +18 -0
- package/dist/esm/check/handoff-provider-identity.mjs.map +1 -0
- package/dist/esm/check/inherited-collection.mjs +1 -1
- package/dist/esm/check/inherited-collection.mjs.map +1 -1
- package/dist/esm/check/project-changes.mjs +2 -0
- package/dist/esm/check/project-changes.mjs.map +1 -0
- package/dist/esm/check/project-context.mjs +2 -0
- package/dist/esm/check/project-context.mjs.map +1 -0
- package/dist/esm/check-settlement/facts.mjs.map +1 -1
- package/dist/esm/check-settlement/record-store.mjs +1 -1
- package/dist/esm/check-settlement/record-store.mjs.map +1 -1
- package/dist/esm/data-boundary/canonical-data.mjs +36 -7
- package/dist/esm/data-boundary/canonical-data.mjs.map +1 -1
- package/dist/esm/data-boundary/canonical-json.mjs.map +1 -1
- package/dist/esm/data-boundary/closed-values.mjs +28 -4
- package/dist/esm/data-boundary/closed-values.mjs.map +1 -1
- package/dist/esm/{package-checks/project-files → data-boundary}/config-glob.mjs +3 -3
- package/dist/esm/data-boundary/config-glob.mjs.map +1 -0
- package/dist/esm/data-boundary/project-path.mjs +19 -0
- package/dist/esm/data-boundary/project-path.mjs.map +1 -0
- package/dist/esm/index.mjs +12 -5
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/machine-output/v4/atomic-publication.mjs +4 -1
- package/dist/esm/machine-output/v4/atomic-publication.mjs.map +1 -1
- package/dist/esm/package-checks/check-authoring.mjs +69 -0
- package/dist/esm/package-checks/check-authoring.mjs.map +1 -0
- package/dist/esm/package-checks/code-quality-findings/finding-waiver-authoring.mjs.map +1 -1
- package/dist/esm/package-checks/code-quality-findings/finding-waiver-evidence.mjs.map +1 -1
- package/dist/esm/package-checks/command-check/command-check.mjs +55 -0
- package/dist/esm/package-checks/command-check/command-check.mjs.map +1 -0
- package/dist/esm/package-checks/command-check/contract.mjs +2 -0
- package/dist/esm/package-checks/command-check/contract.mjs.map +1 -0
- package/dist/esm/package-checks/command-check/execution.mjs +134 -0
- package/dist/esm/package-checks/command-check/execution.mjs.map +1 -0
- package/dist/esm/package-checks/command-check/options.mjs +284 -0
- package/dist/esm/package-checks/command-check/options.mjs.map +1 -0
- package/dist/esm/package-checks/command-check/transcript.mjs +26 -0
- package/dist/esm/package-checks/command-check/transcript.mjs.map +1 -0
- package/dist/esm/package-checks/duplicate-detection/default-check.mjs +9 -11
- package/dist/esm/package-checks/duplicate-detection/default-check.mjs.map +1 -1
- package/dist/esm/package-checks/duplicate-detection/execution.mjs +2 -4
- package/dist/esm/package-checks/duplicate-detection/execution.mjs.map +1 -1
- package/dist/esm/package-checks/duplicate-detection/finding-messages.mjs +1 -1
- package/dist/esm/package-checks/duplicate-detection/finding-messages.mjs.map +1 -1
- package/dist/esm/package-checks/duplicate-detection/jscpd/availability.mjs +1 -1
- package/dist/esm/package-checks/duplicate-detection/jscpd/availability.mjs.map +1 -1
- package/dist/esm/package-checks/duplicate-detection/options.mjs.map +1 -1
- package/dist/esm/package-checks/duplicate-detection/records.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/constructor.mjs +9 -11
- package/dist/esm/package-checks/file-metrics/constructor.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/execution.mjs +2 -4
- package/dist/esm/package-checks/file-metrics/execution.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/finding-messages.mjs +1 -1
- package/dist/esm/package-checks/file-metrics/finding-messages.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/options.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/records.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/scc/availability.mjs +1 -1
- package/dist/esm/package-checks/file-metrics/scc/availability.mjs.map +1 -1
- package/dist/esm/package-checks/file-metrics/scc/batch-planner.mjs +38 -0
- package/dist/esm/package-checks/file-metrics/scc/batch-planner.mjs.map +1 -0
- package/dist/esm/package-checks/file-metrics/scc/logical-scan-resources.mjs +35 -0
- package/dist/esm/package-checks/file-metrics/scc/logical-scan-resources.mjs.map +1 -0
- package/dist/esm/package-checks/file-metrics/scc/scanner.mjs +102 -29
- package/dist/esm/package-checks/file-metrics/scc/scanner.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analysis.mjs +7 -2
- package/dist/esm/package-checks/function-metrics/analysis.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/analysis-model.mjs +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/analysis-model.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.mjs +1 -3
- package/dist/esm/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/extensions/protocol.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/pipeline.mjs +3 -2
- package/dist/esm/package-checks/function-metrics/analyzer/pipeline.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/erlang.mjs +6 -6
- package/dist/esm/package-checks/function-metrics/analyzer/readers/erlang.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/fortran.mjs +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/fortran.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/objc.mjs +9 -3
- package/dist/esm/package-checks/function-metrics/analyzer/readers/objc.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/php-states.mjs +12 -7
- package/dist/esm/package-checks/function-metrics/analyzer/readers/php-states.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/plsql.mjs +6 -6
- package/dist/esm/package-checks/function-metrics/analyzer/readers/plsql.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/python.mjs +5 -3
- package/dist/esm/package-checks/function-metrics/analyzer/readers/python.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/r.mjs +2 -0
- package/dist/esm/package-checks/function-metrics/analyzer/readers/r.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/ttcn.mjs +9 -3
- package/dist/esm/package-checks/function-metrics/analyzer/readers/ttcn.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/typescript.mjs +9 -3
- package/dist/esm/package-checks/function-metrics/analyzer/readers/typescript.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/zig.mjs +3 -1
- package/dist/esm/package-checks/function-metrics/analyzer/readers/zig.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/shared/code-reader.mjs +3 -1
- package/dist/esm/package-checks/function-metrics/analyzer/shared/code-reader.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer/shared/js-style-regex.mjs +12 -5
- package/dist/esm/package-checks/function-metrics/analyzer/shared/js-style-regex.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/analyzer-worker-port.mjs +20 -8
- package/dist/esm/package-checks/function-metrics/analyzer-worker-port.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/constructor.mjs +9 -11
- package/dist/esm/package-checks/function-metrics/constructor.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/execution.mjs +2 -4
- package/dist/esm/package-checks/function-metrics/execution.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/finding-messages.mjs +1 -1
- package/dist/esm/package-checks/function-metrics/finding-messages.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/measurement.mjs +3 -1
- package/dist/esm/package-checks/function-metrics/measurement.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/options.mjs.map +1 -1
- package/dist/esm/package-checks/function-metrics/records.mjs.map +1 -1
- package/dist/esm/package-checks/host-environment/git.mjs +11 -0
- package/dist/esm/package-checks/host-environment/git.mjs.map +1 -1
- package/dist/esm/package-checks/host-environment/path.mjs +1 -17
- package/dist/esm/package-checks/host-environment/path.mjs.map +1 -1
- package/dist/esm/package-checks/host-environment/process/contract.mjs.map +1 -1
- package/dist/esm/package-checks/host-environment/process/result.mjs +43 -17
- package/dist/esm/package-checks/host-environment/process/result.mjs.map +1 -1
- package/dist/esm/package-checks/host-environment/process/runner.mjs +7 -5
- package/dist/esm/package-checks/host-environment/process/runner.mjs.map +1 -1
- package/dist/esm/package-checks/json-schema-validation/default-check.mjs +9 -11
- package/dist/esm/package-checks/json-schema-validation/default-check.mjs.map +1 -1
- package/dist/esm/package-checks/json-schema-validation/options.mjs.map +1 -1
- package/dist/esm/package-checks/json-schema-validation/reference-resolver.mjs +6 -2
- package/dist/esm/package-checks/json-schema-validation/reference-resolver.mjs.map +1 -1
- package/dist/esm/package-checks/json-schema-validation/schema-policy.mjs +11 -3
- package/dist/esm/package-checks/json-schema-validation/schema-policy.mjs.map +1 -1
- package/dist/esm/package-checks/json-validation/default-check.mjs +9 -11
- package/dist/esm/package-checks/json-validation/default-check.mjs.map +1 -1
- package/dist/esm/package-checks/json-validation/options.mjs.map +1 -1
- package/dist/esm/package-checks/local-cache-options.mjs +28 -0
- package/dist/esm/package-checks/local-cache-options.mjs.map +1 -0
- package/dist/esm/package-checks/maintenance-reminders/maintenance-reminders.mjs +37 -45
- package/dist/esm/package-checks/maintenance-reminders/maintenance-reminders.mjs.map +1 -1
- package/dist/esm/package-checks/maintenance-reminders/maintenance-support.mjs +3 -1
- package/dist/esm/package-checks/maintenance-reminders/maintenance-support.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/default-check.mjs +19 -33
- package/dist/esm/package-checks/markdown-link-validation/default-check.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/execution.mjs +1 -1
- package/dist/esm/package-checks/markdown-link-validation/execution.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/finding-messages.mjs +1 -1
- package/dist/esm/package-checks/markdown-link-validation/finding-messages.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/markdown-parser.mjs +1 -3
- package/dist/esm/package-checks/markdown-link-validation/markdown-parser.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/options-resolution.mjs +3 -18
- package/dist/esm/package-checks/markdown-link-validation/options-resolution.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/options-validation.mjs +2 -14
- package/dist/esm/package-checks/markdown-link-validation/options-validation.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/options.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-link-validation/parse-facts-cache-payload.mjs +4 -5
- package/dist/esm/package-checks/markdown-link-validation/parse-facts-cache-payload.mjs.map +1 -1
- package/dist/esm/package-checks/markdown-lint/adapter.mjs +125 -0
- package/dist/esm/package-checks/markdown-lint/adapter.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/default-check.mjs +37 -0
- package/dist/esm/package-checks/markdown-lint/default-check.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/execution.mjs +202 -0
- package/dist/esm/package-checks/markdown-lint/execution.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/final-data.mjs +16 -0
- package/dist/esm/package-checks/markdown-lint/final-data.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/finding-messages.mjs +72 -0
- package/dist/esm/package-checks/markdown-lint/finding-messages.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/finding-waiver-identity.mjs +41 -0
- package/dist/esm/package-checks/markdown-lint/finding-waiver-identity.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/findings-cache.mjs +110 -0
- package/dist/esm/package-checks/markdown-lint/findings-cache.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/options-resolution.mjs +74 -0
- package/dist/esm/package-checks/markdown-lint/options-resolution.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/options-validation.mjs +41 -0
- package/dist/esm/package-checks/markdown-lint/options-validation.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/options.mjs +13 -0
- package/dist/esm/package-checks/markdown-lint/options.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/records.mjs +65 -0
- package/dist/esm/package-checks/markdown-lint/records.mjs.map +1 -0
- package/dist/esm/package-checks/markdown-lint/unavailable-reasons.mjs +14 -0
- package/dist/esm/package-checks/markdown-lint/unavailable-reasons.mjs.map +1 -0
- package/dist/esm/package-checks/project-files/collection.mjs +23 -19
- package/dist/esm/package-checks/project-files/collection.mjs.map +1 -1
- package/dist/esm/package-checks/project-files/configuration.mjs +1 -1
- package/dist/esm/package-checks/project-files/configuration.mjs.map +1 -1
- package/dist/esm/package-checks/project-files/gitlink-revision.mjs +2 -5
- package/dist/esm/package-checks/project-files/gitlink-revision.mjs.map +1 -1
- package/dist/esm/package-checks/project-files/gitlink-worktree.mjs +22 -6
- package/dist/esm/package-checks/project-files/gitlink-worktree.mjs.map +1 -1
- package/dist/esm/package-checks/project-files/public-collection.mjs +1 -1
- package/dist/esm/package-checks/project-files/public-collection.mjs.map +1 -1
- package/dist/esm/package-checks/project-files/revision-paths.mjs +3 -3
- package/dist/esm/package-checks/project-files/revision-paths.mjs.map +1 -1
- package/dist/esm/package-checks/project-files/revision-worktree-files.mjs +11 -15
- package/dist/esm/package-checks/project-files/revision-worktree-files.mjs.map +1 -1
- package/dist/esm/package-checks/secret-detection/default-check.mjs +9 -11
- package/dist/esm/package-checks/secret-detection/default-check.mjs.map +1 -1
- package/dist/esm/package-checks/secret-detection/execution.mjs +2 -2
- package/dist/esm/package-checks/secret-detection/execution.mjs.map +1 -1
- package/dist/esm/package-checks/secret-detection/input-preparation.mjs +46 -7
- package/dist/esm/package-checks/secret-detection/input-preparation.mjs.map +1 -1
- package/dist/esm/package-checks/secret-detection/options.mjs.map +1 -1
- package/dist/esm/package-checks/secret-detection/records.mjs.map +1 -1
- package/dist/esm/package-checks/secret-detection/secretlint/adapter.mjs +3 -4
- package/dist/esm/package-checks/secret-detection/secretlint/adapter.mjs.map +1 -1
- package/dist/esm/package-tools/admission-policy/define-admission-policy.mjs +10 -0
- package/dist/esm/package-tools/admission-policy/define-admission-policy.mjs.map +1 -0
- package/dist/esm/{cache → package-tools/cache}/cache-json-by-key.mjs +13 -14
- package/dist/esm/package-tools/cache/cache-json-by-key.mjs.map +1 -0
- package/dist/esm/package-tools/finding-presentation/finding-presentation.mjs.map +1 -0
- package/dist/esm/{finding-waivers → package-tools/finding-waivers}/reconciliation.mjs +14 -5
- package/dist/esm/package-tools/finding-waivers/reconciliation.mjs.map +1 -0
- package/dist/esm/package-tools/learned-critical-path/critical-path-ranking.mjs.map +1 -0
- package/dist/esm/package-tools/learned-critical-path/duration-model/bounded-history.mjs.map +1 -0
- package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.mjs +2 -2
- package/dist/esm/package-tools/learned-critical-path/duration-model/prediction.mjs.map +1 -0
- package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.mjs +4 -2
- package/dist/esm/package-tools/learned-critical-path/duration-model/preparation.mjs.map +1 -0
- package/dist/esm/package-tools/learned-critical-path/duration-model/recording.mjs.map +1 -0
- package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.mjs +8 -8
- package/dist/esm/package-tools/learned-critical-path/duration-model/storage.mjs.map +1 -0
- package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.mjs +1 -2
- package/dist/esm/package-tools/learned-critical-path/selection-layers.mjs.map +1 -0
- package/dist/esm/package-tools/learned-critical-path/static-decision.mjs.map +1 -0
- package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/strategy.mjs +3 -3
- package/dist/esm/package-tools/learned-critical-path/strategy.mjs.map +1 -0
- package/dist/esm/project-definition/check-tree/authoring.mjs +8 -5
- package/dist/esm/project-definition/check-tree/authoring.mjs.map +1 -1
- package/dist/esm/project-definition/check-tree/check-fields-authoring.mjs +79 -66
- package/dist/esm/project-definition/check-tree/check-fields-authoring.mjs.map +1 -1
- package/dist/esm/project-definition/check-tree/flag-conditions.mjs +71 -0
- package/dist/esm/project-definition/check-tree/flag-conditions.mjs.map +1 -0
- package/dist/esm/project-definition/check-tree/materialization.mjs +13 -8
- package/dist/esm/project-definition/check-tree/materialization.mjs.map +1 -1
- package/dist/esm/project-definition/check-tree/resolution.mjs +7 -6
- package/dist/esm/project-definition/check-tree/resolution.mjs.map +1 -1
- package/dist/esm/project-definition/declarative-snapshot.mjs +2 -1
- package/dist/esm/project-definition/declarative-snapshot.mjs.map +1 -1
- package/dist/esm/project-definition/project-changes.mjs +70 -0
- package/dist/esm/project-definition/project-changes.mjs.map +1 -0
- package/dist/esm/project-definition/project-definition-validation.mjs +40 -8
- package/dist/esm/project-definition/project-definition-validation.mjs.map +1 -1
- package/dist/esm/project-definition/project-definition.mjs +22 -15
- package/dist/esm/project-definition/project-definition.mjs.map +1 -1
- package/dist/esm/project-definition/scheduler-policy.mjs.map +1 -1
- package/dist/esm/project-run/admission-strategy-provider/custom-strategy-preparation.mjs +9 -6
- package/dist/esm/project-run/admission-strategy-provider/custom-strategy-preparation.mjs.map +1 -1
- package/dist/esm/project-run/admission-strategy-provider/prepared-admission-strategy.mjs.map +1 -1
- package/dist/esm/project-run/aggregation.mjs +42 -59
- package/dist/esm/project-run/aggregation.mjs.map +1 -1
- package/dist/esm/project-run/changes/git.mjs +161 -0
- package/dist/esm/project-run/changes/git.mjs.map +1 -0
- package/dist/esm/project-run/check-execution/admitted-check-execution.mjs +41 -0
- package/dist/esm/project-run/check-execution/admitted-check-execution.mjs.map +1 -0
- package/dist/esm/project-run/check-execution/callback.mjs +3 -2
- package/dist/esm/project-run/check-execution/callback.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/dependencies.mjs +80 -5
- package/dist/esm/project-run/check-execution/dependencies.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/execution-finalization.mjs +5 -3
- package/dist/esm/project-run/check-execution/execution-finalization.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/execution-settlement.mjs +37 -16
- package/dist/esm/project-run/check-execution/execution-settlement.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/flag-controls.mjs +15 -7
- package/dist/esm/project-run/check-execution/flag-controls.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/lifecycle.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/{preflight-result.mjs → preparation-result.mjs} +24 -24
- package/dist/esm/project-run/check-execution/preparation-result.mjs.map +1 -0
- package/dist/esm/project-run/check-execution/{preflight.mjs → preparation.mjs} +52 -52
- package/dist/esm/project-run/check-execution/preparation.mjs.map +1 -0
- package/dist/esm/project-run/check-execution/ready-check-execution.mjs +71 -0
- package/dist/esm/project-run/check-execution/ready-check-execution.mjs.map +1 -0
- package/dist/esm/project-run/check-execution/resolved-checks.mjs +27 -164
- package/dist/esm/project-run/check-execution/resolved-checks.mjs.map +1 -1
- package/dist/esm/project-run/check-execution/scheduled-check-run.mjs +79 -0
- package/dist/esm/project-run/check-execution/scheduled-check-run.mjs.map +1 -0
- package/dist/esm/project-run/check-execution/terminal-result.mjs +70 -25
- package/dist/esm/project-run/check-execution/terminal-result.mjs.map +1 -1
- package/dist/esm/project-run/completion/completion.mjs +18 -1
- package/dist/esm/project-run/completion/completion.mjs.map +1 -1
- package/dist/esm/project-run/controls/contract.mjs.map +1 -1
- package/dist/esm/project-run/controls/validation.mjs +7 -54
- package/dist/esm/project-run/controls/validation.mjs.map +1 -1
- package/dist/esm/project-run/diagnostic-logging/diagnostic-detail-rendering.mjs +3 -3
- package/dist/esm/project-run/diagnostic-logging/diagnostic-detail-rendering.mjs.map +1 -1
- package/dist/esm/project-run/diagnostic-logging/observation-rendering.mjs +1 -1
- package/dist/esm/project-run/diagnostic-logging/observation-rendering.mjs.map +1 -1
- package/dist/esm/project-run/invocation/candidate.mjs +17 -13
- package/dist/esm/project-run/invocation/candidate.mjs.map +1 -1
- package/dist/esm/project-run/invocation/candidates.mjs +26 -0
- package/dist/esm/project-run/invocation/candidates.mjs.map +1 -0
- package/dist/esm/project-run/invocation/creation.mjs +7 -3
- package/dist/esm/project-run/invocation/creation.mjs.map +1 -1
- package/dist/esm/project-run/invocation/execution.mjs +98 -0
- package/dist/esm/project-run/invocation/execution.mjs.map +1 -0
- package/dist/esm/project-run/invocation/run.mjs +13 -112
- package/dist/esm/project-run/invocation/run.mjs.map +1 -1
- package/dist/esm/project-run/invocation/scheduler.mjs +13 -6
- package/dist/esm/project-run/invocation/scheduler.mjs.map +1 -1
- package/dist/esm/project-run/outputs/status.mjs +12 -12
- package/dist/esm/project-run/outputs/status.mjs.map +1 -1
- package/dist/esm/project-run/progress-rendering/presentation.mjs +31 -11
- package/dist/esm/project-run/progress-rendering/presentation.mjs.map +1 -1
- package/dist/esm/project-run/progress-rendering/renderer-formatting.mjs +11 -4
- package/dist/esm/project-run/progress-rendering/renderer-formatting.mjs.map +1 -1
- package/dist/esm/project-run/progress-rendering/renderer-lifecycle.mjs +20 -6
- package/dist/esm/project-run/progress-rendering/renderer-lifecycle.mjs.map +1 -1
- package/dist/esm/project-run/progress-rendering/renderer.mjs +6 -2
- package/dist/esm/project-run/progress-rendering/renderer.mjs.map +1 -1
- package/dist/esm/project-run/project-context.mjs +2 -1
- package/dist/esm/project-run/project-context.mjs.map +1 -1
- package/dist/esm/project-run/result.mjs +2 -2
- package/dist/esm/project-run/result.mjs.map +1 -1
- package/dist/esm/project-run/run.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph-lookup.mjs +45 -0
- package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph-lookup.mjs.map +1 -0
- package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph.mjs +9 -4
- package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/admission-core/selection-query.mjs +3 -5
- package/dist/esm/project-run/task-scheduler/admission-core/selection-query.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/admission-core/selection-seed.mjs +25 -8
- package/dist/esm/project-run/task-scheduler/admission-core/selection-seed.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/admission-core/selection-transition.mjs +8 -8
- package/dist/esm/project-run/task-scheduler/admission-core/selection-transition.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/execution-state.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/measurement/diagnostics.mjs +8 -4
- package/dist/esm/project-run/task-scheduler/measurement/diagnostics.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/measurement/timing.mjs +12 -6
- package/dist/esm/project-run/task-scheduler/measurement/timing.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/scheduler-observation.mjs +3 -1
- package/dist/esm/project-run/task-scheduler/scheduler-observation.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/scheduler-terminal-measurement.mjs +17 -17
- package/dist/esm/project-run/task-scheduler/scheduler-terminal-measurement.mjs.map +1 -1
- package/dist/esm/project-run/task-scheduler/scheduler.mjs +18 -6
- package/dist/esm/project-run/task-scheduler/scheduler.mjs.map +1 -1
- package/docs/api-mechanics.md +147 -28
- package/docs/changelog.md +145 -2
- package/docs/checks/duplicate-detection.md +22 -3
- package/docs/checks/file-metrics.md +25 -6
- package/docs/checks/function-metrics.md +21 -2
- package/docs/checks/json-schema-validation.md +25 -4
- package/docs/checks/json-validation.md +24 -5
- package/docs/checks/maintenance-reminders.md +30 -6
- package/docs/checks/markdown-link-validation.md +24 -4
- package/docs/checks/markdown-lint.md +167 -0
- package/docs/checks/secret-detection.md +31 -7
- package/docs/examples/artifacts/mixed-outcomes/definition.ts +10 -10
- package/docs/guides/building-project-gate.md +706 -0
- package/docs/guides/callbacks.md +81 -22
- package/docs/guides/check-dependencies.md +41 -10
- package/docs/guides/collecting-project-files.md +7 -7
- package/docs/guides/command-check.md +155 -0
- package/docs/guides/data-boundaries.md +140 -0
- package/docs/guides/extending-check-lifecycle.md +77 -25
- package/docs/guides/finding-waivers.md +43 -1
- package/docs/guides/learned-scheduling.md +1 -1
- package/docs/guides/run-outputs.md +35 -9
- package/docs/guides/scheduling.md +15 -15
- package/docs/output.md +6 -5
- package/package.json +2 -1
- package/src/check/check.ts +332 -92
- package/src/check/flag-enablement.ts +76 -0
- package/src/check/handoff-provider-identity.ts +34 -0
- package/src/check/inherited-collection.ts +1 -1
- package/src/check/project-changes.ts +14 -0
- package/src/check/project-context.ts +11 -0
- package/src/check-settlement/facts.ts +1 -1
- package/src/check-settlement/record-store.ts +1 -1
- package/src/data-boundary/canonical-data.ts +36 -9
- package/src/data-boundary/canonical-json.ts +18 -1
- package/src/data-boundary/closed-values.ts +26 -6
- package/src/data-boundary/config-glob.ts +17 -0
- package/src/data-boundary/project-path.ts +21 -0
- package/src/index.ts +72 -11
- package/src/machine-output/v4/atomic-publication.ts +3 -1
- package/src/package-checks/check-authoring.ts +136 -0
- package/src/package-checks/code-quality-findings/finding-waiver-authoring.ts +1 -1
- package/src/package-checks/code-quality-findings/finding-waiver-evidence.ts +1 -1
- package/src/package-checks/command-check/command-check.ts +152 -0
- package/src/package-checks/command-check/contract.ts +168 -0
- package/src/package-checks/command-check/execution.ts +211 -0
- package/src/package-checks/command-check/options.ts +331 -0
- package/src/package-checks/command-check/transcript.ts +35 -0
- package/src/package-checks/duplicate-detection/default-check.ts +37 -6
- package/src/package-checks/duplicate-detection/execution.ts +2 -4
- package/src/package-checks/duplicate-detection/finding-messages.ts +2 -2
- package/src/package-checks/duplicate-detection/jscpd/availability.ts +1 -1
- package/src/package-checks/duplicate-detection/options.ts +6 -3
- package/src/package-checks/duplicate-detection/records.ts +1 -1
- package/src/package-checks/file-metrics/constructor.ts +29 -6
- package/src/package-checks/file-metrics/execution.ts +2 -4
- package/src/package-checks/file-metrics/finding-messages.ts +1 -1
- package/src/package-checks/file-metrics/options.ts +6 -3
- package/src/package-checks/file-metrics/records.ts +1 -1
- package/src/package-checks/file-metrics/scc/availability.ts +1 -1
- package/src/package-checks/file-metrics/scc/batch-planner.ts +56 -0
- package/src/package-checks/file-metrics/scc/logical-scan-resources.ts +59 -0
- package/src/package-checks/file-metrics/scc/scanner.ts +134 -32
- package/src/package-checks/function-metrics/analysis.ts +7 -2
- package/src/package-checks/function-metrics/analyzer/analysis-model.ts +1 -1
- package/src/package-checks/function-metrics/analyzer/extension-output.ts +14 -6
- package/src/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.ts +1 -3
- package/src/package-checks/function-metrics/analyzer/extensions/protocol.ts +3 -3
- package/src/package-checks/function-metrics/analyzer/pipeline.ts +4 -2
- package/src/package-checks/function-metrics/analyzer/readers/erlang.ts +6 -6
- package/src/package-checks/function-metrics/analyzer/readers/fortran.ts +1 -1
- package/src/package-checks/function-metrics/analyzer/readers/objc.ts +9 -3
- package/src/package-checks/function-metrics/analyzer/readers/php-states.ts +14 -7
- package/src/package-checks/function-metrics/analyzer/readers/plsql.ts +8 -4
- package/src/package-checks/function-metrics/analyzer/readers/python.ts +4 -3
- package/src/package-checks/function-metrics/analyzer/readers/r.ts +2 -1
- package/src/package-checks/function-metrics/analyzer/readers/ttcn.ts +9 -3
- package/src/package-checks/function-metrics/analyzer/readers/typescript.ts +9 -3
- package/src/package-checks/function-metrics/analyzer/readers/zig.ts +2 -1
- package/src/package-checks/function-metrics/analyzer/shared/code-reader.ts +3 -1
- package/src/package-checks/function-metrics/analyzer/shared/js-style-regex.ts +10 -5
- package/src/package-checks/function-metrics/analyzer-worker-port.ts +20 -6
- package/src/package-checks/function-metrics/constructor.ts +30 -7
- package/src/package-checks/function-metrics/execution.ts +2 -4
- package/src/package-checks/function-metrics/finding-messages.ts +2 -2
- package/src/package-checks/function-metrics/measurement.ts +3 -1
- package/src/package-checks/function-metrics/options.ts +6 -3
- package/src/package-checks/function-metrics/records.ts +1 -1
- package/src/package-checks/host-environment/git.ts +11 -0
- package/src/package-checks/host-environment/path.ts +1 -20
- package/src/package-checks/host-environment/process/contract.ts +17 -9
- package/src/package-checks/host-environment/process/result.ts +48 -20
- package/src/package-checks/host-environment/process/runner.ts +8 -4
- package/src/package-checks/json-schema-validation/default-check.ts +38 -5
- package/src/package-checks/json-schema-validation/options.ts +4 -1
- package/src/package-checks/json-schema-validation/reference-resolver.ts +6 -2
- package/src/package-checks/json-schema-validation/schema-policy.ts +10 -5
- package/src/package-checks/json-validation/default-check.ts +27 -6
- package/src/package-checks/json-validation/options.ts +4 -1
- package/src/package-checks/local-cache-options.ts +40 -0
- package/src/package-checks/maintenance-reminders/maintenance-reminders.ts +89 -9
- package/src/package-checks/maintenance-reminders/maintenance-support.ts +3 -3
- package/src/package-checks/markdown-link-validation/default-check.ts +48 -5
- package/src/package-checks/markdown-link-validation/execution.ts +1 -1
- package/src/package-checks/markdown-link-validation/finding-messages.ts +1 -1
- package/src/package-checks/markdown-link-validation/markdown-parser.ts +1 -5
- package/src/package-checks/markdown-link-validation/options-resolution.ts +2 -19
- package/src/package-checks/markdown-link-validation/options-validation.ts +2 -17
- package/src/package-checks/markdown-link-validation/options.ts +6 -7
- package/src/package-checks/markdown-link-validation/parse-facts-cache-payload.ts +4 -5
- package/src/package-checks/markdown-lint/adapter.ts +167 -0
- package/src/package-checks/markdown-lint/default-check.ts +92 -0
- package/src/package-checks/markdown-lint/execution.ts +266 -0
- package/src/package-checks/markdown-lint/final-data.ts +33 -0
- package/src/package-checks/markdown-lint/finding-messages.ts +87 -0
- package/src/package-checks/markdown-lint/finding-waiver-identity.ts +54 -0
- package/src/package-checks/markdown-lint/findings-cache.ts +141 -0
- package/src/package-checks/markdown-lint/options-resolution.ts +102 -0
- package/src/package-checks/markdown-lint/options-validation.ts +50 -0
- package/src/package-checks/markdown-lint/options.ts +82 -0
- package/src/package-checks/markdown-lint/records.ts +132 -0
- package/src/package-checks/markdown-lint/unavailable-reasons.ts +33 -0
- package/src/package-checks/project-files/collection.ts +38 -22
- package/src/package-checks/project-files/config-glob.ts +1 -17
- package/src/package-checks/project-files/configuration.ts +1 -1
- package/src/package-checks/project-files/gitlink-revision.ts +4 -6
- package/src/package-checks/project-files/gitlink-worktree.ts +35 -7
- package/src/package-checks/project-files/public-collection.ts +1 -1
- package/src/package-checks/project-files/revision-paths.ts +3 -3
- package/src/package-checks/project-files/revision-worktree-files.ts +16 -16
- package/src/package-checks/secret-detection/default-check.ts +29 -6
- package/src/package-checks/secret-detection/execution.ts +2 -2
- package/src/package-checks/secret-detection/input-preparation.ts +64 -7
- package/src/package-checks/secret-detection/options.ts +5 -2
- package/src/package-checks/secret-detection/records.ts +1 -1
- package/src/package-checks/secret-detection/secretlint/adapter.ts +3 -4
- package/src/package-tools/admission-policy/define-admission-policy.ts +54 -0
- package/src/{cache → package-tools/cache}/cache-json-by-key.ts +13 -17
- package/src/{check → package-tools/finding-presentation}/finding-presentation.ts +3 -1
- package/src/{finding-waivers → package-tools/finding-waivers}/reconciliation.ts +16 -8
- package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.ts +5 -2
- package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.ts +5 -3
- package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.ts +5 -4
- package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.ts +9 -10
- package/src/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.ts +2 -3
- package/src/{learned-critical-path → package-tools/learned-critical-path}/static-decision.ts +1 -1
- package/src/{learned-critical-path → package-tools/learned-critical-path}/strategy.ts +7 -4
- package/src/project-definition/check-tree/authoring.ts +15 -8
- package/src/project-definition/check-tree/check-fields-authoring.ts +106 -91
- package/src/project-definition/check-tree/flag-conditions.ts +99 -0
- package/src/project-definition/check-tree/materialization.ts +12 -8
- package/src/project-definition/check-tree/resolution.ts +13 -15
- package/src/project-definition/declarative-snapshot.ts +9 -2
- package/src/project-definition/project-changes.ts +112 -0
- package/src/project-definition/project-definition-validation.ts +58 -10
- package/src/project-definition/project-definition.ts +41 -68
- package/src/project-definition/scheduler-policy.ts +6 -3
- package/src/project-run/admission-strategy-provider/custom-strategy-preparation.ts +11 -8
- package/src/project-run/admission-strategy-provider/prepared-admission-strategy.ts +2 -2
- package/src/project-run/aggregation.ts +51 -74
- package/src/project-run/changes/git.ts +206 -0
- package/src/project-run/check-execution/admitted-check-execution.ts +62 -0
- package/src/project-run/check-execution/callback.ts +3 -2
- package/src/project-run/check-execution/dependencies.ts +120 -6
- package/src/project-run/check-execution/execution-finalization.ts +6 -4
- package/src/project-run/check-execution/execution-settlement.ts +88 -29
- package/src/project-run/check-execution/flag-controls.ts +22 -8
- package/src/project-run/check-execution/lifecycle.ts +14 -6
- package/src/project-run/check-execution/{preflight-result.ts → preparation-result.ts} +34 -32
- package/src/project-run/check-execution/{preflight.ts → preparation.ts} +92 -84
- package/src/project-run/check-execution/ready-check-execution.ts +97 -0
- package/src/project-run/check-execution/resolved-checks.ts +40 -219
- package/src/project-run/check-execution/scheduled-check-run.ts +119 -0
- package/src/project-run/check-execution/terminal-result.ts +108 -29
- package/src/project-run/completion/completion.ts +17 -3
- package/src/project-run/controls/contract.ts +6 -16
- package/src/project-run/controls/validation.ts +7 -60
- package/src/project-run/diagnostic-logging/diagnostic-detail-rendering.ts +1 -2
- package/src/project-run/diagnostic-logging/observation-rendering.ts +1 -1
- package/src/project-run/invocation/candidate.ts +28 -15
- package/src/project-run/invocation/candidates.ts +56 -0
- package/src/project-run/invocation/creation.ts +7 -3
- package/src/project-run/invocation/execution.ts +136 -0
- package/src/project-run/invocation/run.ts +15 -179
- package/src/project-run/invocation/scheduler.ts +13 -6
- package/src/project-run/outputs/status.ts +15 -15
- package/src/project-run/progress-rendering/presentation.ts +35 -13
- package/src/project-run/progress-rendering/renderer-formatting.ts +20 -7
- package/src/project-run/progress-rendering/renderer-lifecycle.ts +23 -6
- package/src/project-run/progress-rendering/renderer.ts +10 -4
- package/src/project-run/project-context.ts +8 -4
- package/src/project-run/result.ts +5 -5
- package/src/project-run/run.ts +1 -1
- package/src/project-run/task-scheduler/admission-core/compiled-graph-lookup.ts +71 -0
- package/src/project-run/task-scheduler/admission-core/compiled-graph.ts +9 -4
- package/src/project-run/task-scheduler/admission-core/selection-query.ts +6 -4
- package/src/project-run/task-scheduler/admission-core/selection-seed.ts +36 -6
- package/src/project-run/task-scheduler/admission-core/selection-transition.ts +17 -8
- package/src/project-run/task-scheduler/execution-state.ts +4 -4
- package/src/project-run/task-scheduler/measurement/diagnostics.ts +10 -4
- package/src/project-run/task-scheduler/measurement/timing.ts +13 -5
- package/src/project-run/task-scheduler/scheduler-observation.ts +3 -1
- package/src/project-run/task-scheduler/scheduler-terminal-measurement.ts +24 -22
- package/src/project-run/task-scheduler/scheduler.ts +23 -6
- package/types/check/check.d.ts +178 -67
- package/types/check/flag-enablement.d.ts +42 -0
- package/types/check/handoff-provider-identity.d.ts +12 -0
- package/types/check/project-changes.d.ts +13 -0
- package/types/check/project-context.d.ts +10 -0
- package/types/check-settlement/facts.d.ts +1 -1
- package/types/data-boundary/canonical-data.d.ts +28 -5
- package/types/data-boundary/canonical-json.d.ts +18 -1
- package/types/data-boundary/closed-values.d.ts +17 -1
- package/types/data-boundary/config-glob.d.ts +5 -0
- package/types/data-boundary/project-path.d.ts +4 -0
- package/types/index.d.ts +27 -11
- package/types/package-checks/check-authoring.d.ts +45 -0
- package/types/package-checks/code-quality-findings/finding-waiver-authoring.d.ts +1 -1
- package/types/package-checks/code-quality-findings/finding-waiver-evidence.d.ts +1 -1
- package/types/package-checks/command-check/command-check.d.ts +48 -0
- package/types/package-checks/command-check/contract.d.ts +108 -0
- package/types/package-checks/command-check/execution.d.ts +7 -0
- package/types/package-checks/command-check/options.d.ts +11 -0
- package/types/package-checks/command-check/transcript.d.ts +8 -0
- package/types/package-checks/duplicate-detection/default-check.d.ts +5 -2
- package/types/package-checks/duplicate-detection/finding-messages.d.ts +1 -1
- package/types/package-checks/duplicate-detection/options.d.ts +4 -3
- package/types/package-checks/duplicate-detection/records.d.ts +1 -1
- package/types/package-checks/file-metrics/constructor.d.ts +5 -2
- package/types/package-checks/file-metrics/options.d.ts +4 -3
- package/types/package-checks/file-metrics/records.d.ts +1 -1
- package/types/package-checks/file-metrics/scc/batch-planner.d.ts +18 -0
- package/types/package-checks/file-metrics/scc/logical-scan-resources.d.ts +14 -0
- package/types/package-checks/function-metrics/analyzer/extensions/protocol.d.ts +3 -3
- package/types/package-checks/function-metrics/constructor.d.ts +5 -2
- package/types/package-checks/function-metrics/finding-messages.d.ts +1 -1
- package/types/package-checks/function-metrics/options.d.ts +4 -3
- package/types/package-checks/function-metrics/records.d.ts +1 -1
- package/types/package-checks/host-environment/git.d.ts +2 -0
- package/types/package-checks/host-environment/path.d.ts +1 -3
- package/types/package-checks/host-environment/process/contract.d.ts +17 -9
- package/types/package-checks/json-schema-validation/default-check.d.ts +4 -1
- package/types/package-checks/json-schema-validation/options.d.ts +2 -1
- package/types/package-checks/json-validation/default-check.d.ts +4 -1
- package/types/package-checks/json-validation/options.d.ts +2 -1
- package/types/package-checks/local-cache-options.d.ts +9 -0
- package/types/package-checks/maintenance-reminders/maintenance-reminders.d.ts +11 -2
- package/types/package-checks/markdown-link-validation/default-check.d.ts +4 -1
- package/types/package-checks/markdown-link-validation/options.d.ts +4 -7
- package/types/package-checks/markdown-lint/adapter.d.ts +10 -0
- package/types/package-checks/markdown-lint/default-check.d.ts +37 -0
- package/types/package-checks/markdown-lint/execution.d.ts +24 -0
- package/types/package-checks/markdown-lint/final-data.d.ts +8 -0
- package/types/package-checks/markdown-lint/finding-messages.d.ts +6 -0
- package/types/package-checks/markdown-lint/finding-waiver-identity.d.ts +3 -0
- package/types/package-checks/markdown-lint/findings-cache.d.ts +17 -0
- package/types/package-checks/markdown-lint/options-resolution.d.ts +3 -0
- package/types/package-checks/markdown-lint/options-validation.d.ts +2 -0
- package/types/package-checks/markdown-lint/options.d.ts +65 -0
- package/types/package-checks/markdown-lint/records.d.ts +39 -0
- package/types/package-checks/markdown-lint/unavailable-reasons.d.ts +3 -0
- package/types/package-checks/secret-detection/default-check.d.ts +4 -1
- package/types/package-checks/secret-detection/options.d.ts +3 -2
- package/types/package-tools/admission-policy/define-admission-policy.d.ts +26 -0
- package/types/{check → package-tools/finding-presentation}/finding-presentation.d.ts +3 -1
- package/types/{finding-waivers → package-tools/finding-waivers}/reconciliation.d.ts +3 -3
- package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.d.ts +2 -2
- package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.d.ts +1 -1
- package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.d.ts +1 -1
- package/types/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.d.ts +1 -1
- package/types/{learned-critical-path → package-tools/learned-critical-path}/static-decision.d.ts +1 -1
- package/types/{learned-critical-path → package-tools/learned-critical-path}/strategy.d.ts +1 -1
- package/types/project-definition/check-tree/authoring.d.ts +5 -3
- package/types/project-definition/check-tree/check-fields-authoring.d.ts +12 -7
- package/types/project-definition/check-tree/flag-conditions.d.ts +5 -0
- package/types/project-definition/check-tree/resolution.d.ts +6 -4
- package/types/project-definition/declarative-snapshot.d.ts +4 -1
- package/types/project-definition/project-changes.d.ts +30 -0
- package/types/project-definition/project-definition.d.ts +15 -30
- package/types/project-definition/scheduler-policy.d.ts +3 -3
- package/types/project-run/admission-strategy-provider/prepared-admission-strategy.d.ts +2 -2
- package/types/project-run/aggregation.d.ts +8 -6
- package/types/project-run/changes/git.d.ts +14 -0
- package/types/project-run/check-execution/admitted-check-execution.d.ts +18 -0
- package/types/project-run/check-execution/dependencies.d.ts +3 -0
- package/types/project-run/check-execution/execution-finalization.d.ts +1 -1
- package/types/project-run/check-execution/execution-settlement.d.ts +15 -7
- package/types/project-run/check-execution/flag-controls.d.ts +1 -1
- package/types/project-run/check-execution/lifecycle.d.ts +9 -5
- package/types/project-run/check-execution/{preflight-result.d.ts → preparation-result.d.ts} +3 -3
- package/types/project-run/check-execution/{preflight.d.ts → preparation.d.ts} +10 -9
- package/types/project-run/check-execution/ready-check-execution.d.ts +18 -0
- package/types/project-run/check-execution/resolved-checks.d.ts +12 -13
- package/types/project-run/check-execution/scheduled-check-run.d.ts +10 -0
- package/types/project-run/check-execution/terminal-result.d.ts +13 -1
- package/types/project-run/completion/completion.d.ts +3 -1
- package/types/project-run/controls/contract.d.ts +6 -16
- package/types/project-run/invocation/candidates.d.ts +8 -0
- package/types/project-run/invocation/execution.d.ts +5 -0
- package/types/project-run/invocation/run.d.ts +2 -2
- package/types/project-run/outputs/status.d.ts +4 -4
- package/types/project-run/progress-rendering/presentation.d.ts +4 -3
- package/types/project-run/progress-rendering/renderer-formatting.d.ts +5 -2
- package/types/project-run/progress-rendering/renderer-lifecycle.d.ts +2 -0
- package/types/project-run/progress-rendering/renderer.d.ts +4 -2
- package/types/project-run/project-context.d.ts +3 -3
- package/types/project-run/result.d.ts +3 -3
- package/types/project-run/run.d.ts +1 -1
- package/types/project-run/task-scheduler/admission-core/compiled-graph-lookup.d.ts +10 -0
- package/types/project-run/task-scheduler/execution-state.d.ts +4 -4
- package/types/project-run/task-scheduler/measurement/diagnostics.d.ts +2 -2
- package/types/project-run/task-scheduler/scheduler-terminal-measurement.d.ts +1 -1
- package/dist/esm/cache/cache-json-by-key.mjs.map +0 -1
- package/dist/esm/check/finding-presentation.mjs.map +0 -1
- package/dist/esm/finding-waivers/reconciliation.mjs.map +0 -1
- package/dist/esm/learned-critical-path/duration-model/bounded-history.mjs.map +0 -1
- package/dist/esm/learned-critical-path/duration-model/prediction.mjs.map +0 -1
- package/dist/esm/learned-critical-path/duration-model/preparation.mjs.map +0 -1
- package/dist/esm/learned-critical-path/duration-model/recording.mjs.map +0 -1
- package/dist/esm/learned-critical-path/duration-model/storage.mjs.map +0 -1
- package/dist/esm/learned-critical-path/selection-layers.mjs.map +0 -1
- package/dist/esm/learned-critical-path/static-decision.mjs.map +0 -1
- package/dist/esm/learned-critical-path/strategy.mjs.map +0 -1
- package/dist/esm/package-checks/project-files/config-glob.mjs.map +0 -1
- package/dist/esm/project-run/check-execution/preflight-result.mjs.map +0 -1
- package/dist/esm/project-run/check-execution/preflight.mjs.map +0 -1
- package/dist/esm/project-run/task-scheduler/critical-path-ranking.mjs.map +0 -1
- package/types/package-checks/project-files/config-glob.d.ts +0 -5
- /package/dist/esm/{check → package-tools/finding-presentation}/finding-presentation.mjs +0 -0
- /package/dist/esm/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.mjs +0 -0
- /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.mjs +0 -0
- /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.mjs +0 -0
- /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/static-decision.mjs +0 -0
- /package/src/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.ts +0 -0
- /package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.ts +0 -0
- /package/types/{cache → package-tools/cache}/cache-json-by-key.d.ts +0 -0
- /package/types/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.d.ts +0 -0
- /package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.d.ts +0 -0
- /package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diagnosticTags, summarizeDiagnosticValue } from "../diagnostic-logging/logger.mjs";
|
|
2
|
-
import { parseCheckTerminalResult } from "./terminal-result.mjs";
|
|
2
|
+
import { diagnosticCallbackResult, parseCheckTerminalResult } from "./terminal-result.mjs";
|
|
3
3
|
import { combineCheckMessages } from "./messages.mjs";
|
|
4
4
|
export class CheckExecutionInvariantFailure extends Error {
|
|
5
5
|
constructor(message) {
|
|
@@ -8,38 +8,59 @@ export class CheckExecutionInvariantFailure extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export function settleCallback(input) {
|
|
11
|
+
return input.callback.source === "product"
|
|
12
|
+
? settleProductCallback(input, input.callback)
|
|
13
|
+
: settleAuthorCallback(input, input.callback);
|
|
14
|
+
}
|
|
15
|
+
/** Product-controlled callback failures settle without author-result parsing or handoff publication. */
|
|
16
|
+
function settleProductCallback(input, callback) {
|
|
17
|
+
const outcome = input.scope.settleProduct(callback.result);
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
messages: combineCheckMessages(input.preparationMessages, callback.consoleMessages),
|
|
20
|
+
outcome
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Parses an author result, settles it in Core, then commits its reference only after acceptance. */
|
|
24
|
+
function settleAuthorCallback(input, callback) {
|
|
11
25
|
const executionTags = diagnosticTags(`CHECK:${input.checkId}`, "EXECUTION");
|
|
12
|
-
const
|
|
13
|
-
if (callback.source === "product") {
|
|
14
|
-
const outcome = input.scope.settleProduct(callback.result);
|
|
15
|
-
return Object.freeze({
|
|
16
|
-
messages: combineCheckMessages(input.preflightMessages, callback.consoleMessages),
|
|
17
|
-
outcome
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
const terminal = parseCheckTerminalResult(callback.result);
|
|
26
|
+
const terminal = parseCheckTerminalResult(callback.result, input.handoff);
|
|
21
27
|
if (terminal === undefined) {
|
|
22
28
|
input.diagnosticLogger?.observe({
|
|
23
29
|
event: "callback.malformed",
|
|
24
30
|
tags: diagnosticTags(...executionTags, "MALFORMED"),
|
|
25
|
-
details: { result: callback.result }
|
|
31
|
+
details: { result: diagnosticCallbackResult(callback.result, input.handoff) }
|
|
26
32
|
});
|
|
27
33
|
}
|
|
28
|
-
const settlement = input.scope.settle(terminal
|
|
34
|
+
const settlement = input.scope.settle(callbackSettlementCandidate(terminal, input.handoff, callback.result));
|
|
29
35
|
if (terminal !== undefined && !settlement.authorResultAccepted) {
|
|
30
36
|
input.diagnosticLogger?.observe({
|
|
31
37
|
event: "check.contained",
|
|
32
38
|
tags: diagnosticTags(...executionTags, "CONTAINED"),
|
|
33
|
-
details: { outcome: diagnosticOutcome(settlement.outcome), raw:
|
|
39
|
+
details: { outcome: diagnosticOutcome(settlement.outcome), raw: terminal.result }
|
|
34
40
|
});
|
|
35
41
|
}
|
|
42
|
+
if (terminal?.handoff !== undefined && settlement.authorResultAccepted) {
|
|
43
|
+
commitAcceptedHandoff(input.checkId, terminal.handoff, input.state);
|
|
44
|
+
}
|
|
36
45
|
return Object.freeze({
|
|
37
46
|
messages: terminal !== undefined && settlement.authorResultAccepted
|
|
38
|
-
? combineCheckMessages(input.
|
|
39
|
-
: combineCheckMessages(input.
|
|
47
|
+
? combineCheckMessages(input.preparationMessages, callback.consoleMessages, terminal.messages)
|
|
48
|
+
: combineCheckMessages(input.preparationMessages, callback.consoleMessages),
|
|
40
49
|
outcome: settlement.outcome
|
|
41
50
|
});
|
|
42
51
|
}
|
|
52
|
+
/** A declared callback never sends its raw result to Core when terminal parsing rejects the handoff. */
|
|
53
|
+
function callbackSettlementCandidate(terminal, handoff, rawResult) {
|
|
54
|
+
if (terminal !== undefined)
|
|
55
|
+
return terminal.result;
|
|
56
|
+
return handoff === undefined ? rawResult : undefined;
|
|
57
|
+
}
|
|
58
|
+
function commitAcceptedHandoff(checkId, handoff, state) {
|
|
59
|
+
if (state.handoffsByCheckId.has(checkId)) {
|
|
60
|
+
throw new CheckExecutionInvariantFailure("Check handoff published more than once");
|
|
61
|
+
}
|
|
62
|
+
state.handoffsByCheckId.set(checkId, handoff);
|
|
63
|
+
}
|
|
43
64
|
/** Records one terminal Check lifecycle fact after its owning Core scope has closed. */
|
|
44
65
|
export function recordSettledCheck(input) {
|
|
45
66
|
if (input.state.settledFactsByCheckId.has(input.check.checkId)) {
|
|
@@ -63,7 +84,7 @@ export function recordSettledCheck(input) {
|
|
|
63
84
|
durationMs: input.durationMs,
|
|
64
85
|
messages: input.messages,
|
|
65
86
|
records: input.state.session.readSettledCheckRecords(input.check.checkId),
|
|
66
|
-
|
|
87
|
+
omitQuietPassedRow: input.check.omitQuietPassedRow
|
|
67
88
|
}));
|
|
68
89
|
}
|
|
69
90
|
function diagnosticSettledOutcome(outcome) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-settlement.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/execution-settlement.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,wBAAwB,EAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAyBrD,MAAM,OAAO,8BAA+B,SAAQ,KAAK;IACvD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,UAAU,cAAc,CAC5B,KAME;IAEF,MAAM,aAAa,GAAG,cAAc,CAAC,SAAS,KAAK,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;IAC5E,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,QAAQ,EAAE,oBAAoB,CAAC,KAAK,CAAC,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAC;YACjF,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IACD,MAAM,QAAQ,GAAG,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,gBAAgB,EAAE,OAAO,CAAC;YAC9B,KAAK,EAAE,oB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AAC;QACvB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACnD,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7F,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAqB;IAC9C,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC5C,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;QACL,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACnF,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC","sourcesContent":["import type { CheckMessage, CheckOutcome, CheckVisibility } from \"../../check/check.ts\";\nimport type { CoreCheckSession } from \"../../check-settlement/session.ts\";\nimport {\n diagnosticTags,\n summarizeDiagnosticValue,\n type DiagnosticLogger\n} from \"../diagnostic-logging/logger.ts\";\nimport { parseCheckTerminalResult } from \"./terminal-result.ts\";\nimport { combineCheckMessages } from \"./messages.ts\";\nimport type { CheckExecutionLifecycle } from \"./lifecycle.ts\";\nimport type { executeCheckCallback } from \"./callback.ts\";\n\nexport type CheckIdentity = Readonly<{\n readonly checkId: string;\n readonly displayName: string;\n readonly visibility: CheckVisibility;\n}>;\n\nexport interface SettledCheckFacts {\n readonly durationMs: number | null;\n readonly messages: readonly CheckMessage[];\n}\n\nexport type CheckExecutionSettlementState = Readonly<{\n readonly session: CoreCheckSession;\n readonly diagnosticLogger: DiagnosticLogger | undefined;\n readonly lifecycle: CheckExecutionLifecycle | undefined;\n readonly settledFactsByCheckId: Map<string, SettledCheckFacts>;\n}>;\n\n/** Mutable execution session state shared by execution and terminal finalization. */\nexport type CheckExecutionState = CheckExecutionSettlementState;\n\nexport class CheckExecutionInvariantFailure extends Error {\n public constructor(message: string) {\n super(message);\n this.name = \"CheckExecutionInvariantFailure\";\n }\n}\n\nexport function settleCallback(\n input: Readonly<{\n readonly callback: Awaited<ReturnType<typeof executeCheckCallback>>;\n readonly checkId: string;\n readonly diagnosticLogger: DiagnosticLogger | undefined;\n readonly preflightMessages: readonly CheckMessage[];\n readonly scope: ReturnType<CoreCheckSession[\"openCheckScope\"]>;\n }>\n): Readonly<{ readonly messages: readonly CheckMessage[]; readonly outcome: CheckOutcome }> {\n const executionTags = diagnosticTags(`CHECK:${input.checkId}`, \"EXECUTION\");\n const { callback } = input;\n if (callback.source === \"product\") {\n const outcome = input.scope.settleProduct(callback.result);\n return Object.freeze({\n messages: combineCheckMessages(input.preflightMessages, callback.consoleMessages),\n outcome\n });\n }\n const terminal = parseCheckTerminalResult(callback.result);\n if (terminal === undefined) {\n input.diagnosticLogger?.observe({\n event: \"callback.malformed\",\n tags: diagnosticTags(...executionTags, \"MALFORMED\"),\n details: { result: callback.result }\n });\n }\n const settlement = input.scope.settle(terminal?.result ?? callback.result);\n if (terminal !== undefined && !settlement.authorResultAccepted) {\n input.diagnosticLogger?.observe({\n event: \"check.contained\",\n tags: diagnosticTags(...executionTags, \"CONTAINED\"),\n details: { outcome: diagnosticOutcome(settlement.outcome), raw: callback.result }\n });\n }\n return Object.freeze({\n messages:\n terminal !== undefined && settlement.authorResultAccepted\n ? combineCheckMessages(input.preflightMessages, callback.consoleMessages, terminal.messages)\n : combineCheckMessages(input.preflightMessages, callback.consoleMessages),\n outcome: settlement.outcome\n });\n}\n\n/** Records one terminal Check lifecycle fact after its owning Core scope has closed. */\nexport function recordSettledCheck(\n input: Readonly<{\n readonly check: CheckIdentity;\n readonly durationMs: number | null;\n readonly messages: readonly CheckMessage[];\n readonly outcome: CheckOutcome;\n readonly phase: \"control\" | \"dependency\" | \"execution\" | \"preflight\";\n readonly state: CheckExecutionSettlementState;\n }>\n): void {\n if (input.state.settledFactsByCheckId.has(input.check.checkId)) {\n throw new CheckExecutionInvariantFailure(\"Check lifecycle settled more than once\");\n }\n input.state.settledFactsByCheckId.set(\n input.check.checkId,\n Object.freeze({ durationMs: input.durationMs, messages: input.messages })\n );\n input.state.diagnosticLogger?.observe({\n event: \"check.finished\",\n tags: diagnosticTags(\n `CHECK:${input.check.checkId}`,\n input.phase.toUpperCase(),\n \"FINISHED\",\n input.outcome.status.toUpperCase()\n ),\n details: {\n durationMs: input.durationMs,\n messageCount: input.messages.length,\n phase: input.phase,\n ...diagnosticSettledOutcome(input.outcome)\n }\n });\n input.state.lifecycle?.settled(\n Object.freeze({\n checkId: input.check.checkId,\n displayName: input.check.displayName,\n outcome: input.outcome,\n durationMs: input.durationMs,\n messages: input.messages,\n records: input.state.session.readSettledCheckRecords(input.check.checkId),\n visibility: input.check.visibility\n })\n );\n}\n\nfunction diagnosticSettledOutcome(outcome: CheckOutcome): Readonly<Record<string, unknown>> {\n switch (outcome.status) {\n case \"passed\":\n case \"failed\":\n return Object.freeze({ status: outcome.status });\n case \"not-applicable\":\n return Object.freeze({ reasonCode: outcome.reason?.code ?? null, status: outcome.status });\n case \"unavailable\":\n return Object.freeze({ reasonCode: outcome.reason.code, status: outcome.status });\n }\n}\n\nfunction diagnosticOutcome(outcome: CheckOutcome): Readonly<Record<string, unknown>> {\n switch (outcome.status) {\n case \"passed\":\n case \"failed\":\n return Object.freeze({\n data: summarizeDiagnosticValue(outcome.data),\n status: outcome.status\n });\n case \"not-applicable\":\n return Object.freeze({ reason: outcome.reason ?? null, status: outcome.status });\n case \"unavailable\":\n return Object.freeze({ reason: outcome.reason, status: outcome.status });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"execution-settlement.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/execution-settlement.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,wBAAwB,EAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA0BrD,MAAM,OAAO,8BAA+B,SAAQ,KAAK;IACvD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IAC/C,CAAC;CACF;AAmBD,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS;QACxC,CAAC,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC;QAC9C,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AAClD,CAAC;AAED,wGAAwG;AACxG,SAAS,qBAAqB,CAC5B,KAA0B,EAC1B,QAAyB;IAEzB,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,EAA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AAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACnD,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7F,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAqB;IAC9C,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC5C,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;QACL,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACnF,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC","sourcesContent":["import type { CheckMessage, CheckOutcome } from \"../../check/check.ts\";\nimport type { HandoffProviderIdentity } from \"../../check/handoff-provider-identity.ts\";\nimport type { CoreCheckSession } from \"../../check-settlement/session.ts\";\nimport {\n diagnosticTags,\n summarizeDiagnosticValue,\n type DiagnosticLogger\n} from \"../diagnostic-logging/logger.ts\";\nimport {\n diagnosticCallbackResult,\n parseCheckTerminalResult,\n type ParsedCheckTerminalHandoff\n} from \"./terminal-result.ts\";\nimport { combineCheckMessages } from \"./messages.ts\";\nimport type { CheckExecutionLifecycle } from \"./lifecycle.ts\";\nimport type { executeCheckCallback } from \"./callback.ts\";\n\nexport type CheckIdentity = Readonly<{\n readonly checkId: string;\n readonly displayName: string;\n readonly omitQuietPassedRow: boolean;\n}>;\n\nexport interface SettledCheckFacts {\n readonly durationMs: number | null;\n readonly messages: readonly CheckMessage[];\n}\n\nexport type CheckExecutionSettlementState = Readonly<{\n readonly diagnosticLogger: DiagnosticLogger | undefined;\n readonly handoffsByCheckId: Map<string, ParsedCheckTerminalHandoff>;\n readonly lifecycle: CheckExecutionLifecycle | undefined;\n readonly session: CoreCheckSession;\n readonly settledFactsByCheckId: Map<string, SettledCheckFacts>;\n}>;\n\n/** Mutable execution session state shared by execution and terminal finalization. */\nexport type CheckExecutionState = CheckExecutionSettlementState;\n\nexport class CheckExecutionInvariantFailure extends Error {\n public constructor(message: string) {\n super(message);\n this.name = \"CheckExecutionInvariantFailure\";\n }\n}\n\ntype SettleCallbackInput = Readonly<{\n readonly callback: Awaited<ReturnType<typeof executeCheckCallback>>;\n readonly checkId: string;\n readonly diagnosticLogger: DiagnosticLogger | undefined;\n readonly handoff: HandoffProviderIdentity | undefined;\n readonly preparationMessages: readonly CheckMessage[];\n readonly scope: ReturnType<CoreCheckSession[\"openCheckScope\"]>;\n readonly state: CheckExecutionSettlementState;\n}>;\n\ntype SettledCallback = Readonly<{\n readonly messages: readonly CheckMessage[];\n readonly outcome: CheckOutcome;\n}>;\ntype ProductCallback = Extract<SettleCallbackInput[\"callback\"], { readonly source: \"product\" }>;\ntype AuthorCallback = Extract<SettleCallbackInput[\"callback\"], { readonly source: \"author\" }>;\n\nexport function settleCallback(input: SettleCallbackInput): SettledCallback {\n return input.callback.source === \"product\"\n ? settleProductCallback(input, input.callback)\n : settleAuthorCallback(input, input.callback);\n}\n\n/** Product-controlled callback failures settle without author-result parsing or handoff publication. */\nfunction settleProductCallback(\n input: SettleCallbackInput,\n callback: ProductCallback\n): SettledCallback {\n const outcome = input.scope.settleProduct(callback.result);\n return Object.freeze({\n messages: combineCheckMessages(input.preparationMessages, callback.consoleMessages),\n outcome\n });\n}\n\n/** Parses an author result, settles it in Core, then commits its reference only after acceptance. */\nfunction settleAuthorCallback(\n input: SettleCallbackInput,\n callback: AuthorCallback\n): SettledCallback {\n const executionTags = diagnosticTags(`CHECK:${input.checkId}`, \"EXECUTION\");\n const terminal = parseCheckTerminalResult(callback.result, input.handoff);\n if (terminal === undefined) {\n input.diagnosticLogger?.observe({\n event: \"callback.malformed\",\n tags: diagnosticTags(...executionTags, \"MALFORMED\"),\n details: { result: diagnosticCallbackResult(callback.result, input.handoff) }\n });\n }\n const settlement = input.scope.settle(\n callbackSettlementCandidate(terminal, input.handoff, callback.result)\n );\n if (terminal !== undefined && !settlement.authorResultAccepted) {\n input.diagnosticLogger?.observe({\n event: \"check.contained\",\n tags: diagnosticTags(...executionTags, \"CONTAINED\"),\n details: { outcome: diagnosticOutcome(settlement.outcome), raw: terminal.result }\n });\n }\n if (terminal?.handoff !== undefined && settlement.authorResultAccepted) {\n commitAcceptedHandoff(input.checkId, terminal.handoff, input.state);\n }\n return Object.freeze({\n messages:\n terminal !== undefined && settlement.authorResultAccepted\n ? combineCheckMessages(\n input.preparationMessages,\n callback.consoleMessages,\n terminal.messages\n )\n : combineCheckMessages(input.preparationMessages, callback.consoleMessages),\n outcome: settlement.outcome\n });\n}\n\n/** A declared callback never sends its raw result to Core when terminal parsing rejects the handoff. */\nfunction callbackSettlementCandidate(\n terminal: ReturnType<typeof parseCheckTerminalResult>,\n handoff: HandoffProviderIdentity | undefined,\n rawResult: unknown\n): unknown {\n if (terminal !== undefined) return terminal.result;\n return handoff === undefined ? rawResult : undefined;\n}\n\nfunction commitAcceptedHandoff(\n checkId: string,\n handoff: ParsedCheckTerminalHandoff,\n state: CheckExecutionSettlementState\n): void {\n if (state.handoffsByCheckId.has(checkId)) {\n throw new CheckExecutionInvariantFailure(\"Check handoff published more than once\");\n }\n state.handoffsByCheckId.set(checkId, handoff);\n}\n\n/** Records one terminal Check lifecycle fact after its owning Core scope has closed. */\nexport function recordSettledCheck(\n input: Readonly<{\n readonly check: CheckIdentity;\n readonly durationMs: number | null;\n readonly messages: readonly CheckMessage[];\n readonly outcome: CheckOutcome;\n readonly phase: \"control\" | \"dependency\" | \"execution\" | \"preparation\";\n readonly state: CheckExecutionSettlementState;\n }>\n): void {\n if (input.state.settledFactsByCheckId.has(input.check.checkId)) {\n throw new CheckExecutionInvariantFailure(\"Check lifecycle settled more than once\");\n }\n input.state.settledFactsByCheckId.set(\n input.check.checkId,\n Object.freeze({ durationMs: input.durationMs, messages: input.messages })\n );\n input.state.diagnosticLogger?.observe({\n event: \"check.finished\",\n tags: diagnosticTags(\n `CHECK:${input.check.checkId}`,\n input.phase.toUpperCase(),\n \"FINISHED\",\n input.outcome.status.toUpperCase()\n ),\n details: {\n durationMs: input.durationMs,\n messageCount: input.messages.length,\n phase: input.phase,\n ...diagnosticSettledOutcome(input.outcome)\n }\n });\n input.state.lifecycle?.settled(\n Object.freeze({\n checkId: input.check.checkId,\n displayName: input.check.displayName,\n outcome: input.outcome,\n durationMs: input.durationMs,\n messages: input.messages,\n records: input.state.session.readSettledCheckRecords(input.check.checkId),\n omitQuietPassedRow: input.check.omitQuietPassedRow\n })\n );\n}\n\nfunction diagnosticSettledOutcome(outcome: CheckOutcome): Readonly<Record<string, unknown>> {\n switch (outcome.status) {\n case \"passed\":\n case \"failed\":\n return Object.freeze({ status: outcome.status });\n case \"not-applicable\":\n return Object.freeze({ reasonCode: outcome.reason?.code ?? null, status: outcome.status });\n case \"unavailable\":\n return Object.freeze({ reasonCode: outcome.reason.code, status: outcome.status });\n }\n}\n\nfunction diagnosticOutcome(outcome: CheckOutcome): Readonly<Record<string, unknown>> {\n switch (outcome.status) {\n case \"passed\":\n case \"failed\":\n return Object.freeze({\n data: summarizeDiagnosticValue(outcome.data),\n status: outcome.status\n });\n case \"not-applicable\":\n return Object.freeze({ reason: outcome.reason ?? null, status: outcome.status });\n case \"unavailable\":\n return Object.freeze({ reason: outcome.reason, status: outcome.status });\n }\n}\n"]}
|
|
@@ -49,7 +49,7 @@ function resolveFlagControl(check, selectedCheckIds) {
|
|
|
49
49
|
return Object.freeze({
|
|
50
50
|
check: Object.freeze({
|
|
51
51
|
definition: check.definition,
|
|
52
|
-
|
|
52
|
+
omitQuietPassedRow: check.omitQuietPassedRow
|
|
53
53
|
}),
|
|
54
54
|
outcome: Object.freeze({
|
|
55
55
|
status: "not-applicable",
|
|
@@ -72,16 +72,24 @@ function selectCheckAndDependsOnClosure(check, checksByCheckId, expandedCheckIds
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
function matchesFlagEnablement(enablement, runFlags) {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
return matchesFlagCondition(enablement.when, new Set(runFlags));
|
|
76
|
+
}
|
|
77
|
+
function matchesFlagCondition(condition, runFlags) {
|
|
78
|
+
if (typeof condition === "string")
|
|
79
|
+
return runFlags.has(condition);
|
|
80
|
+
switch (condition.kind) {
|
|
77
81
|
case "all":
|
|
78
|
-
return
|
|
82
|
+
return condition.conditions.every((child) => matchesFlagCondition(child, runFlags));
|
|
79
83
|
case "any":
|
|
80
|
-
return
|
|
84
|
+
return condition.conditions.some((child) => matchesFlagCondition(child, runFlags));
|
|
81
85
|
case "none":
|
|
82
|
-
return !
|
|
86
|
+
return !condition.conditions.some((child) => matchesFlagCondition(child, runFlags));
|
|
83
87
|
case "not-all":
|
|
84
|
-
return !
|
|
88
|
+
return !condition.conditions.every((child) => matchesFlagCondition(child, runFlags));
|
|
89
|
+
case "exactly-one":
|
|
90
|
+
return (condition.conditions.filter((child) => matchesFlagCondition(child, runFlags)).length === 1);
|
|
91
|
+
case "not":
|
|
92
|
+
return !matchesFlagCondition(condition.condition, runFlags);
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
//# sourceMappingURL=flag-controls.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flag-controls.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/flag-controls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flag-controls.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/flag-controls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAyB,MAAM,iCAAiC,CAAC;AAExF,MAAM,CAAC,MAAM,+BAA+B,GAAG,4BAA4B,CAAC;AAa5E;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAkC,EAClC,KAAwB;IAExB,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC3C,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC3C,MAAM,eAAe,GAAG,IAAI,GAAG,CAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAU,CAAC,CAClE,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC;QACxC,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,UAAU,EAAE,KAAK,CAAC;YAAE,SAAS;QAEpF,IAAI,UAAU,EAAE,kBAAkB,KAAK,IAAI,EAAE,CAAC;YAC5C,8BAA8B,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YAC3F,SAAS;QACX,CAAC;QACD,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,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OAAO,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClE,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,KAAK;YACR,OAAO,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACtF,KAAK,KAAK;YACR,OAAO,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACrF,KAAK,MAAM;YACT,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACtF,KAAK,SAAS;YACZ,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvF,KAAK,aAAa;YAChB,OAAO,CACL,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAC3F,CAAC;QACJ,KAAK,KAAK;YACR,OAAO,CAAC,oBAAoB,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;AACH,CAAC","sourcesContent":["import type { CheckFlagCondition } from \"../../check/check.ts\";\nimport type { NormalizedCheck } from \"../../project-definition/project-definition.ts\";\nimport { diagnosticTags, type DiagnosticLogger } from \"../diagnostic-logging/logger.ts\";\n\nexport const FLAG_CONDITION_NOT_MATCHED_CODE = \"flag-condition-not-matched\";\n\ntype FlagControlledCheck = Pick<NormalizedCheck, \"definition\" | \"omitQuietPassedRow\">;\ntype FlagControlOutcome = Readonly<{\n readonly status: \"not-applicable\";\n readonly reason: Readonly<{ readonly code: typeof FLAG_CONDITION_NOT_MATCHED_CODE }>;\n}>;\n\nexport type FlagControlSettlement = Readonly<{\n readonly check: FlagControlledCheck;\n readonly outcome: FlagControlOutcome;\n}>;\n\n/**\n * Selects canonical Check IDs for direct flag matches and their opt-in\n * `dependsOn` closures after complete static graph validation.\n */\nexport function selectEffectiveCheckIds(\n checks: readonly NormalizedCheck[],\n flags: readonly string[]\n): readonly string[] {\n const expandedCheckIds = new Set<string>();\n const selectedCheckIds = new Set<string>();\n const checksByCheckId = new Map(\n checks.map((check) => [check.definition.checkId, check] as const)\n );\n\n for (const check of checks) {\n const enablement = check.enabledByFlags;\n if (enablement !== undefined && !matchesFlagEnablement(enablement, flags)) continue;\n\n if (enablement?.propagateDependsOn === true) {\n selectCheckAndDependsOnClosure(check, checksByCheckId, expandedCheckIds, selectedCheckIds);\n continue;\n }\n selectedCheckIds.add(check.definition.checkId);\n }\n\n return Object.freeze([...selectedCheckIds].sort());\n}\n\n/** Resolves all flag-controlled outcomes before Scheduler admission or Check-owned work. */\nexport function resolveFlagControlSettlements(\n input: Readonly<{\n readonly checks: readonly NormalizedCheck[];\n readonly diagnosticLogger?: DiagnosticLogger;\n readonly effectiveCheckIds: readonly string[];\n readonly signal: AbortSignal | undefined;\n }>\n): readonly FlagControlSettlement[] {\n if (input.signal?.aborted === true) return Object.freeze([]);\n\n const settlements: FlagControlSettlement[] = [];\n const selectedCheckIds = new Set(input.effectiveCheckIds);\n for (const check of input.checks) {\n const settlement = resolveFlagControl(check, selectedCheckIds);\n if (settlement === undefined) continue;\n settlements.push(settlement);\n input.diagnosticLogger?.observe({\n event: \"control.resolved\",\n tags: diagnosticTags(\n `CHECK:${check.definition.checkId}`,\n \"CONTROL\",\n FLAG_CONDITION_NOT_MATCHED_CODE.toUpperCase()\n ),\n details: {\n enabledByFlags: check.enabledByFlags,\n outcome: settlement.outcome\n }\n });\n }\n return Object.freeze(settlements);\n}\n\nfunction resolveFlagControl(\n check: NormalizedCheck,\n selectedCheckIds: ReadonlySet<string>\n): FlagControlSettlement | undefined {\n if (check.enabledByFlags === undefined || selectedCheckIds.has(check.definition.checkId)) {\n return undefined;\n }\n return Object.freeze({\n check: Object.freeze({\n definition: check.definition,\n omitQuietPassedRow: check.omitQuietPassedRow\n }),\n outcome: Object.freeze({\n status: \"not-applicable\",\n reason: Object.freeze({ code: FLAG_CONDITION_NOT_MATCHED_CODE })\n })\n });\n}\n\nfunction selectCheckAndDependsOnClosure(\n check: NormalizedCheck,\n checksByCheckId: ReadonlyMap<string, NormalizedCheck>,\n expandedCheckIds: Set<string>,\n selectedCheckIds: Set<string>\n): void {\n const checkId = check.definition.checkId;\n if (expandedCheckIds.has(checkId)) return;\n expandedCheckIds.add(checkId);\n selectedCheckIds.add(checkId);\n\n for (const dependencyId of check.dependsOn) {\n const dependency = checksByCheckId.get(dependencyId);\n if (dependency === undefined) {\n throw new Error(\"Validated Check graph has an unavailable dependency\");\n }\n selectCheckAndDependsOnClosure(dependency, checksByCheckId, expandedCheckIds, selectedCheckIds);\n }\n}\n\nfunction matchesFlagEnablement(\n enablement: NonNullable<NormalizedCheck[\"enabledByFlags\"]>,\n runFlags: readonly string[]\n): boolean {\n return matchesFlagCondition(enablement.when, new Set(runFlags));\n}\n\nfunction matchesFlagCondition(\n condition: CheckFlagCondition,\n runFlags: ReadonlySet<string>\n): boolean {\n if (typeof condition === \"string\") return runFlags.has(condition);\n switch (condition.kind) {\n case \"all\":\n return condition.conditions.every((child) => matchesFlagCondition(child, runFlags));\n case \"any\":\n return condition.conditions.some((child) => matchesFlagCondition(child, runFlags));\n case \"none\":\n return !condition.conditions.some((child) => matchesFlagCondition(child, runFlags));\n case \"not-all\":\n return !condition.conditions.every((child) => matchesFlagCondition(child, runFlags));\n case \"exactly-one\":\n return (\n condition.conditions.filter((child) => matchesFlagCondition(child, runFlags)).length === 1\n );\n case \"not\":\n return !matchesFlagCondition(condition.condition, runFlags);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["import type { CheckMessage, CheckOutcome
|
|
1
|
+
{"version":3,"file":"lifecycle.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/lifecycle.ts"],"names":[],"mappings":"","sourcesContent":["import type { CheckMessage, CheckOutcome } from \"../../check/check.ts\";\nimport type { CoreRecord } from \"../../check-settlement/facts.ts\";\n\n/** Private invocation-wide barrier that is independent from per-Check lifecycle facts. */\nexport type InvocationLifecycle = Readonly<{\n /** Fires once after Product accepts every flag-control settlement and before Scheduler work. */\n readonly selectionSettled: () => void;\n}>;\n\n/** Private per-Check lifecycle presentation and accounting channel. */\nexport type CheckExecutionLifecycle = Readonly<{\n readonly started: (fact: CheckStartedFact) => void;\n readonly settled: (fact: CheckSettledFact) => void;\n}>;\n\nexport type CheckStartedFact = Readonly<{\n checkId: string;\n displayName: string;\n omitQuietPassedRow: boolean;\n}>;\n\nexport type CheckSettledFact = CheckStartedFact &\n Readonly<{\n durationMs: number | null;\n messages: readonly CheckMessage[];\n records: readonly CoreRecord[];\n outcome: CheckOutcome;\n omitQuietPassedRow: boolean;\n }>;\n"]}
|
package/dist/esm/project-run/check-execution/{preflight-result.mjs → preparation-result.mjs}
RENAMED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { hasRequiredAndOptionalRecordKeys, snapshotClosedRecord } from "../../data-boundary/closed-values.mjs";
|
|
2
2
|
import { parseCheckMessages } from "./messages.mjs";
|
|
3
|
-
/** Parses the closed result vocabulary returned by one trusted Check
|
|
4
|
-
export function
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
3
|
+
/** Parses the closed result vocabulary returned by one trusted Check preparation. */
|
|
4
|
+
export function parseCheckPreparationResult(value) {
|
|
5
|
+
const preparationResult = snapshotClosedRecord(value);
|
|
6
|
+
if (preparationResult === undefined) {
|
|
7
7
|
return undefined;
|
|
8
8
|
}
|
|
9
|
-
const messages = parseCheckMessages(
|
|
9
|
+
const messages = parseCheckMessages(preparationResult.messages);
|
|
10
10
|
if (messages === undefined)
|
|
11
11
|
return undefined;
|
|
12
|
-
switch (
|
|
12
|
+
switch (preparationResult.status) {
|
|
13
13
|
case "success":
|
|
14
|
-
return
|
|
14
|
+
return parseSuccessfulPreparation(preparationResult, messages);
|
|
15
15
|
case "failure":
|
|
16
|
-
return
|
|
16
|
+
return parseFailedPreparation(preparationResult, messages);
|
|
17
17
|
default:
|
|
18
18
|
return undefined;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
if (!hasRequiredAndOptionalRecordKeys(
|
|
21
|
+
function parseSuccessfulPreparation(preparationResult, messages) {
|
|
22
|
+
if (!hasRequiredAndOptionalRecordKeys(preparationResult, {
|
|
23
23
|
optional: ["messages"],
|
|
24
24
|
required: ["status", "preparedOptions"]
|
|
25
25
|
})) {
|
|
@@ -27,27 +27,27 @@ function parseSuccessfulPreflight(preflightResult, messages) {
|
|
|
27
27
|
}
|
|
28
28
|
return Object.freeze({
|
|
29
29
|
status: "success",
|
|
30
|
-
preparedOptions:
|
|
30
|
+
preparedOptions: preparationResult.preparedOptions,
|
|
31
31
|
messages
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (typeof
|
|
34
|
+
function parseFailedPreparation(preparationResult, messages) {
|
|
35
|
+
if (typeof preparationResult.action !== "string")
|
|
36
36
|
return undefined;
|
|
37
|
-
const reason =
|
|
37
|
+
const reason = parsePreparationReason(preparationResult.reason);
|
|
38
38
|
if (reason === undefined)
|
|
39
39
|
return undefined;
|
|
40
|
-
switch (
|
|
40
|
+
switch (preparationResult.action) {
|
|
41
41
|
case "block":
|
|
42
|
-
return
|
|
42
|
+
return parseBlockedPreparation(preparationResult, reason, messages);
|
|
43
43
|
case "continue":
|
|
44
|
-
return
|
|
44
|
+
return parseContinuedPreparation(preparationResult, reason, messages);
|
|
45
45
|
default:
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
if (!hasRequiredAndOptionalRecordKeys(
|
|
49
|
+
function parseBlockedPreparation(preparationResult, reason, messages) {
|
|
50
|
+
if (!hasRequiredAndOptionalRecordKeys(preparationResult, {
|
|
51
51
|
optional: ["messages"],
|
|
52
52
|
required: ["status", "action", "reason"]
|
|
53
53
|
})) {
|
|
@@ -55,8 +55,8 @@ function parseBlockedPreflight(preflightResult, reason, messages) {
|
|
|
55
55
|
}
|
|
56
56
|
return Object.freeze({ status: "failure", action: "block", reason, messages });
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
if (!hasRequiredAndOptionalRecordKeys(
|
|
58
|
+
function parseContinuedPreparation(preparationResult, reason, messages) {
|
|
59
|
+
if (!hasRequiredAndOptionalRecordKeys(preparationResult, {
|
|
60
60
|
optional: ["messages"],
|
|
61
61
|
required: ["status", "action", "fallback", "reason"]
|
|
62
62
|
})) {
|
|
@@ -65,12 +65,12 @@ function parseContinuedPreflight(preflightResult, reason, messages) {
|
|
|
65
65
|
return Object.freeze({
|
|
66
66
|
status: "failure",
|
|
67
67
|
action: "continue",
|
|
68
|
-
fallback:
|
|
68
|
+
fallback: preparationResult.fallback,
|
|
69
69
|
reason,
|
|
70
70
|
messages
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function parsePreparationReason(value) {
|
|
74
74
|
const reason = snapshotClosedRecord(value);
|
|
75
75
|
if (reason === undefined ||
|
|
76
76
|
Object.keys(reason).length !== 1 ||
|
|
@@ -80,4 +80,4 @@ function parsePreflightReason(value) {
|
|
|
80
80
|
}
|
|
81
81
|
return Object.freeze({ code: reason.code });
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=
|
|
83
|
+
//# sourceMappingURL=preparation-result.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation-result.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/preparation-result.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAsBnD,qFAAqF;AACrF,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACtD,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAChE,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,QAAQ,iBAAiB,CAAC,MAAM,EAAE,CAAC;QACjC,KAAK,SAAS;YACZ,OAAO,0BAA0B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QACjE,KAAK,SAAS;YACZ,OAAO,sBAAsB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAC7D;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CACjC,iBAAoD,EACpD,QAAiC;IAEjC,IACE,CAAC,gCAAgC,CAAC,iBAAiB,EAAE;QACnD,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,QAAQ,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC;KACxC,CAAC,EACF,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,iBAAiB,CAAC,eAAe;QAClD,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAC7B,iBAAoD,EAC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AAS;QACjB,MAAM,EAAE,UAAmB;QAC3B,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;QACpC,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc;IAC5C,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,IACE,MAAM,KAAK,SAAS;QACpB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAChC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;QAC/B,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EACxB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import {\n hasRequiredAndOptionalRecordKeys,\n snapshotClosedRecord\n} from \"../../data-boundary/closed-values.ts\";\nimport type { CheckMessage } from \"../../check/check.ts\";\nimport { parseCheckMessages } from \"./messages.ts\";\n\nexport type ParsedCheckPreparationResult =\n | Readonly<{\n readonly status: \"success\";\n readonly preparedOptions: unknown;\n readonly messages: readonly CheckMessage[];\n }>\n | Readonly<{\n readonly status: \"failure\";\n readonly action: \"block\";\n readonly reason: { readonly code: string };\n readonly messages: readonly CheckMessage[];\n }>\n | Readonly<{\n readonly status: \"failure\";\n readonly action: \"continue\";\n readonly fallback: unknown;\n readonly reason: { readonly code: string };\n readonly messages: readonly CheckMessage[];\n }>;\n\n/** Parses the closed result vocabulary returned by one trusted Check preparation. */\nexport function parseCheckPreparationResult(\n value: unknown\n): ParsedCheckPreparationResult | undefined {\n const preparationResult = snapshotClosedRecord(value);\n if (preparationResult === undefined) {\n return undefined;\n }\n const messages = parseCheckMessages(preparationResult.messages);\n if (messages === undefined) return undefined;\n switch (preparationResult.status) {\n case \"success\":\n return parseSuccessfulPreparation(preparationResult, messages);\n case \"failure\":\n return parseFailedPreparation(preparationResult, messages);\n default:\n return undefined;\n }\n}\n\nfunction parseSuccessfulPreparation(\n preparationResult: Readonly<Record<string, unknown>>,\n messages: readonly CheckMessage[]\n): ParsedCheckPreparationResult | undefined {\n if (\n !hasRequiredAndOptionalRecordKeys(preparationResult, {\n optional: [\"messages\"],\n required: [\"status\", \"preparedOptions\"]\n })\n ) {\n return undefined;\n }\n return Object.freeze({\n status: \"success\",\n preparedOptions: preparationResult.preparedOptions,\n messages\n });\n}\n\nfunction parseFailedPreparation(\n preparationResult: Readonly<Record<string, unknown>>,\n messages: readonly CheckMessage[]\n): ParsedCheckPreparationResult | undefined {\n if (typeof preparationResult.action !== \"string\") return undefined;\n const reason = parsePreparationReason(preparationResult.reason);\n if (reason === undefined) return undefined;\n switch (preparationResult.action) {\n case \"block\":\n return parseBlockedPreparation(preparationResult, reason, messages);\n case \"continue\":\n return parseContinuedPreparation(preparationResult, reason, messages);\n default:\n return undefined;\n }\n}\n\nfunction parseBlockedPreparation(\n preparationResult: Readonly<Record<string, unknown>>,\n reason: Readonly<{ readonly code: string }>,\n messages: readonly CheckMessage[]\n): ParsedCheckPreparationResult | undefined {\n if (\n !hasRequiredAndOptionalRecordKeys(preparationResult, {\n optional: [\"messages\"],\n required: [\"status\", \"action\", \"reason\"]\n })\n ) {\n return undefined;\n }\n return Object.freeze({ status: \"failure\", action: \"block\", reason, messages });\n}\n\nfunction parseContinuedPreparation(\n preparationResult: Readonly<Record<string, unknown>>,\n reason: Readonly<{ readonly code: string }>,\n messages: readonly CheckMessage[]\n): ParsedCheckPreparationResult | undefined {\n if (\n !hasRequiredAndOptionalRecordKeys(preparationResult, {\n optional: [\"messages\"],\n required: [\"status\", \"action\", \"fallback\", \"reason\"]\n })\n ) {\n return undefined;\n }\n return Object.freeze({\n status: \"failure\",\n action: \"continue\" as const,\n fallback: preparationResult.fallback,\n reason,\n messages\n });\n}\n\nfunction parsePreparationReason(value: unknown): Readonly<{ readonly code: string }> | undefined {\n const reason = snapshotClosedRecord(value);\n if (\n reason === undefined ||\n Object.keys(reason).length !== 1 ||\n typeof reason.code !== \"string\" ||\n reason.code.length === 0\n ) {\n return undefined;\n }\n return Object.freeze({ code: reason.code });\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { snapshotJsonObject } from "../../check/options-snapshot.mjs";
|
|
2
2
|
import { diagnosticTags, summarizeDiagnosticValue } from "../diagnostic-logging/logger.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { parseCheckPreparationResult } from "./preparation-result.mjs";
|
|
4
4
|
import { invokeWithCapturedConsole } from "./console-capture.mjs";
|
|
5
5
|
import { combineCheckMessages } from "./messages.mjs";
|
|
6
6
|
const EMPTY_MESSAGES = Object.freeze([]);
|
|
7
7
|
const INERT_SIGNAL = new AbortController().signal;
|
|
8
8
|
/** Resolves one Check's task-local preparation after Scheduler admission. */
|
|
9
9
|
export async function prepareCheck(input) {
|
|
10
|
-
if (input.signal?.aborted) {
|
|
11
|
-
return
|
|
10
|
+
if (input.signal?.aborted === true) {
|
|
11
|
+
return observeBlockedPreparation({
|
|
12
12
|
check: input.check,
|
|
13
13
|
diagnosticLogger: input.diagnosticLogger,
|
|
14
14
|
details: {},
|
|
@@ -16,10 +16,10 @@ export async function prepareCheck(input) {
|
|
|
16
16
|
reasonCode: "execution-cancelled"
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
if (input.check.
|
|
19
|
+
if (input.check.prepare === undefined) {
|
|
20
20
|
return resolveAuthoredOptions(input);
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return resolvePreparationInvocation(input, await invokePreparation(input));
|
|
23
23
|
}
|
|
24
24
|
function resolveAuthoredOptions(input) {
|
|
25
25
|
const resolution = readyResolution({
|
|
@@ -30,106 +30,106 @@ function resolveAuthoredOptions(input) {
|
|
|
30
30
|
observeReadyOrMalformedResolution(input.diagnosticLogger, input.check.definition.checkId, resolution, "skipped", { source: "authored" });
|
|
31
31
|
return resolution;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function resolvePreparationInvocation(input, invocation) {
|
|
34
34
|
if (invocation.kind === "threw") {
|
|
35
|
-
return
|
|
35
|
+
return observeBlockedPreparation({
|
|
36
36
|
check: input.check,
|
|
37
37
|
diagnosticLogger: input.diagnosticLogger,
|
|
38
38
|
details: { error: invocation.error },
|
|
39
39
|
messages: invocation.messages,
|
|
40
|
-
result: input.signal?.aborted ? "cancelled-after-throw" : "threw",
|
|
41
|
-
reasonCode: input.signal?.aborted ? "execution-cancelled" : "
|
|
40
|
+
result: input.signal?.aborted === true ? "cancelled-after-throw" : "threw",
|
|
41
|
+
reasonCode: input.signal?.aborted === true ? "execution-cancelled" : "preparation-threw"
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return resolveReturnedPreparation(input, invocation.output, invocation.messages);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
if (input.signal?.aborted) {
|
|
48
|
-
return
|
|
46
|
+
function resolveReturnedPreparation(input, preparationOutput, consoleMessages) {
|
|
47
|
+
if (input.signal?.aborted === true) {
|
|
48
|
+
return observeBlockedPreparation({
|
|
49
49
|
check: input.check,
|
|
50
50
|
diagnosticLogger: input.diagnosticLogger,
|
|
51
|
-
details: { raw:
|
|
51
|
+
details: { raw: preparationOutput },
|
|
52
52
|
messages: consoleMessages,
|
|
53
53
|
result: "cancelled-after-callback",
|
|
54
54
|
reasonCode: "execution-cancelled"
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
return
|
|
57
|
+
const preparationResult = parseCheckPreparationResult(preparationOutput);
|
|
58
|
+
if (preparationResult === undefined) {
|
|
59
|
+
return observeBlockedPreparation({
|
|
60
60
|
check: input.check,
|
|
61
61
|
diagnosticLogger: input.diagnosticLogger,
|
|
62
|
-
details: { raw:
|
|
62
|
+
details: { raw: preparationOutput },
|
|
63
63
|
messages: consoleMessages,
|
|
64
64
|
result: "malformed",
|
|
65
|
-
reasonCode: "invalid-
|
|
65
|
+
reasonCode: "invalid-preparation-result"
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
if (
|
|
69
|
-
return
|
|
68
|
+
if (preparationResult.status === "failure" && preparationResult.action === "block") {
|
|
69
|
+
return resolveBlockedPreparationResult(input, preparationResult, consoleMessages);
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return resolveReadyPreparationResult(input, preparationOutput, preparationResult, consoleMessages);
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function resolveBlockedPreparationResult(input, preparationResult, consoleMessages) {
|
|
74
74
|
const resolution = blockedResolution({
|
|
75
75
|
check: input.check,
|
|
76
|
-
messages: combineCheckMessages(consoleMessages,
|
|
77
|
-
reasonCode:
|
|
76
|
+
messages: combineCheckMessages(consoleMessages, preparationResult.messages),
|
|
77
|
+
reasonCode: preparationResult.reason.code
|
|
78
78
|
});
|
|
79
|
-
|
|
80
|
-
...(
|
|
81
|
-
reason:
|
|
79
|
+
observePreparationResolution(input.diagnosticLogger, input.check.definition.checkId, resolution, "blocked", {
|
|
80
|
+
...(preparationResult.messages.length === 0 ? {} : { messages: preparationResult.messages }),
|
|
81
|
+
reason: preparationResult.reason
|
|
82
82
|
});
|
|
83
83
|
return resolution;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function resolveReadyPreparationResult(input, preparationOutput, preparationResult, consoleMessages) {
|
|
86
86
|
const checkId = input.check.definition.checkId;
|
|
87
|
-
const result =
|
|
87
|
+
const result = preparationResult.status === "success" ? "prepared" : "continued";
|
|
88
88
|
const resolution = readyResolution({
|
|
89
89
|
authoredCheck: input.check,
|
|
90
|
-
messages: combineCheckMessages(consoleMessages,
|
|
91
|
-
preparedOptions:
|
|
92
|
-
?
|
|
93
|
-
:
|
|
90
|
+
messages: combineCheckMessages(consoleMessages, preparationResult.messages),
|
|
91
|
+
preparedOptions: preparationResult.status === "success"
|
|
92
|
+
? preparationResult.preparedOptions
|
|
93
|
+
: preparationResult.fallback
|
|
94
94
|
});
|
|
95
95
|
observeReadyOrMalformedResolution(input.diagnosticLogger, checkId, resolution, result, {
|
|
96
|
-
messages:
|
|
97
|
-
...(
|
|
98
|
-
raw:
|
|
96
|
+
messages: preparationResult.messages,
|
|
97
|
+
...(preparationResult.status === "success" ? {} : { reason: preparationResult.reason }),
|
|
98
|
+
raw: preparationOutput
|
|
99
99
|
});
|
|
100
100
|
return resolution;
|
|
101
101
|
}
|
|
102
|
-
async function
|
|
103
|
-
return invokeWithCapturedConsole(() => check.
|
|
102
|
+
async function invokePreparation(input) {
|
|
103
|
+
return invokeWithCapturedConsole(() => input.check.prepare(input.check.options, input.signal ?? INERT_SIGNAL, input.project));
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function observeBlockedPreparation(input) {
|
|
106
106
|
const resolution = blockedResolution({
|
|
107
107
|
check: input.check,
|
|
108
108
|
messages: input.messages ?? EMPTY_MESSAGES,
|
|
109
109
|
reasonCode: input.reasonCode
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
observePreparationResolution(input.diagnosticLogger, input.check.definition.checkId, resolution, input.result, input.details);
|
|
112
112
|
return resolution;
|
|
113
113
|
}
|
|
114
114
|
function observeReadyOrMalformedResolution(diagnosticLogger, checkId, resolution, result, details) {
|
|
115
115
|
if (resolution.kind === "blocked") {
|
|
116
|
-
|
|
116
|
+
observePreparationResolution(diagnosticLogger, checkId, resolution, "malformed", {
|
|
117
117
|
raw: "raw" in details ? details.raw : summarizeDiagnosticValue(details)
|
|
118
118
|
});
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
const messages = "messages" in details ? details.messages : EMPTY_MESSAGES;
|
|
122
|
-
|
|
122
|
+
observePreparationResolution(diagnosticLogger, checkId, resolution, result, {
|
|
123
123
|
...(Array.isArray(messages) && messages.length > 0 ? { messages } : {}),
|
|
124
124
|
options: summarizeDiagnosticValue(resolution.check.options),
|
|
125
125
|
...("reason" in details ? { reason: details.reason } : {}),
|
|
126
126
|
...("source" in details ? { source: details.source } : {})
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function observePreparationResolution(diagnosticLogger, checkId, resolution, result, details) {
|
|
130
130
|
diagnosticLogger?.observe({
|
|
131
|
-
event: "
|
|
132
|
-
tags: diagnosticTags(`CHECK:${checkId}`, "
|
|
131
|
+
event: "preparation.resolved",
|
|
132
|
+
tags: diagnosticTags(`CHECK:${checkId}`, "PREPARATION", result.toUpperCase()),
|
|
133
133
|
details: {
|
|
134
134
|
...details,
|
|
135
135
|
...(resolution.kind === "blocked" ? { outcome: resolution.outcome } : {})
|
|
@@ -142,16 +142,16 @@ function readyResolution(input) {
|
|
|
142
142
|
return blockedResolution({
|
|
143
143
|
check: input.authoredCheck,
|
|
144
144
|
messages: input.messages,
|
|
145
|
-
reasonCode: "invalid-
|
|
145
|
+
reasonCode: "invalid-preparation-result"
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
const {
|
|
148
|
+
const { prepare: _preparation, ...check } = input.authoredCheck;
|
|
149
149
|
return Object.freeze({
|
|
150
150
|
kind: "ready",
|
|
151
151
|
check: Object.freeze({
|
|
152
152
|
...check,
|
|
153
153
|
options: preparedOptions,
|
|
154
|
-
|
|
154
|
+
preparationMessages: input.messages
|
|
155
155
|
})
|
|
156
156
|
});
|
|
157
157
|
}
|
|
@@ -160,8 +160,8 @@ function blockedResolution(input) {
|
|
|
160
160
|
kind: "blocked",
|
|
161
161
|
check: Object.freeze({
|
|
162
162
|
definition: input.check.definition,
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
preparationMessages: input.messages,
|
|
164
|
+
omitQuietPassedRow: input.check.omitQuietPassedRow
|
|
165
165
|
}),
|
|
166
166
|
outcome: Object.freeze({
|
|
167
167
|
status: "unavailable",
|
|
@@ -169,4 +169,4 @@ function blockedResolution(input) {
|
|
|
169
169
|
})
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
//# sourceMappingURL=
|
|
172
|
+
//# sourceMappingURL=preparation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.mjs","sourceRoot":"","sources":["../../../../src/project-run/check-execution/preparation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,cAAc,EACd,wBAAwB,EAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,cAAc,GAA4B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAClE,MAAM,YAAY,GAAG,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC;AA2ClD,6EAA6E;AAC7E,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAwB;IACzD,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QACnC,OAAO,yBAAyB,CAAC;YAC/B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,2BAA2B;YACnC,UAAU,EAAE,qBAAqB;SAClC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,4BAA4B,CAAC,KAAK,EAAE,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAwB;IACtD,MAAM,UAAU,GAAG,eAAe,CAAC;QACjC,aAAa,E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;QACb,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;YACnB,GAAG,KAAK;YACR,OAAO,EAAE,eAAe;YACxB,mBAAmB,EAAE,KAAK,CAAC,QAAQ;SACpC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,KAIE;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;YACnB,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU;YAClC,mBAAmB,EAAE,KAAK,CAAC,QAAQ;YACnC,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,kBAAkB;SACnD,CAAC;QACF,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;YACrB,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;SAClD,CAAC;KACH,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { CheckMessage, CheckOutcome, CheckProjectContext } from \"../../check/check.ts\";\nimport type { NormalizedCheck } from \"../../project-definition/project-definition.ts\";\nimport { snapshotJsonObject } from \"../../check/options-snapshot.ts\";\nimport {\n diagnosticTags,\n summarizeDiagnosticValue,\n type DiagnosticLogger\n} from \"../diagnostic-logging/logger.ts\";\nimport {\n parseCheckPreparationResult,\n type ParsedCheckPreparationResult\n} from \"./preparation-result.ts\";\nimport { invokeWithCapturedConsole } from \"./console-capture.ts\";\nimport { combineCheckMessages } from \"./messages.ts\";\n\nconst EMPTY_MESSAGES: readonly CheckMessage[] = Object.freeze([]);\nconst INERT_SIGNAL = new AbortController().signal;\n\nexport type PreparedCheck = Omit<NormalizedCheck, \"options\" | \"prepare\"> &\n Readonly<{ readonly options: object; readonly preparationMessages: readonly CheckMessage[] }>;\n\ntype BlockedCheck = Pick<NormalizedCheck, \"definition\" | \"omitQuietPassedRow\"> &\n Readonly<{ readonly preparationMessages: readonly CheckMessage[] }>;\n\nexport type ReadyCheckPreparationResolution = Readonly<{\n readonly kind: \"ready\";\n readonly check: PreparedCheck;\n}>;\n\nexport type BlockedCheckPreparationResolution = Readonly<{\n readonly kind: \"blocked\";\n readonly check: BlockedCheck;\n readonly outcome: CheckOutcome;\n}>;\n\nexport type CheckPreparationResolution =\n | ReadyCheckPreparationResolution\n | BlockedCheckPreparationResolution;\n\ntype PreparationResolutionResult =\n | \"skipped\"\n | \"prepared\"\n | \"continued\"\n | \"blocked\"\n | \"cancelled-before-callback\"\n | \"cancelled-after-callback\"\n | \"cancelled-after-throw\"\n | \"threw\"\n | \"malformed\";\n\ntype PrepareCheckInput = Readonly<{\n readonly check: NormalizedCheck;\n readonly diagnosticLogger: DiagnosticLogger | undefined;\n readonly project: CheckProjectContext;\n readonly signal: AbortSignal | undefined;\n}>;\n\ntype PreparationInvocation = Awaited<ReturnType<typeof invokeWithCapturedConsole<unknown>>>;\n\n/** Resolves one Check's task-local preparation after Scheduler admission. */\nexport async function prepareCheck(input: PrepareCheckInput): Promise<CheckPreparationResolution> {\n if (input.signal?.aborted === true) {\n return observeBlockedPreparation({\n check: input.check,\n diagnosticLogger: input.diagnosticLogger,\n details: {},\n result: \"cancelled-before-callback\",\n reasonCode: \"execution-cancelled\"\n });\n }\n if (input.check.prepare === undefined) {\n return resolveAuthoredOptions(input);\n }\n return resolvePreparationInvocation(input, await invokePreparation(input));\n}\n\nfunction resolveAuthoredOptions(input: PrepareCheckInput): CheckPreparationResolution {\n const resolution = readyResolution({\n authoredCheck: input.check,\n messages: EMPTY_MESSAGES,\n preparedOptions: input.check.options\n });\n observeReadyOrMalformedResolution(\n input.diagnosticLogger,\n input.check.definition.checkId,\n resolution,\n \"skipped\",\n { source: \"authored\" }\n );\n return resolution;\n}\n\nfunction resolvePreparationInvocation(\n input: PrepareCheckInput,\n invocation: PreparationInvocation\n): CheckPreparationResolution {\n if (invocation.kind === \"threw\") {\n return observeBlockedPreparation({\n check: input.check,\n diagnosticLogger: input.diagnosticLogger,\n details: { error: invocation.error },\n messages: invocation.messages,\n result: input.signal?.aborted === true ? \"cancelled-after-throw\" : \"threw\",\n reasonCode: input.signal?.aborted === true ? \"execution-cancelled\" : \"preparation-threw\"\n });\n }\n return resolveReturnedPreparation(input, invocation.output, invocation.messages);\n}\n\nfunction resolveReturnedPreparation(\n input: PrepareCheckInput,\n preparationOutput: unknown,\n consoleMessages: readonly CheckMessage[]\n): CheckPreparationResolution {\n if (input.signal?.aborted === true) {\n return observeBlockedPreparation({\n check: input.check,\n diagnosticLogger: input.diagnosticLogger,\n details: { raw: preparationOutput },\n messages: consoleMessages,\n result: \"cancelled-after-callback\",\n reasonCode: \"execution-cancelled\"\n });\n }\n const preparationResult = parseCheckPreparationResult(preparationOutput);\n if (preparationResult === undefined) {\n return observeBlockedPreparation({\n check: input.check,\n diagnosticLogger: input.diagnosticLogger,\n details: { raw: preparationOutput },\n messages: consoleMessages,\n result: \"malformed\",\n reasonCode: \"invalid-preparation-result\"\n });\n }\n if (preparationResult.status === \"failure\" && preparationResult.action === \"block\") {\n return resolveBlockedPreparationResult(input, preparationResult, consoleMessages);\n }\n return resolveReadyPreparationResult(\n input,\n preparationOutput,\n preparationResult,\n consoleMessages\n );\n}\n\nfunction resolveBlockedPreparationResult(\n input: PrepareCheckInput,\n preparationResult: Extract<ParsedCheckPreparationResult, { readonly action: \"block\" }>,\n consoleMessages: readonly CheckMessage[]\n): CheckPreparationResolution {\n const resolution = blockedResolution({\n check: input.check,\n messages: combineCheckMessages(consoleMessages, preparationResult.messages),\n reasonCode: preparationResult.reason.code\n });\n observePreparationResolution(\n input.diagnosticLogger,\n input.check.definition.checkId,\n resolution,\n \"blocked\",\n {\n ...(preparationResult.messages.length === 0 ? {} : { messages: preparationResult.messages }),\n reason: preparationResult.reason\n }\n );\n return resolution;\n}\n\nfunction resolveReadyPreparationResult(\n input: PrepareCheckInput,\n preparationOutput: unknown,\n preparationResult: Exclude<ParsedCheckPreparationResult, { readonly action: \"block\" }>,\n consoleMessages: readonly CheckMessage[]\n): CheckPreparationResolution {\n const checkId = input.check.definition.checkId;\n const result = preparationResult.status === \"success\" ? \"prepared\" : \"continued\";\n const resolution = readyResolution({\n authoredCheck: input.check,\n messages: combineCheckMessages(consoleMessages, preparationResult.messages),\n preparedOptions:\n preparationResult.status === \"success\"\n ? preparationResult.preparedOptions\n : preparationResult.fallback\n });\n observeReadyOrMalformedResolution(input.diagnosticLogger, checkId, resolution, result, {\n messages: preparationResult.messages,\n ...(preparationResult.status === \"success\" ? {} : { reason: preparationResult.reason }),\n raw: preparationOutput\n });\n return resolution;\n}\n\nasync function invokePreparation(input: PrepareCheckInput): Promise<PreparationInvocation> {\n return invokeWithCapturedConsole(() =>\n input.check.prepare!(input.check.options, input.signal ?? INERT_SIGNAL, input.project)\n );\n}\n\nfunction observeBlockedPreparation(\n input: Readonly<{\n readonly check: NormalizedCheck;\n readonly diagnosticLogger: DiagnosticLogger | undefined;\n readonly details: Readonly<Record<string, unknown>>;\n readonly messages?: readonly CheckMessage[];\n readonly result: PreparationResolutionResult;\n readonly reasonCode: string;\n }>\n): BlockedCheckPreparationResolution {\n const resolution = blockedResolution({\n check: input.check,\n messages: input.messages ?? EMPTY_MESSAGES,\n reasonCode: input.reasonCode\n });\n observePreparationResolution(\n input.diagnosticLogger,\n input.check.definition.checkId,\n resolution,\n input.result,\n input.details\n );\n return resolution;\n}\n\nfunction observeReadyOrMalformedResolution(\n diagnosticLogger: DiagnosticLogger | undefined,\n checkId: string,\n resolution: CheckPreparationResolution,\n result: \"skipped\" | \"prepared\" | \"continued\",\n details: Readonly<Record<string, unknown>>\n): void {\n if (resolution.kind === \"blocked\") {\n observePreparationResolution(diagnosticLogger, checkId, resolution, \"malformed\", {\n raw: \"raw\" in details ? details.raw : summarizeDiagnosticValue(details)\n });\n return;\n }\n const messages = \"messages\" in details ? details.messages : EMPTY_MESSAGES;\n observePreparationResolution(diagnosticLogger, checkId, resolution, result, {\n ...(Array.isArray(messages) && messages.length > 0 ? { messages } : {}),\n options: summarizeDiagnosticValue(resolution.check.options),\n ...(\"reason\" in details ? { reason: details.reason } : {}),\n ...(\"source\" in details ? { source: details.source } : {})\n });\n}\n\nfunction observePreparationResolution(\n diagnosticLogger: DiagnosticLogger | undefined,\n checkId: string,\n resolution: CheckPreparationResolution,\n result: PreparationResolutionResult,\n details: Readonly<Record<string, unknown>>\n): void {\n diagnosticLogger?.observe({\n event: \"preparation.resolved\",\n tags: diagnosticTags(`CHECK:${checkId}`, \"PREPARATION\", result.toUpperCase()),\n details: {\n ...details,\n ...(resolution.kind === \"blocked\" ? { outcome: resolution.outcome } : {})\n }\n });\n}\n\nfunction readyResolution(\n input: Readonly<{\n readonly authoredCheck: NormalizedCheck;\n readonly messages: readonly CheckMessage[];\n readonly preparedOptions: unknown;\n }>\n): CheckPreparationResolution {\n const preparedOptions = snapshotJsonObject(input.preparedOptions);\n if (preparedOptions === undefined) {\n return blockedResolution({\n check: input.authoredCheck,\n messages: input.messages,\n reasonCode: \"invalid-preparation-result\"\n });\n }\n const { prepare: _preparation, ...check } = input.authoredCheck;\n return Object.freeze({\n kind: \"ready\",\n check: Object.freeze({\n ...check,\n options: preparedOptions,\n preparationMessages: input.messages\n })\n });\n}\n\nfunction blockedResolution(\n input: Readonly<{\n readonly check: NormalizedCheck;\n readonly messages: readonly CheckMessage[];\n readonly reasonCode: string;\n }>\n): BlockedCheckPreparationResolution {\n return Object.freeze({\n kind: \"blocked\",\n check: Object.freeze({\n definition: input.check.definition,\n preparationMessages: input.messages,\n omitQuietPassedRow: input.check.omitQuietPassedRow\n }),\n outcome: Object.freeze({\n status: \"unavailable\",\n reason: Object.freeze({ code: input.reasonCode })\n })\n });\n}\n"]}
|