@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,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Foundry Task Contracts
|
|
3
|
+
docType: contract
|
|
4
|
+
scope: task-ledger
|
|
5
|
+
status: active
|
|
6
|
+
authoritative: true
|
|
7
|
+
owner: tiangong-lca-data-foundry
|
|
8
|
+
language: en
|
|
9
|
+
whenToUse:
|
|
10
|
+
- when creating or validating Foundry task workspace artifacts
|
|
11
|
+
- when deciding what belongs in foundry-job, source, seed, checkpoint, or artifact ledgers
|
|
12
|
+
whenToUpdate:
|
|
13
|
+
- when Foundry task, workspace, checkpoint, or artifact contracts change
|
|
14
|
+
- when new lanes or owner route fields become required
|
|
15
|
+
checkPaths:
|
|
16
|
+
- docs/foundry-task-contracts.md
|
|
17
|
+
- AGENTS.md
|
|
18
|
+
- WORKFLOW.md
|
|
19
|
+
- scripts/lib/foundry-task-store.ts
|
|
20
|
+
- scripts/lib/foundry-task-authorization.ts
|
|
21
|
+
- scripts/lib/foundry-execution-admission.ts
|
|
22
|
+
- scripts/foundry-facade.ts
|
|
23
|
+
- scripts/lib/foundry-facade-store.ts
|
|
24
|
+
- scripts/lib/foundry-task-start-spec.ts
|
|
25
|
+
- scripts/lib/foundry-package-contract.ts
|
|
26
|
+
- docs/package-distribution-contract.md
|
|
27
|
+
- specs/schemas/authorization-derivation.schema.json
|
|
28
|
+
- specs/schemas/execution-context.schema.json
|
|
29
|
+
- specs/import-profiles.json
|
|
30
|
+
- tasks/**
|
|
31
|
+
lastReviewedAt: 2026-09-08
|
|
32
|
+
lastReviewedCommit: 73b74f070dcfa3864474c4061c7cebb6020e43f0
|
|
33
|
+
lastReviewedNote: "Reviewed for Foundry #125: positive dependent-scope fixtures use a logical Date clock to avoid hardware-time expiry. A separate runtime identity regression advances beyond60seconds and requires a new owner receipt. Production freshness, task binding, authorization, execution and no-replay behavior are unchanged."
|
|
34
|
+
related:
|
|
35
|
+
- AGENTS.md
|
|
36
|
+
- WORKFLOW.md
|
|
37
|
+
- docs/runtime-skill-management.md
|
|
38
|
+
- specs/import-profiles.json
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# Foundry Task Contracts
|
|
42
|
+
|
|
43
|
+
The v2 task store is implemented by `foundry-task-registration.ts`, `foundry-task-store.ts`, `foundry-task-io.ts` and `foundry-task-types.ts`. It keeps source/profile/task identity separate from permissions and reuses the published CLI's `withBatchRunLock` for local metadata transactions. It does not perform database mutations or replace the CLI's consumed-attempt/readback recovery contract.
|
|
44
|
+
|
|
45
|
+
The earlier v1 examples at commit `ad9c885dde64b22f6e0a8e17f9da46bdba5345ef` remain historical input for W10. Existing unregistered directories, v1 jobs, locks and attempts are never relabeled as v2 automatically. Real task #95 remains outside migration scope.
|
|
46
|
+
|
|
47
|
+
Installing or verifying `@tiangong-lca/foundry` does not create, migrate or relabel task state. Package descriptor/file identity becomes the runtime facts recorded by newly created jobs. Existing jobs whose package identity differs require the explicit compatibility/migration path; a new package directory cannot reset their source, authorization, artifact or attempt ledgers.
|
|
48
|
+
|
|
49
|
+
## Layout and authority
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
<workspace>/.foundry/state/
|
|
53
|
+
task-locks/<task-id>.*
|
|
54
|
+
task-registrations/<task-id>.json
|
|
55
|
+
task-publications/<task-id>.json
|
|
56
|
+
task-accounts/<task-id>.json
|
|
57
|
+
task-authorizations/<task-id>/<authorization-sha256>.json
|
|
58
|
+
task-initialization/<owned-staging-id>/
|
|
59
|
+
facade-requests/<request-sha256>.json
|
|
60
|
+
facade-tasks/<task-id>.json
|
|
61
|
+
facade-request-locks/<request-sha256>.*
|
|
62
|
+
<workspace>/.foundry/workspaces/<task-id>/
|
|
63
|
+
foundry-job.json
|
|
64
|
+
source-manifest.json
|
|
65
|
+
profile-lock.json
|
|
66
|
+
seed-manifest.json # source-evidence lane only
|
|
67
|
+
account-intent.json # once an expected account is selected
|
|
68
|
+
authorization.json # current pointer; not a raw self-authorizing grant
|
|
69
|
+
artifact-index.jsonl
|
|
70
|
+
checkpoints/<operation-id>.plan.json
|
|
71
|
+
checkpoints/<operation-id>.json
|
|
72
|
+
evidence/authorizations/<grant-id>/
|
|
73
|
+
evidence/executions/<execution-context-sha256>.json
|
|
74
|
+
outputs/<operation-revision>/
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Workspace registration retains the complete intended job/source/profile/seed metadata and a content digest. The task-local copies must match it. Account intent and approved grants also have separate immutable workspace registrations. These records contain no passwords, access tokens or session contents.
|
|
78
|
+
|
|
79
|
+
Local native-import and CLI context-pack stages use the existing operation plan, receipt and artifact index. A successful repeated stage reuses its checked receipt. Native output is inspected before registration; CLI context runs in a fresh task-contained generation so its file references remain valid. Interrupted unindexed generations are not accepted as completed stages. Neither conversion nor context readiness supplies content acceptance, identity or write authority.
|
|
80
|
+
|
|
81
|
+
Row materialization and assessment also use this local transaction. Materialized rows preserve domain payloads and row metadata, normalize typed API payload wrappers to the CLI-compatible `json` slot, and retain a producer chain to the original selected seed or primary native dataset. Original wrappers remain in the frozen source; bundled copies are excluded from row selection. Assessment reads only selected indexed rows/context, then registers native validation, local QA, queue, curation and authoring outputs. Its report records the owner's resolution base for relative references. Pending work is a current artifact state, not permission to execute a rendered command or dispatch a remote write.
|
|
82
|
+
|
|
83
|
+
Identity preflight runs its qualified, account-bound remote reads before a local transaction captures the resulting files. Each capture has a distinct invocation identity and rechecks current rows under the task lock; the receipt cannot replay a query. A completed identity report binds the current row manifest and its combined preflight index, invalidating earlier assessments until curation consumes that index. Failed reads retain diagnostics and can be retried by a later resume; status remains read-only over stored files. Current-account write admission still requires fresh identity and separate authorization.
|
|
84
|
+
|
|
85
|
+
Facade request indexes map one explicit request id to retained task revisions. The request key binds workspace id plus request id; a revision fingerprint binds the strict task-start spec and ordered canonical source path/bytes/SHA facts. Task ids include the complete request SHA-256 plus the revision ordinal, avoiding a shorter cross-request namespace. A changed source path or content, actor/account, lane/profile/entity scope, seed or preparation creates a predecessor-bound task rather than editing the prior job. Same-fingerprint concurrent starts serialize through the CLI-owned lock and return the same task bytes. The immutable task pointer names one exact revision record; status never locates authority by scanning task directories. If a host stops after publishing a task but before appending its request revision, only the original spec can complete that interrupted registration; a different retry returns `facade_crash_recovery_conflict` and identifies the deterministic task id.
|
|
86
|
+
|
|
87
|
+
## Task creation and recovery
|
|
88
|
+
|
|
89
|
+
Public authorization result records identify the current finalization, concrete input scope, grant/pointer digests, expiry and optional sealed handoff/capsule. The grant and approval snapshots remain owned by the existing authorization registry. State projection uses only a matching active pointer, current finalization and unexpired result; it is not execution admission. Registration and snapshot sealing never run a database command, and duplicate current approval reuses the recorded result.
|
|
90
|
+
|
|
91
|
+
An approved preparation continuation records its source approval digest in the new finalization. This retained relationship permits recovery when the derived grant has activated but the sealed-result capture was interrupted. The continuation independently reloads current authority, validates the original grant and exact successor content, and proves row lineage before sealing. A stale or unrelated active grant cannot be substituted. Producer indexing is shared by input verification and explicit ancestry proof, retaining all candidate order and earlier-sequence checks within each call.
|
|
92
|
+
|
|
93
|
+
Semantic submissions bind current assessment and work-item digests independently of their supplied files. Accepted input, its projected collection manifest, local CLI result and new row manifest enter the same receipt/index lineage. A blocked application may retain a diagnostic output but publishes no new current-row manifest. Current row selection follows the latest registered row-manifest producer, and an assessment is current only for those row files. The semantic transaction checks current selection again while holding the task lock; it cannot publish a stale result after another submission advanced the task.
|
|
94
|
+
|
|
95
|
+
Identity application adds retained `identity_reports` and `identity_rewrite_reports` to current row manifests. These reports preserve source rows, reference-only partitions and dependent rewrites when local write candidates shrink to zero; zero candidates alone never proves completion. Failed/unresolved application keeps its diagnostic artifacts without replacing current rows. Assessment reads only selected report facts and passes their existing owner evidence into curation.
|
|
96
|
+
|
|
97
|
+
Producer lookup builds a verification-local index keyed by resolved path, content digest and byte count. It retains original index order and the strict earlier-sequence requirement. Paths, original source bytes, producer receipts/plans and selected artifact bytes are still validated; the lookup is discarded after each verification and is not a cross-operation trust cache.
|
|
98
|
+
|
|
99
|
+
Finalization captures existing owner outputs in a distinct generation after read-only work. It uses current row-manifest ancestry to select semantic reports and retains their originals. Fresh per-type identity request/output paths prevent legacy refresh logic from rewriting already indexed evidence; dependency entries are preserved and execution is limited to the current type. The capture verifies selected lineage before reads and current rows under the lock. A `foundry-finalize.json` record is current only for its exact rows and assessment, and repeated pending resume does not rerun finalization. A ready record requests authorization and is not a completed task or mutation receipt.
|
|
100
|
+
|
|
101
|
+
`foundry-job.json` uses `tiangong-foundry.job.v2`. It binds workspace/task/actor/request identity, lane, target profile/entity types, source/profile/optional seed content references, current runtime manifest/entry identity, UTC creation time, and the default `write_policy` of `dry-run` with remote state 0. Task metadata cannot enable a remote write by changing that policy object. Actual permission requires the separate reviewed authorization/execution boundary.
|
|
102
|
+
|
|
103
|
+
Creation validates selected source bytes and package profile before writing. It builds complete metadata in an owned private staging directory, saves an immutable workspace registration, and publishes the task directory by rename. A publication receipt must exist before operations proceed. A registration without a published task may complete only the same interrupted initialization. Once publication is recorded, a missing task directory is a recovery/audit condition; it must not be recreated with empty operation or attempt history. Missing publication evidence over existing outputs/attempts is ambiguous and remains blocked.
|
|
104
|
+
|
|
105
|
+
Changed actor, task, workspace, request, profile or target entity intent is rejected. Runtime or profile changes require the pinned version or an explicit migration; they cannot silently invalidate earlier attempts. Same-task local metadata operations serialize under one CLI-owned lock. The lock protects metadata, not permission: acquiring it grants no data authority.
|
|
106
|
+
|
|
107
|
+
## Frozen inputs and profile
|
|
108
|
+
|
|
109
|
+
`source-manifest.json` uses `tiangong-foundry.source-manifest.v2` and records the original canonical selected file paths, byte sizes and SHA-256 values, along with workspace/task identity. Current original sources must still match their frozen facts. Unavailable or changed sources require restoration or an explicit new revision. A new revision must retain previous mutation/attempt authority as required by W10; this store does not reset it.
|
|
110
|
+
|
|
111
|
+
`profile-lock.json` uses `tiangong-foundry.profile-lock.v2` and preserves the selected raw profile and its digest. The lock bytes must match both the registered job reference and the current package's profile. Historical profile authorization flags are not current permission.
|
|
112
|
+
|
|
113
|
+
The source-evidence lane additionally requires a retained `seed-manifest.json`. The W05 `task-start.v1` spec requires the JSON seed to be one of the independently selected source files. Intake freezes it but does not claim semantic completeness; storing a seed alone does not prove it is ready for authoring.
|
|
114
|
+
|
|
115
|
+
## Local operation plans and receipts
|
|
116
|
+
|
|
117
|
+
The first admitted transaction is deterministic local `dataset-curation-cleanup`. Remote mutations, network-driven work and batch execution must not be routed through its replay path.
|
|
118
|
+
|
|
119
|
+
An operation id binds job bytes, command, exact selected input facts and normalized options. Its immutable plan retains a fixed operation time, so interrupted deterministic preparation can reproduce its artifacts without overwriting prior bytes. A successful operation records all output facts and the exact returned report, then atomically updates `artifact-index.jsonl`. Repeating the same request reads only the matching completed local receipt and revalidates outputs; it does not rerun the command or append duplicate records.
|
|
120
|
+
|
|
121
|
+
A completed _operation receipt_ means its local invocation produced recorded output. It does not mean the business task is completed or that a blocked cleanup report passed its gates. The facade must interpret the actual result and required completion/readback evidence.
|
|
122
|
+
|
|
123
|
+
## Artifact lineage
|
|
124
|
+
|
|
125
|
+
The v2 JSONL index records sequence, previous record digest, operation/command/input-scope identity, producer receipt reference, task-relative artifact path, byte size and SHA-256. The index points to artifacts; it does not copy payloads. It is replaced atomically under the metadata lock, with previous-byte comparison and bounded size. Truncated, malformed or changed chains are rejected.
|
|
126
|
+
|
|
127
|
+
A derived input must match an indexed output. Its completed producer receipt and plan must match the same job and content digests; every ancestor must lead through earlier index entries to frozen original source. The lineage walk verifies every receipt and plan again and explores every matching earlier producer, so reproducing identical output bytes cannot hide another valid ancestry path. Arbitrary files placed under `outputs/` do not become trusted inputs. Changing a parent receipt or plan invalidates continuation. Current selected input bytes are checked again, including before a local operation receipt is finalized.
|
|
128
|
+
|
|
129
|
+
## Account and authorization
|
|
130
|
+
|
|
131
|
+
Account registration optionally stores `account_mode` from explicit task/host intent. Omitted legacy records retain their bytes and mean ordinary; production-test records cannot be downgraded on the same task. Request fingerprints and migration task templates retain an explicit mode. This verification policy grants no additional write action.
|
|
132
|
+
|
|
133
|
+
An expected account may be selected after local preparation. The first selection is registered as project/user intent; subsequent disagreement is rejected. A missing task-local account file may only be restored from its existing workspace registration. This is intent, not proof of authentication.
|
|
134
|
+
|
|
135
|
+
`verifyFoundryRuntimeIdentity` invokes the exact installed CLI through executable/argv in a fresh private CWD with a restricted environment. The CLI owns OAuth/session refresh and server identity verification. Returned proof is immutable, process-local and bound to workspace/task/actor/runtime, with a 60-second freshness check at permission admission. Serialized proof is not reusable authority. Headless mode uses the CLI's existing explicit target and process-only access token, with cache disabled and no token persistence. CLI 0.1.12 reports no token-expiry timestamp for that mode; Foundry does not invent one or claim a separately verified token lifetime.
|
|
136
|
+
|
|
137
|
+
`registerFoundryTaskAuthorization` is an explicit host approval operation. It requires fresh identity, current task/input lineage, a valid W03 grant, and independently selected evidence facts supplied by the trusted caller. The grant cannot select its own evidence paths. Each original evidence file is rechecked and copied into an immutable task snapshot; the grant and selection are registered in workspace state. Updating `authorization.json` uses compare-and-swap against its prior digest and preserves historical grants. Unknown legacy authorization files are not overwritten.
|
|
138
|
+
|
|
139
|
+
`loadFoundryTaskAuthorization` rechecks live identity, task registration, input lineage, active pointer/registration, grant expiry/scope and both evidence snapshots and originals. A previous grant cannot be relabeled for changed or derived inputs. Reusing its approval requires a qualified, process-local derivation that proves ancestry, changes only the input digest, retains authority bounds and records `authorization-derivation.v1` evidence. The active parent pointer is checked around preparation and captured for later compare-and-swap. A separately reviewed approval may instead register the exact derived bytes directly. Login, task creation, local preparation and an empty grant never grant publication, deletion or restricted write actions.
|
|
140
|
+
|
|
141
|
+
Before a restricted child handoff, the runtime stores a content-addressed `execution-context.v1` under task evidence. A new process must reconstruct the context, qualification and identity, then recheck source ancestry, final bytes, current authorization/QA exceptions, owner CLI path and CommandSpec operation semantics. Only the verified spec is returned to the existing no-replay executor. The execution context never carries credentials and never clears or retries an attempt.
|
|
142
|
+
|
|
143
|
+
The public facade projects preparation, sealed approval, owner execution and independent readback through the result envelope. Before dispatch, the dedicated execution-consume operation registers an immutable `attempts/owner-v1/<scope>/consumed.json` output with producer evidence; other local operations cannot write task-control paths. Recognized consumed requests resume readback only, while unknown attempts remain blocked. Completion requires a current producer-backed completion report or verified current write scopes plus independent verification of all current canonical reference partitions. Inspect revalidates completion, execution requests, consumed markers, observations, owner results and canonical reference verification results against their exact producer plans, receipts and current bytes. A forged index entry borrowing another operation receipt cannot prove completion. No child command is inferred from a directory name.
|
|
144
|
+
|
|
145
|
+
The request store revalidates every predecessor's retained job against its publication and indexed identity before admitting a new revision or returning a descendant for status/resume. A nonempty predecessor attempt directory blocks the descendant and directs recovery to the original owner; its declared success/unknown state never clears the guard. Missing or altered predecessor state is an audit condition, not permission to reconstruct an empty history. This facade guard does not by itself establish complete migration history, cross-request inheritance or restricted execution admission.
|
|
146
|
+
|
|
147
|
+
Explicit migration preserves original records and creates current registrations only for independently admitted local preparation. The adoption callback remains pending and expires after preparation; activation anchors the archive and immutable current registrations. Read-only inspection can validate retained runtime/profile bytes without matching current write rules and without taking a write lock. Mutation admission rechecks retained dataset scope independently of new request/path/runtime labels; terminal or unresolved work is not a new executable task. Subsequent migration retains origin ids and rechecks later attempts. See the workspace migration contract for scope limitations and original-owner recovery.
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: BAFU TIDAS Import Constraints
|
|
3
|
+
docType: import-constraints
|
|
4
|
+
scope: bafu
|
|
5
|
+
status: draft
|
|
6
|
+
owner: tiangong-lca-data-foundry
|
|
7
|
+
related:
|
|
8
|
+
- docs/import-profiles/bafu/profile.md
|
|
9
|
+
- docs/import-profiles/bafu/state-code-100-name-shapes.md
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# BAFU TIDAS Import Constraints
|
|
13
|
+
|
|
14
|
+
本文记录 BAFU 数据处理约束,用于把完整 BAFU 转换结果整理成符合 TianGong TIDAS 要求、可写入 BAFU TianGong 账号的数据。本文件定义 BAFU-specific 规则和质量门禁;执行顺序、checkpoint 和恢复语义由 `docs/import-profiles/bafu/profile.md` 定义。
|
|
15
|
+
|
|
16
|
+
## 账号和写入边界
|
|
17
|
+
|
|
18
|
+
- 远端 Foundry / TianGong CLI 读写必须使用 BAFU account profile,并由运行态 task manifest / account profile / checkpoint 记录实际账号、session、命令前缀和 guard 结果。
|
|
19
|
+
- 仓库根目录或子项目根目录的 `.env` 只能提供运行态 credential / endpoint / 默认命令参数,不能替代 durable `source-manifest.json`、`profile-lock.json`、account/write guard report、checkpoint 和 artifact ledger。正式写入前必须能从 task workspace 证明当前 source、profile、目标账号、write policy 和待写 scope。
|
|
20
|
+
- 单次运行的 thread id、具体 user id、临时 env 值或一次性命令前缀不属于 durable constraints;这些内容只能写入运行态 workspace、checkpoint 或 run manifest。
|
|
21
|
+
- 所有写入必须通过官方 CLI / 平台路径执行;不得绕过 RLS,不得直接写 dataset tables。
|
|
22
|
+
- 符合 task write policy 的批量自动 commit 是允许的;人工审批用于 policy 变更、exceptional waiver、缺失 canonical database support、删除动作或其他 profile gate,不用于逐条确认已经通过所有硬门禁的独立 scope。
|
|
23
|
+
- 若运行态账号 guard 不能证明当前命令指向 BAFU account profile,应阻塞 remote write。
|
|
24
|
+
|
|
25
|
+
## 总体导入原则
|
|
26
|
+
|
|
27
|
+
- 不得把任何转换器的初始转换结果原样写入。历史批次的初始结果中存在 `TIDAS_IMPORT_PLACEHOLDER`、trace-only 字段、方向字段异常、单位/属性未标准化等问题。
|
|
28
|
+
- 这个原则同时适用于 TIDAS JSON 和 ILCD 文件包。ILCD 是交换/交付格式,不等于数据库写入计划;写入 TianGong 时不能因为 ILCD 包里有某个 contact、source、flow property、unit group、flow 或 process 文件,就直接新建对应数据库记录。
|
|
29
|
+
- 对 ILCD 包执行数据库写入前,也必须先做 TianGong 侧实体解析:已有记录优先复用;同 UUID/version 的私有记录使用 update/upsert;只有确认没有合适既有记录且符合对应数据集规范时才允许新建。
|
|
30
|
+
- 完整转入前必须完成:源数据依据整理、流匹配、单位/属性标准化、源语言名称整理、必填字段补齐、QA YAML 质量门禁、SDK/schema 验证、前端等价验证、远端回读验证。
|
|
31
|
+
- schema 验证只能证明结构基本符合,不足以证明业务字段完整。例如“年供应量或生产量”结构存在但语义为空时仍可能通过 schema,因此必须加 QA 和前端校验口径。
|
|
32
|
+
- BAFU flow / process / lifecyclemodel 写库前必须证明已经完成 full-context AI semantic completion:AI authoring package、classification decision task 或 location decision task 必须包含 SDK schema、methodology YAML、runtime ruleset、TIDAS classification category schemas、`tidas_locations_category.json`、profile constraints、queue/dependency closure、source row 和当前 entity payload;分类类 AI 输出必须经过 `dataset-classification-decisions-apply`,location 编码 AI 输出必须经过 `dataset-location-decisions-apply`,非分类/非 location 字段 patch 必须经过 `dataset-authoring-patch-collect` 和严格 `dataset-patch-apply`,并在 evidence 中保留上下文来源、关闭的 action item 或 queue item、以及完整 used-context 说明。没有这些证据,即使 schema/QA/dry-run/readback 通过,也不得进入 remote write planning。
|
|
33
|
+
- 任何补齐或替换都必须有来源:EcoSpold1 原字段、`mapping.csv`、转换报告、TIDAS/ILCD 规范、TianGong 数据库检索结果、已有公开 flow/property/unit group 记录、或明确的人工判断记录。
|
|
34
|
+
|
|
35
|
+
## 工作流触发和 Prewrite Evidence Gate
|
|
36
|
+
|
|
37
|
+
- BAFU 导入不能只把运行目录、checkpoint 文件或最终状态报告命名为 `external-dataset-curated-import`。必须实际执行 `external-dataset-curated-import` top-level skill 编排的 entity closure 流程,并保留子 skill / CLI evidence。
|
|
38
|
+
- `curation-queue next` 只适用于已经进入结构化 TIDAS/ILCD entity row 的研制阶段。若输入仍是 PDF、网页、报告、截图、自由文本、任意表格等非结构化资料,必须先走上游 source-evidence / draft-dataset authoring:抽取事实、记录引用、明确假设、形成 draft TIDAS rows,然后才允许 build curation queue。
|
|
39
|
+
- Codex 可以在新 profile 或非结构化来源阶段先梳理 run-level plan,但这个 plan 必须落成 profile constraints、source manifest、queue tasks、entity-run-plan、checkpoint 和 CLI/skill 命令后再执行。执行期不能让每个 worker 临场自由决定“这次怎么处理”,否则会回到不稳定批处理和本地脚本拼接的问题。
|
|
40
|
+
- CLI 的职责是稳定状态机、artifact contract、门禁和恢复点;Codex 的语义能力只在明确的 child skill 步骤中使用,例如 name-plan、分类判断、证据支持的字段补齐。不得用 CLI 代替 Codex 做语义研制,也不得绕过 CLI 让 Codex 直接写最终 row。
|
|
41
|
+
- 队列建立后,每个执行 worker 在修改任何 row 之前都必须先运行:
|
|
42
|
+
- `tiangong-lca dataset curation-queue next --queue-dir .foundry/workspaces/<task-id>/curation-queue --entity-type <support|flow|process> --limit 1 --out-dir .foundry/workspaces/<task-id>/execution-next`
|
|
43
|
+
- worker 只能执行 `curation-queue next` 返回的 `next_tasks[].action`:若返回 CLI command,就按该命令执行;若返回 child skill,就按返回的 `skill`、`input_artifact`、`output_artifacts` 执行。完成后再次调用 `curation-queue next`。对导入、更新、写入、重跑类任务,必须持续循环,直到请求范围内的 support、flow、process scope 都返回 `status=complete`;只执行第一条 support / flow / process action 不能视为完成。
|
|
44
|
+
- BAFU 当前转换结果按 process bundle 拆分时,允许多个 worker 并行执行独立 `curation-queue next` 返回的任务。并行数必须来自 task workspace 的 `max_parallelism` / execution policy,不得写死在 BAFU 规则中;每个 worker 必须持有不同 `lock_key`,且其 `depends_on` checkpoint 已通过。一个 entity 或 dependency closure 被 blocker 阻塞时,只记录该 blocker 和受影响 scope,不能阻塞没有共享未完成依赖的其他 ready process bundle。
|
|
45
|
+
- 不得跳过 `curation-queue next` 自行选择“干净”的 process/flow/lifecyclemodel,也不得用 task-local 脚本批量生成 `rows/*.final.jsonl`、`rows/*.name-curated.jsonl` 或其他看似最终的行文件。
|
|
46
|
+
- 每次正式 remote write 前必须运行并通过:
|
|
47
|
+
- `tiangong-lca dataset curation-queue verify --queue-dir .foundry/workspaces/<task-id>/curation-queue --out-dir .foundry/workspaces/<task-id>/prewrite-evidence-gate`
|
|
48
|
+
- `curation-queue verify` 的结果必须写入 stage 8 checkpoint 和 remote write status。若状态为 `blocked`,不得执行 commit。若任一 `curation-queue next` scope 仍返回 `status=ready`,该 blocked 只是说明队列尚未跑完,worker 必须继续执行 next 返回的 action;只有 next 本身 blocked、没有可执行 action 但 verify 仍 blocked,或遇到需要人工判断的 profile gate,才可以把 run 状态报告为阻塞。
|
|
49
|
+
- 对批量自动入库,`verify --type` 或 exact-scope verify 可以按 support / flow / process / bundle scope 分别证明。通过 verify 的独立 scope 可进入 finalize/commit/readback;未通过的 scope 必须留在 blocked ledger 中,等待人工或数据库侧补齐后重跑,不得混入本次 executable commit scope。
|
|
50
|
+
- 该 gate 必须证明每个 owned support / flow / process entity 均有:
|
|
51
|
+
- `name-plan-units.jsonl`
|
|
52
|
+
- Codex-authored `name-plan-draft.jsonl`
|
|
53
|
+
- `name-plan-evidence.json`
|
|
54
|
+
- `name-plan-apply-report.json`
|
|
55
|
+
- `name-plan-validate-report.json`
|
|
56
|
+
- 只存在 schema validate、name-quality validate、remote dry-run、readback verify 或由 finalizer 汇总生成的 `checkpoints/*.json`,不能证明完整流程已经执行。尤其不得用 Foundry-local hardcoded rule / regex / glossary 脚本直接生成 `name.*` 或分类后再让验证通过。
|
|
57
|
+
- 任务本地脚本可以做选择、组装输入、汇总报告和生成 human-readable status;可复用的研制逻辑必须进入 skill 或 CLI。任何直接生成最终语义字段的本地脚本都只能作为临时实验,不能作为 BAFU 正式导入依据。
|
|
58
|
+
|
|
59
|
+
## Compliance 与 DataSet Format 约束
|
|
60
|
+
|
|
61
|
+
- BAFU EcoSpold1 来源未声明 ILCD compliance system。转换产物中由占位逻辑生成的 `TIDAS_IMPORT_PLACEHOLDER:COMPLIANCE_NOT_DEFINED` / `Compliance systems` source dataset 不得写入 BAFU 账号。
|
|
62
|
+
- TIDAS 设计口径是:正式入库的数据集应使用平台认可的 compliance declaration。当前应引用 TianGong public canonical 的 `ILCD Data Network - Entry-level` compliance system:
|
|
63
|
+
- UUID:`d92a1a12-2545-49e2-a585-55c259997756`
|
|
64
|
+
- version:`20.20.002`
|
|
65
|
+
- type:`source data set`
|
|
66
|
+
- shortDescription:`ILCD Data Network - Entry-level`
|
|
67
|
+
- `ILCD Entry-level` 声明适用于转入并修复后的 TIDAS 目标数据集,不是 BAFU 原始 EcoSpold1 包自带的声明。必须在 provenance / `common:other` 中明确记录:BAFU EcoSpold1 source did not declare an ILCD compliance system; TianGong LCA transformed, completed, normalised, validated, and published the datasets under the BAFU account, and the resulting TIDAS datasets meet ILCD Entry-level / TianGong import-readiness requirements.
|
|
68
|
+
- 只有完成 schema、QA YAML、前端等价校验、引用闭包检查和远端回读验证后,才允许把 `common:approvalOfOverallCompliance` 写为 `Fully compliant`。在 dry-run 或修复未完成阶段不得提前写成 fully compliant。
|
|
69
|
+
- 不得因为 TIDAS/ILCD schema 中存在 `complianceDeclarations`,就新建 BAFU 私有的 compliance system source。合规声明引用的是目标数据集按哪个合规体系被声明和评审,不是源 EcoSpold1 包自然具备的元数据。
|
|
70
|
+
- 若 TianGong public canonical 的 `ILCD Data Network - Entry-level` compliance source 不存在或不可引用,应阻塞写入并先补公共支撑对象,不得在 BAFU 账号下临时新建占位 compliance system。
|
|
71
|
+
- `referenceToDataSetFormat` 同样应优先引用 TianGong 公共库已有的 canonical data format source,例如平台标准的 TIDAS/ILCD format 记录;不得把转换包生成的临时 source 当作 BAFU-owned source 写入。
|
|
72
|
+
- 本文件中的 `support` 是 workflow umbrella,不是一个单独 TIDAS dataset type。普通 support writer 的 BAFU 可写 scope 只允许真实 `source` 和 canonical BAFU/FOEN `contact`;compliance system 与 data set format 始终属于 public canonical reference reuse / provenance rewrite。flow property 与 unit group 默认同样复用 public canonical,但在 profile lock 明确启用 `allow_account_local_support_and_elementary` 且公共库确无可辩护候选时,可以进入独立的 account-local candidate registry,并且只能通过 current-user owner-draft 专用路径维护,不能混入普通 support scope。
|
|
73
|
+
- `source` 表只能写入真实文献、报告、出版物、数据库文档或可追溯来源记录。`ILCD format`、`Not specified`、compliance system、data format、`Created for EcoSpold 1 compatibility` 等转换/格式/兼容性占位不得作为真实 source 名称写库;这些只能作为 canonical reference rewrite/provenance trace 保留。若 source description 中包含 `Original title`、`First author`、`Year` 等报告元数据,应先修复 source shortName/sourceCitation,并同步修复 process `referenceToDataSource.common:shortDescription`。
|
|
74
|
+
- 若 process `referenceToDataSource` 指向上述占位 support source,Foundry 必须先用完整 bundle context 查找同一 process scope 内可证明的真实报告、论文、数据库文档或数据来源;只有存在唯一且语义明确的 true source 时才自动改写到该 source。若没有任何来源线索,才允许改写到统一的 `BAFU 2025 Version 2 LCA database` database-level fallback source,并在 `source-reference-rewrites.jsonl` / `source-semantics.jsonl` 中记录 fallback 理由。不得因为原始转换 source 是占位就盲目写库,也不得在多个可能 true source 间无证据任选。
|
|
75
|
+
- 若 process 的 `common:generalComment`、technology、data-source treatment 等上下文明确写出 `Original source`、DOI、标题、年份和作者,且该来源比转换出的 package-level true source 更具体,Foundry 必须生成或复用该 process-context source,并将 process `referenceToDataSource` 改写到该来源;原转换 source 若在当前 scope 内不再被 process 引用,不得进入 support 写入。
|
|
76
|
+
- 若 true source 的 `sourceDescriptionOrComment` 为空或只有 `Report` / `Publication` / `Source` 这类类型词,应使用 `sourceCitation` 或 `common:shortName` 生成可读的报告/出版物说明,不能把空描述或单独 `Report` 当作最终来源描述。写库前 mutation manifest 必须阻断仍带这些占位 identity 的 support/source rows。
|
|
77
|
+
- mutation manifest 必须把 compliance system / data set format reference rewrite 单独列出:原始引用 UUID、原始 shortDescription、目标 canonical UUID/version、处理动作、理由和来源证据。
|
|
78
|
+
- 最终远端回读必须确认所有 compliance/data format 引用都指向 TianGong public canonical 支撑对象,且没有 `TIDAS_IMPORT_PLACEHOLDER:COMPLIANCE_NOT_DEFINED`、`COMPLIANCE_NOT_DEFINED` 或仅本地存在的 compliance source。
|
|
79
|
+
|
|
80
|
+
## Flow 处理约束
|
|
81
|
+
|
|
82
|
+
- 写入前必须先检索 TianGong 数据库已有 flow。不能只按本地转换 flow 文件盲目新建,也不能只做名称 exact match 后就判定“库里没有”。
|
|
83
|
+
- Flow 检索必须采用两阶段流程:
|
|
84
|
+
1. UUID/version 精确检索:
|
|
85
|
+
- 先从 EcoSpold1、TIDAS JSON、ILCD、`mapping.csv` 和 trace 中提取源 flow UUID、version、type、direction、classification、reference property/unit、geography 和名称组件。
|
|
86
|
+
- 先用 UUID/version 在目标 BAFU 账号和 TianGong 公共库中检索。若命中,应继续核对 type、classification、reference property/unit、geography、version 语义和可见性,不能只因 UUID 命中就无条件复用。
|
|
87
|
+
- 若 UUID 命中公共库且语义一致,应优先复用公共库记录;若 UUID 命中 BAFU 账号历史记录,应按当前规范决定 update 或替换引用,不应重复新建。
|
|
88
|
+
- 若 UUID 命中但 type、属性、单位或语义明显不一致,应作为数据冲突进入人工/规则化判定,不能静默复用。
|
|
89
|
+
2. 结构化语义检索:
|
|
90
|
+
- 只有在 UUID/version 未命中、或 UUID 命中但经核对不可复用时,才进入语义检索。
|
|
91
|
+
- 语义检索必须使用结构化字段、源语言名称和同义词扩展,而不是只用源英文完整名称。检索字段至少包括 base name、treatment/technology、mix type、location/geography、flow properties、classification、flow type、reference property/unit、CAS/chemical formula(若存在)、market/plant/grid/to-user 等上下文。
|
|
92
|
+
- 语义检索结果必须打分并记录证据:为什么复用、为什么不复用、哪个字段不匹配、是否需要新建 BAFU flow。
|
|
93
|
+
- 若语义检索发现公共库已有高置信候选,应优先复用公共库;只有没有合适公共/账号内候选时,才允许保留 BAFU 源 UUID 按 TIDAS flow 规范新建。
|
|
94
|
+
- Product / waste / intermediate flow:
|
|
95
|
+
- 优先复用数据库中名称、类型、分类、参考属性、参考单位、地理和技术范围均匹配的已有 flow。
|
|
96
|
+
- 若没有合适已有 flow,才可以按 TIDAS flow 规范新建。
|
|
97
|
+
- 新建不是“随便生成一个新 flow”:应保留源 UUID/version 作为可追溯身份,并补齐规范要求的 name、classification、flow property、unit group、reference unit、source/review 依据。
|
|
98
|
+
- 即使决定保留 BAFU 原始 flow UUID/version 并新建或更新该 flow,也不得直接沿用转换包里临时生成的 flow property、unit group 或 reference unit。flow identity 的保留只解决 flow 自身身份和溯源,不代表其依赖的属性/单位实体也应新建。
|
|
99
|
+
- Flow 分类选择:
|
|
100
|
+
- 若复用 TianGong 公共库或 BAFU 账号内已有 flow,应复用目标 flow 已有的正式分类;不得由 BAFU 源分类覆盖目标分类。
|
|
101
|
+
- 若必须新建或更新 BAFU-owned product / waste / intermediate flow,正式 `classificationInformation` 必须按 TianGong/TIDAS flow 新建规范选择目标分类。选择时应使用分类目录/CLI 候选和结构化字段,由 flow type、四段式 name、flow property/reference unit、地理、技术、源 process 和 source context 共同支撑,不得只把 EcoSpold1 或转换包里的源分类原样写成目标分类。
|
|
102
|
+
- 源 EcoSpold1/转换包分类应作为来源证据保留在 `common:generalComment`、trace/provenance 或 mapping 中;只有在经分类目录匹配和语义判断后确认与 TianGong/TIDAS 目标分类一致时,才可以作为目标分类依据之一。
|
|
103
|
+
- 明显工业/电池/化学数据不得沿用 `Activities of membership organizations`、`Community, social and personal services`、`Other environmental protection services n.e.c.` 等源转换错分;出现这类组合时必须阻塞并返回 full-context AI classification decision。
|
|
104
|
+
- `mapping.csv` 或配套分类证据必须记录 `source_classification`、`selected_tidas_classification`、`classification_basis`、`candidate_categories`、`decision_status`。若未生成这些证据,不得正式写入。
|
|
105
|
+
- Flow schema 校验只证明 `classificationInformation` 字段结构可被解析,不代表分类语义正确,也不代表目标分类属于 TianGong/TIDAS 分类树中的合适位置。发布前必须额外通过 flow classification decision gate:没有分类决策证据、源分类未被保留为溯源、或把源分类无依据地复制成目标分类,均应阻塞写入。
|
|
106
|
+
- Elementary flow:
|
|
107
|
+
- 默认必须使用 TianGong 数据库已有的 elementary flow,匹配顺序为:UUID/version 精确检索、CAS/name/category/synonym 确定性匹配、结构化语义检索、已评审的人工/规则化候选。
|
|
108
|
+
- LCIA 因子依赖既有 elementary flow 身份,因此“公共库没有候选”本身不能授权新建。只有 profile lock 明确启用 `allow_account_local_support_and_elementary`、完整候选检索证明不存在可辩护 public/existing canonical、且保留源 elementary identity、分类/compartment、CAS/name、方向、单位和 provenance 时,才允许把缺口保留为当前 BAFU owner 的 `state_code=0` account-local elementary candidate。
|
|
109
|
+
- account-local elementary candidate 只服务于同一 owner 的私有清洗、建模和试算;不得进入全局 LCIA flow cache,不得被 public 或其他 owner 的 process 引用,也不能因为标记了 `LCIA characterization pending` 就视为已完成专家评审或具备公开资格。
|
|
110
|
+
- 有可采用候选的 source elementary flow,必须使用选定的 TianGong existing/public flow,并在 mapping/provenance 中保留候选等级、源 UUID/version、候选 UUID/version、选择理由和风险说明。
|
|
111
|
+
- 没有可辩护 existing/public 候选且 profile override 未生效或证据不完整时,不改成 product flow、不强行映射到不等价 public flow,也不写入 BAFU-owned elementary flow;必须保留在 elementary flow mapping/curation queue 中,并阻塞引用它的 process 写入。override 与证据都有效时,可继续同 owner、全闭包 `state_code=0` 的私有流程,但公开发布仍被阻塞。
|
|
112
|
+
- 历史 BAFU-owned elementary flow 必须逐条重新做 public reuse audit:有可辩护 canonical 候选时改写 process exchange;无候选但满足 profile-authorized account-local 条件时登记为私有候选;未登记、无引用或不满足条件的记录进入待人工删除/退役清单。自动导入流程不得直接 delete,也不能把删除候选当作已清理。
|
|
113
|
+
- Generic `Carbon dioxide` / `Carbon monoxide` air-emission elementary flow 必须显式记录 fossil / biogenic / land-use-change 判定:
|
|
114
|
+
- 当源 flow 名称正好是 generic `Carbon dioxide` 或 `Carbon monoxide`,且 trace category 是 air-emission compartment,而 TianGong public elementary library 没有同名不分型 air-emission flow 时,映射到同 air compartment 的 public `fossil` variant,作为保守的 impact-bearing 默认值。
|
|
115
|
+
- `Carbon dioxide, land transformation` 等明确源名映射到 land-use-change variant;`Carbon dioxide, in air` 作为 resource 时映射到 public resource uptake candidate。
|
|
116
|
+
- mapping/provenance 必须说明源 BAFU/EcoSpold1 未标注 fossil/biogenic/LUC qualifier,以及本次采用何种判定方案和理由。
|
|
117
|
+
- 确定性 public elementary alias / aggregate 规则可用于本批导入,但必须同时保留 category/direction 证据:
|
|
118
|
+
- 已评审的 EcoSpold1 命名变体可映射到 TianGong public elementary 名称,例如 `1-Pentanol -> pentan-1-ol`、`1-Propanol -> n-propanol`、`3-Methyl-1-butanol -> 3-methylbutan-1-ol`、`4,4'-Biphenol -> biphenyl-4,4'-diol`、`Acrylate -> Acrylate, ion`、`Chloramine -> chloramide`、`Chlorosulfonic acid -> chlorosulphuric acid`、`Chrysotile -> asbestos (white)`、`Ethanol, 2-ethoxy- -> 2-ethoxyethanol`、`N-octane -> octane`、`p-Cresol -> para-cresol`、`Petrol -> gasoline`、`Solids, inorganic -> Dissolved solids` 等。
|
|
119
|
+
- land occupation/transformation 可在 direction 保持一致时使用 public aggregate land-use elementary flow;ore-grade resource 可在 ground/non-renewable element resource 分类一致时映射到同一金属元素资源;`Oils, biogenic` 可在 compartment 匹配时映射到 `Oils, non-fossil`。
|
|
120
|
+
- source resource classification 明显错误时可按证据修正到 biosphere renewable material resources,例如 standing wood;若 public support 只有 soft wood / primary forest wood / energy wood,hard/unspecified standing wood 仍按候选或例外规则处理,不能静默降级。
|
|
121
|
+
|
|
122
|
+
### 电力 Flow 语义检索补充
|
|
123
|
+
|
|
124
|
+
- 电力类 product flow 是上述两阶段检索的一个典型场景。必须先按 UUID/version 检索;若 UUID 未命中或不可复用,再做结构化语义检索。不能只用 BAFU/EcoSpold1 英文源名做 exact match 检索,也不能因为 `Electricity, low voltage, at grid {CH}` 这类英文检索没有命中 exact candidate,就判定 TianGong 公共库没有对应 flow。
|
|
125
|
+
- 写入前必须做 TIDAS 结构化语义检索和打分,至少包括:
|
|
126
|
+
- `Electricity` / `alternating current` / `交流电`;
|
|
127
|
+
- `electricity mix` / `电力混合`;
|
|
128
|
+
- `consumption mix` / `消费组合`;
|
|
129
|
+
- `to consumers` / `到用户`;
|
|
130
|
+
- 电压等级归一化:`<1kV`、`1-35kV`、`35-330kV`、low voltage、medium voltage、high voltage;
|
|
131
|
+
- 地理字段:`CH`、`CN`、`GLO`、source geography、locationOfSupply、market/plant/grid 语义。
|
|
132
|
+
- 已确认远端 TianGong 公共库存在电力开放数据候选,例如:
|
|
133
|
+
- `<1kV` consumption mix candidate:`50657322-939c-4829-a87b-47c093bfa6a7@01.01.001`,名称结构为 `交流电; 电力混合; 消费组合,到用户; <1kV`;
|
|
134
|
+
- `1-35kV` consumption mix candidate:`3d76981f-964a-4865-b588-0e067a2a1163@01.01.001`,名称结构为 `交流电; 电力混合; 消费组合, 到用户; 1-35kV`;
|
|
135
|
+
- `35-330kV` consumption mix candidate:`4d0361a3-56cc-45f9-aa42-bb9103285bf9@01.01.001`,名称结构为 `交流电; 电力混合; 消费组合,到用户; 35-330kV`。
|
|
136
|
+
- 上述公共库候选只是候选,不是对所有 BAFU electricity exchange 的自动映射。最终复用必须同时比较电压等级、消费/生产混合语义、grid/to-user/plant 语义、地理范围、flow type、flow property、reference unit 和 source context。
|
|
137
|
+
- 已明确:TianGong 公共库中部分 energy / electricity flow 因历史上缺少 Energy / Amount-in-kWh 等单位支撑,沿用了 `Net calorific value` 作为 flow property。对 BAFU 导入而言,这个属性口径差异本身不再作为复用公共电力 flow 的硬性否决条件;应记录为 TianGong 公共库 legacy support / 待公共库升级事项。
|
|
138
|
+
- 复用公共电力 flow 时,仍必须核对 flow identity 语义:电压等级、消费/生产混合、grid/to-user/plant 边界、地理范围、flow type、source context 和数量单位换算。只有 `Net calorific value` 这一项不一致时,不应因此新建 BAFU 私有 electricity flow。
|
|
139
|
+
- 电力 flow 匹配脚本必须扩大候选检索范围,不能只取英文源名 top 10。建议先用源名检索,再用结构化同义词二次检索,并输出候选打分证据;未复用公共库 flow 时,必须说明是地理/电压/语义/属性不匹配,而不是简单写“数据库没有”。
|
|
140
|
+
- 电力 flow 的 mutation manifest 不得只写 `uuid_not_found_semantic_no_suitable_candidate` 作为最终理由。对每个未复用公共库的电力 flow,必须附候选评估表,至少列出已知公共候选 UUID/version、名称组件、电压等级、消费/生产语义、地理范围、flow property/reference unit、可复用结论和拒绝理由。
|
|
141
|
+
- 对 `Electricity, low voltage, production ENTSO-E, at grid {ENTSO-E}` 这类源 flow,若当前公共库只有 `交流电; 电力混合; 消费组合,到用户; <1kV/1-35kV/35-330kV` 等 consumption mix 候选,不能自动映射;但也不能直接新建并结束。必须明确判断:
|
|
142
|
+
- `production ENTSO-E` 与 `consumption mix, to user` 是否代表不同 supply-chain boundary;
|
|
143
|
+
- `ENTSO-E` 地理范围是否可接受映射到 `GLO`、`RER`、`CN` 或其他公共候选;
|
|
144
|
+
- `low voltage` 是否应映射到 `<1kV`;
|
|
145
|
+
- 公共候选使用 `Net calorific value` 是否只是 TianGong 公共库 energy/unit support 的 legacy 表达;若其它语义字段匹配,不得仅因该属性名称拒绝复用。
|
|
146
|
+
- 若检索过程只使用英文源名、没有覆盖同义词和平台已有候选名称,或候选结果主要是 unrelated plant-specific electricity,则该次检索证据不足;不得把该结果作为“新建 BAFU electricity flow”的充分依据,必须补做结构化语义检索后再写入或更新。
|
|
147
|
+
|
|
148
|
+
## 中间流与非中间流约束
|
|
149
|
+
|
|
150
|
+
- “中间流”定义为:同一 flow 在某个 process 中作为 output,同时在另一个不同 process 中作为 input。
|
|
151
|
+
- 中间流是 process 间供应链连接点,必须保持身份一致:
|
|
152
|
+
- 如果复用已有数据库 flow,所有相关 process 都应指向同一个目标 flow。
|
|
153
|
+
- 如果新建 flow,相关 process 必须引用同一 UUID/version,不得拆成多个近似流。
|
|
154
|
+
- “非中间流”指没有在本批 process 内形成 output-input 连接的非 elementary flow。
|
|
155
|
+
- 非中间流也要优先检索并复用 TianGong 数据库已有 flow。
|
|
156
|
+
- 只有没有合适匹配时才允许新建,并记录为什么不能复用。
|
|
157
|
+
|
|
158
|
+
## 单位、属性与参考单位约束
|
|
159
|
+
|
|
160
|
+
- EcoSpold1 的单位不能直接等同于 TIDAS reference unit。必须映射到 TIDAS flow property、unit group、reference unit 的规范结构。
|
|
161
|
+
- Flow property、unit group、reference unit 必须优先复用 TianGong 数据库已有的 public canonical 记录。只有 profile lock 明确启用 `allow_account_local_support_and_elementary`,且公共库确无可辩护候选时,才允许把缺口物化为 BAFU 当前账号拥有的 `state_code=0` My Data 候选;这类候选不是 public canonical,也不能供其他账号隐式复用。
|
|
162
|
+
- BAFU account-local FP/UG 必须保留源量纲、源单位、reference unit、换算口径和完整 mapping/provenance,使账号内 flow/process 闭包在清洗期间自洽。它们进入独立的 account-local candidate registry,不得写入或冒充 `specs/canonical-support/flow-properties-unit-groups.json` 的 public canonical cache。
|
|
163
|
+
- account-local 例外只解除“必须等公共 support 才能继续”的治理墙,不解除 schema、单位尺度、内容饱和、引用闭包、owner/state、计划 hash、审计和 readback 门禁。任何 source/target/flow/process 跨 owner、非 `state_code=0` 或混合可见性批次都必须阻塞。
|
|
164
|
+
- 已确认的单位/属性处理口径:
|
|
165
|
+
- `p` 应映射为 `Number of items` / `Units of items`,参考单位使用 `Item(s)`;不能把 `p` 当作 TIDAS reference unit。
|
|
166
|
+
- `kg` 映射到 Mass / Units of mass。
|
|
167
|
+
- `m2` 映射到 Area / Units of area。
|
|
168
|
+
- `tkm` 映射为质量距离量纲,按 `1000 kg*km` 处理。
|
|
169
|
+
- `kWh` 映射为 Energy,换算到 `MJ` 时系数为 `3.6`。
|
|
170
|
+
- `MJ` 映射为 Energy / MJ。
|
|
171
|
+
- `Nm3` / `Amount in Nm3` 映射到 TianGong public `Volume` / volume unit group;`Nm3` 作为源单位证据保留在 mapping/provenance 中。不得为 `Nm3` 新建 BAFU 私有 flow property。若 public Volume unit group 暂缺 `Nm3` alias,应记录为公共库 unit alias 后续事项,而不是阻塞 BAFU 私有 property。
|
|
172
|
+
- Flow property / unit group 引用必须解析到数据库中精确存在且当前账号可见的记录:优先使用 public canonical cache;无 public 候选且 profile override 生效时,可使用同一 BAFU owner 的 `state_code=0` account-local FP/UG 对。两者不得在同一 alias batch 中混合,且 private FP 的 reference unit group 必须是同一 owner/state 的精确版本。
|
|
173
|
+
- 若源单位可以可靠映射到现有 public canonical support,必须重写 `referenceToFlowPropertyDataSet` / `referenceToReferenceUnitGroup` 到该公开记录,并把源单位、源属性名和映射理由保存在 mapping/provenance 中。
|
|
174
|
+
- 若源单位或量纲没有可辩护的 public canonical support,例如 person transport、duration、length\*time,可先使用经 profile lock 授权的 BAFU account-local FP/UG 继续私有清洗和试算,同时保留公共库候选评审待办。能否最终公开由量纲、单位、命名、来源、复用价值和专家审批决定,不能用 LCIA 方法是否覆盖直接代替该判断。
|
|
175
|
+
- Energy 类 `kWh` / `MJ` 当前可按现有 public `Net calorific value` legacy support 处理并记录 legacy note;后续若公共库新增 generic `Energy` support,再通过迁移映射重写引用。不得创建 BAFU 私有 Energy support。
|
|
176
|
+
- `unitgroups.jsonl` 和 `flowproperties.jsonl` 仍与 source/contact `support.jsonl` 分离。profile override 生效时,它们可进入专用 account-local candidate/handoff,但只能通过 current-user、owner-draft、计划绑定的官方 CLI/数据库路径维护;不得由 generic support writer、Foundry 直写或 `publish-support` 作为私有清洗前置。
|
|
177
|
+
|
|
178
|
+
## Process 字段补齐约束
|
|
179
|
+
|
|
180
|
+
- 每个必填项都要有正式内容,不能保留 trace、placeholder、空字符串、`UNSPECIFIED_TEXT` 或本地路径。
|
|
181
|
+
- `functionalUnitOrOther`、exchange `shortDescription`、quantitative reference 等字段应与标准化后的 flow/unit 文本一致。
|
|
182
|
+
- process exchange 中 `referenceToFlowDataSet/common:shortDescription` 必须从被引用 flow 的正式权威 `name` 结构物化,不能只取 `baseName`。组合顺序为 `baseName`、`treatmentStandardsRoutes`、`mixAndLocationTypes`、`functionalUnitFlowProperties`,跳过空字段,并按语言分别组合。该字段是引用显示文本,不得由 process 独立翻译或手写;更新 flow name 后必须重新 build authority catalog、materialize process refs、validate refs,并在写入后回读确认。
|
|
183
|
+
- “年供应量或生产量”字段需要同时满足 SDK/schema 和前端校验:
|
|
184
|
+
- 使用多语言数组结构,实际文本写在 `#text`。
|
|
185
|
+
- 文本必须以真实数值和空格开头,并显式表达年化单位,例如 `1.0 Item(s)/year ...`、`3.6 MJ/year ...` 或 `3.6 MJ/年 ...`。只写“参考流描述”不能通过新版 SDK/schema。
|
|
186
|
+
- 如果源数据没有独立年度市场供应量,不能编造市场量;应以 EcoSpold1 quantitative reference 的参考流数量作为有来源的年化代表生产量,并明确说明“来源未另行声明独立的年度市场供应量”。
|
|
187
|
+
- 时间字段也必须做语义清洗,不能只满足 schema:
|
|
188
|
+
- `common:referenceYear` 中的 `9999`、`0`、`0000`、空字符串、`Not defined`、`Unknown` 等值均视为占位/哨兵值,不得正式写入数据库。
|
|
189
|
+
- 若 EcoSpold1 的 `startDate` / `endDate` 为空,仅有 `dataValidForEntirePeriod=true`,不得把转换器生成的 `9999` 保留下来,也不得把 `9999` 写入 `timeRepresentativenessDescription`。
|
|
190
|
+
- 必须从可追溯来源补真实年份:优先使用源 EcoSpold1 的有效 `startDate` / `endDate`;若缺失,可使用源文献年份、数据源报告年份、技术数据年份、包版本/发布年份或人工评审确认年份,但必须在 `timeRepresentativenessDescription` 或 provenance 中说明采用哪个年份、来自哪个字段/source/comment、为什么适合做 reference year。
|
|
191
|
+
- 对缺少 `startDate` / `endDate` 和可解析 source citation year 的 BAFU 2025 行,可使用 `2025` 作为 reference year,证据为 BAFU 2025 package identity。该方案比 EcoSpold1 export/edit timestamp 更稳定,并可追溯到本包身份。
|
|
192
|
+
- 若个别行只能从 EcoSpold1 dataset `timestamp` 推导 reference year,该方案对本批受影响 process 可接受,但 `timeRepresentativenessDescription` 必须明确说明:该 timestamp 可能代表导出/编辑时间;由于未找到更强的 reference-year 证据,本次将其作为可追溯年份使用。
|
|
193
|
+
- 若无法找到任何可追溯年份或可接受 fallback,应阻塞写入或把记录列入人工修复清单;不得为了通过前端/schema 验证而编造年份。
|
|
194
|
+
- 对已写入的 BAFU 数据,远端回读必须扫描 `common:referenceYear` 和时间说明文本,确认不存在 `9999` 这类占位值。
|
|
195
|
+
- TIDAS/ILCD `dateTime` 源值可合法携带 timezone offset,例如 `+08:00` 或 `+00:00`;但 BAFU 导入进入 TianGong 写入 payload 前必须规范化为 UTC `Z` 形式,便于远端 diff、readback verify 和 mapping 稳定比较。不得把合法 offset 当作源数据错误,也不得把非 `Z` offset 原样写入最终 TianGong payload。
|
|
196
|
+
- 采样程序、数据代表性、数据完整性、审查、source/contact 引用、平台 canonical compliance/data format 引用必须基于源字段、平台 canonical 支撑对象或可验证的合理补齐,不得只填占位描述。
|
|
197
|
+
|
|
198
|
+
## Contact 与归属约束
|
|
199
|
+
|
|
200
|
+
- BAFU 2025 数据导入不得继续使用占位联系人,例如 `BAFU 2025 package import contact`。
|
|
201
|
+
- BAFU contact 可以由 AI 生成/修复,且必须作为一次性的 canonical support authoring task 被所有 bundle 复用。AI 任务必须带 FOEN/BAFU 官方来源证据、当前转换 contact payload、SDK/schema、profile constraints 和固定 UUID/version;输出必须经过 patch collect/apply、schema/name-plan/location/manifest/readback 门禁后再被所有 bundle 复用。
|
|
202
|
+
- 本批 BAFU / FOEN 数据的 canonical contact 使用:
|
|
203
|
+
- UUID:`a6db11f5-1cb4-579a-b503-bd17c361b8c2`
|
|
204
|
+
- version:`00.00.001`
|
|
205
|
+
- shortName:`Federal Office for the Environment FOEN (BAFU)` / `瑞士联邦环境署(FOEN/BAFU)`
|
|
206
|
+
- name:`Swiss Federal Administration - Federal Office for the Environment (FOEN)` / `瑞士联邦政府 - 联邦环境署(FOEN/BAFU)`
|
|
207
|
+
- classification:`Organisations` / `Governmental organisations`
|
|
208
|
+
- address:`Federal Office for the Environment FOEN, 3003 Bern, Switzerland`
|
|
209
|
+
- telephone:`+41 58 462 93 11`
|
|
210
|
+
- email:`info@bafu.admin.ch`
|
|
211
|
+
- WWWAddress:`https://www.bafu.admin.ch/en/contact-en`
|
|
212
|
+
- 上述联系人信息来源为 FOEN / BAFU 官方 contact page。后续批量导入前应再次核对官方网页;若官方联系信息变更,应更新 contact dataset 并记录来源日期。
|
|
213
|
+
- BAFU 导入包里的 commissioner、ownership,以及没有更具体来源人的 BAFU source/contact 引用,应统一指向上述 canonical BAFU / FOEN contact,不得保留临时导入联系人名称。
|
|
214
|
+
- 同一个 BAFU 数据库/整库导入只允许使用这一条 canonical BAFU / FOEN contact 作为归属 contact。转换工具生成的 `TianGong LCA import tooling`、本地脚本、临时操作者等 contact 只能作为 provenance/trace 说明,不得作为 commissioner、ownership 或 source/contact support row 写入。
|
|
215
|
+
- TianGong LCA 在本批数据中承担转换、字段补齐、flow reference 修复、验证和数据库发布处理工作,但不应因此被写成 BAFU 源数据的 commissioner 或 owner。
|
|
216
|
+
- TianGong 的处理角色应记录在 `administrativeInformation.dataEntryBy.common:other` 或等价 provenance 字段中,例如说明 TianGong LCA prepared the TIDAS conversion, source-language field completion, flow-reference repair, validation, and database publication under the BAFU account。若以后引入单独的 TianGong contact,可在 `dataEntryBy.referenceToPersonOrEntityEnteringTheData` 中引用 TianGong contact,但不得替代 BAFU / FOEN 的 source ownership / commissioner attribution。
|
|
217
|
+
|
|
218
|
+
## 源语言内容约束
|
|
219
|
+
|
|
220
|
+
- BAFU 导入行应保持源语言内容。不得在数据库导入前生成额外多语言文本,也不得把缺少中文作为导入 blocker。
|
|
221
|
+
- 不使用机器翻译 API,也不通过给某个 LLM key 的方式批量机翻。
|
|
222
|
+
- 对 dataset `name` 这类结构化字段,必须把同一 `name` 组内的 `baseName`、`treatmentStandardsRoutes`、`mixAndLocationTypes`、`functionalUnitFlowProperties` 一起作为上下文进入 source-language name-plan 判断;输出仍按对应 `field_path` 写回单个字段。
|
|
223
|
+
- 可写支撑数据集也必须使用同一套 source-language name-plan evidence 流程,不能回退到脚本词表翻译或正则拼接。`source` / `contact` 继续走普通 support curation;profile-authorized account-local `unitgroup` / `flowproperty` 走独立候选 registry、单位证据和 owner-draft 维护合同,不能冒充 public canonical cache。
|
|
224
|
+
- 远端写入 source/contact support rows 必须使用 `tiangong-lca dataset save-draft --type auto --commit` 或 profile 指定的官方 support commit handoff。account-local unitgroup/flowproperty 只能使用专用 current-user owner-draft 命令;两类路径都必须保留 schema validation、curation lineage、计划 hash、数据库审计和 readback 到 stage 8 checkpoint。不得使用 Foundry-local writer 或直接表写。
|
|
225
|
+
- 保留 LCA、TIDAS、ILCD、EcoSpold、化学式、CAS、标准号、UUID、单位、地理代码和技术边界等专业语义。若无法凭来源证据确定 source-language 字段内容,应形成 `manual_review` blocker,而不是生成猜测文本。
|
|
226
|
+
- 若源数据没有单独声明地理或供应场景字段,只能在 generalComment、mapping 或其他 provenance 字段说明,不得写入 `name.mixAndLocationTypes` 或任何 `name.*` 字段。`name.mixAndLocationTypes` 必须是可得性/地点/组合类型的名称片段,例如 `at plant {RER}`、`at grid {ENTSO-E}`、`at user {CH}`、`production mix, Switzerland {CH}`;无法从证据拆出时应形成 review blocker。
|
|
227
|
+
- process 正文中的通用字段缺失、补齐或代表性说明应使用“源数据”而不是反复写 “EcoSpold1”,例如 `源数据未声明...`、`基于源数据定量参考流...`、`源数据的 startDate/endDate...`。但用于溯源的具体证据必须保留原始格式名,例如 exchange generalComment 中的 `Source EcoSpold1 exchange number`、源包未声明 ILCD compliance system 的 dataEntryBy provenance、以及明确说明由 EcoSpold1 转换的 intended application。
|
|
228
|
+
- 可见业务字段不得保留导入占位或源系统噪声:`xx`、`{GLO}` 这类未拆分 name token、`Not declared in source package`、`Not specified by the BAFU ecoSpold1 source.`、`No ... BAFU ecoSpold1 source.`、本地路径、zip 内路径等必须进入 Foundry AI authoring action item。若字段确实未知,用户可见文本只写 `Not specified` 或按 schema 省略;BAFU/ecoSpold 只作为 provenance/evidence,不作为业务字段 filler。
|
|
229
|
+
- BAFU 的 full-context AI completion 要求写入规划前完成内容字段饱和。`tidasimport:sourceTrace`、TIDAS schema/YAML、分类/location schema 或 profile context 能证明正式字段值时,必须在同一次 AI authoring package 中尽量补全,不能先写库再靠人工巡检补。典型字段包括 process `common:synonyms`、`percentageSupplyOrProductionCovered`、`uncertaintyAdjustments`,flow `locationOfSupply`、`name.flowProperties`、source-backed `common:generalComment`,source `sourceDescriptionOrComment` 中的作者/年份/标题/出版地/出版社/卷号,以及 FOEN/BAFU contact 的官网、邮箱、电话、地址和 central contact point。无法证明或候选冲突时才 block/review;可证明字段缺失时 curation gate 必须阻断。
|
|
230
|
+
- Flow `locationOfSupply` 的证据不只来自 flow 自身已有 geography 字段。`name.mixAndLocationTypes` 中的明确 location code、引用该 flow 的 process `locationOfOperationSupplyOrProduction.@location`、exchange `location` 以及 source trace 中的地理字段都必须进入 flow authoring context;能证明为 TIDAS/ILCD location code 时必须补齐,候选冲突或非 code 描述才进入 location authoring/review。
|
|
231
|
+
- `common:other` 只能保存不能安全推断的 provenance/trace,不得替代 schema 必填字段或正式名称、functional unit、classification、reference flow 等业务字段。只有 action item 的 `allowed_resolution_modes` 明确包含 `deferred_to_common_other` 时,才允许延期;functional unit / classification / reference flow 这类正式字段必须补 evidence-backed 真值或保持阻塞。`annualSupplyOrProductionVolume` 是 schema 必填项,不得转入 `common:other`;若原始数据缺少年供应量,Foundry deterministic cleanup 写入 `9999 missing-data-sentinel/year`,这是有意无物理意义、便于批量查询定位的占位值,后续由数据库侧 curation 替换为真实值。允许 `resolution.mode=deferred_to_common_other` 的 action item 必须写入 `common:other.tiangongfoundry:unresolvedTrace`,且包含 `status`、`action_item_code`、`blocked_path`、`reason`、结构化 `evidence` 和 `next_action`;`evidence` 必须包含 source 以及 quote / trace / path / citation 等可追踪指针。
|
|
232
|
+
- 最终 rows 中的 `common:other.tiangongfoundry:unresolvedTrace` 和 `common:other.tiangongfoundry:sourceExchangeCompleteness` 必须由同一行的 AI patch evidence,或由 cleanup report 为同一 final row 生成的确定性 proof 放行;手工预置或 identity/classification/location 决策不能替代该证据。其中 unresolved trace 使用 `resolution.mode=deferred_to_common_other` 并关闭匹配 action item;source-only-output 接受使用 `resolution.mode=source_trace_verified`,或由 `dataset-curation-cleanup --source-rows-file <source rows>` 证明源 process row 本身 Output-only 且最终 row 保留非 `referenceToFlowDataSet` exchange signature。Commit handoff 必须先从最终 rows 推导这些 trace,并逐条匹配 mutation/finalize 保留的 trace queue JSONL;stale/extra/missing trace 都不能生成可执行 commit 命令。Post-write closeout 必须在读回验证后复核同一覆盖关系。
|
|
233
|
+
- process / flow / lifecycle model 的 `name` 子字段是名称片段,不是 provenance 或字段缺失说明,不得写入 `源数据未声明...`、`no separate ... was declared...` 这类句子。若源数据未单独给出某个 name 子字段,应从源全名、分类、地理代码、技术描述和来源字段中做可辩护拆分;仍无法确定时形成 review blocker,或在非 name 的 provenance 字段说明,不得用说明句占位。
|
|
234
|
+
- 所有 `name.*` LangText 中不得出现 `xx` / `xxx` / `XX` 等源数据标记或导入标记,不得出现 `TIDAS_IMPORT_PLACEHOLDER`、trace-only 文本、本地路径,也不得出现中文分号 `;` 或英文分号 `;`。TIDAS/ILCD name 子字段应使用逗号分隔的技术短语,不能使用分号连接说明句。
|
|
235
|
+
- `name` / name-like display 字段必须先使用 `tidas-name-plan-authoring` skill + `tiangong-lca dataset name-plan extract/validate/apply` 流程生成 source-language `name_plan`。不能靠穷举词表、简单正则替换或 Foundry-local 字典脚本完成:
|
|
236
|
+
- `extract` 产出 `outputs/name-plan-units.jsonl`,每个 unit 必须包含 `source_full_name`、当前 name 四段、字段定义、分类/地理/技术/flow property/unit 等上下文,以及 `name_plan_prompt`;
|
|
237
|
+
- Codex 只基于 `name_plan_prompt` 和来源证据生成 `name-plan-draft.jsonl`;
|
|
238
|
+
- `validate` 必须阻断分号、`xx/xxx`、trace-only、provenance 说明句和字段缺失说明句;
|
|
239
|
+
- `apply` 必须生成 name-planned rows 和 `outputs/name-plan-evidence.json`;
|
|
240
|
+
- 对可写 support rows,`source_full_name` 不拆成 flow/process 四段;draft 只能填写该 unit 的 `target_name_fields`。当前 BAFU 导入的可写 support 字段口径如下:source 用 `sourceInformation.dataSetInformation.common:shortName`;contact 用 `contactInformation.dataSetInformation.common:name` 和 `common:shortName`。unit group / flow property 默认只引用现有 public canonical rows;profile override 生效且公共库确无可辩护候选时,BAFU 私有 FP/UG 候选的名称只能在独立 account-local candidate registry 中依据单位/量纲/provenance 证据编写,并经专用 owner-draft 计划、审计与 readback 路径维护,不得进入 generic support name-plan/write 路径或 public canonical cache。
|
|
241
|
+
- `baseName`:只保留核心产品/废物流/服务/过程名称和必要的基本加工层级;去除前缀 `xx` / `xxx`,并尽量不要混入地点可得性、市场/生产组合、地理代码、路线说明或功能单位属性。
|
|
242
|
+
- `treatmentStandardsRoutes`:放处理方式、标准、质量等级、用途、生产路线、原料/educt、primary / secondary 等技术限定;例如废弃物去向或处理路线若是过程/流的技术路线,应放在此字段。
|
|
243
|
+
- `mixAndLocationTypes`:放 production mix / consumption mix / market mix、location type of availability、origin / destination、`at plant` / `at user` / `at grid` / `to consumer` / `at regional storage` 等可得性和地点类型信息;`工厂端 {KR}` / `at plant {KR}` 这类内容应优先拆入此字段,同时地理代码仍应写入 geography/location 或等价结构。
|
|
244
|
+
- process 的 `functionalUnitFlowProperties` / flow 的 `flowProperties`:放定量限定属性,例如浓度、含水率、能量含量、U 值、功率、单位相关的产品/过程属性等;非限定性的 CAS、公式、同义词不放在 name 子字段。
|
|
245
|
+
- 为了可回写和审计,源数据原始完整 name 必须保存在 mapping/provenance 中;不得为了回写便利而把未拆分的完整源名原样保留在 `baseName` 并在其他 name 字段重复补充。若复用 TianGong 公共库已有 flow/process 的 canonical name,可保留公共库 canonical name,同时在 mapping 中记录 BAFU 源名与 canonical name 的差异。
|
|
246
|
+
- name-plan 质量是写入前硬门禁,不是 UI 展示优化。若 `baseName` 仍包含 `production mix`、`production OM`、`at freight ship`、`at plant`、`at sawmill`、`{CH}` 等未拆源名片段,或包含 `wet, measured as dry mass`、`allocation exergy` 等应进入 functional/flow property 的限定,必须阻断并走 AI name-plan patch;`treatmentStandardsRoutes = source-described route` 属于生成占位,必须阻断;`mixAndLocationTypes` 只有 `CH`、`JP`、`RER` 这类裸 location code 时也必须阻断,除非同一 name-plan evidence 证明源数据确实没有可得性/地点类型片段且该字段应省略。
|
|
247
|
+
|
|
248
|
+
## QA 与验证门禁
|
|
249
|
+
|
|
250
|
+
- process 的 QA YAML 是独立质量门禁,必须至少检查:
|
|
251
|
+
- 必填字段是否结构和语义都完整;
|
|
252
|
+
- 是否仍有 placeholder、trace-only 文本、本地路径;
|
|
253
|
+
- flow 引用是否真实存在;
|
|
254
|
+
- elementary flow 是否优先复用公开数据库 flow;若属于 profile-authorized BAFU account-local candidate,是否已保留原始 elementary identity、完整候选检索、public 候选不可辩护理由、owner/state 闭包和 LCIA characterization 待处理状态;
|
|
255
|
+
- product/intermediate flow 是否完成已有库检索和复用/新建理由;
|
|
256
|
+
- flow 正式分类是否来自 TianGong/TIDAS 分类目录和语义决策证据,而不是仅复制源 EcoSpold1/转换包分类;
|
|
257
|
+
- 源 flow 分类是否已保留在 generalComment、trace/provenance 或 mapping 中,且未被当作唯一目标分类依据;
|
|
258
|
+
- reference flow、单位、flow property 是否一致;
|
|
259
|
+
- 年供应量或生产量是否能通过前端口径。
|
|
260
|
+
- BAFU 账号级物料平衡处理口径:
|
|
261
|
+
- CLI process QA 只产出 deterministic QA metrics/findings;Foundry 的 process curation gate 才负责 profile policy、AI authoring package、import-only trace cleanup、waiver 和最终 prewrite 状态。
|
|
262
|
+
- AI authoring 只能输出结构化 identity decision、classification decision、location decision、patch 或 build-plan。identity blocker 必须先通过 `node scripts/foundry.ts dataset-identity-decision-task-build --curation-gate-report <dataset-curation-gate-report.json> --out-dir <task-dir>` 转成明确的 AI decision task;分类 blocker 必须先通过 `node scripts/foundry.ts dataset-classification-decision-task-build --classification-queue <classification-authoring-queue.jsonl> --schema-file <schema.json> --yaml-file <methodology.yaml> --ruleset-file <runtime-ruleset.json> --classification-schema <tidas_*_category.json> --location-schema <tidas_locations_category.json> --out-dir <task-dir>` 转成明确的 AI decision task;location blocker 必须先通过 `node scripts/foundry.ts dataset-location-decision-task-build --location-queue <location-authoring-queue.jsonl> --schema-file <schema.json> --yaml-file <methodology.yaml> --ruleset-file <runtime-ruleset.json> --classification-schema <tidas_*_category.json> --location-schema <tidas_locations_category.json> --out-dir <task-dir>` 转成明确的 AI decision task。Decision task status 必须是 ready;若返回 `blocked_missing_full_context`,说明 schema、methodology YAML、runtime ruleset、分类/地点 schema、identity authoring package 或转换后的原始 row payload 不完整,必须先补齐,不能交给 AI 猜。非 identity/分类/location blocked authoring package 必须先通过 `node scripts/foundry.ts dataset-authoring-task-build --authoring-package <package> --out-dir <task-dir>` 转成明确的 AI task、patch template 和 deterministic apply 命令;task manifest 必须是 `ready_for_ai_authoring_batch`,若是 `blocked_missing_full_context` 必须先补齐 context,不能让 Codex/skill 直接手工改 rows。
|
|
263
|
+
- Identity decision 输出必须先通过 `node scripts/foundry.ts dataset-identity-decisions-apply --type <flow|process> --rows-file <rows.jsonl> --decisions <identity-decisions.jsonl> --out-dir <apply-dir>`,由 Foundry 按 AI 决策确定性拆分 write candidates、reference reuse rows 和 `identity-reference-rewrites.jsonl`。decision 必须保留 `decision_status=completed`、`authoring_package`、`authoring_package_sha256`、`used_context_kinds`、`basis`、结构化 evidence 和关闭的 identity action item;若 decision 留有 `__AI_FILL_*` 模板占位、缺 canonical reuse 目标或缺 evidence/context,应返回 AI authoring 修复。elementary flow 的 `create_new` 只有在 profile lock 授权且 decision 明确标记 account-local candidate、绑定候选检索与 owner/state/LCIA 缺口证据时才可进入 mutation manifest;其他 elementary `create_new` 一律阻塞。
|
|
264
|
+
- 分类 decision 输出必须先通过 `node scripts/foundry.ts dataset-classification-decisions-apply --classification-queue <classification-authoring-queue.jsonl> --decisions <classification-decisions.jsonl> --decision-task <classification-decision-task.json> --out-dir <apply-dir>`,由 CLI 根据 TIDAS 分类 schema 生成 canonical class path;decision 必须保留模板中的 `decision_status=completed` 和 `authoring_context.context_bundle_sha256`,且该 hash 必须来自对应 `classification-decision-task.json` 的 `context_bundle.sha256`,不得误用 shared context bundle hash;apply report 必须绑定 decision task/context bundle;apply report 未完成、decision 缺 completed 状态 / context bundle / evidence / basis、code 非法、或 queue item 未关闭时,应返回 AI authoring 修复。大队列可用 `--dataset-type`、`--bundle-id`/`--process-id`、`--limit`、`--offset`、`--chunk-label` 分块;若多个 chunk task 的决策合并应用到原始 queue,必须重复传入每个 `--decision-task`。
|
|
265
|
+
- Location decision 输出必须先通过 `node scripts/foundry.ts dataset-location-decisions-apply --location-queue <location-authoring-queue.jsonl> --decisions <location-decisions.jsonl> --decision-task <location-decision-task.json> --out-dir <apply-dir>`,由 CLI 根据 `tidas_locations_category.json` 写入 canonical location code;decision 必须保留模板中的 `decision_status=completed` 和 `authoring_context.context_bundle_sha256`,且该 hash 必须来自对应 `location-decision-task.json` 的 `context_bundle.sha256`,不得误用 shared context bundle hash;apply report 必须绑定 decision task/context bundle;apply report 未完成、decision 缺 completed 状态 / context bundle / target_path / evidence / basis、code 非法、或 queue item 未关闭时,应返回 AI authoring 修复。大队列可用 `--dataset-type`、`--bundle-id`/`--process-id`、`--limit`、`--offset`、`--chunk-label` 分块;若多个 chunk task 的决策合并应用到原始 queue,必须重复传入每个 `--decision-task`。
|
|
266
|
+
- 批量 authoring task 的 AI patch 输出必须先通过 `node scripts/foundry.ts dataset-authoring-patch-collect --task-manifest <authoring-task-manifest.json>` 收集成 batch patch;每个 AI patch 文件必须显式声明 `patch_status=completed`。collect 若发现缺 patch 文件、patch 状态缺失/非 completed、未完成模板、`__AI_FILL_*` 占位符、格式错误、authoring package 不匹配、缺 evidence、action item 未关闭,或 task/manifest 已失去完整 schema/YAML/ruleset/category/location/source-row context 证明,应返回 AI authoring 修复。
|
|
267
|
+
- 字段修改必须通过 `node scripts/foundry.ts dataset-patch-apply` 或 `tiangong-lca dataset patch apply` 落地,且 apply report 必须为 `completed`。BAFU 导入流程应使用 `--authoring-package-dir`、`--require-authoring-package` 和 `--require-action-item-closure`,使每个 patch set 绑定对应 AI authoring package,并显式关闭其解决的 `action_items`。分类/location 确定性 apply 之后,后续 full-context patch、identity decision、finalize 和 commit 必须以上一阶段 apply 输出 rows 为输入,不得回退到 apply 前的 cleanup rows;process/flow patch 后必须刷新 exact-payload identity preflight 并 merge 回当前 scope index 后才能 finalize/write。若 patch apply 被 `test` 失败、缺证据、路径缺失、row selector 问题、authoring package 不匹配或 action item 未关闭阻塞,应返回 AI authoring 修复,不得手工改 rows 后继续写库。
|
|
268
|
+
- 对写入 BAFU TianGong 账号的 BAFU 数据,`process_material_balance_deviation` 不作为 remote write blocker。该规则适用于本账号后续所有 BAFU 导入、更新和批量修复任务。
|
|
269
|
+
- 物料平衡仍应由 QA 工具计算并写入 QA report、mapping/report 或 QA artifact,作为源数据特征和后续人工分析信息;但不得因为 `raw material input != product + by-product + waste` 阻塞 schema 已通过、引用已验证、必填字段已补齐的 BAFU 数据写入。
|
|
270
|
+
- 该豁免只覆盖物料平衡偏差本身,不覆盖 exchange amount 缺失、单位换算缺失、exchangeDirection 错误、flow 引用不可解析、reference unit/property 不一致、trace/placeholder 残留、年供应量缺失或其他 QA/schema/frontend-equivalent blocker。
|
|
271
|
+
- 执行时必须在 stage 6 checkpoint、mapping/report 和 remote write manifest 中记录 `process_material_balance_deviation` 已按 BAFU account policy waived,并保留偏差数值、QA report 路径和采用该账号级规则的约束文件快照。
|
|
272
|
+
- 完整写入流程需要远端回读验证:写入后按 BAFU profile 重新读取 process/flow/lifecyclemodel/contact/source 等记录,确认实际数据库内容与本地计划一致。
|
|
273
|
+
- 对已经存在于数据库的 BAFU 记录应使用 update/upsert_current_version 类路径,不应重复创建同一数据集。
|
|
274
|
+
|
|
275
|
+
## 已知转换质量门禁
|
|
276
|
+
|
|
277
|
+
- 早期完整 BAFU TIDAS JSON 曾出现 process exchange 的 `exchangeDirection` 全部为 `Output`。后续完整转入前必须重新统计 `exchangeDirection` 与 EcoSpold1 trace 中 `inputGroup` / `outputGroup` 的一致性;若 mismatch 不为 0,应阻塞写入。
|
|
278
|
+
- 若源 EcoSpold1/TIDAS 文件本身只有 output exchange,也不能静默写库。优先由 Foundry deterministic cleanup 在传入 `source_rows_file` 后比较源 row 与最终 row:源 row 必须 Output-only,最终 row 也必须 Output-only,并且除允许的 `referenceToFlowDataSet` canonical rewrite 外 exchange signature 一致;通过时写入 `common:other.tiangongfoundry:sourceExchangeCompleteness` 和 cleanup proof。若无法做该确定性证明,AI 必须读取 source XML/TIDAS trace 与 process context 后记录 `status=source_only_output_exchange_verified`(或修复 exchange set),并保留结构化证据;证据必须包含 source 以及 quote / trace / path / citation 等可追踪指针。没有 deterministic proof 或 AI evidence 时 process curation gate 必须阻塞。
|
|
279
|
+
- 历史证据:2026-05-23 使用当时的 Python converter 重新转换 `BAFU-2025 Version 2 - ecoSpold1 2026-03-09.zip` 后,完整 TIDAS 结果为 `Input=143105`、`Output=274604`、trace mismatch `0`,因此“全部 Output”异常在该转换结果中已不再发生;该旧 converter 路径不是当前执行入口。
|
|
280
|
+
- 初始转换 flow 文件夹包含未被 process 引用的 flow;后续不能因为 flow 文件存在就全部写入账号。
|
|
281
|
+
- 10 条样本修复中曾发现自建 elementary flow `Heat, waste` 被 process 引用;已改为公开 `waste heat` flow。完整转换时同类问题必须按批量规则处理。
|
|
282
|
+
|
|
283
|
+
## 整库写入约束
|
|
284
|
+
|
|
285
|
+
- 完整写入前必须生成 mutation manifest,至少列出计划写入、更新、跳过、复用或引用的 `contacts`、`sources`、`unitgroups`、`flowproperties`、`flows`、`processes`,以及每条记录的 UUID、version、目标 owner、state_code、依赖关系和处理理由。`unitgroups` / `flowproperties` 默认标记为 reference-only public canonical reuse;profile override 生效时,确无可辩护 public 候选的记录可以标记为 account-local candidate,但必须绑定 profile-lock、独立 UUID/version、当前 owner、`state_code=0`、单位换算与引用闭包证据,并走专用 owner-draft handoff。
|
|
286
|
+
- process / flow / lifecyclemodel 写入范围的 mutation manifest 必须由 `node scripts/foundry.ts dataset-mutation-manifest --type <process|flow|lifecyclemodel>` 生成,并引用 schema validation、post-authoring Foundry curation gate、AI semantic evidence(identity 预检使用 identity decision apply report 且该 report 必须绑定 authoring package/sha/action item;分类队列使用 classification decision apply report 且该 report 必须绑定 classification decision task/context bundle;location 队列使用 location decision apply report 且该 report 必须绑定 location decision task/context bundle;其他字段修复使用 AI patch collect/apply report/evidence)、cleanup、dry-run、remote verification、target owner 和 reference-reuse 证据;这些证据必须对应同一 exact rows-file scope:schema / remote verification 的 `input_path` 指向 manifest rows,curation gate 的 `rows_file` 指向 manifest rows,curation gate 引用的 deterministic QA report 的 `rows_file` / `input_path` 指向 manifest rows,cleanup 的 `cleaned_rows_file` 指向 manifest rows,identity/classification/location decision apply 的 `files.output_rows` 或 AI patch apply 的输出必须链到 cleanup 输入。零散 dry-run 输出不能单独替代该 manifest。若 manifest 输出 unresolved/source-exchange trace queue,commit handoff 和 post-write closeout 都必须证明这些 queue 与最终 rows 的 `common:other` trace 逐条一致,作为后续数据库侧治理入口。
|
|
287
|
+
- process / flow / lifecyclemodel 写库前必须在 mutation manifest 阶段证明引用闭包:当前 exact write scope 内的引用可以由本次 rows 证明;互相引用的可写 contact/source 必须先合并为 `support` scope,通过 `dataset-post-authoring-finalize --type support`、`tiangong-lca dataset save-draft --type auto --commit` 和 post-write verify/closeout;unitgroup/flowproperty 引用必须由 public canonical support cache + 远端公开库验证,或由 profile-authorized account-local candidate registry + 同 owner/state 的远端精确回读证明;scope 外的 flow/source/contact 等可写引用,必须在上游 scope 已写入后通过 `tiangong-lca dataset verify-remote` 证明远端存在并匹配。否则 `dataset-post-authoring-finalize` 必须停在 `reference_closure_remote_verify_required`、`reference_closure_unproven` 或 `reference_only_support_type_write_blocked`,不得生成可执行 commit handoff。
|
|
288
|
+
- 完整写入前必须锁定本文件 sha256 和原则快照;每条 row receipt、mutation manifest 和最终 mapping CSV/JSON 都必须记录该快照 hash。若本文件发生变化,必须重新生成 plan、row receipts、flow resolution 和 write plan,不得沿用旧产物。
|
|
289
|
+
- mutation manifest 可以额外产出 `delete_candidates`,但该字段只表示“建议人工检查并删除”的候选清单,不得触发自动删除。
|
|
290
|
+
- 写入范围必须以 process 实际引用闭包为准:
|
|
291
|
+
- process 未引用的 flow 文件不应仅因存在于 flow 文件夹就写入;
|
|
292
|
+
- flow 未引用的 flow property / unit group 不应写入;
|
|
293
|
+
- source/contact 也应按实际引用闭包和必要的 provenance 引用确定。
|
|
294
|
+
- 完整写入必须分阶段执行并留下 artifact:
|
|
295
|
+
1. 远端 before snapshot;
|
|
296
|
+
2. source/contact 写入计划,以及 unitgroup/flowproperty public canonical reuse 或 profile-authorized account-local candidate 计划;
|
|
297
|
+
3. flow 映射和写入计划;
|
|
298
|
+
4. process exchange reference rewrite 计划;
|
|
299
|
+
5. dry-run 报告;
|
|
300
|
+
6. commit 报告;
|
|
301
|
+
7. 远端 after snapshot;
|
|
302
|
+
8. schema/QA/frontend-equivalent/readback 验证报告。
|
|
303
|
+
- 所有远端写入必须幂等:
|
|
304
|
+
- 同 UUID/version 已存在于 BAFU 账号时使用 update/upsert_current_version;
|
|
305
|
+
- 不得重复 create 同一 UUID/version;
|
|
306
|
+
- 若目标记录已经是 public 或其他 owner 的记录,不得直接覆盖,必须转为引用复用;profile-authorized BAFU account-local unitgroup/flowproperty 必须使用独立 UUID/version、当前 owner 和 `state_code=0`,不得影子覆盖 public identity。
|
|
307
|
+
- 完整写入流程不得执行物理删除。确认未被引用且属于 BAFU 账号的历史残留记录时,只能输出待人工删除清单,列明 UUID、version、entity type、owner、引用检查结果、建议删除原因和风险说明;真正删除动作由人另行确认并执行。
|
|
308
|
+
- 所有引用必须在最终远端回读中可解析:
|
|
309
|
+
- process exchange 引用的 flow 要么是 TianGong public/existing canonical,要么是本次 BAFU owner-draft 闭包内、经 profile lock 授权并有 remote verify 的 flow(包括尚无公共候选的 account-local elementary flow);任何 public process 不得引用 private flow;
|
|
310
|
+
- flow 引用的 flow property / unit group 必须是 TianGong public canonical,或同一 BAFU owner、同为 `state_code=0` 的精确 account-local FP/UG 对,并有 public cache 或 account-local registry + remote verify 证据;
|
|
311
|
+
- contact/source/compliance/data format 引用必须真实存在,不能只在本地包里存在;compliance/data format 必须使用 TianGong public canonical 支撑对象。
|
|
312
|
+
- 完整写入不得把 `lciamethods`、LCIA 因子或未评审的影响评价支撑对象顺带写入。若未来要导入 LCIA 相关数据,必须另设规则,因为 elementary flow identity 与 LCIA factor 对应关系是独立质量门禁。
|
|
313
|
+
- 完整写入后必须检查 BAFU 账号内是否存在 orphan support records:
|
|
314
|
+
- BAFU-owned flow property / unit group 必须能在 account-local candidate registry 中解释其量纲、单位、引用闭包和后续评审状态;未登记或无引用的记录进入人工处置候选;
|
|
315
|
+
- 未被任何 process/flow/source/provenance 引用的 contact/source;
|
|
316
|
+
- 已被 public canonical 替代但仍残留的旧私有 support。这些记录应进入待人工删除清单,不得混入“本次导入成功”口径。
|
|
317
|
+
- 完整写入必须保留 source-to-target mapping CSV/JSON:
|
|
318
|
+
- flow mapping;
|
|
319
|
+
- elementary flow mapping;
|
|
320
|
+
- flow property / unit group mapping;
|
|
321
|
+
- unit conversion mapping;
|
|
322
|
+
- contact/source mapping;
|
|
323
|
+
- compliance system / data set format reference rewrite mapping;
|
|
324
|
+
- process exchange rewrite mapping。这些 mapping 是后续审计、回滚和迁移到 public canonical 的依据。
|
|
325
|
+
- 大批量写入需要控制批次和失败恢复:
|
|
326
|
+
- 每个批次必须可重跑;
|
|
327
|
+
- commit 报告必须列出成功、失败、跳过、更新和插入;
|
|
328
|
+
- 远端写入必须按 exact write scope / process bundle closure 形成 dry-run、mutation manifest、commit handoff、commit report、readback verify 和 closeout;
|
|
329
|
+
- 任一 scope 出现引用不完整、schema invalid、前端必填校验失败、unitgroup/flowproperty 既无 public canonical 又无合规的 profile-authorized account-local candidate,或 elementary flow 既未解析 public/existing canonical 又不满足 account-local candidate 门禁,应阻塞该 scope 及依赖它的闭包,并把 blocker 写入 blocked ledger;不得阻塞已经证明依赖独立且门禁通过的其他批次继续自动 commit/readback。
|
|
330
|
+
|
|
331
|
+
## Mapping Evidence And CSV Contract
|
|
332
|
+
|
|
333
|
+
- 完整导入必须输出 source-to-target mapping CSV/JSON。mapping 是审计、回滚、LCIA 后续补齐、公共库迁移和远端回读 diff 的依据,不是可选报告。
|
|
334
|
+
- mapping 至少覆盖:
|
|
335
|
+
- source package / source dataset / normalized TIDAS / final TianGong dataset 的 id 和 version;
|
|
336
|
+
- contact、source、compliance system、data set format、unit group、flow property、flow、process、exchange、classification、source-language text、unit conversion、reference year、annual supply/production volume;
|
|
337
|
+
- reuse / update / upsert / create / skip / exception / delete-candidate 等动作;
|
|
338
|
+
- source value、normalized value、final value、change reason、evidence、confidence 或 decision status;
|
|
339
|
+
- checkpoint stage、rule snapshot hash、command/report path、review status 和 residual blockers。
|
|
340
|
+
- 对 flow classification,mapping 必须记录 `source_classification`、`selected_tidas_classification`、`classification_basis`、`candidate_categories`、`decision_status`。
|
|
341
|
+
- 对 elementary flow,mapping 必须区分 public/existing canonical reuse、profile-authorized account-local candidate、forced candidate 和 unresolved blocker;account-local flow 不得进入全局 LCIA 正式缓存,试验因子只能走 BAFU staging overlay。
|
|
342
|
+
- 对 support records,mapping 必须说明 source/contact 写入理由、unitgroup/flowproperty public canonical reuse 证据,或 account-local candidate 的 profile-lock、owner/state、单位尺度、引用闭包和专家评审状态。任何未登记的 BAFU-owned unitgroup/flowproperty 才视为历史残留或错误写入候选。
|
|
343
|
+
- 执行顺序、checkpoint 和中断恢复机制不在本文重复维护;必须按 `docs/import-profiles/bafu/profile.md` 的九阶段 workflow 执行。
|