@tiangong-lca/foundry 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +532 -0
- package/docs/architecture.md +450 -0
- package/docs/foundry-task-contracts.md +147 -0
- package/docs/import-profiles/bafu/constraints.md +343 -0
- package/docs/import-profiles/bafu/leaf-process-classification-authoring.md +153 -0
- package/docs/import-profiles/bafu/profile.md +183 -0
- package/docs/import-profiles/uslci/constraints.md +29 -0
- package/docs/import-profiles/uslci/profile.md +43 -0
- package/docs/import-profiles/worldsteel/constraints.md +77 -0
- package/docs/import-profiles/worldsteel/import-coverage.md +93 -0
- package/docs/import-profiles/worldsteel/import-plan.md +375 -0
- package/docs/import-profiles/worldsteel/profile.md +78 -0
- package/docs/package-distribution-contract.md +287 -0
- package/docs/public-runtime-contract.md +218 -0
- package/docs/runtime-context-contract.md +138 -0
- package/docs/safety-policy.md +164 -0
- package/docs/task-authorization-contract.md +131 -0
- package/docs/uslci-import-runbook.md +336 -0
- package/docs/workspace-migration-contract.md +127 -0
- package/package-dist/assets/foundry-package-descriptor.json +1661 -0
- package/package-dist/scripts/foundry-facade.d.ts +78 -0
- package/package-dist/scripts/foundry-facade.js +1317 -0
- package/package-dist/scripts/foundry-runtime.d.ts +180 -0
- package/package-dist/scripts/foundry-runtime.js +190 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.d.ts +27 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.js +85 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.d.ts +38 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.js +90 -0
- package/package-dist/scripts/lib/bundle-row-types.d.ts +44 -0
- package/package-dist/scripts/lib/bundle-row-types.js +46 -0
- package/package-dist/scripts/lib/bundle-sample-utils.d.ts +183 -0
- package/package-dist/scripts/lib/bundle-sample-utils.js +526 -0
- package/package-dist/scripts/lib/bundle-source-context.d.ts +31 -0
- package/package-dist/scripts/lib/bundle-source-context.js +142 -0
- package/package-dist/scripts/lib/canonical-description.d.ts +12 -0
- package/package-dist/scripts/lib/canonical-description.js +72 -0
- package/package-dist/scripts/lib/canonical-support-rewrites.d.ts +127 -0
- package/package-dist/scripts/lib/canonical-support-rewrites.js +527 -0
- package/package-dist/scripts/lib/decision-owners/classification.d.ts +245 -0
- package/package-dist/scripts/lib/decision-owners/classification.js +754 -0
- package/package-dist/scripts/lib/decision-owners/identity-preflight.d.ts +333 -0
- package/package-dist/scripts/lib/decision-owners/identity-preflight.js +1353 -0
- package/package-dist/scripts/lib/decision-owners/identity-task.d.ts +130 -0
- package/package-dist/scripts/lib/decision-owners/identity-task.js +494 -0
- package/package-dist/scripts/lib/decision-owners/identity.d.ts +74 -0
- package/package-dist/scripts/lib/decision-owners/identity.js +443 -0
- package/package-dist/scripts/lib/decision-owners/location.d.ts +239 -0
- package/package-dist/scripts/lib/decision-owners/location.js +704 -0
- package/package-dist/scripts/lib/decision-task-utils.d.ts +484 -0
- package/package-dist/scripts/lib/decision-task-utils.js +735 -0
- package/package-dist/scripts/lib/finalize-owners/cli-wrappers.d.ts +52 -0
- package/package-dist/scripts/lib/finalize-owners/cli-wrappers.js +146 -0
- package/package-dist/scripts/lib/finalize-owners/commit-handoff.d.ts +79 -0
- package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +515 -0
- package/package-dist/scripts/lib/finalize-owners/post-authoring.d.ts +234 -0
- package/package-dist/scripts/lib/finalize-owners/post-authoring.js +1720 -0
- package/package-dist/scripts/lib/finalize-owners/post-write-closeout.d.ts +140 -0
- package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +656 -0
- package/package-dist/scripts/lib/foundry-args.d.ts +7 -0
- package/package-dist/scripts/lib/foundry-args.js +38 -0
- package/package-dist/scripts/lib/foundry-authentication-environment.d.ts +17 -0
- package/package-dist/scripts/lib/foundry-authentication-environment.js +55 -0
- package/package-dist/scripts/lib/foundry-authorization-input.d.ts +31 -0
- package/package-dist/scripts/lib/foundry-authorization-input.js +151 -0
- package/package-dist/scripts/lib/foundry-command-metadata.d.ts +32 -0
- package/package-dist/scripts/lib/foundry-command-metadata.js +1012 -0
- package/package-dist/scripts/lib/foundry-command-registry.d.ts +34 -0
- package/package-dist/scripts/lib/foundry-command-registry.js +241 -0
- package/package-dist/scripts/lib/foundry-command-spec.d.ts +1 -0
- package/package-dist/scripts/lib/foundry-command-spec.js +1 -0
- package/package-dist/scripts/lib/foundry-decision-owners.d.ts +17 -0
- package/package-dist/scripts/lib/foundry-decision-owners.js +68 -0
- package/package-dist/scripts/lib/foundry-decision-routing.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-decision-routing.js +38 -0
- package/package-dist/scripts/lib/foundry-execution-admission.d.ts +33 -0
- package/package-dist/scripts/lib/foundry-execution-admission.js +225 -0
- package/package-dist/scripts/lib/foundry-execution-attempt.d.ts +11 -0
- package/package-dist/scripts/lib/foundry-execution-attempt.js +33 -0
- package/package-dist/scripts/lib/foundry-execution-context-format.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-execution-context-format.js +83 -0
- package/package-dist/scripts/lib/foundry-facade-store.d.ts +25 -0
- package/package-dist/scripts/lib/foundry-facade-store.js +449 -0
- package/package-dist/scripts/lib/foundry-finalize-owners.d.ts +21 -0
- package/package-dist/scripts/lib/foundry-finalize-owners.js +203 -0
- package/package-dist/scripts/lib/foundry-identity-owners.d.ts +13 -0
- package/package-dist/scripts/lib/foundry-identity-owners.js +58 -0
- package/package-dist/scripts/lib/foundry-managed-host.d.ts +7 -0
- package/package-dist/scripts/lib/foundry-managed-host.js +173 -0
- package/package-dist/scripts/lib/foundry-migration-adoption-plan.d.ts +39 -0
- package/package-dist/scripts/lib/foundry-migration-adoption-plan.js +467 -0
- package/package-dist/scripts/lib/foundry-migration-adoption.d.ts +31 -0
- package/package-dist/scripts/lib/foundry-migration-adoption.js +187 -0
- package/package-dist/scripts/lib/foundry-migration-authority.d.ts +42 -0
- package/package-dist/scripts/lib/foundry-migration-authority.js +280 -0
- package/package-dist/scripts/lib/foundry-migration-inventory.d.ts +31 -0
- package/package-dist/scripts/lib/foundry-migration-inventory.js +148 -0
- package/package-dist/scripts/lib/foundry-migration-plan.d.ts +48 -0
- package/package-dist/scripts/lib/foundry-migration-plan.js +234 -0
- package/package-dist/scripts/lib/foundry-migration-replay.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-migration-replay.js +134 -0
- package/package-dist/scripts/lib/foundry-migration-stage.d.ts +15 -0
- package/package-dist/scripts/lib/foundry-migration-stage.js +152 -0
- package/package-dist/scripts/lib/foundry-migration-transfer-io.d.ts +13 -0
- package/package-dist/scripts/lib/foundry-migration-transfer-io.js +226 -0
- package/package-dist/scripts/lib/foundry-migration-transfer.d.ts +36 -0
- package/package-dist/scripts/lib/foundry-migration-transfer.js +350 -0
- package/package-dist/scripts/lib/foundry-operation-result.d.ts +71 -0
- package/package-dist/scripts/lib/foundry-operation-result.js +264 -0
- package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +319 -0
- package/package-dist/scripts/lib/foundry-owner-execution-store.js +293 -0
- package/package-dist/scripts/lib/foundry-owner-readback.d.ts +22 -0
- package/package-dist/scripts/lib/foundry-owner-readback.js +189 -0
- package/package-dist/scripts/lib/foundry-owner-trace-acceptance.d.ts +15 -0
- package/package-dist/scripts/lib/foundry-owner-trace-acceptance.js +68 -0
- package/package-dist/scripts/lib/foundry-package-contract.d.ts +56 -0
- package/package-dist/scripts/lib/foundry-package-contract.js +392 -0
- package/package-dist/scripts/lib/foundry-private-path.d.ts +2 -0
- package/package-dist/scripts/lib/foundry-private-path.js +20 -0
- package/package-dist/scripts/lib/foundry-runtime-cache.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-runtime-cache.js +25 -0
- package/package-dist/scripts/lib/foundry-runtime-command-policy.d.ts +20 -0
- package/package-dist/scripts/lib/foundry-runtime-command-policy.js +173 -0
- package/package-dist/scripts/lib/foundry-runtime-context-types.d.ts +59 -0
- package/package-dist/scripts/lib/foundry-runtime-context-types.js +1 -0
- package/package-dist/scripts/lib/foundry-runtime-context.d.ts +27 -0
- package/package-dist/scripts/lib/foundry-runtime-context.js +668 -0
- package/package-dist/scripts/lib/foundry-runtime-environment.d.ts +9 -0
- package/package-dist/scripts/lib/foundry-runtime-environment.js +90 -0
- package/package-dist/scripts/lib/foundry-runtime-error.d.ts +4 -0
- package/package-dist/scripts/lib/foundry-runtime-error.js +8 -0
- package/package-dist/scripts/lib/foundry-runtime-identity.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-runtime-identity.js +127 -0
- package/package-dist/scripts/lib/foundry-runtime-paths.d.ts +16 -0
- package/package-dist/scripts/lib/foundry-runtime-paths.js +159 -0
- package/package-dist/scripts/lib/foundry-runtime-qualification.d.ts +66 -0
- package/package-dist/scripts/lib/foundry-runtime-qualification.js +223 -0
- package/package-dist/scripts/lib/foundry-runtime-selection-record.d.ts +16 -0
- package/package-dist/scripts/lib/foundry-runtime-selection-record.js +32 -0
- package/package-dist/scripts/lib/foundry-runtime-selection.d.ts +14 -0
- package/package-dist/scripts/lib/foundry-runtime-selection.js +123 -0
- package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +178 -0
- package/package-dist/scripts/lib/foundry-runtime-utils.js +603 -0
- package/package-dist/scripts/lib/foundry-semantic-input.d.ts +30 -0
- package/package-dist/scripts/lib/foundry-semantic-input.js +132 -0
- package/package-dist/scripts/lib/foundry-task-authorization.d.ts +68 -0
- package/package-dist/scripts/lib/foundry-task-authorization.js +350 -0
- package/package-dist/scripts/lib/foundry-task-io.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-task-io.js +92 -0
- package/package-dist/scripts/lib/foundry-task-registration.d.ts +6 -0
- package/package-dist/scripts/lib/foundry-task-registration.js +384 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +34 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.js +161 -0
- package/package-dist/scripts/lib/foundry-task-store.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-task-store.js +466 -0
- package/package-dist/scripts/lib/foundry-task-types.d.ts +99 -0
- package/package-dist/scripts/lib/foundry-task-types.js +1 -0
- package/package-dist/scripts/lib/foundry-workflow-approval-continuation.d.ts +6 -0
- package/package-dist/scripts/lib/foundry-workflow-approval-continuation.js +136 -0
- package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-workflow-assessment.js +231 -0
- package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +22 -0
- package/package-dist/scripts/lib/foundry-workflow-authorization.js +174 -0
- package/package-dist/scripts/lib/foundry-workflow-context.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-workflow-context.js +99 -0
- package/package-dist/scripts/lib/foundry-workflow-decisions.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-workflow-decisions.js +123 -0
- package/package-dist/scripts/lib/foundry-workflow-execution.d.ts +8 -0
- package/package-dist/scripts/lib/foundry-workflow-execution.js +248 -0
- package/package-dist/scripts/lib/foundry-workflow-finalize.d.ts +13 -0
- package/package-dist/scripts/lib/foundry-workflow-finalize.js +264 -0
- package/package-dist/scripts/lib/foundry-workflow-identity-apply.d.ts +14 -0
- package/package-dist/scripts/lib/foundry-workflow-identity-apply.js +159 -0
- package/package-dist/scripts/lib/foundry-workflow-identity.d.ts +6 -0
- package/package-dist/scripts/lib/foundry-workflow-identity.js +153 -0
- package/package-dist/scripts/lib/foundry-workflow-import.d.ts +4 -0
- package/package-dist/scripts/lib/foundry-workflow-import.js +70 -0
- package/package-dist/scripts/lib/foundry-workflow-io.d.ts +11 -0
- package/package-dist/scripts/lib/foundry-workflow-io.js +77 -0
- package/package-dist/scripts/lib/foundry-workflow-reference-verify.d.ts +41 -0
- package/package-dist/scripts/lib/foundry-workflow-reference-verify.js +266 -0
- package/package-dist/scripts/lib/foundry-workflow-rows.d.ts +2 -0
- package/package-dist/scripts/lib/foundry-workflow-rows.js +47 -0
- package/package-dist/scripts/lib/foundry-workflow-semantic.d.ts +5 -0
- package/package-dist/scripts/lib/foundry-workflow-semantic.js +367 -0
- package/package-dist/scripts/lib/foundry-workflow-state.d.ts +37 -0
- package/package-dist/scripts/lib/foundry-workflow-state.js +158 -0
- package/package-dist/scripts/lib/full-context-proof.d.ts +51 -0
- package/package-dist/scripts/lib/full-context-proof.js +932 -0
- package/package-dist/scripts/lib/identity-preflight-artifacts.d.ts +184 -0
- package/package-dist/scripts/lib/identity-preflight-artifacts.js +573 -0
- package/package-dist/scripts/lib/identity-preflight-proof.d.ts +117 -0
- package/package-dist/scripts/lib/identity-preflight-proof.js +341 -0
- package/package-dist/scripts/lib/identity-reference-rewrite-utils.d.ts +147 -0
- package/package-dist/scripts/lib/identity-reference-rewrite-utils.js +817 -0
- package/package-dist/scripts/lib/import-curation/authoring-packages.d.ts +28 -0
- package/package-dist/scripts/lib/import-curation/authoring-packages.js +92 -0
- package/package-dist/scripts/lib/import-curation/curation-cleanup.d.ts +32 -0
- package/package-dist/scripts/lib/import-curation/curation-cleanup.js +203 -0
- package/package-dist/scripts/lib/import-curation/curation-gate.d.ts +47 -0
- package/package-dist/scripts/lib/import-curation/curation-gate.js +528 -0
- package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.d.ts +24 -0
- package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.js +152 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.d.ts +3 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.js +3 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.d.ts +1 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.js +1 -0
- package/package-dist/scripts/lib/import-curation/internal/context-inputs.d.ts +56 -0
- package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +206 -0
- package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.d.ts +14 -0
- package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.js +14 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-payload.d.ts +70 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-payload.js +141 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-types.d.ts +25 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-types.js +45 -0
- package/package-dist/scripts/lib/import-curation/internal/full-context-proof.d.ts +129 -0
- package/package-dist/scripts/lib/import-curation/internal/full-context-proof.js +552 -0
- package/package-dist/scripts/lib/import-curation/internal/hash-utils.d.ts +2 -0
- package/package-dist/scripts/lib/import-curation/internal/hash-utils.js +10 -0
- package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.d.ts +15 -0
- package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.js +15 -0
- package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +31 -0
- package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +467 -0
- package/package-dist/scripts/lib/import-curation/internal/profiles-config.d.ts +47 -0
- package/package-dist/scripts/lib/import-curation/internal/profiles-config.js +88 -0
- package/package-dist/scripts/lib/import-curation/internal/runtime-io.d.ts +23 -0
- package/package-dist/scripts/lib/import-curation/internal/runtime-io.js +132 -0
- package/package-dist/scripts/lib/import-curation/internal/trace-summary.d.ts +53 -0
- package/package-dist/scripts/lib/import-curation/internal/trace-summary.js +114 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.d.ts +141 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +854 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.d.ts +20 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.js +46 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.d.ts +110 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.js +782 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.d.ts +24 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.js +191 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.d.ts +80 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.js +359 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.d.ts +146 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.js +381 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.d.ts +223 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.js +1079 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.d.ts +41 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +412 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.d.ts +117 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.js +278 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.d.ts +59 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.js +593 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.d.ts +58 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +263 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.d.ts +177 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.js +812 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.d.ts +159 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.js +466 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.d.ts +152 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +1377 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.d.ts +38 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.js +116 -0
- package/package-dist/scripts/lib/import-curation/mutation-manifest.d.ts +51 -0
- package/package-dist/scripts/lib/import-curation/mutation-manifest.js +542 -0
- package/package-dist/scripts/lib/import-curation/patch-collect.d.ts +18 -0
- package/package-dist/scripts/lib/import-curation/patch-collect.js +172 -0
- package/package-dist/scripts/lib/import-curation/profiles.d.ts +1 -0
- package/package-dist/scripts/lib/import-curation/profiles.js +1 -0
- package/package-dist/scripts/lib/import-curation/trace-summary.d.ts +1 -0
- package/package-dist/scripts/lib/import-curation/trace-summary.js +1 -0
- package/package-dist/scripts/lib/oauth-session-reference.d.ts +1 -0
- package/package-dist/scripts/lib/oauth-session-reference.js +20 -0
- package/package-dist/scripts/lib/post-authoring-finalize-utils.d.ts +95 -0
- package/package-dist/scripts/lib/post-authoring-finalize-utils.js +548 -0
- package/package-dist/scripts/lib/post-write-root-proof.d.ts +44 -0
- package/package-dist/scripts/lib/post-write-root-proof.js +169 -0
- package/package-dist/scripts/lib/reference-description-text.d.ts +2 -0
- package/package-dist/scripts/lib/reference-description-text.js +12 -0
- package/package-dist/scripts/lib/remote-verification-accepted-diff.d.ts +42 -0
- package/package-dist/scripts/lib/remote-verification-accepted-diff.js +424 -0
- package/package-dist/scripts/lib/same-identity-commit-recovery.d.ts +8 -0
- package/package-dist/scripts/lib/same-identity-commit-recovery.js +52 -0
- package/package-dist/scripts/lib/source-semantics.d.ts +255 -0
- package/package-dist/scripts/lib/source-semantics.js +888 -0
- package/package-dist/scripts/lib/stage-contract.d.ts +36 -0
- package/package-dist/scripts/lib/stage-contract.js +25 -0
- package/package-dist/scripts/lib/task-authorization.d.ts +84 -0
- package/package-dist/scripts/lib/task-authorization.js +210 -0
- package/package-dist/scripts/lib/tidas-adapter.d.ts +113 -0
- package/package-dist/scripts/lib/tidas-adapter.js +525 -0
- package/package-dist/scripts/lib/tidas-language-utils.d.ts +8 -0
- package/package-dist/scripts/lib/tidas-language-utils.js +206 -0
- package/package-dist/scripts/lib/tidas-row-utils.d.ts +70 -0
- package/package-dist/scripts/lib/tidas-row-utils.js +225 -0
- package/package-dist/scripts/lib/trace-coverage.d.ts +53 -0
- package/package-dist/scripts/lib/trace-coverage.js +178 -0
- package/package-dist/scripts/package-entry.d.ts +2 -0
- package/package-dist/scripts/package-entry.js +4 -0
- package/package-dist/scripts/public-api.d.ts +80 -0
- package/package-dist/scripts/public-api.js +28 -0
- package/package-dist/scripts/runtime-entry.d.ts +23 -0
- package/package-dist/scripts/runtime-entry.js +424 -0
- package/package.json +93 -0
- package/specs/canonical-support/flow-properties-unit-groups.json +2692 -0
- package/specs/import-profiles.json +118 -0
- package/specs/prewrite-content-policy.json +105 -0
- package/specs/schemas/authorization-derivation.schema.json +34 -0
- package/specs/schemas/execution-context.schema.json +68 -0
- package/specs/schemas/foundry-authorization-input.schema.json +120 -0
- package/specs/schemas/foundry-facade-request-index.schema.json +78 -0
- package/specs/schemas/foundry-managed-runtime.schema.json +122 -0
- package/specs/schemas/foundry-migration-activation.schema.json +213 -0
- package/specs/schemas/foundry-migration-adoption-plan.schema.json +548 -0
- package/specs/schemas/foundry-migration-transfer-receipt.schema.json +93 -0
- package/specs/schemas/foundry-operation-result.schema.json +147 -0
- package/specs/schemas/foundry-package-descriptor.schema.json +134 -0
- package/specs/schemas/foundry-runtime-selection.schema.json +59 -0
- package/specs/schemas/foundry-semantic-input.schema.json +36 -0
- package/specs/schemas/foundry-task-start.schema.json +123 -0
- package/specs/schemas/foundry-workspace-migration-pending.schema.json +17 -0
- package/specs/schemas/foundry-workspace-migration-plan.schema.json +59 -0
- package/specs/schemas/foundry-workspace-migration-transfer-plan.schema.json +357 -0
- package/specs/schemas/foundry-workspace-v2.schema.json +70 -0
- package/specs/schemas/runtime-qualification.schema.json +63 -0
- package/specs/schemas/task-authorization.schema.json +154 -0
- package/specs/schemas/tidas-runtime-expectation.schema.json +54 -0
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import { fullContextDecisionTaskProofBlockers, fullContextPackageProofBlockers, payloadSha256ByIdentityForRows, } from "./full-context-proof.js";
|
|
2
|
+
import { asText, ensureArray, optionList, repoRelativePath, sameArtifactPath, unique, } from "./runtime-io.js";
|
|
3
|
+
import { readClassificationDecisionApplyContext } from "./workflow-decision-apply-context.js";
|
|
4
|
+
import { identityDecisionCanonical, identityDecisionClosesAction, identityDecisionPackageReference, identityDecisionPackageSha, identityDecisionValue, } from "./workflow-identity-decision-context.js";
|
|
5
|
+
import { decisionApplyExpectedRowsFile, decisionApplyInputRowsMatch, decisionApplyOutputRowsChainThroughClassification, decisionApplyOutputRowsChainThroughClassificationAndIdentityRewrite, decisionApplyOutputRowsChainThroughClassificationIdentityRewriteAndUnresolvedExchangeExternalization, decisionApplyOutputRowsChainThroughIdentityRewrite, decisionApplyOutputRowsChainThroughIdentityRewriteAndUnresolvedExchangeExternalization, decisionApplyOutputRowsChainThroughPatch, decisionApplyOutputRowsChainThroughPatchAndIdentityRewrite, decisionApplyOutputRowsMatch, decisionApplyOutputRowsReachableThroughDeterministicTransforms, rowsFileChainsThroughUnresolvedExchangeExternalization, sameRowsArtifact, } from "./workflow-row-transform-context.js";
|
|
6
|
+
// part-10.mjs
|
|
7
|
+
export function decisionApplyOutputRowsChainThroughUnresolvedExchangeExternalization(repoRoot, context, unresolvedExchangeExternalizationContext, expectedRowsFile) {
|
|
8
|
+
return Boolean(expectedRowsFile &&
|
|
9
|
+
unresolvedExchangeExternalizationContext?.inputRowsFile &&
|
|
10
|
+
decisionApplyOutputRowsMatch(repoRoot, context, unresolvedExchangeExternalizationContext.inputRowsFile) &&
|
|
11
|
+
rowsFileChainsThroughUnresolvedExchangeExternalization({
|
|
12
|
+
repoRoot,
|
|
13
|
+
upstreamFile: unresolvedExchangeExternalizationContext.inputRowsFile,
|
|
14
|
+
finalFile: expectedRowsFile,
|
|
15
|
+
unresolvedExchangeExternalizationContext,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
export function decisionApplyOutputRowsChainThroughPatchAndUnresolvedExchangeExternalization(repoRoot, context, patchApplyContext, unresolvedExchangeExternalizationContext, expectedRowsFile) {
|
|
19
|
+
return Boolean(expectedRowsFile &&
|
|
20
|
+
patchApplyContext?.inputRowsFile &&
|
|
21
|
+
unresolvedExchangeExternalizationContext?.inputRowsFile &&
|
|
22
|
+
decisionApplyOutputRowsMatch(repoRoot, context, patchApplyContext.inputRowsFile) &&
|
|
23
|
+
patchApplyContext.outputRows?.some((filePath) => sameArtifactPath(repoRoot, filePath, unresolvedExchangeExternalizationContext.inputRowsFile)) &&
|
|
24
|
+
rowsFileChainsThroughUnresolvedExchangeExternalization({
|
|
25
|
+
repoRoot,
|
|
26
|
+
upstreamFile: unresolvedExchangeExternalizationContext.inputRowsFile,
|
|
27
|
+
finalFile: expectedRowsFile,
|
|
28
|
+
unresolvedExchangeExternalizationContext,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function decisionApplyRowsEquivalentToExpected(repoRoot, context, expectedRowsFile) {
|
|
32
|
+
return Boolean(expectedRowsFile &&
|
|
33
|
+
context?.inputRows?.some((filePath) => sameRowsArtifact(repoRoot, filePath, expectedRowsFile)) &&
|
|
34
|
+
context?.outputRows?.some((filePath) => sameRowsArtifact(repoRoot, filePath, expectedRowsFile)));
|
|
35
|
+
}
|
|
36
|
+
function decisionDatasetType(decision) {
|
|
37
|
+
const record = decision;
|
|
38
|
+
const explicit = asText(record?.dataset_type ?? record?.datasetType);
|
|
39
|
+
if (explicit)
|
|
40
|
+
return explicit;
|
|
41
|
+
const categoryType = asText(record?.category_type ?? record?.categoryType);
|
|
42
|
+
if (categoryType === "process")
|
|
43
|
+
return "process";
|
|
44
|
+
if (categoryType.startsWith("flow"))
|
|
45
|
+
return "flow";
|
|
46
|
+
if (["source", "contact", "flowproperty", "unitgroup", "lifecyclemodel"].includes(categoryType)) {
|
|
47
|
+
return categoryType;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function decisionTargetIdentityKeys(context) {
|
|
52
|
+
return ensureArray(context?.decisions)
|
|
53
|
+
.map((decision) => {
|
|
54
|
+
const datasetType = decisionDatasetType(decision);
|
|
55
|
+
const id = asText(decision?.dataset_id ?? decision?.datasetId ?? decision?.id);
|
|
56
|
+
const version = asText(decision?.dataset_version ?? decision?.datasetVersion ?? decision?.version) ||
|
|
57
|
+
"00.00.001";
|
|
58
|
+
return datasetType && id ? `${datasetType}:${id}@@${version}` : null;
|
|
59
|
+
})
|
|
60
|
+
.filter(Boolean);
|
|
61
|
+
}
|
|
62
|
+
export function decisionApplyContextRelevantToExpectedRowsFile({ repoRoot, context, expectedRowsFile, }) {
|
|
63
|
+
if (!context || !expectedRowsFile)
|
|
64
|
+
return true;
|
|
65
|
+
if (decisionApplyInputRowsMatch(repoRoot, context, expectedRowsFile) ||
|
|
66
|
+
decisionApplyOutputRowsMatch(repoRoot, context, expectedRowsFile)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
const expectedKeys = new Set(payloadSha256ByIdentityForRows(repoRoot, [expectedRowsFile]).keys());
|
|
70
|
+
if (expectedKeys.size === 0)
|
|
71
|
+
return true;
|
|
72
|
+
if (decisionTargetIdentityKeys(context).some((key) => expectedKeys.has(key)))
|
|
73
|
+
return true;
|
|
74
|
+
const contextKeys = [
|
|
75
|
+
...Array.from(context.inputPayloadSha256ByIdentity?.keys?.() ?? []),
|
|
76
|
+
...Array.from(context.outputPayloadSha256ByIdentity?.keys?.() ?? []),
|
|
77
|
+
];
|
|
78
|
+
return contextKeys.some((key) => expectedKeys.has(key));
|
|
79
|
+
}
|
|
80
|
+
export function decisionApplyContextCoversExpectedRowsIdentity({ repoRoot, context, expectedRowsFile, }) {
|
|
81
|
+
if (!context || !expectedRowsFile)
|
|
82
|
+
return false;
|
|
83
|
+
const expectedKeys = new Set(payloadSha256ByIdentityForRows(repoRoot, [expectedRowsFile]).keys());
|
|
84
|
+
if (expectedKeys.size === 0)
|
|
85
|
+
return false;
|
|
86
|
+
const contextKeys = new Set([
|
|
87
|
+
...decisionTargetIdentityKeys(context),
|
|
88
|
+
...Array.from(context.inputPayloadSha256ByIdentity?.keys?.() ?? []),
|
|
89
|
+
...Array.from(context.outputPayloadSha256ByIdentity?.keys?.() ?? []),
|
|
90
|
+
]);
|
|
91
|
+
if (contextKeys.size === 0)
|
|
92
|
+
return false;
|
|
93
|
+
return Array.from(expectedKeys).every((key) => contextKeys.has(key));
|
|
94
|
+
}
|
|
95
|
+
export function decisionApplyContextRelevantToRowsFile({ repoRoot, rowsFile, cleanupArtifact, context, }) {
|
|
96
|
+
return decisionApplyContextRelevantToExpectedRowsFile({
|
|
97
|
+
repoRoot,
|
|
98
|
+
context,
|
|
99
|
+
expectedRowsFile: decisionApplyExpectedRowsFile({ repoRoot, rowsFile, cleanupArtifact }),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export function decisionApplyOutputRowsChainThroughPatchIdentityRewriteAndUnresolvedExchangeExternalization(repoRoot, context, patchApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, expectedRowsFile) {
|
|
103
|
+
return Boolean(expectedRowsFile &&
|
|
104
|
+
patchApplyContext?.inputRowsFile &&
|
|
105
|
+
identityReferenceRewriteContext?.inputRowsFile &&
|
|
106
|
+
identityReferenceRewriteContext?.outputRowsFile &&
|
|
107
|
+
unresolvedExchangeExternalizationContext?.inputRowsFile &&
|
|
108
|
+
decisionApplyOutputRowsMatch(repoRoot, context, patchApplyContext.inputRowsFile) &&
|
|
109
|
+
patchApplyContext.outputRows?.some((filePath) => sameArtifactPath(repoRoot, filePath, identityReferenceRewriteContext.inputRowsFile)) &&
|
|
110
|
+
sameArtifactPath(repoRoot, identityReferenceRewriteContext.outputRowsFile, unresolvedExchangeExternalizationContext.inputRowsFile) &&
|
|
111
|
+
rowsFileChainsThroughUnresolvedExchangeExternalization({
|
|
112
|
+
repoRoot,
|
|
113
|
+
upstreamFile: unresolvedExchangeExternalizationContext.inputRowsFile,
|
|
114
|
+
finalFile: expectedRowsFile,
|
|
115
|
+
unresolvedExchangeExternalizationContext,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
export function identityDecisionApplyProvesReferenceRewrite(repoRoot, context, identityReferenceRewriteContext) {
|
|
119
|
+
const scopedRows = identityReferenceRewriteContext?.scopedRows ?? [];
|
|
120
|
+
const decisionRewriteFiles = unique([
|
|
121
|
+
...ensureArray(context?.identityReferenceRewritesFiles),
|
|
122
|
+
context?.identityReferenceRewritesFile,
|
|
123
|
+
].filter(Boolean));
|
|
124
|
+
if (decisionRewriteFiles.length === 0 || !identityReferenceRewriteContext?.sourceFile) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return decisionRewriteFiles.some((decisionRewriteFile) => {
|
|
128
|
+
const directlyUsed = sameArtifactPath(repoRoot, decisionRewriteFile, identityReferenceRewriteContext.sourceFile);
|
|
129
|
+
const chainedThroughProcessRewrite = scopedRows.some((row) => {
|
|
130
|
+
const rewriteSource = row?.rewrite_source;
|
|
131
|
+
const camelRewriteSource = row?.rewriteSource;
|
|
132
|
+
return (sameArtifactPath(repoRoot, rewriteSource?.file, decisionRewriteFile) ||
|
|
133
|
+
sameArtifactPath(repoRoot, camelRewriteSource?.file, decisionRewriteFile));
|
|
134
|
+
});
|
|
135
|
+
return Boolean(scopedRows.length > 0 && (directlyUsed || chainedThroughProcessRewrite));
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
export function classificationDecisionContextKinds(decision) {
|
|
139
|
+
const record = decision;
|
|
140
|
+
const resolution = record?.resolution;
|
|
141
|
+
const evidence = record?.evidence;
|
|
142
|
+
return [
|
|
143
|
+
...optionList(record?.used_context_kinds ?? record?.usedContextKinds),
|
|
144
|
+
...optionList(resolution?.used_context_kinds ?? resolution?.usedContextKinds),
|
|
145
|
+
...optionList(evidence?.used_context_kinds ?? evidence?.usedContextKinds),
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
export function classificationDecisionContextBundleSha256(decision) {
|
|
149
|
+
const record = decision;
|
|
150
|
+
const authoringContext = record?.authoring_context;
|
|
151
|
+
const camelContext = record?.authoringContext;
|
|
152
|
+
return asText(authoringContext?.context_bundle_sha256 ??
|
|
153
|
+
camelContext?.contextBundleSha256 ??
|
|
154
|
+
record?.authoring_context_sha256 ??
|
|
155
|
+
record?.context_bundle_sha256 ??
|
|
156
|
+
record?.contextBundleSha256);
|
|
157
|
+
}
|
|
158
|
+
export function classificationDecisionCompletionStatus(decision) {
|
|
159
|
+
const record = decision;
|
|
160
|
+
return asText(record?.decision_status ?? record?.decisionStatus ?? record?.status);
|
|
161
|
+
}
|
|
162
|
+
export function decisionTaskProofListFromContext(context) {
|
|
163
|
+
const proofs = ensureArray(context?.decisionTaskProofs).filter(Boolean);
|
|
164
|
+
if (proofs.length > 0)
|
|
165
|
+
return proofs;
|
|
166
|
+
return context?.decisionTaskProof ? [context.decisionTaskProof] : [];
|
|
167
|
+
}
|
|
168
|
+
export function decisionTaskContextBundleHashesFromContext(context) {
|
|
169
|
+
return unique(decisionTaskProofListFromContext(context).map((proof) => proof.context_bundle_sha256));
|
|
170
|
+
}
|
|
171
|
+
export function buildClassificationDecisionFullContextBlockers({ repoRoot, rowsFile, cleanupArtifact, requirement, classificationDecisionApplyArtifact, classificationDecisionApplyContext, locationDecisionApplyContext, patchApplyContext, identityDecisionApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, sourceContactRewriteContext, canonicalSupportRewriteContext, cleanupContext, }) {
|
|
172
|
+
const blockers = [];
|
|
173
|
+
if (!classificationDecisionApplyArtifact)
|
|
174
|
+
return blockers;
|
|
175
|
+
const context = classificationDecisionApplyContext;
|
|
176
|
+
const expectedRowsFile = decisionApplyExpectedRowsFile({
|
|
177
|
+
repoRoot,
|
|
178
|
+
rowsFile,
|
|
179
|
+
cleanupArtifact,
|
|
180
|
+
});
|
|
181
|
+
if (!decisionApplyContextRelevantToExpectedRowsFile({
|
|
182
|
+
repoRoot,
|
|
183
|
+
context,
|
|
184
|
+
expectedRowsFile,
|
|
185
|
+
})) {
|
|
186
|
+
return blockers;
|
|
187
|
+
}
|
|
188
|
+
if (context?.status !== "completed") {
|
|
189
|
+
blockers.push({
|
|
190
|
+
code: "full_context_ai_classification_apply_not_completed",
|
|
191
|
+
stage: "full_context_ai_completion",
|
|
192
|
+
message: `dataset-classification-decisions-apply status is ${context?.status || "missing"}.`,
|
|
193
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const decisionTaskProofs = decisionTaskProofListFromContext(context);
|
|
197
|
+
if (decisionTaskProofs.length === 0) {
|
|
198
|
+
blockers.push(...fullContextDecisionTaskProofBlockers({
|
|
199
|
+
requirement,
|
|
200
|
+
proof: null,
|
|
201
|
+
label: "classification",
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
for (const proof of decisionTaskProofs) {
|
|
206
|
+
blockers.push(...fullContextDecisionTaskProofBlockers({
|
|
207
|
+
requirement,
|
|
208
|
+
proof,
|
|
209
|
+
label: "classification",
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (cleanupArtifact && !expectedRowsFile) {
|
|
214
|
+
blockers.push({
|
|
215
|
+
code: "full_context_ai_classification_cleanup_input_missing",
|
|
216
|
+
stage: "full_context_ai_completion",
|
|
217
|
+
message: "Classification decision proof cannot be chained because the cleanup report does not record its input rows_file.",
|
|
218
|
+
rows_file: repoRelativePath(repoRoot, rowsFile),
|
|
219
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
220
|
+
cleanup_report: repoRelativePath(repoRoot, cleanupArtifact.path),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
else if (!decisionApplyOutputRowsMatch(repoRoot, context, expectedRowsFile) &&
|
|
224
|
+
!decisionApplyRowsEquivalentToExpected(repoRoot, context, expectedRowsFile) &&
|
|
225
|
+
!decisionApplyContextCoversExpectedRowsIdentity({
|
|
226
|
+
repoRoot,
|
|
227
|
+
context,
|
|
228
|
+
expectedRowsFile,
|
|
229
|
+
}) &&
|
|
230
|
+
!decisionApplyOutputRowsChainThroughPatch(repoRoot, context, patchApplyContext, expectedRowsFile) &&
|
|
231
|
+
!decisionApplyOutputRowsChainThroughPatchAndIdentityRewrite(repoRoot, context, patchApplyContext, identityReferenceRewriteContext, expectedRowsFile) &&
|
|
232
|
+
!decisionApplyOutputRowsChainThroughIdentityRewrite(repoRoot, context, identityReferenceRewriteContext, expectedRowsFile) &&
|
|
233
|
+
!decisionApplyOutputRowsChainThroughUnresolvedExchangeExternalization(repoRoot, context, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
234
|
+
!decisionApplyOutputRowsChainThroughPatchAndUnresolvedExchangeExternalization(repoRoot, context, patchApplyContext, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
235
|
+
!decisionApplyOutputRowsChainThroughPatchIdentityRewriteAndUnresolvedExchangeExternalization(repoRoot, context, patchApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
236
|
+
!decisionApplyOutputRowsReachableThroughDeterministicTransforms({
|
|
237
|
+
repoRoot,
|
|
238
|
+
context,
|
|
239
|
+
expectedRowsFile,
|
|
240
|
+
patchApplyContext,
|
|
241
|
+
locationDecisionApplyContext,
|
|
242
|
+
identityDecisionApplyContext,
|
|
243
|
+
identityReferenceRewriteContext,
|
|
244
|
+
unresolvedExchangeExternalizationContext,
|
|
245
|
+
sourceContactRewriteContext,
|
|
246
|
+
canonicalSupportRewriteContext,
|
|
247
|
+
cleanupContext,
|
|
248
|
+
})) {
|
|
249
|
+
blockers.push({
|
|
250
|
+
code: "full_context_ai_classification_rows_mismatch",
|
|
251
|
+
stage: "full_context_ai_completion",
|
|
252
|
+
message: "Classification decision apply report files.output_rows must match the cleanup input rows file, the exact mutation rows file, or the input rows of a completed patch apply report whose output rows then match that cleanup/mutation file.",
|
|
253
|
+
rows_file: repoRelativePath(repoRoot, rowsFile),
|
|
254
|
+
expected_output_rows_file: repoRelativePath(repoRoot, expectedRowsFile),
|
|
255
|
+
patch_apply_input_rows_file: patchApplyContext?.inputRowsFile
|
|
256
|
+
? repoRelativePath(repoRoot, patchApplyContext.inputRowsFile)
|
|
257
|
+
: null,
|
|
258
|
+
patch_apply_output_rows_files: patchApplyContext?.outputRows?.map((file) => repoRelativePath(repoRoot, file)) ?? [],
|
|
259
|
+
identity_reference_rewrite_input_rows_file: identityReferenceRewriteContext?.inputRowsFile
|
|
260
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.inputRowsFile)
|
|
261
|
+
: null,
|
|
262
|
+
identity_reference_rewrite_output_rows_file: identityReferenceRewriteContext?.outputRowsFile
|
|
263
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.outputRowsFile)
|
|
264
|
+
: null,
|
|
265
|
+
unresolved_exchange_externalization_input_rows_file: unresolvedExchangeExternalizationContext?.inputRowsFile
|
|
266
|
+
? repoRelativePath(repoRoot, unresolvedExchangeExternalizationContext.inputRowsFile)
|
|
267
|
+
: null,
|
|
268
|
+
unresolved_exchange_externalization_output_rows_file: unresolvedExchangeExternalizationContext?.outputRowsFile
|
|
269
|
+
? repoRelativePath(repoRoot, unresolvedExchangeExternalizationContext.outputRowsFile)
|
|
270
|
+
: null,
|
|
271
|
+
source_contact_rewrite_input_rows_file: sourceContactRewriteContext?.inputRowsFile
|
|
272
|
+
? repoRelativePath(repoRoot, sourceContactRewriteContext.inputRowsFile)
|
|
273
|
+
: null,
|
|
274
|
+
source_contact_rewrite_output_rows_file: sourceContactRewriteContext?.outputRowsFile
|
|
275
|
+
? repoRelativePath(repoRoot, sourceContactRewriteContext.outputRowsFile)
|
|
276
|
+
: null,
|
|
277
|
+
canonical_support_rewrite_input_rows_file: canonicalSupportRewriteContext?.inputRowsFile
|
|
278
|
+
? repoRelativePath(repoRoot, canonicalSupportRewriteContext.inputRowsFile)
|
|
279
|
+
: null,
|
|
280
|
+
canonical_support_rewrite_output_rows_file: canonicalSupportRewriteContext?.outputRowsFile
|
|
281
|
+
? repoRelativePath(repoRoot, canonicalSupportRewriteContext.outputRowsFile)
|
|
282
|
+
: null,
|
|
283
|
+
cleanup_input_rows_file: cleanupContext?.inputRowsFile
|
|
284
|
+
? repoRelativePath(repoRoot, cleanupContext.inputRowsFile)
|
|
285
|
+
: null,
|
|
286
|
+
cleanup_output_rows_file: cleanupContext?.outputRowsFile
|
|
287
|
+
? repoRelativePath(repoRoot, cleanupContext.outputRowsFile)
|
|
288
|
+
: null,
|
|
289
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
if (!context?.decisions?.length) {
|
|
293
|
+
blockers.push({
|
|
294
|
+
code: "full_context_ai_classification_decision_evidence_required",
|
|
295
|
+
stage: "full_context_ai_completion",
|
|
296
|
+
message: "Classification decision apply report must point to at least one AI-authored classification decision.",
|
|
297
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
298
|
+
});
|
|
299
|
+
return blockers;
|
|
300
|
+
}
|
|
301
|
+
const missingBasis = context.decisions.filter((decision) => !asText(decision?.basis));
|
|
302
|
+
if (missingBasis.length > 0) {
|
|
303
|
+
blockers.push({
|
|
304
|
+
code: "full_context_ai_classification_basis_missing",
|
|
305
|
+
stage: "full_context_ai_completion",
|
|
306
|
+
message: "Every classification decision must include basis.",
|
|
307
|
+
count: missingBasis.length,
|
|
308
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
const missingEvidence = context.decisions.filter((decision) => !decision?.evidence || typeof decision.evidence !== "object");
|
|
312
|
+
if (missingEvidence.length > 0) {
|
|
313
|
+
blockers.push({
|
|
314
|
+
code: "full_context_ai_classification_evidence_missing",
|
|
315
|
+
stage: "full_context_ai_completion",
|
|
316
|
+
message: "Every classification decision must include structured evidence.",
|
|
317
|
+
count: missingEvidence.length,
|
|
318
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
const notCompleted = context.decisions.filter((decision) => classificationDecisionCompletionStatus(decision) !== "completed");
|
|
322
|
+
if (notCompleted.length > 0) {
|
|
323
|
+
blockers.push({
|
|
324
|
+
code: "full_context_ai_classification_decision_status_not_completed",
|
|
325
|
+
stage: "full_context_ai_completion",
|
|
326
|
+
message: "Every classification decision used as full-context AI evidence must declare decision_status=completed.",
|
|
327
|
+
count: notCompleted.length,
|
|
328
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const missingContextKinds = [];
|
|
332
|
+
for (const decision of context.decisions) {
|
|
333
|
+
const usedKinds = new Set(classificationDecisionContextKinds(decision));
|
|
334
|
+
for (const requiredKind of requirement.requiredContextKinds) {
|
|
335
|
+
if (!usedKinds.has(requiredKind)) {
|
|
336
|
+
missingContextKinds.push({ decision, requiredKind });
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (missingContextKinds.length > 0) {
|
|
341
|
+
blockers.push({
|
|
342
|
+
code: "full_context_ai_classification_context_missing",
|
|
343
|
+
stage: "full_context_ai_completion",
|
|
344
|
+
message: "Classification decision used_context_kinds must include every required full-context kind for this profile.",
|
|
345
|
+
count: missingContextKinds.length,
|
|
346
|
+
required_context_kinds: requirement.requiredContextKinds,
|
|
347
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
const expectedContextBundleSha256AnyOf = decisionTaskContextBundleHashesFromContext(context);
|
|
351
|
+
if (expectedContextBundleSha256AnyOf.length > 0) {
|
|
352
|
+
const mismatchedContextBundle = context.decisions.filter((decision) => !expectedContextBundleSha256AnyOf.includes(classificationDecisionContextBundleSha256(decision)));
|
|
353
|
+
if (mismatchedContextBundle.length > 0) {
|
|
354
|
+
blockers.push({
|
|
355
|
+
code: "full_context_ai_classification_context_bundle_mismatch",
|
|
356
|
+
stage: "full_context_ai_completion",
|
|
357
|
+
message: "Every classification decision must reference one of the AI decision task context_bundle_sha256 values.",
|
|
358
|
+
count: mismatchedContextBundle.length,
|
|
359
|
+
expected_context_bundle_sha256: expectedContextBundleSha256AnyOf.length === 1
|
|
360
|
+
? expectedContextBundleSha256AnyOf[0]
|
|
361
|
+
: null,
|
|
362
|
+
expected_context_bundle_sha256_any_of: expectedContextBundleSha256AnyOf,
|
|
363
|
+
artifact: repoRelativePath(repoRoot, classificationDecisionApplyArtifact.path),
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return blockers;
|
|
368
|
+
}
|
|
369
|
+
export function readLocationDecisionApplyContext(repoRoot, locationDecisionApplyArtifact) {
|
|
370
|
+
return readClassificationDecisionApplyContext(repoRoot, locationDecisionApplyArtifact, "location_decision_apply");
|
|
371
|
+
}
|
|
372
|
+
export function buildLocationDecisionFullContextBlockers({ repoRoot, rowsFile, cleanupArtifact, requirement, locationDecisionApplyArtifact, locationDecisionApplyContext, patchApplyContext, identityDecisionApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, sourceContactRewriteContext, canonicalSupportRewriteContext, cleanupContext, }) {
|
|
373
|
+
const blockers = [];
|
|
374
|
+
if (!locationDecisionApplyArtifact)
|
|
375
|
+
return blockers;
|
|
376
|
+
const context = locationDecisionApplyContext;
|
|
377
|
+
const expectedRowsFile = decisionApplyExpectedRowsFile({
|
|
378
|
+
repoRoot,
|
|
379
|
+
rowsFile,
|
|
380
|
+
cleanupArtifact,
|
|
381
|
+
});
|
|
382
|
+
if (!decisionApplyContextRelevantToExpectedRowsFile({
|
|
383
|
+
repoRoot,
|
|
384
|
+
context,
|
|
385
|
+
expectedRowsFile,
|
|
386
|
+
})) {
|
|
387
|
+
return blockers;
|
|
388
|
+
}
|
|
389
|
+
if (context?.status !== "completed") {
|
|
390
|
+
blockers.push({
|
|
391
|
+
code: "full_context_ai_location_apply_not_completed",
|
|
392
|
+
stage: "full_context_ai_completion",
|
|
393
|
+
message: `dataset-location-decisions-apply status is ${context?.status || "missing"}.`,
|
|
394
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
const decisionTaskProofs = decisionTaskProofListFromContext(context);
|
|
398
|
+
if (decisionTaskProofs.length === 0) {
|
|
399
|
+
blockers.push(...fullContextDecisionTaskProofBlockers({
|
|
400
|
+
requirement,
|
|
401
|
+
proof: null,
|
|
402
|
+
label: "location",
|
|
403
|
+
}));
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
for (const proof of decisionTaskProofs) {
|
|
407
|
+
blockers.push(...fullContextDecisionTaskProofBlockers({
|
|
408
|
+
requirement,
|
|
409
|
+
proof,
|
|
410
|
+
label: "location",
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (cleanupArtifact && !expectedRowsFile) {
|
|
415
|
+
blockers.push({
|
|
416
|
+
code: "full_context_ai_location_cleanup_input_missing",
|
|
417
|
+
stage: "full_context_ai_completion",
|
|
418
|
+
message: "Location decision proof cannot be chained because the cleanup report does not record its input rows_file.",
|
|
419
|
+
rows_file: repoRelativePath(repoRoot, rowsFile),
|
|
420
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
421
|
+
cleanup_report: repoRelativePath(repoRoot, cleanupArtifact.path),
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
else if (!decisionApplyOutputRowsMatch(repoRoot, context, expectedRowsFile) &&
|
|
425
|
+
!decisionApplyRowsEquivalentToExpected(repoRoot, context, expectedRowsFile) &&
|
|
426
|
+
!decisionApplyContextCoversExpectedRowsIdentity({
|
|
427
|
+
repoRoot,
|
|
428
|
+
context,
|
|
429
|
+
expectedRowsFile,
|
|
430
|
+
}) &&
|
|
431
|
+
!decisionApplyOutputRowsChainThroughPatch(repoRoot, context, patchApplyContext, expectedRowsFile) &&
|
|
432
|
+
!decisionApplyOutputRowsChainThroughPatchAndIdentityRewrite(repoRoot, context, patchApplyContext, identityReferenceRewriteContext, expectedRowsFile) &&
|
|
433
|
+
!decisionApplyOutputRowsChainThroughIdentityRewrite(repoRoot, context, identityReferenceRewriteContext, expectedRowsFile) &&
|
|
434
|
+
!decisionApplyOutputRowsChainThroughUnresolvedExchangeExternalization(repoRoot, context, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
435
|
+
!decisionApplyOutputRowsChainThroughPatchAndUnresolvedExchangeExternalization(repoRoot, context, patchApplyContext, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
436
|
+
!decisionApplyOutputRowsChainThroughPatchIdentityRewriteAndUnresolvedExchangeExternalization(repoRoot, context, patchApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
437
|
+
!decisionApplyOutputRowsReachableThroughDeterministicTransforms({
|
|
438
|
+
repoRoot,
|
|
439
|
+
context,
|
|
440
|
+
expectedRowsFile,
|
|
441
|
+
patchApplyContext,
|
|
442
|
+
identityDecisionApplyContext,
|
|
443
|
+
identityReferenceRewriteContext,
|
|
444
|
+
unresolvedExchangeExternalizationContext,
|
|
445
|
+
sourceContactRewriteContext,
|
|
446
|
+
canonicalSupportRewriteContext,
|
|
447
|
+
cleanupContext,
|
|
448
|
+
})) {
|
|
449
|
+
blockers.push({
|
|
450
|
+
code: "full_context_ai_location_rows_mismatch",
|
|
451
|
+
stage: "full_context_ai_completion",
|
|
452
|
+
message: "Location decision apply report files.output_rows must match the cleanup input rows file, the exact mutation rows file, or the input rows of a completed patch apply report whose output rows then match that cleanup/mutation file.",
|
|
453
|
+
rows_file: repoRelativePath(repoRoot, rowsFile),
|
|
454
|
+
expected_output_rows_file: repoRelativePath(repoRoot, expectedRowsFile),
|
|
455
|
+
patch_apply_input_rows_file: patchApplyContext?.inputRowsFile
|
|
456
|
+
? repoRelativePath(repoRoot, patchApplyContext.inputRowsFile)
|
|
457
|
+
: null,
|
|
458
|
+
patch_apply_output_rows_files: patchApplyContext?.outputRows?.map((file) => repoRelativePath(repoRoot, file)) ?? [],
|
|
459
|
+
identity_reference_rewrite_input_rows_file: identityReferenceRewriteContext?.inputRowsFile
|
|
460
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.inputRowsFile)
|
|
461
|
+
: null,
|
|
462
|
+
identity_reference_rewrite_output_rows_file: identityReferenceRewriteContext?.outputRowsFile
|
|
463
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.outputRowsFile)
|
|
464
|
+
: null,
|
|
465
|
+
unresolved_exchange_externalization_input_rows_file: unresolvedExchangeExternalizationContext?.inputRowsFile
|
|
466
|
+
? repoRelativePath(repoRoot, unresolvedExchangeExternalizationContext.inputRowsFile)
|
|
467
|
+
: null,
|
|
468
|
+
unresolved_exchange_externalization_output_rows_file: unresolvedExchangeExternalizationContext?.outputRowsFile
|
|
469
|
+
? repoRelativePath(repoRoot, unresolvedExchangeExternalizationContext.outputRowsFile)
|
|
470
|
+
: null,
|
|
471
|
+
source_contact_rewrite_input_rows_file: sourceContactRewriteContext?.inputRowsFile
|
|
472
|
+
? repoRelativePath(repoRoot, sourceContactRewriteContext.inputRowsFile)
|
|
473
|
+
: null,
|
|
474
|
+
source_contact_rewrite_output_rows_file: sourceContactRewriteContext?.outputRowsFile
|
|
475
|
+
? repoRelativePath(repoRoot, sourceContactRewriteContext.outputRowsFile)
|
|
476
|
+
: null,
|
|
477
|
+
canonical_support_rewrite_input_rows_file: canonicalSupportRewriteContext?.inputRowsFile
|
|
478
|
+
? repoRelativePath(repoRoot, canonicalSupportRewriteContext.inputRowsFile)
|
|
479
|
+
: null,
|
|
480
|
+
canonical_support_rewrite_output_rows_file: canonicalSupportRewriteContext?.outputRowsFile
|
|
481
|
+
? repoRelativePath(repoRoot, canonicalSupportRewriteContext.outputRowsFile)
|
|
482
|
+
: null,
|
|
483
|
+
cleanup_input_rows_file: cleanupContext?.inputRowsFile
|
|
484
|
+
? repoRelativePath(repoRoot, cleanupContext.inputRowsFile)
|
|
485
|
+
: null,
|
|
486
|
+
cleanup_output_rows_file: cleanupContext?.outputRowsFile
|
|
487
|
+
? repoRelativePath(repoRoot, cleanupContext.outputRowsFile)
|
|
488
|
+
: null,
|
|
489
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
if (!context?.decisions?.length) {
|
|
493
|
+
blockers.push({
|
|
494
|
+
code: "full_context_ai_location_decision_evidence_required",
|
|
495
|
+
stage: "full_context_ai_completion",
|
|
496
|
+
message: "Location decision apply report must point to at least one AI-authored location decision.",
|
|
497
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
498
|
+
});
|
|
499
|
+
return blockers;
|
|
500
|
+
}
|
|
501
|
+
const missingBasis = context.decisions.filter((decision) => !asText(decision?.basis));
|
|
502
|
+
if (missingBasis.length > 0) {
|
|
503
|
+
blockers.push({
|
|
504
|
+
code: "full_context_ai_location_basis_missing",
|
|
505
|
+
stage: "full_context_ai_completion",
|
|
506
|
+
message: "Every location decision must include basis.",
|
|
507
|
+
count: missingBasis.length,
|
|
508
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
const missingEvidence = context.decisions.filter((decision) => !decision?.evidence || typeof decision.evidence !== "object");
|
|
512
|
+
if (missingEvidence.length > 0) {
|
|
513
|
+
blockers.push({
|
|
514
|
+
code: "full_context_ai_location_evidence_missing",
|
|
515
|
+
stage: "full_context_ai_completion",
|
|
516
|
+
message: "Every location decision must include structured evidence.",
|
|
517
|
+
count: missingEvidence.length,
|
|
518
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
const notCompleted = context.decisions.filter((decision) => classificationDecisionCompletionStatus(decision) !== "completed");
|
|
522
|
+
if (notCompleted.length > 0) {
|
|
523
|
+
blockers.push({
|
|
524
|
+
code: "full_context_ai_location_decision_status_not_completed",
|
|
525
|
+
stage: "full_context_ai_completion",
|
|
526
|
+
message: "Every location decision used as full-context AI evidence must declare decision_status=completed.",
|
|
527
|
+
count: notCompleted.length,
|
|
528
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
const missingContextKinds = [];
|
|
532
|
+
for (const decision of context.decisions) {
|
|
533
|
+
const usedKinds = new Set(classificationDecisionContextKinds(decision));
|
|
534
|
+
for (const requiredKind of requirement.requiredContextKinds) {
|
|
535
|
+
if (!usedKinds.has(requiredKind)) {
|
|
536
|
+
missingContextKinds.push({ decision, requiredKind });
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (missingContextKinds.length > 0) {
|
|
541
|
+
blockers.push({
|
|
542
|
+
code: "full_context_ai_location_context_missing",
|
|
543
|
+
stage: "full_context_ai_completion",
|
|
544
|
+
message: "Location decision used_context_kinds must include every required full-context kind for this profile.",
|
|
545
|
+
count: missingContextKinds.length,
|
|
546
|
+
required_context_kinds: requirement.requiredContextKinds,
|
|
547
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const expectedContextBundleSha256AnyOf = decisionTaskContextBundleHashesFromContext(context);
|
|
551
|
+
if (expectedContextBundleSha256AnyOf.length > 0) {
|
|
552
|
+
const mismatchedContextBundle = context.decisions.filter((decision) => !expectedContextBundleSha256AnyOf.includes(classificationDecisionContextBundleSha256(decision)));
|
|
553
|
+
if (mismatchedContextBundle.length > 0) {
|
|
554
|
+
blockers.push({
|
|
555
|
+
code: "full_context_ai_location_context_bundle_mismatch",
|
|
556
|
+
stage: "full_context_ai_completion",
|
|
557
|
+
message: "Every location decision must reference one of the AI decision task context_bundle_sha256 values.",
|
|
558
|
+
count: mismatchedContextBundle.length,
|
|
559
|
+
expected_context_bundle_sha256: expectedContextBundleSha256AnyOf.length === 1
|
|
560
|
+
? expectedContextBundleSha256AnyOf[0]
|
|
561
|
+
: null,
|
|
562
|
+
expected_context_bundle_sha256_any_of: expectedContextBundleSha256AnyOf,
|
|
563
|
+
artifact: repoRelativePath(repoRoot, locationDecisionApplyArtifact.path),
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return blockers;
|
|
568
|
+
}
|
|
569
|
+
export function buildIdentityDecisionFullContextBlockers({ repoRoot, rowsFile, cleanupArtifact, requirement, identityDecisionApplyArtifact, identityDecisionApplyContext, classificationDecisionApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, sourceContactRewriteContext, canonicalSupportRewriteContext, cleanupContext, }) {
|
|
570
|
+
const blockers = [];
|
|
571
|
+
if (!identityDecisionApplyArtifact)
|
|
572
|
+
return blockers;
|
|
573
|
+
const context = identityDecisionApplyContext;
|
|
574
|
+
if (context?.status !== "completed") {
|
|
575
|
+
blockers.push({
|
|
576
|
+
code: "full_context_ai_identity_apply_not_completed",
|
|
577
|
+
stage: "full_context_ai_completion",
|
|
578
|
+
message: `dataset-identity-decisions-apply status is ${context?.status || "missing"}.`,
|
|
579
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
const expectedRowsFile = decisionApplyExpectedRowsFile({
|
|
583
|
+
repoRoot,
|
|
584
|
+
rowsFile,
|
|
585
|
+
cleanupArtifact,
|
|
586
|
+
});
|
|
587
|
+
const contextRelevantToRows = decisionApplyContextRelevantToExpectedRowsFile({
|
|
588
|
+
repoRoot,
|
|
589
|
+
context,
|
|
590
|
+
expectedRowsFile,
|
|
591
|
+
});
|
|
592
|
+
if (cleanupArtifact && !expectedRowsFile) {
|
|
593
|
+
blockers.push({
|
|
594
|
+
code: "full_context_ai_identity_cleanup_input_missing",
|
|
595
|
+
stage: "full_context_ai_completion",
|
|
596
|
+
message: "Identity decision proof cannot be chained because the cleanup report does not record its input rows_file.",
|
|
597
|
+
rows_file: repoRelativePath(repoRoot, rowsFile),
|
|
598
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
599
|
+
cleanup_report: repoRelativePath(repoRoot, cleanupArtifact.path),
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
else if (contextRelevantToRows &&
|
|
603
|
+
!decisionApplyOutputRowsMatch(repoRoot, context, expectedRowsFile) &&
|
|
604
|
+
!decisionApplyContextCoversExpectedRowsIdentity({
|
|
605
|
+
repoRoot,
|
|
606
|
+
context,
|
|
607
|
+
expectedRowsFile,
|
|
608
|
+
}) &&
|
|
609
|
+
!decisionApplyOutputRowsChainThroughIdentityRewrite(repoRoot, context, identityReferenceRewriteContext, expectedRowsFile) &&
|
|
610
|
+
!decisionApplyOutputRowsChainThroughIdentityRewriteAndUnresolvedExchangeExternalization(repoRoot, context, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
611
|
+
!decisionApplyOutputRowsChainThroughClassification(repoRoot, context, classificationDecisionApplyContext, expectedRowsFile) &&
|
|
612
|
+
!decisionApplyOutputRowsChainThroughClassificationAndIdentityRewrite(repoRoot, context, classificationDecisionApplyContext, identityReferenceRewriteContext, expectedRowsFile) &&
|
|
613
|
+
!decisionApplyOutputRowsChainThroughClassificationIdentityRewriteAndUnresolvedExchangeExternalization(repoRoot, context, classificationDecisionApplyContext, identityReferenceRewriteContext, unresolvedExchangeExternalizationContext, expectedRowsFile) &&
|
|
614
|
+
!identityDecisionApplyProvesReferenceRewrite(repoRoot, context, identityReferenceRewriteContext) &&
|
|
615
|
+
!decisionApplyOutputRowsReachableThroughDeterministicTransforms({
|
|
616
|
+
repoRoot,
|
|
617
|
+
context,
|
|
618
|
+
expectedRowsFile,
|
|
619
|
+
classificationDecisionApplyContext,
|
|
620
|
+
identityReferenceRewriteContext,
|
|
621
|
+
unresolvedExchangeExternalizationContext,
|
|
622
|
+
sourceContactRewriteContext,
|
|
623
|
+
canonicalSupportRewriteContext,
|
|
624
|
+
cleanupContext,
|
|
625
|
+
})) {
|
|
626
|
+
blockers.push({
|
|
627
|
+
code: "full_context_ai_identity_rows_mismatch",
|
|
628
|
+
stage: "full_context_ai_completion",
|
|
629
|
+
message: "Identity decision apply report files.output_rows must match the cleanup input rows file, the exact mutation rows file, feed a completed identity reference rewrite / unresolved exchange externalization chain, or provide an identity-reference-rewrites file used by this scope.",
|
|
630
|
+
rows_file: repoRelativePath(repoRoot, rowsFile),
|
|
631
|
+
expected_output_rows_file: repoRelativePath(repoRoot, expectedRowsFile),
|
|
632
|
+
identity_reference_rewrite_input_rows_file: identityReferenceRewriteContext?.inputRowsFile
|
|
633
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.inputRowsFile)
|
|
634
|
+
: null,
|
|
635
|
+
identity_reference_rewrite_output_rows_file: identityReferenceRewriteContext?.outputRowsFile
|
|
636
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.outputRowsFile)
|
|
637
|
+
: null,
|
|
638
|
+
classification_decision_apply_input_rows_files: classificationDecisionApplyContext?.inputRows?.map((file) => repoRelativePath(repoRoot, file)) ?? [],
|
|
639
|
+
classification_decision_apply_output_rows_files: classificationDecisionApplyContext?.outputRows?.map((file) => repoRelativePath(repoRoot, file)) ?? [],
|
|
640
|
+
unresolved_exchange_externalization_input_rows_file: unresolvedExchangeExternalizationContext?.inputRowsFile
|
|
641
|
+
? repoRelativePath(repoRoot, unresolvedExchangeExternalizationContext.inputRowsFile)
|
|
642
|
+
: null,
|
|
643
|
+
unresolved_exchange_externalization_output_rows_file: unresolvedExchangeExternalizationContext?.outputRowsFile
|
|
644
|
+
? repoRelativePath(repoRoot, unresolvedExchangeExternalizationContext.outputRowsFile)
|
|
645
|
+
: null,
|
|
646
|
+
source_contact_rewrite_input_rows_file: sourceContactRewriteContext?.inputRowsFile
|
|
647
|
+
? repoRelativePath(repoRoot, sourceContactRewriteContext.inputRowsFile)
|
|
648
|
+
: null,
|
|
649
|
+
source_contact_rewrite_output_rows_file: sourceContactRewriteContext?.outputRowsFile
|
|
650
|
+
? repoRelativePath(repoRoot, sourceContactRewriteContext.outputRowsFile)
|
|
651
|
+
: null,
|
|
652
|
+
canonical_support_rewrite_input_rows_file: canonicalSupportRewriteContext?.inputRowsFile
|
|
653
|
+
? repoRelativePath(repoRoot, canonicalSupportRewriteContext.inputRowsFile)
|
|
654
|
+
: null,
|
|
655
|
+
canonical_support_rewrite_output_rows_file: canonicalSupportRewriteContext?.outputRowsFile
|
|
656
|
+
? repoRelativePath(repoRoot, canonicalSupportRewriteContext.outputRowsFile)
|
|
657
|
+
: null,
|
|
658
|
+
cleanup_input_rows_file: cleanupContext?.inputRowsFile
|
|
659
|
+
? repoRelativePath(repoRoot, cleanupContext.inputRowsFile)
|
|
660
|
+
: null,
|
|
661
|
+
cleanup_output_rows_file: cleanupContext?.outputRowsFile
|
|
662
|
+
? repoRelativePath(repoRoot, cleanupContext.outputRowsFile)
|
|
663
|
+
: null,
|
|
664
|
+
identity_decision_reference_rewrites_file: context?.identityReferenceRewritesFile
|
|
665
|
+
? repoRelativePath(repoRoot, context.identityReferenceRewritesFile)
|
|
666
|
+
: null,
|
|
667
|
+
identity_reference_rewrites_file: identityReferenceRewriteContext?.sourceFile
|
|
668
|
+
? repoRelativePath(repoRoot, identityReferenceRewriteContext.sourceFile)
|
|
669
|
+
: null,
|
|
670
|
+
identity_reference_rewrite_rows: identityReferenceRewriteContext?.scopedRows?.length ?? 0,
|
|
671
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
if (!context?.decisions?.length) {
|
|
675
|
+
blockers.push({
|
|
676
|
+
code: "full_context_ai_identity_decision_evidence_required",
|
|
677
|
+
stage: "full_context_ai_completion",
|
|
678
|
+
message: "Identity decision apply report must point to at least one AI-authored identity decision.",
|
|
679
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
680
|
+
});
|
|
681
|
+
return blockers;
|
|
682
|
+
}
|
|
683
|
+
const packageProofs = ensureArray(context.authoringPackageProofs);
|
|
684
|
+
if (packageProofs.length === 0) {
|
|
685
|
+
blockers.push({
|
|
686
|
+
code: "full_context_ai_identity_authoring_package_required",
|
|
687
|
+
stage: "full_context_ai_completion",
|
|
688
|
+
message: "Identity decisions must reference readable full-context authoring packages before remote write planning.",
|
|
689
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
for (const proof of packageProofs) {
|
|
694
|
+
blockers.push(...fullContextPackageProofBlockers({
|
|
695
|
+
requirement,
|
|
696
|
+
proof: proof,
|
|
697
|
+
}));
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const missingPackageBinding = context.decisions.filter((decision) => !identityDecisionPackageReference(decision) || !identityDecisionPackageSha(decision));
|
|
701
|
+
if (missingPackageBinding.length > 0) {
|
|
702
|
+
blockers.push({
|
|
703
|
+
code: "full_context_ai_identity_package_binding_missing",
|
|
704
|
+
stage: "full_context_ai_completion",
|
|
705
|
+
message: "Every identity decision must include authoring_package and authoring_package_sha256.",
|
|
706
|
+
count: missingPackageBinding.length,
|
|
707
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
const missingBasis = context.decisions.filter((decision) => !asText(decision?.basis ?? decision?.reason));
|
|
711
|
+
if (missingBasis.length > 0) {
|
|
712
|
+
blockers.push({
|
|
713
|
+
code: "full_context_ai_identity_basis_missing",
|
|
714
|
+
stage: "full_context_ai_completion",
|
|
715
|
+
message: "Every identity decision must include basis.",
|
|
716
|
+
count: missingBasis.length,
|
|
717
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
const missingEvidence = context.decisions.filter((decision) => !decision?.evidence || typeof decision.evidence !== "object");
|
|
721
|
+
if (missingEvidence.length > 0) {
|
|
722
|
+
blockers.push({
|
|
723
|
+
code: "full_context_ai_identity_evidence_missing",
|
|
724
|
+
stage: "full_context_ai_completion",
|
|
725
|
+
message: "Every identity decision must include structured evidence.",
|
|
726
|
+
count: missingEvidence.length,
|
|
727
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
const notCompleted = context.decisions.filter((decision) => classificationDecisionCompletionStatus(decision) !== "completed");
|
|
731
|
+
if (notCompleted.length > 0) {
|
|
732
|
+
blockers.push({
|
|
733
|
+
code: "full_context_ai_identity_decision_status_not_completed",
|
|
734
|
+
stage: "full_context_ai_completion",
|
|
735
|
+
message: "Every identity decision used as full-context AI evidence must declare decision_status=completed.",
|
|
736
|
+
count: notCompleted.length,
|
|
737
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
const missingClosures = context.decisions.filter((decision) => !identityDecisionClosesAction(decision, "identity_preflight_manual_review") &&
|
|
741
|
+
!identityDecisionClosesAction(decision, "elementary_flow_identity_manual_review"));
|
|
742
|
+
if (missingClosures.length > 0) {
|
|
743
|
+
blockers.push({
|
|
744
|
+
code: "full_context_ai_identity_action_closure_missing",
|
|
745
|
+
stage: "full_context_ai_completion",
|
|
746
|
+
message: "Every identity decision must close identity_preflight_manual_review or elementary_flow_identity_manual_review.",
|
|
747
|
+
count: missingClosures.length,
|
|
748
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
const missingCanonical = context.decisions.filter((decision) => identityDecisionValue(decision) === "reuse_existing_reference" &&
|
|
752
|
+
!identityDecisionCanonical(decision));
|
|
753
|
+
if (missingCanonical.length > 0) {
|
|
754
|
+
blockers.push({
|
|
755
|
+
code: "full_context_ai_identity_canonical_missing",
|
|
756
|
+
stage: "full_context_ai_completion",
|
|
757
|
+
message: "reuse_existing_reference identity decisions must include canonical ref_object_id/version.",
|
|
758
|
+
count: missingCanonical.length,
|
|
759
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
const missingContextKinds = [];
|
|
763
|
+
for (const decision of context.decisions) {
|
|
764
|
+
const usedKinds = new Set(classificationDecisionContextKinds(decision));
|
|
765
|
+
for (const requiredKind of requirement.requiredContextKinds) {
|
|
766
|
+
if (!usedKinds.has(requiredKind)) {
|
|
767
|
+
missingContextKinds.push({ decision, requiredKind });
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (missingContextKinds.length > 0) {
|
|
772
|
+
blockers.push({
|
|
773
|
+
code: "full_context_ai_identity_context_missing",
|
|
774
|
+
stage: "full_context_ai_completion",
|
|
775
|
+
message: "Identity decision used_context_kinds must include every required full-context kind for this profile.",
|
|
776
|
+
count: missingContextKinds.length,
|
|
777
|
+
required_context_kinds: requirement.requiredContextKinds,
|
|
778
|
+
artifact: repoRelativePath(repoRoot, identityDecisionApplyArtifact.path),
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
return blockers;
|
|
782
|
+
}
|