@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.
Files changed (323) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +532 -0
  3. package/docs/architecture.md +450 -0
  4. package/docs/foundry-task-contracts.md +147 -0
  5. package/docs/import-profiles/bafu/constraints.md +343 -0
  6. package/docs/import-profiles/bafu/leaf-process-classification-authoring.md +153 -0
  7. package/docs/import-profiles/bafu/profile.md +183 -0
  8. package/docs/import-profiles/uslci/constraints.md +29 -0
  9. package/docs/import-profiles/uslci/profile.md +43 -0
  10. package/docs/import-profiles/worldsteel/constraints.md +77 -0
  11. package/docs/import-profiles/worldsteel/import-coverage.md +93 -0
  12. package/docs/import-profiles/worldsteel/import-plan.md +375 -0
  13. package/docs/import-profiles/worldsteel/profile.md +78 -0
  14. package/docs/package-distribution-contract.md +287 -0
  15. package/docs/public-runtime-contract.md +218 -0
  16. package/docs/runtime-context-contract.md +138 -0
  17. package/docs/safety-policy.md +164 -0
  18. package/docs/task-authorization-contract.md +131 -0
  19. package/docs/uslci-import-runbook.md +336 -0
  20. package/docs/workspace-migration-contract.md +127 -0
  21. package/package-dist/assets/foundry-package-descriptor.json +1661 -0
  22. package/package-dist/scripts/foundry-facade.d.ts +78 -0
  23. package/package-dist/scripts/foundry-facade.js +1317 -0
  24. package/package-dist/scripts/foundry-runtime.d.ts +180 -0
  25. package/package-dist/scripts/foundry-runtime.js +190 -0
  26. package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.d.ts +27 -0
  27. package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.js +85 -0
  28. package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.d.ts +38 -0
  29. package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.js +90 -0
  30. package/package-dist/scripts/lib/bundle-row-types.d.ts +44 -0
  31. package/package-dist/scripts/lib/bundle-row-types.js +46 -0
  32. package/package-dist/scripts/lib/bundle-sample-utils.d.ts +183 -0
  33. package/package-dist/scripts/lib/bundle-sample-utils.js +526 -0
  34. package/package-dist/scripts/lib/bundle-source-context.d.ts +31 -0
  35. package/package-dist/scripts/lib/bundle-source-context.js +142 -0
  36. package/package-dist/scripts/lib/canonical-description.d.ts +12 -0
  37. package/package-dist/scripts/lib/canonical-description.js +72 -0
  38. package/package-dist/scripts/lib/canonical-support-rewrites.d.ts +127 -0
  39. package/package-dist/scripts/lib/canonical-support-rewrites.js +527 -0
  40. package/package-dist/scripts/lib/decision-owners/classification.d.ts +245 -0
  41. package/package-dist/scripts/lib/decision-owners/classification.js +754 -0
  42. package/package-dist/scripts/lib/decision-owners/identity-preflight.d.ts +333 -0
  43. package/package-dist/scripts/lib/decision-owners/identity-preflight.js +1353 -0
  44. package/package-dist/scripts/lib/decision-owners/identity-task.d.ts +130 -0
  45. package/package-dist/scripts/lib/decision-owners/identity-task.js +494 -0
  46. package/package-dist/scripts/lib/decision-owners/identity.d.ts +74 -0
  47. package/package-dist/scripts/lib/decision-owners/identity.js +443 -0
  48. package/package-dist/scripts/lib/decision-owners/location.d.ts +239 -0
  49. package/package-dist/scripts/lib/decision-owners/location.js +704 -0
  50. package/package-dist/scripts/lib/decision-task-utils.d.ts +484 -0
  51. package/package-dist/scripts/lib/decision-task-utils.js +735 -0
  52. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.d.ts +52 -0
  53. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.js +146 -0
  54. package/package-dist/scripts/lib/finalize-owners/commit-handoff.d.ts +79 -0
  55. package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +515 -0
  56. package/package-dist/scripts/lib/finalize-owners/post-authoring.d.ts +234 -0
  57. package/package-dist/scripts/lib/finalize-owners/post-authoring.js +1720 -0
  58. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.d.ts +140 -0
  59. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +656 -0
  60. package/package-dist/scripts/lib/foundry-args.d.ts +7 -0
  61. package/package-dist/scripts/lib/foundry-args.js +38 -0
  62. package/package-dist/scripts/lib/foundry-authentication-environment.d.ts +17 -0
  63. package/package-dist/scripts/lib/foundry-authentication-environment.js +55 -0
  64. package/package-dist/scripts/lib/foundry-authorization-input.d.ts +31 -0
  65. package/package-dist/scripts/lib/foundry-authorization-input.js +151 -0
  66. package/package-dist/scripts/lib/foundry-command-metadata.d.ts +32 -0
  67. package/package-dist/scripts/lib/foundry-command-metadata.js +1012 -0
  68. package/package-dist/scripts/lib/foundry-command-registry.d.ts +34 -0
  69. package/package-dist/scripts/lib/foundry-command-registry.js +241 -0
  70. package/package-dist/scripts/lib/foundry-command-spec.d.ts +1 -0
  71. package/package-dist/scripts/lib/foundry-command-spec.js +1 -0
  72. package/package-dist/scripts/lib/foundry-decision-owners.d.ts +17 -0
  73. package/package-dist/scripts/lib/foundry-decision-owners.js +68 -0
  74. package/package-dist/scripts/lib/foundry-decision-routing.d.ts +3 -0
  75. package/package-dist/scripts/lib/foundry-decision-routing.js +38 -0
  76. package/package-dist/scripts/lib/foundry-execution-admission.d.ts +33 -0
  77. package/package-dist/scripts/lib/foundry-execution-admission.js +225 -0
  78. package/package-dist/scripts/lib/foundry-execution-attempt.d.ts +11 -0
  79. package/package-dist/scripts/lib/foundry-execution-attempt.js +33 -0
  80. package/package-dist/scripts/lib/foundry-execution-context-format.d.ts +18 -0
  81. package/package-dist/scripts/lib/foundry-execution-context-format.js +83 -0
  82. package/package-dist/scripts/lib/foundry-facade-store.d.ts +25 -0
  83. package/package-dist/scripts/lib/foundry-facade-store.js +449 -0
  84. package/package-dist/scripts/lib/foundry-finalize-owners.d.ts +21 -0
  85. package/package-dist/scripts/lib/foundry-finalize-owners.js +203 -0
  86. package/package-dist/scripts/lib/foundry-identity-owners.d.ts +13 -0
  87. package/package-dist/scripts/lib/foundry-identity-owners.js +58 -0
  88. package/package-dist/scripts/lib/foundry-managed-host.d.ts +7 -0
  89. package/package-dist/scripts/lib/foundry-managed-host.js +173 -0
  90. package/package-dist/scripts/lib/foundry-migration-adoption-plan.d.ts +39 -0
  91. package/package-dist/scripts/lib/foundry-migration-adoption-plan.js +467 -0
  92. package/package-dist/scripts/lib/foundry-migration-adoption.d.ts +31 -0
  93. package/package-dist/scripts/lib/foundry-migration-adoption.js +187 -0
  94. package/package-dist/scripts/lib/foundry-migration-authority.d.ts +42 -0
  95. package/package-dist/scripts/lib/foundry-migration-authority.js +280 -0
  96. package/package-dist/scripts/lib/foundry-migration-inventory.d.ts +31 -0
  97. package/package-dist/scripts/lib/foundry-migration-inventory.js +148 -0
  98. package/package-dist/scripts/lib/foundry-migration-plan.d.ts +48 -0
  99. package/package-dist/scripts/lib/foundry-migration-plan.js +234 -0
  100. package/package-dist/scripts/lib/foundry-migration-replay.d.ts +3 -0
  101. package/package-dist/scripts/lib/foundry-migration-replay.js +134 -0
  102. package/package-dist/scripts/lib/foundry-migration-stage.d.ts +15 -0
  103. package/package-dist/scripts/lib/foundry-migration-stage.js +152 -0
  104. package/package-dist/scripts/lib/foundry-migration-transfer-io.d.ts +13 -0
  105. package/package-dist/scripts/lib/foundry-migration-transfer-io.js +226 -0
  106. package/package-dist/scripts/lib/foundry-migration-transfer.d.ts +36 -0
  107. package/package-dist/scripts/lib/foundry-migration-transfer.js +350 -0
  108. package/package-dist/scripts/lib/foundry-operation-result.d.ts +71 -0
  109. package/package-dist/scripts/lib/foundry-operation-result.js +264 -0
  110. package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +319 -0
  111. package/package-dist/scripts/lib/foundry-owner-execution-store.js +293 -0
  112. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +22 -0
  113. package/package-dist/scripts/lib/foundry-owner-readback.js +189 -0
  114. package/package-dist/scripts/lib/foundry-owner-trace-acceptance.d.ts +15 -0
  115. package/package-dist/scripts/lib/foundry-owner-trace-acceptance.js +68 -0
  116. package/package-dist/scripts/lib/foundry-package-contract.d.ts +56 -0
  117. package/package-dist/scripts/lib/foundry-package-contract.js +392 -0
  118. package/package-dist/scripts/lib/foundry-private-path.d.ts +2 -0
  119. package/package-dist/scripts/lib/foundry-private-path.js +20 -0
  120. package/package-dist/scripts/lib/foundry-runtime-cache.d.ts +3 -0
  121. package/package-dist/scripts/lib/foundry-runtime-cache.js +25 -0
  122. package/package-dist/scripts/lib/foundry-runtime-command-policy.d.ts +20 -0
  123. package/package-dist/scripts/lib/foundry-runtime-command-policy.js +173 -0
  124. package/package-dist/scripts/lib/foundry-runtime-context-types.d.ts +59 -0
  125. package/package-dist/scripts/lib/foundry-runtime-context-types.js +1 -0
  126. package/package-dist/scripts/lib/foundry-runtime-context.d.ts +27 -0
  127. package/package-dist/scripts/lib/foundry-runtime-context.js +668 -0
  128. package/package-dist/scripts/lib/foundry-runtime-environment.d.ts +9 -0
  129. package/package-dist/scripts/lib/foundry-runtime-environment.js +90 -0
  130. package/package-dist/scripts/lib/foundry-runtime-error.d.ts +4 -0
  131. package/package-dist/scripts/lib/foundry-runtime-error.js +8 -0
  132. package/package-dist/scripts/lib/foundry-runtime-identity.d.ts +18 -0
  133. package/package-dist/scripts/lib/foundry-runtime-identity.js +127 -0
  134. package/package-dist/scripts/lib/foundry-runtime-paths.d.ts +16 -0
  135. package/package-dist/scripts/lib/foundry-runtime-paths.js +159 -0
  136. package/package-dist/scripts/lib/foundry-runtime-qualification.d.ts +66 -0
  137. package/package-dist/scripts/lib/foundry-runtime-qualification.js +223 -0
  138. package/package-dist/scripts/lib/foundry-runtime-selection-record.d.ts +16 -0
  139. package/package-dist/scripts/lib/foundry-runtime-selection-record.js +32 -0
  140. package/package-dist/scripts/lib/foundry-runtime-selection.d.ts +14 -0
  141. package/package-dist/scripts/lib/foundry-runtime-selection.js +123 -0
  142. package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +178 -0
  143. package/package-dist/scripts/lib/foundry-runtime-utils.js +603 -0
  144. package/package-dist/scripts/lib/foundry-semantic-input.d.ts +30 -0
  145. package/package-dist/scripts/lib/foundry-semantic-input.js +132 -0
  146. package/package-dist/scripts/lib/foundry-task-authorization.d.ts +68 -0
  147. package/package-dist/scripts/lib/foundry-task-authorization.js +350 -0
  148. package/package-dist/scripts/lib/foundry-task-io.d.ts +18 -0
  149. package/package-dist/scripts/lib/foundry-task-io.js +92 -0
  150. package/package-dist/scripts/lib/foundry-task-registration.d.ts +6 -0
  151. package/package-dist/scripts/lib/foundry-task-registration.js +384 -0
  152. package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +34 -0
  153. package/package-dist/scripts/lib/foundry-task-start-spec.js +161 -0
  154. package/package-dist/scripts/lib/foundry-task-store.d.ts +18 -0
  155. package/package-dist/scripts/lib/foundry-task-store.js +466 -0
  156. package/package-dist/scripts/lib/foundry-task-types.d.ts +99 -0
  157. package/package-dist/scripts/lib/foundry-task-types.js +1 -0
  158. package/package-dist/scripts/lib/foundry-workflow-approval-continuation.d.ts +6 -0
  159. package/package-dist/scripts/lib/foundry-workflow-approval-continuation.js +136 -0
  160. package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +3 -0
  161. package/package-dist/scripts/lib/foundry-workflow-assessment.js +231 -0
  162. package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +22 -0
  163. package/package-dist/scripts/lib/foundry-workflow-authorization.js +174 -0
  164. package/package-dist/scripts/lib/foundry-workflow-context.d.ts +3 -0
  165. package/package-dist/scripts/lib/foundry-workflow-context.js +99 -0
  166. package/package-dist/scripts/lib/foundry-workflow-decisions.d.ts +18 -0
  167. package/package-dist/scripts/lib/foundry-workflow-decisions.js +123 -0
  168. package/package-dist/scripts/lib/foundry-workflow-execution.d.ts +8 -0
  169. package/package-dist/scripts/lib/foundry-workflow-execution.js +248 -0
  170. package/package-dist/scripts/lib/foundry-workflow-finalize.d.ts +13 -0
  171. package/package-dist/scripts/lib/foundry-workflow-finalize.js +264 -0
  172. package/package-dist/scripts/lib/foundry-workflow-identity-apply.d.ts +14 -0
  173. package/package-dist/scripts/lib/foundry-workflow-identity-apply.js +159 -0
  174. package/package-dist/scripts/lib/foundry-workflow-identity.d.ts +6 -0
  175. package/package-dist/scripts/lib/foundry-workflow-identity.js +153 -0
  176. package/package-dist/scripts/lib/foundry-workflow-import.d.ts +4 -0
  177. package/package-dist/scripts/lib/foundry-workflow-import.js +70 -0
  178. package/package-dist/scripts/lib/foundry-workflow-io.d.ts +11 -0
  179. package/package-dist/scripts/lib/foundry-workflow-io.js +77 -0
  180. package/package-dist/scripts/lib/foundry-workflow-reference-verify.d.ts +41 -0
  181. package/package-dist/scripts/lib/foundry-workflow-reference-verify.js +266 -0
  182. package/package-dist/scripts/lib/foundry-workflow-rows.d.ts +2 -0
  183. package/package-dist/scripts/lib/foundry-workflow-rows.js +47 -0
  184. package/package-dist/scripts/lib/foundry-workflow-semantic.d.ts +5 -0
  185. package/package-dist/scripts/lib/foundry-workflow-semantic.js +367 -0
  186. package/package-dist/scripts/lib/foundry-workflow-state.d.ts +37 -0
  187. package/package-dist/scripts/lib/foundry-workflow-state.js +158 -0
  188. package/package-dist/scripts/lib/full-context-proof.d.ts +51 -0
  189. package/package-dist/scripts/lib/full-context-proof.js +932 -0
  190. package/package-dist/scripts/lib/identity-preflight-artifacts.d.ts +184 -0
  191. package/package-dist/scripts/lib/identity-preflight-artifacts.js +573 -0
  192. package/package-dist/scripts/lib/identity-preflight-proof.d.ts +117 -0
  193. package/package-dist/scripts/lib/identity-preflight-proof.js +341 -0
  194. package/package-dist/scripts/lib/identity-reference-rewrite-utils.d.ts +147 -0
  195. package/package-dist/scripts/lib/identity-reference-rewrite-utils.js +817 -0
  196. package/package-dist/scripts/lib/import-curation/authoring-packages.d.ts +28 -0
  197. package/package-dist/scripts/lib/import-curation/authoring-packages.js +92 -0
  198. package/package-dist/scripts/lib/import-curation/curation-cleanup.d.ts +32 -0
  199. package/package-dist/scripts/lib/import-curation/curation-cleanup.js +203 -0
  200. package/package-dist/scripts/lib/import-curation/curation-gate.d.ts +47 -0
  201. package/package-dist/scripts/lib/import-curation/curation-gate.js +528 -0
  202. package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.d.ts +24 -0
  203. package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.js +152 -0
  204. package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.d.ts +3 -0
  205. package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.js +3 -0
  206. package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.d.ts +1 -0
  207. package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.js +1 -0
  208. package/package-dist/scripts/lib/import-curation/internal/context-inputs.d.ts +56 -0
  209. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +206 -0
  210. package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.d.ts +14 -0
  211. package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.js +14 -0
  212. package/package-dist/scripts/lib/import-curation/internal/dataset-payload.d.ts +70 -0
  213. package/package-dist/scripts/lib/import-curation/internal/dataset-payload.js +141 -0
  214. package/package-dist/scripts/lib/import-curation/internal/dataset-types.d.ts +25 -0
  215. package/package-dist/scripts/lib/import-curation/internal/dataset-types.js +45 -0
  216. package/package-dist/scripts/lib/import-curation/internal/full-context-proof.d.ts +129 -0
  217. package/package-dist/scripts/lib/import-curation/internal/full-context-proof.js +552 -0
  218. package/package-dist/scripts/lib/import-curation/internal/hash-utils.d.ts +2 -0
  219. package/package-dist/scripts/lib/import-curation/internal/hash-utils.js +10 -0
  220. package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.d.ts +15 -0
  221. package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.js +15 -0
  222. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +31 -0
  223. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +467 -0
  224. package/package-dist/scripts/lib/import-curation/internal/profiles-config.d.ts +47 -0
  225. package/package-dist/scripts/lib/import-curation/internal/profiles-config.js +88 -0
  226. package/package-dist/scripts/lib/import-curation/internal/runtime-io.d.ts +23 -0
  227. package/package-dist/scripts/lib/import-curation/internal/runtime-io.js +132 -0
  228. package/package-dist/scripts/lib/import-curation/internal/trace-summary.d.ts +53 -0
  229. package/package-dist/scripts/lib/import-curation/internal/trace-summary.js +114 -0
  230. package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.d.ts +141 -0
  231. package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +854 -0
  232. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.d.ts +20 -0
  233. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.js +46 -0
  234. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.d.ts +110 -0
  235. package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.js +782 -0
  236. package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.d.ts +24 -0
  237. package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.js +191 -0
  238. package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.d.ts +80 -0
  239. package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.js +359 -0
  240. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.d.ts +146 -0
  241. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.js +381 -0
  242. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.d.ts +223 -0
  243. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.js +1079 -0
  244. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.d.ts +41 -0
  245. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +412 -0
  246. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.d.ts +117 -0
  247. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.js +278 -0
  248. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.d.ts +59 -0
  249. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.js +593 -0
  250. package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.d.ts +58 -0
  251. package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +263 -0
  252. package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.d.ts +177 -0
  253. package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.js +812 -0
  254. package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.d.ts +159 -0
  255. package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.js +466 -0
  256. package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.d.ts +152 -0
  257. package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +1377 -0
  258. package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.d.ts +38 -0
  259. package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.js +116 -0
  260. package/package-dist/scripts/lib/import-curation/mutation-manifest.d.ts +51 -0
  261. package/package-dist/scripts/lib/import-curation/mutation-manifest.js +542 -0
  262. package/package-dist/scripts/lib/import-curation/patch-collect.d.ts +18 -0
  263. package/package-dist/scripts/lib/import-curation/patch-collect.js +172 -0
  264. package/package-dist/scripts/lib/import-curation/profiles.d.ts +1 -0
  265. package/package-dist/scripts/lib/import-curation/profiles.js +1 -0
  266. package/package-dist/scripts/lib/import-curation/trace-summary.d.ts +1 -0
  267. package/package-dist/scripts/lib/import-curation/trace-summary.js +1 -0
  268. package/package-dist/scripts/lib/oauth-session-reference.d.ts +1 -0
  269. package/package-dist/scripts/lib/oauth-session-reference.js +20 -0
  270. package/package-dist/scripts/lib/post-authoring-finalize-utils.d.ts +95 -0
  271. package/package-dist/scripts/lib/post-authoring-finalize-utils.js +548 -0
  272. package/package-dist/scripts/lib/post-write-root-proof.d.ts +44 -0
  273. package/package-dist/scripts/lib/post-write-root-proof.js +169 -0
  274. package/package-dist/scripts/lib/reference-description-text.d.ts +2 -0
  275. package/package-dist/scripts/lib/reference-description-text.js +12 -0
  276. package/package-dist/scripts/lib/remote-verification-accepted-diff.d.ts +42 -0
  277. package/package-dist/scripts/lib/remote-verification-accepted-diff.js +424 -0
  278. package/package-dist/scripts/lib/same-identity-commit-recovery.d.ts +8 -0
  279. package/package-dist/scripts/lib/same-identity-commit-recovery.js +52 -0
  280. package/package-dist/scripts/lib/source-semantics.d.ts +255 -0
  281. package/package-dist/scripts/lib/source-semantics.js +888 -0
  282. package/package-dist/scripts/lib/stage-contract.d.ts +36 -0
  283. package/package-dist/scripts/lib/stage-contract.js +25 -0
  284. package/package-dist/scripts/lib/task-authorization.d.ts +84 -0
  285. package/package-dist/scripts/lib/task-authorization.js +210 -0
  286. package/package-dist/scripts/lib/tidas-adapter.d.ts +113 -0
  287. package/package-dist/scripts/lib/tidas-adapter.js +525 -0
  288. package/package-dist/scripts/lib/tidas-language-utils.d.ts +8 -0
  289. package/package-dist/scripts/lib/tidas-language-utils.js +206 -0
  290. package/package-dist/scripts/lib/tidas-row-utils.d.ts +70 -0
  291. package/package-dist/scripts/lib/tidas-row-utils.js +225 -0
  292. package/package-dist/scripts/lib/trace-coverage.d.ts +53 -0
  293. package/package-dist/scripts/lib/trace-coverage.js +178 -0
  294. package/package-dist/scripts/package-entry.d.ts +2 -0
  295. package/package-dist/scripts/package-entry.js +4 -0
  296. package/package-dist/scripts/public-api.d.ts +80 -0
  297. package/package-dist/scripts/public-api.js +28 -0
  298. package/package-dist/scripts/runtime-entry.d.ts +23 -0
  299. package/package-dist/scripts/runtime-entry.js +424 -0
  300. package/package.json +93 -0
  301. package/specs/canonical-support/flow-properties-unit-groups.json +2692 -0
  302. package/specs/import-profiles.json +118 -0
  303. package/specs/prewrite-content-policy.json +105 -0
  304. package/specs/schemas/authorization-derivation.schema.json +34 -0
  305. package/specs/schemas/execution-context.schema.json +68 -0
  306. package/specs/schemas/foundry-authorization-input.schema.json +120 -0
  307. package/specs/schemas/foundry-facade-request-index.schema.json +78 -0
  308. package/specs/schemas/foundry-managed-runtime.schema.json +122 -0
  309. package/specs/schemas/foundry-migration-activation.schema.json +213 -0
  310. package/specs/schemas/foundry-migration-adoption-plan.schema.json +548 -0
  311. package/specs/schemas/foundry-migration-transfer-receipt.schema.json +93 -0
  312. package/specs/schemas/foundry-operation-result.schema.json +147 -0
  313. package/specs/schemas/foundry-package-descriptor.schema.json +134 -0
  314. package/specs/schemas/foundry-runtime-selection.schema.json +59 -0
  315. package/specs/schemas/foundry-semantic-input.schema.json +36 -0
  316. package/specs/schemas/foundry-task-start.schema.json +123 -0
  317. package/specs/schemas/foundry-workspace-migration-pending.schema.json +17 -0
  318. package/specs/schemas/foundry-workspace-migration-plan.schema.json +59 -0
  319. package/specs/schemas/foundry-workspace-migration-transfer-plan.schema.json +357 -0
  320. package/specs/schemas/foundry-workspace-v2.schema.json +70 -0
  321. package/specs/schemas/runtime-qualification.schema.json +63 -0
  322. package/specs/schemas/task-authorization.schema.json +154 -0
  323. package/specs/schemas/tidas-runtime-expectation.schema.json +54 -0
@@ -0,0 +1,375 @@
1
+ ---
2
+ lastReviewedAt: 2026-09-08
3
+ lastReviewedCommit: 2c1a449c0af751067d5c05363128353e288b1126
4
+ lastReviewedNote: "Reviewed for Foundry #123: adopt independently verified CLI0.1.12 at immutable6df087b, including the corrected original Windows HTTP bootstrap. Exact package/runtime expectations, release input/source/script hashes and current examples advance together; Node/TIDAS pins, profile semantics, authorization and retained private-case evidence are unchanged. Final F1 publication remains separate."
5
+ title: worldsteel EF3.1 ILCD Import Plan
6
+ docType: plan
7
+ scope: import-profile/worldsteel
8
+ status: draft
9
+ authoritative: true
10
+ revision: 4 (decisions D1–D4 + refinements R1–R5; R5 superseded FP/UG reference-only on 2026-07-01)
11
+ owner: tiangong-lca-data-foundry
12
+ language: en
13
+ whenToUse:
14
+ - when executing or revising the sequenced Worldsteel import workflow
15
+ - when tracing a current decision back to D1-D4 or refinements R1-R5
16
+ whenToUpdate:
17
+ - when a Worldsteel workflow stage, dependency, resolved decision, or operational blocker changes
18
+ - when a historical implementation path gains or loses current executable authority
19
+ checkPaths:
20
+ - specs/import-profiles.json
21
+ - scripts/commands/worldsteel-batch-import-run.ts
22
+ - docs/import-profiles/worldsteel/profile.md
23
+ - docs/import-profiles/worldsteel/constraints.md
24
+ - docs/import-profiles/worldsteel/import-plan.md
25
+ - docs/import-profiles/worldsteel/import-coverage.md
26
+ - test/unit/worldsteel-support-mint-truth.test.mts
27
+ created_utc: 2026-06-29
28
+ related:
29
+ - docs/uslci-import-plan.md
30
+ - docs/uslci-import-runbook.md
31
+ - docs/bafu-import-runbook.md
32
+ - docs/import-profiles/hiq/hiq-import-governance-proposal.md
33
+ - docs/import-profiles/bafu/profile.md
34
+ - docs/import-profiles/bafu/constraints.md
35
+ - specs/import-profiles.json
36
+ - specs/canonical-support/flow-properties-unit-groups.json
37
+ - WORKFLOW.md
38
+ - AGENTS.md
39
+ input_package: inputs/CUP2025-2_2022b_v10_worldsteel_products_Tiangong_v1 EF3.1 2026_01_27
40
+ ---
41
+
42
+ > **Rust cutover note:** Python `tidas-tools` source paths, virtualenv flags, package-release prerequisites, and legacy CLI conversion commands in this plan are frozen implementation history. They are not current blockers or TODOs. Active ILCD import and schema validation use the Foundry `dataset-tidas-import` / `dataset-tidas-validate` adapters over a compatible Rust `tidas` 0.2.x binary; CLI remains responsible for QA/curation, attachments, and remote handoff.
43
+
44
+ # worldsteel EF3.1 ILCD Import Plan
45
+
46
+ Current task authorization is defined by `docs/task-authorization-contract.md`. Distributed profiles grant no mint/write action or QA waiver. The dated R1–R5 decisions and inventories below are historical case evidence; new tasks require their own exact binding and action evidence. Local candidate preparation remains available, and old locks/seals/attempts are not rewritten or replayed.
47
+
48
+ ## 0. TL;DR
49
+
50
+ The worldsteel package is a **native ILCD 1.1 / EF3.1 package** (Sphera/GaBi origin, converted to EF/EPLCA ILCD) with a **small new payload** (33 steel processes + ~74 genuinely new flows + a thin worldsteel contact/source/flow-property overlay) sitting on a **large EF3.1 reference layer** (~1,315 reference elementary flows + most flowproperties/unitgroups + 25 LCIA methods + EF/PEF/OEF/ILCD compliance boilerplate). Canonical reference rows are **reused, not minted**. The new payload is authored, and a materialized FP/UG absent from the canonical-support cache may enter the separately gated account-local support path recorded by R5.
51
+
52
+ The pipeline reuses the BAFU/USLCI foundry machinery almost entirely. **Two things block a literal copy of the USLCI plan, and they must be resolved first:**
53
+
54
+ 1. **There is no ILCD _source_ adapter** in tidas-tools or the CLI. `import-lca convert --from-format` only accepts `ecospold1|ecospold2|openlca-jsonld|openlca-process-xlsx|simapro-csv`; a native ILCD package auto-detects as `FORMAT_UNKNOWN` and exits 2. → **Build an ILCD→TIDAS source adapter in `tidas-tools/import_lca`** (the HiQLCD proposal already scoped this; worldsteel + HiQ + future EF3.1/ILCD packages justify the reusable capability). This is the single biggest work item and gates the whole pipeline.
55
+ 2. **External binary docs (`referenceToDigitalFile`) have no import-side handling.** The converter _deliberately drops_ the field (`tidas_json.py:493-498`); the only storage code is an **export-direction** S3 download. → Add attachment management **in `tiangong-lca-cli`** (NOT tidas-tools): a new command uploads the 13 binaries to the Supabase `external_docs` bucket **authenticated as the `data@worldsteel.org` account** (the same authenticated-user path the web app uses) and rewrites each source's `referenceToDigitalFile @uri` to `../external_docs/<key>`.
56
+
57
+ Everything downstream is the proven generic chain. Confirmed decisions (D1–D4 + refinements R1–R5, see Decision Log): the canonical DB **already holds the EF3.1 flows under their original UUIDs**, so the ~1,315-flow reference layer is **reused by UUID**; governance remains canonical-first, with a **capped escape hatch to mint at most 17 GaBi/Sphera pseudo-elementary flows** plus R5's profile-gated canonical-cache-miss FP/UG support path; the account is **`data@worldsteel.org`**; packaged contact id `d5710976` is unavailable, so one deterministic owner-draft contact carries the real World Steel Association identity; source versions remain in payload provenance while new owner-draft DB row keys use `00.00.001`. All 33 processes are ~2,000–2,543-exchange mega-scopes. Deterministic resolution rewrites still reduce authoring work, but unbound synthetic preflight seeding is disabled; live identity-preflight remains required until a dedicated request/resolution/provenance-bound seed manifest exists.
58
+
59
+ > **Implementation status, corrected 2026-08-25:** conversion/upload/profile prerequisites are landed and tested. The former `IDENTITY_PREFLIGHT_REUSE_MAP` preseed wrote an unbound synthetic decision and is now fail-closed instead of masquerading as CLI execution evidence. Mega-scope optimization remains open until it emits a dedicated hash-bound library-resolution seed manifest; current runs perform live identity-preflight for rows without valid execution evidence.
60
+
61
+ ## Decision Log (answered 2026-06-29; R5 added 2026-07-01)
62
+
63
+ | # | Question | Answer |
64
+ | --- | --- | --- |
65
+ | **D1** | Account | **`data@worldsteel.org`** — use its dedicated ignored `.foundry/account-profiles/worldsteel.env` with exact project/user intent and the receipt-gated account wrapper. Do not select it through active/commented repository `.env` blocks. |
66
+ | **D2** | `external_docs` write-auth + owner | Use the **`data@worldsteel.org` account's authenticated session** (same INSERT permission the web app's authenticated users have). Implement attachment upload **in `tiangong-lca-cli`**, **not** tidas-tools. |
67
+ | **D3** | Land prerequisites before the import? | **Yes.** tidas-tools: **ILCD adapter** + **eilcd XSD fix**. tiangong-lca-cli: **external-doc upload** (NOT tidas-tools). foundry: **finalize perf optimization**. |
68
+ | **D4** | Does the canonical DB hold EF3.1 flows under original UUIDs? | **Yes.** → **Reuse by UUID directly** (fastest); semantic matching is reserved only for the 17 GaBi/Sphera pseudo-elementary flows + any residual. |
69
+ | **R1** | Library/attribution contact | **Corrected 2026-06-30:** packaged id `d5710976@20.20.002` is occupied by another account and is not public/visible. Omit explicit contact id/version so the runner derives one deterministic same-owner `00.00.001` contact from the real World Steel Association identity fields. |
70
+ | **R2** | Source attribution | **Add a `worldsteel` branch** to `source-semantics.ts` `databaseFallbackSourceConfig` (synthesized `worldsteel LCI database` source), so processes never inherit the BAFU citation. |
71
+ | **R3** | Residual elementary flows | **Allow minting at most 17 elementary flows** to keep the processes complete. These are NOT matched by UUID — give the AI full context to judge reuse-vs-mint. After the UUID-reuse pass, review how many remain; set the shared `enabled=false` only when both this R3 residual and R5 FP/UG support no longer require account-local authorization. |
72
+ | **R4** | Version numbering | **Corrected 2026-06-30:** preserve source versions inside the ILCD/TIDAS payload for provenance; new Worldsteel-owned DB row keys use `00.00.001`, while reused canonical references retain their current published versions. |
73
+ | **R5** | Unmatched FP/UG support | **Supersedes the earlier FP/UG reference-only plan.** Freeze `mintUnmatchedFpUgSupport=true`. A materialized FP/UG absent from the canonical-support cache enters the task-authorized same-owner My Data support set at `00.00.001`; Unit Groups precede Flow Properties and dependent rows wait for support closeout/readback. The retained 10+10 LANCA gap motivated the decision, but the runtime has no LANCA name whitelist or numeric cap. Canonical matches are always reused. |
74
+
75
+ ---
76
+
77
+ ## 1. Scope: new payload vs reference payload
78
+
79
+ Input: `inputs/CUP2025-2_2022b_v10_worldsteel_products_Tiangong_v1 EF3.1 2026_01_27/` — standard ILCD zip (`META-INF/MANIFEST.MF` ILCD-Version 1.1). Counts: **processes 33, flows 1389, sources 76, contacts 44, flowproperties 198, unitgroups 146, lciamethods 25, external_docs 13.**
80
+
81
+ ### 1a. NEW payload — author / profile-gated account-local mint
82
+
83
+ | Entity | Count | Notes |
84
+ | --- | --- | --- |
85
+ | **Processes** | **33** | All LCI-result, attributional, mass-based (`1 kg`), GLO/Europe/EU, reference year 2022 (a few EU 2019/2020/2021). ~2,000–2,543 exchanges each. **LCIAResult = 0 on all 33** (expected for LCI-result; corroborated by `REPORT_PR.xlsx` "Doesn't have LCIA results"). Classification = ILCD `Materials production / Other materials` (no CPC). `Value of Scrap 2022` (`91bd5958`) is an economic/allocation dataset, not a physical product. |
86
+ | **Product flows** | 26 (12 distinct steel products reused across geo variants) | e.g. Steel rebar `aeaa3016`, Hot rolled coil `2126a80d`, Plate `b5bb65d3`, Sections `f46cd45b`, Wire rod `7299bf50`, pipes (welded/seamless/UO), galvanised/tinplated/organic-coated/ECCS. Plus intermediate materials (Water variants, Chalk, Hydrogen, Gypsum, etc.). dataSetVersion `20.25.x`. |
87
+ | **Waste flows** | 25 | scrap variants, slag/scoria/jarosite, overburden/tailings, hazardous/demolition waste, treated wastewater, oil sludge. |
88
+ | **Other flows** | 6 | transport carriers (river freight, tanker, rail-electric, bulk carrier). |
89
+ | **GaBi/Sphera "elementary" flows** | **17** | Typed `Elementary flow` at version `20.25.x` but **not** in the EF/ILCD reference set (Aktinide general, Radioactive isotopes unspecific, Heavy metals to water unspecified, scarcity-tiered water, etc.). **Must reuse-match-or-mint** — do NOT blanket-reuse them with the 1,315 reference elementaries. |
90
+ | **worldsteel contacts** | ~6 | worldsteel, Sphera Solutions GmbH, thinkstep (×2), IABP-GaBi, Finkbeiner, Ramboll Italy. |
91
+ | **worldsteel sources** | ~5 | 2017 worldsteel Critical Review Report (`b86f1fd8`, citation-only, no binary), Sphera MLC (`61875b4e`), Sphera Land Use LCI (`5d8c535d`), LCWE doc (`10e645f5`), ISO 14040/14044. |
92
+ | **worldsteel flowproperties** | thin overlay | "Energy (net calorific value) – worldsteel balance", "Steel and iron materials (unspecified)" `29b03f81`, element-content / resin properties. Reuse canonical where one exists; the genuine worldsteel-specific ones are support. |
93
+
94
+ **Genuinely new authorable flows ≈ 74** (57 non-elementary + 17 GaBi pseudo-elementary).
95
+
96
+ ### 1b. REFERENCE payload — reuse-match to existing canonical, never mint
97
+
98
+ - **~1,315 of 1,332 elementary flows** are EF/ILCD reference flows (versions `03.x/01.x/00.00.002/02.x/04.x`). **1,278 carry `permanentDataSetURI` at `lca.jrc.ec.europa.eu` (legacy ILCD reference network)**, only 21 at `eplca.jrc.ec.europa.eu`. → These are _legacy ILCD reference_ flows carried into the EF3.1 package — **the same situation as the USLCI land-flow case**. Reuse-match by identity, do not assume EF3.1 UUID identity.
99
+ - **Mass FP `93a60a56-a3c8-11da-a746-0800200b9a66`** (canonical) is the reference flow property for **1,061 of 1,332** elementary flows; ~95%+ of all flow→FP edges hit canonical FP UUIDs already in `specs/canonical-support/flow-properties-unit-groups.json`.
100
+ - Most of the **198 flowproperties / 146 unitgroups** are EF/ILCD reference + LCIA-method unit groups → reuse.
101
+ - **25 LCIA methods** = EF3.1 reference LCIA boilerplate → **out of import scope** (reference/provenance only, mirroring the BAFU rule "must not write lciamethods inline").
102
+ - EF/PEF/OEF/ILCD compliance + LCIA-citation sources/contacts → reuse-by-identity (see §6 canonical source rewrites). The ILCD-format source `a97a0155-...@03.00.00x` is shipped and is the exact UUID hardcoded in `source-semantics.ts`.
103
+
104
+ ### 1c. EXCLUDED — not import payload
105
+
106
+ `other/converter/Mapping_UUID.xlsx` (EF3.0/GaBi→EF3.1 **process-level** UUID crosswalk — **not** a flow-identity map; zero overlap with `ILCD/flows`), `other/converter/REPORT_PR.xlsx` (generic EF3.0→EF3.1 conversion-QA report; none of the 33 steel UUIDs appear), `other/converter/*.xml` (6 EF LCIAMethod XMLs), `other/Normalisation_Weighting_Factors_EF_3.1.xlsx`, `other/lookLciMethodInformation.config`, the raw `schemas/` (use tidas-tools' _corrected_ eilcd schemas instead). Keep all as provenance evidence in the source manifest.
107
+
108
+ ---
109
+
110
+ ## 2. Foundational decision D1 — ILCD ingestion path (gates everything)
111
+
112
+ **Problem (verified at 3 layers):** `tidas-tools/src/tidas_tools/import_lca/detect.py:29-35` `SUPPORTED_FORMATS` has no ILCD member; `import_lca/cli.py` `_adapter_for` has no ILCD branch; `tiangong-lca-cli/src/cli.ts:946` `--from-format` enumerates only the five non-ILCD formats. Worldsteel root namespaces are `http://lca.jrc.it/ILCD/*` → `FORMAT_UNKNOWN` → `unsupported_format` exit 2. This is the **same wall HiQLCD hit** (`docs/import-profiles/hiq/hiq-import-governance-proposal.md`).
113
+
114
+ **Decision framework (from the HiQLCD proposal):** the adapter boundary is _narrow_ — it converts source-format semantics into canonical TIDAS rows and preserves trace; it must NOT absorb source-data errors, invent allocation, choose backgrounds, or decide fallback citations (those are profile governance). The proposal prefers "ask the provider for openLCA JSON-LD first" and treats an ILCD adapter as justified only when JSON-LD is unavailable **and** the work recurs.
115
+
116
+ **Recommendation: build the ILCD→TIDAS source adapter in `tidas-tools/import_lca` (Option A).** Rationale specific to worldsteel:
117
+
118
+ - Worldsteel's native origin is **Sphera/GaBi** (`thinkstepio:` extension namespace), not openLCA — there is **no JSON-LD re-export to request**. The "JSON-LD first" escape hatch does not apply.
119
+ - The package is **self-contained** (ships its own sources/, FP/UG, elementary flows, contacts) — unlike HiQ it has no missing-references blocker, English-only (no CJK-in-`en` defect), and a **recognized standard publisher** → meets the proposal's adapter preconditions cleanly.
120
+ - The need **recurs** (HiQ + worldsteel + future EF3.1/ILCD deliveries), so a reusable adapter is the correct owner per `specs/capability-ownership-rules.json` (conversion mechanics belong to tidas-tools, never patched in foundry).
121
+
122
+ **Adapter minimum scope** (crib HiQ "Minimum adapter scope" + EF3.1 specifics):
123
+
124
+ 1. `detect.py`: add `FORMAT_ILCD`, sniff by **root namespace URI** `http://lca.jrc.it/ILCD/*` (process/flow/flowproperty/unitgroup/source/contact roots), not by file prefix; add `ilcd` to the CLI `--from-format` enum.
125
+ 2. `IlcdAdapter.read(input, MemoryCanonicalStore, report)`: parse process exchange lists, quantitative reference, geography/time, modelling/validation (reviews + `referenceToCompleteReviewReport`), compliance declarations, contacts, sources, flow properties, unit groups, flow classifications. **Preserve native UUIDs and versions** (critical for reuse — see §7).
126
+ 3. **Preserve `referenceToDigitalFile`** through to the TIDAS source rows (the existing writer drops it — see D2). The corrected `tidas_sources.json:111-137` already models the field as `{@uri}` object|array, so emitting it is schema-legal.
127
+ 4. **Preserve** the `thinkstepio:`/`ext:` extension elements (or drop them safely) — confirm they don't fail corrected-eilcd validation.
128
+ 5. Apply the EF3.1 corrections the writer already owns: `Perc` totalDigits=5/fractionDigits=3 (strip trailing zeros), version pattern `NN.NN(.NNN)`, GlobalReferenceType `@type` enum, language enum, UnitGroup reference-unit selection, CAS-checksum surfacing.
129
+ 6. **Process-reachable cropping**: build the working scope from the 33 processes' exchange-referenced flows + required support + source/contact trace; keep the full package as evidence but do not import the LCIA methods / unreferenced sidecar.
130
+ 7. Hand off to the existing `write_tidas_package` → `scan_conversion_gaps` → `validate_package_dir` → `write_process_bundles` layers (reuse, don't fork).
131
+ 8. Do **not** hard-code any worldsteel-specific repair inside the adapter.
132
+
133
+ **Fallback (Option B):** a bespoke one-off `ilcd→tidas` reader script under `docs/import-profiles/worldsteel/` if landing the adapter in tidas-tools is deferred. Disfavored — it duplicates the writer/validation/bundle layers and won't help HiQ.
134
+
135
+ > `tidas-convert --to-tidas` is **not** a substitute: it is a dumb `xmltodict` transcoder (no schema correction, no canonical resolution, no validation). Output would fail TIDAS validation and lack reuse.
136
+
137
+ **EF3.1-correction handoff:** the conversion's corrections come from the **local `--tidas-tools-dir` / `--python` venv (0.0.36)**, not the published CLI (foundry's CLI shells to python; the bundled tidas-tools must be ≥0.0.35 — the local checkout is 0.0.36, so pass `--tidas-tools-dir /Users/davidli/projects/workspace/tidas-tools --python <its .venv>`). The corrected schemas under `tidas-tools/src/tidas_tools/eilcd/schemas` + `tidas/schemas` (locked by `schema.lock.json`) are the source of truth — **not** raw EF3.1, and not the (possibly stale) `linancn/EF-reference-package-3.1-Correction` XSLT repo.
138
+
139
+ **Validator-crash patch (do before any eILCD validation):** `validate.py:975 schema.validate()` is **not** wrapped in try/except, and the bundled `ILCD_Common_DataTypes.xsd:181/191/201` `<xs:attribute ref="xml:lang" default="en"/>` triggers a libxml2 internal error (`xmlSchemaVAttributesComplex`) on ~230 multilang files (empirically reproduced). This **aborts** `validate_ilcd_package_dir` mid-run. Fix in tidas-tools: strip `default` from the `xml:lang`/`name` attribute uses (and the `name="name" default="ILCD"` in `ILCD_Common_Groups.xsd:92/267`) or guard `schema.validate`. The schema _content_ is clean (only 1/76 sources had a real issue), so this is a tooling bug, not a data problem.
140
+
141
+ ---
142
+
143
+ ## 3. Foundational decision D2 — external-doc storage contract (the user's concern #1)
144
+
145
+ **Verified state:** the foundry CLI has **zero** storage/upload code; `tidas_json.py:493-498` **deliberately drops** `referenceToDigitalFile`; the only storage code is **export-direction** (`export.py:147 download_external_docs`, boto3 against `AWS_EXTERNAL_DOCS_BUCKET`). The working _upload_ path exists only in the **web app**: `tiangong-lca-next/src/services/supabase/storage.ts uploadFile()` → `supabase.storage.from('external_docs').upload(<key>)`, with the source JSON storing `referenceToDigitalFile = [{"@uri":"../external_docs/<key>"}]` (`Sources/Components/create.tsx:114-156`). `external_docs` is a **private** bucket (reads via `createSignedUrl`). `AWS_EXTERNAL_DOCS_BUCKET` is **unset** in foundry `.env`.
146
+
147
+ **The 13 binaries and how they're referenced (ground truth):**
148
+
149
+ | Binary | size | referencing source UUID(s) |
150
+ | --- | --- | --- |
151
+ | bof+route+pic.jpg | 121 KB | 109bed9b |
152
+ | bof+route.png | 21 KB | 89744403 |
153
+ | eaf+route+pic.jpg | 54 KB | c2fd9baf |
154
+ | eaf.png | 11 KB | c86a2586 |
155
+ | full+lca.png | 19 KB | fe35a7c7 |
156
+ | worldsteel+blast+furnace.jpg | 92 KB | c4173b23 |
157
+ | worldsteel+electric+arc+furnace.jpg | 38 KB | 1d4ed9fd |
158
+ | ILCD-Data-Network*Compliance-Entry-level*…pdf | 604 KB | 9ba3ac1e |
159
+ | ILCD*Compliance_Rules_Draft*…pdf | 79 KB | 88d4f8d9 |
160
+ | oefsr_guidance_v6.3.pdf | 3.75 MB | bb3e3630 |
161
+ | pefcr_guidance_v6.3-2.pdf | 4.07 MB | e2ecfeb8 |
162
+ | **pef_method.pdf** | 4.29 MB | **37d1d84f, 4622beed, 779fb9ea, 909ae358, afc1ce43, cbeab91f, cec792b1** (shared by 7) |
163
+ | European*Commission_EPLCA_logo*…jpg | 29 KB | **417b6710** (`..\external_docs\…`, correct case) **and 99d22639** (`../external_docs/…`, all-lowercase) — one binary, two sources, two encodings |
164
+
165
+ **Recommended contract (per D2 — owner is `tiangong-lca-cli`, auth is the account session):**
166
+
167
+ - **Owner + transport:** a **new `tiangong-lca-cli` command** uploads via the existing **authenticated** Supabase client — `supabase.storage.from('external_docs').upload(<key>, <bytes>)` using the **`data@worldsteel.org` access token** (`SupabaseDataRuntime.getAccessToken()` in `src/lib/supabase-client.ts`). This is the **same authenticated-user path the web app uses** (`tiangong-lca-next/src/services/supabase/storage.ts`), so the account already has the INSERT permission — **no service-role key, no boto3/AWS, no tidas-tools change.** (`tidas-tools` stays read/convert-only.)
168
+ - **Bucket:** `external_docs` (private; the web app hardcodes it at `key.ts:5`). Reads are signed-URL only.
169
+ - **Object-key convention:** keep the **original on-disk filename** as the key (human-readable; round-trips with `export.py`'s download-by-raw-key), **percent-encode** `+`/spaces. The stored `@uri` must stay the **3-part `../external_docs/<key>`** form so the web viewer's `resolveStorageFilePath` resolves it.
170
+ - **Dedupe:** upload each physical binary **once** (pef_method.pdf once, logo once) but keep all referencing source rows.
171
+ - **URI normalization (must handle):** (a) backslash `..\external_docs\…` → forward slash; (b) case-insensitive filename resolution (the `99d22639` all-lowercase ref must map to the capitalized on-disk file or it 404s); (c) **leave plain `http(s)://` `referenceToDigitalFile` URIs untouched** (e.g. `http://lca.jrc.ec.europa.eu`, ecoinvent/quantis/thinkstep node URLs) — those are pointers, not binaries; do not upload them.
172
+ - **Idempotency:** stable keys → re-runs overwrite, not duplicate; mirror the web app's delete-on-source-delete cleanup if a source is later removed.
173
+
174
+ **Pipeline insertion point** — a **new step between conversion and save-draft/publish:**
175
+
176
+ 1. Adapter (D1) preserves the local `../external_docs/*` refs into the TIDAS source rows.
177
+ 2. New CLI command — e.g. `tiangong-lca dataset source upload-attachments --tidas-dir <conversion>/tidas --external-docs-dir "inputs/.../ILCD/external_docs"` (or an `--upload-external-docs` flag on `dataset save-draft --type source`) — enumerates each source's local `referenceToDigitalFile` refs, resolves to the on-disk binary (case/slash-tolerant), uploads each once, then rewrites the `@uri` to the normalized `../external_docs/<key>`.
178
+ 3. `save-draft`/`publish` then persists the rewritten JSON unchanged (the `app_dataset_create` edge command carries JSON only — binaries never travel through it).
179
+
180
+ > Reconcile with the prior intentional fix (`67548bf`) that _stopped_ writing source URLs into `referenceToDigitalFile`: that fix targets _URL_ sources (keep as description text). Worldsteel's local-binary refs are the legitimate case for emitting `referenceToDigitalFile`. The upload step must **distinguish a true uploaded binary from a mere URL** — exactly the normalization rule above.
181
+
182
+ ---
183
+
184
+ ## 4. Governance & profile decisions
185
+
186
+ | Decision | Decision (implemented) | Why |
187
+ | --- | --- | --- |
188
+ | **Reuse vs mint** | Canonical-first for the ~1,315-flow reference layer and FP/UG. **R3:** a capped allowance to mint **≤17** GaBi/Sphera pseudo-elementary flows. **R5:** `mintUnmatchedFpUgSupport=true` sends materialized FP/UG canonical-cache misses through the gated account-local support path. | Canonical rows are reused, never minted. R5 was prompted by the 10+10 LANCA gap but is enforced by cache-miss + profile/gate semantics, not a name/count whitelist. Support failure defers the dependent scope while independent ready scopes may continue. **Do not copy another profile wholesale.** |
189
+ | **17 GaBi pseudo-elementary (R3)** | Reuse-match first **with full AI context** (NOT by UUID); mint the residual as account-local My Data (state_code=0), capped at ≤17. **Review the actual residual count after the UUID-reuse pass**; require separate current task authorization for both elementary and FP/UG actions that are actually needed. | Keeps canonical clean while guaranteeing the 33 steel processes stay complete. |
190
+ | **Profile** | `worldsteel` entry in `specs/import-profiles.json`: source rules, strict full-context proof and conditional naming semantics. Task authorization separately binds R3/R5 write actions and any source-model QA exception; `mintUnmatchedFpUgSupport=true` selects local preparation. The wrapper independently freezes that executable flag. | The contract test freezes runtime `true`, checks that structured profiles grant no authorization, and compares the preparation declaration against every active Worldsteel document without pretending an unconsumed JSON mirror is an execution gate. |
191
+ | **Account** | **`data@worldsteel.org`** (dedicated). Create ignored `.foundry/account-profiles/worldsteel.env` with the three CLI credential values plus `FOUNDRY_EXPECTED_PROJECT_REF` and the canonical `FOUNDRY_EXPECTED_USER_ID`. Do not select accounts by commenting blocks in the repository `.env`. | Account identity is **not** in profile JSON; it lives in the runtime account profile, Codex thread guard when applicable, and the fresh CLI 0.1.3 intent-bound receipt. The same receipt-gated account context authenticates the external-doc upload (D2). |
192
+ | **State / version (R4)** | `state_code=0` (My Data draft) and DB row-version key `00.00.001` for new Worldsteel-owned rows; reused canonical refs stay `state_code=100` at their published versions. Preserve the source `dataSetVersion` inside the payload as provenance. | Native DB slots are occupied by other accounts. Separating payload provenance from the DB row key preserves source evidence without collisions. |
193
+ | **Library/attribution contact (R1)** | Mint one deterministic same-owner `00.00.001` contact from the runner's real World Steel Association identity fields; do not pass the unavailable packaged `d5710976` id/version and never use NREL/FOEN/GaBi-software defaults. | The first-import bootstrap (`commitFlowSupportInline:true`) needs a visible owner-draft contact; the deterministic identity is stable and faithful. |
194
+ | **DB-fallback source (R2)** | `worldsteel` branch added to `source-semantics.ts databaseFallbackSourceConfig` (shortName "worldsteel LCI database", worldsteel citation, `worldsteel.org/lci/<id>` URI). | **Without it, worldsteel processes silently inherit the BAFU 2025 default fallback source — a data-integrity corruption, not an error.** |
195
+ | **LCIA methods** | Out of scope (reference/provenance only). | Same rule as BAFU "must not write lciamethods inline." |
196
+
197
+ ---
198
+
199
+ ## 5. Code touchpoints
200
+
201
+ ✅ = landed + tested (2026-06-29, not committed/pushed). ⏳ = still to do.
202
+
203
+ 1. ✅ **tidas-tools `import_lca`** (D1): `adapters/ilcd.py` `IlcdAdapter` (parses all 6 entity types by root namespace, preserves UUIDs/versions/classification/exchanges, skips LCIA methods); `detect.py FORMAT_ILCD` + namespace sniff; `cli.py _adapter_for` dispatch; `tiangong-lca-cli` `--from-format ilcd` documented. Tests: `tests/test_import_lca_ilcd.py` (3).
204
+ 2. ✅ **tiangong-lca-cli** (D2, NOT tidas-tools): `dataset source upload-attachments` (`src/lib/dataset-source-upload-attachments.ts` + `src/cli.ts` dispatch) — authenticated `external_docs` upload + `referenceToDigitalFile` rewrite, dedup, backslash/case normalization, http-URI passthrough. 25 tests, 100% coverage.
205
+ 3. ✅ **tidas-tools eilcd XSD + writer** (D1/D2): removed `default` from the 5 `xml:lang`/`name` attribute uses (`ILCD_Common_DataTypes.xsd`, `ILCD_Common_Groups.xsd`) — libxml2 crash fixed (validate regression test added); `writers/tidas_json.py` `_source_payload` now emits `referenceToDigitalFile` for local file refs (`_digital_file_refs`).
206
+ 4. ✅ **`scripts/lib/source-semantics.ts`** (R2): `worldsteel` `databaseFallbackSourceConfig` branch (test added: "worldsteel database fallback source cites worldsteel, never BAFU").
207
+ 5. ✅ **`scripts/commands/post-authoring-finalize.ts`**: widened the `source_contact_rewrites` gate to include `'worldsteel'`.
208
+ 6. ✅ **`specs/import-profiles.json`** + **`docs/import-profiles/worldsteel/{profile.md,constraints.md}`**: `worldsteel` profile (capped ≤17 mint, full-context on) + docs. Test added (profile registration).
209
+ 7. ✅ **`scripts/commands/worldsteel-batch-import-run.ts`** + **`bundle-sample-utils.ts`** (R1/R5): runner wrapper (`mintUnmatchedFpUgSupport:true`, `applyResolutionRewrites:true`, real World Steel Association `libraryContact` fields with no explicit id/version so identity is derived deterministically); registered in `foundry.ts`, `foundry-cli.ts`, `foundry-command-registry.ts`, `foundry-command-metadata.ts`. Factory and profile-truth contracts cover the frozen value.
210
+ 8. ⏳ **Mega-scope speed-up (§8)**: unbound synthetic preseed reports are disabled. A replacement must bind request bytes, library-resolution bytes, canonical target, producer provenance, and report bytes before `onlyPending` may skip live identity-preflight.
211
+ 9. ⏳ **context-pack**: generate `tiangong-lca dataset context-pack --type process|flow --profile ai-import` outputs (schema.json/methodology.yaml/runtime-ruleset.json + `tidas_*_category.json`) for the classification round.
212
+
213
+ ---
214
+
215
+ ## 6. End-to-end pipeline (ordered)
216
+
217
+ Environment for every step:
218
+
219
+ ```bash
220
+ pnpm install --frozen-lockfile # installs the exact @tiangong-lca/cli@0.1.3 project dependency
221
+ RUN=".foundry/workspaces/worldsteel-full-import-$(date -u +%Y%m%dT%H%M%SZ)" # stamp once; the runtime forbids Date.now in workflows but the shell is fine
222
+ TUID="<worldsteel target user id>" # in zsh, NOT UID (reserved)
223
+ ```
224
+
225
+ ### Phase 0 — source intake + closure
226
+
227
+ - Freeze the immutable source manifest (`source-manifest.json`, `profile-lock.json`, account-write-guard) under `$RUN/`. Worldsteel is self-contained (no external library merge needed, unlike USLCI), but verify **0 dangling references** in the package's own closure first.
228
+
229
+ ### Phase 1 — conversion (NEW ILCD adapter; tidas-tools owns)
230
+
231
+ ```bash
232
+ ./node_modules/.bin/tiangong-lca dataset import-lca convert \
233
+ --input "inputs/CUP2025-2_2022b_v10_worldsteel_products_Tiangong_v1 EF3.1 2026_01_27" \
234
+ --output-dir "$RUN/conversion-v1" \
235
+ --from-format ilcd --target tidas --validation-jobs 0 \
236
+ --python /Users/davidli/projects/workspace/tidas-tools/.venv/bin/python \
237
+ --tidas-tools-dir /Users/davidli/projects/workspace/tidas-tools --json
238
+ ```
239
+
240
+ Produces `$RUN/conversion-v1/{tidas/, process-bundles/, conversion-report.json}`. **Exit gates:** conversion-report 0 error; TIDAS validation 0 (expect Perc-overflow + CAS-checksum surfacing on EF3.1 rows — confirm corrected); bundle `unresolved_references == 0`; **confirm LCIAResult=0 is tolerated** (writer/finalize/mutation-manifest must not require an LCIA block); confirm `thinkstepio:`/`ext:` extensions preserved-or-dropped without validation failure.
241
+
242
+ ### Phase 1.5 — external-docs upload + URI rewrite (NEW; D2 — runs in `tiangong-lca-cli`, authenticated as `data@worldsteel.org`)
243
+
244
+ ```bash
245
+ pnpm account:run -- worldsteel -- \
246
+ node node_modules/@tiangong-lca/cli/bin/tiangong-lca.js dataset source upload-attachments \
247
+ --tidas-dir "$RUN/conversion-v1/tidas" \
248
+ --external-docs-dir "inputs/CUP2025-2_2022b_v10_worldsteel_products_Tiangong_v1 EF3.1 2026_01_27/ILCD/external_docs" \
249
+ --bucket external_docs --json
250
+ ```
251
+
252
+ Uploads each of the 13 binaries once (dedupe; percent-encode keys), then rewrites the converted TIDAS sources' `referenceToDigitalFile @uri` to `../external_docs/<key>` (normalize backslash/case; leave `http(s)` URIs). **Gate:** verify each rewritten `@uri` resolves via a signed URL before proceeding.
253
+
254
+ ### Phase 2 — library index
255
+
256
+ ```bash
257
+ node scripts/foundry.ts dataset-library-index-build # → $RUN/library-index-v1 (entity index + scope-projection.jsonl)
258
+ ```
259
+
260
+ ### Phase 3 — decision rounds (author on the FINAL conversion only)
261
+
262
+ > The #1 USLCI bug was re-projecting compartment-fingerprinted elementary reuse decisions onto a newer conversion. Author identity/elementary decisions **against `conversion-v1`** and never re-project.
263
+
264
+ - **3a. Identity preflight** — `dataset-identity-preflight-requests-build` → `-query-audit` → `dataset-identity-preflight-run` (CLI `flow|process identity-preflight`, semantic `flow_hybrid_search` on name + EF3.1 compartment path + CAS + reference FP) → `-index-merge`.
265
+ - **3b. Elementary reuse (D4 = reuse-by-UUID confirmed):** the canonical DB already holds the EF3.1 reference flows under their **original UUIDs**, so:
266
+ - **Reference layer (~1,315 flows) → deterministic reuse-by-UUID.** Build an offline library-resolution producing `exchange-reference-rewrites.jsonl`; each row must carry `canonical_short_description`. Apply rewrites with `applyResolutionRewrites:true`. Until a bound seed-manifest contract is implemented, do not treat the rewrite file as identity-preflight execution evidence: live preflight still runs where the workflow requires it.
267
+ - **17 GaBi/Sphera pseudo-elementary + any UUID miss → semantic + AI matching only.** Run identity-preflight + the **AI-first physical-equivalence round** (mirror `$RUN/ai-elementary-match-v1/`: slim ~14-candidate tasks, explicit per-batch id files, adversarial verify) for just this small tail. The historical R3 approval covered that original residual; new task authorization must explicitly admit the current residual as account-local My Data; it remains subject to the full profile/finalize gates.
268
+ - **3c. Classification** (the one hard AI round): `context-pack --profile ai-import` → `dataset-bundle-sample-rows --profile worldsteel` → `dataset-classification-decision-task-build` → AI authors process→ISIC4 leaf, product-flow→CPC level-4 leaf → `dataset-library-classification-decisions-project` → `dataset-classification-decisions-apply`. **Keep the queue file byte-identical at build/project/apply** (sha binding → `classification_decision_task_queue_mismatch`). Note: worldsteel processes ship no CPC; classification is authored fresh.
269
+ - **3d. Location** — `dataset-location-decision-task-build/-suggest/-apply` (GLO/Europe/EU; preserve, don't collapse).
270
+ - **3e. Canonical-support** — `dataset-support-cache-refresh --out specs/canonical-support/flow-properties-unit-groups.json` (state_code=100 only) first; then reuse FP/UG by exact UUID via `canonical-support-rewrites.ts`. **Never** write account-local FP/UG UUIDs into the shared cache. Pass `--block-on-unscaled-canonical-support` through bundle sampling so any scale≠1 rewrite remains in `canonical-support-amount-scaling.jsonl`, the report, and the process-scope ledger; known positive non-1 factors use `canonical_support_amount_scaling_required`, while a missing/non-finite/non-positive factor uses `canonical_support_amount_scale_unresolved`. Watch `canonical_flow_property_unit_group_unproven` (EF3.1 FP family `93a60a56-a3c8-*` vs its reference UG family `93a60a57-a4c8-*`) and do not relax either scale blocker.
271
+
272
+ ### Phase 3-apply — resolution
273
+
274
+ ```bash
275
+ node scripts/foundry.ts dataset-library-decisions-apply \
276
+ --library-index "$RUN/library-index-v1" --decisions-dir "$RUN/decisions-v1" --profile worldsteel
277
+ # → ready-scopes.jsonl, blocked-scope-ledger, rewritten-processes/<id>.json, exchange-reference-rewrites.jsonl
278
+ ```
279
+
280
+ Archive any stale `decisions-*` dirs **out of `$RUN`** so the runner's carry-forward glob can't merge them (the USLCI over-mint root cause).
281
+
282
+ ### Phase 4 — per-scope finalize + commit (the runner)
283
+
284
+ ```bash
285
+ node scripts/foundry.ts dataset-worldsteel-batch-import-run \
286
+ --run-dir "$RUN" \
287
+ --process-bundles-dir "$RUN/conversion-v1/process-bundles" \
288
+ --library-resolution "$RUN/library-resolution-v1" \
289
+ --scope-file "$RUN/library-resolution-v1/ready-scopes.jsonl" \
290
+ --library-classification-decisions "$RUN/decisions-v1/classification-decisions.jsonl" \
291
+ --target-user-id "$TUID" --state-code 0 --profile worldsteel \
292
+ --out-dir "$RUN/batch-import-v1" --commit --parallel 8
293
+ ```
294
+
295
+ Per-scope stages (inside `scope_commit_gate`, flows-first then process): `finalize_ready` → `finalize_after_support[_reuse]` (commits library contact/source support inline — the new-library bootstrap) → `commit` → `post_write_verify` (+retry/accepted-diff) → `closeout`. Run a **resumable loop** (verified scopes skip; blocked stay pending); expect ~10% transient support-commit-race blocks that recover on re-run.
296
+
297
+ ### Phase 5 — coverage + delivery
298
+
299
+ - `node scripts/foundry.ts dataset-import-ledger-report --ledger-dir <dir>` (the BAFU `universe-coverage-report` is BAFU-hardcoded — do not use). Target: verified + minimal registered-non-importable = universe, gap 0.
300
+ - Trace workbook: fork `reports/uslci-import/` (BAFU/USLCI builders are path-hardcoded, not drop-in) → `reports/worldsteel-import/`.
301
+ - Delivery: one PR to `tiangong-lca/data-foundry` main with final rows + validation/QA/curation reports + mutation-manifest + commit-handoff + post-write verify + completeness snapshot; pass the **docpact** pre-push gate (review-mark + commit doc, covering AGENTS.md/WORKFLOW.md/docs/specs/scripts); then bump the `tiangong-lca-data-foundry` submodule pointer in the meta-repo. The tidas-tools adapter + export changes ship as their own PR/release (≥ the version the CLI bundles) **before** the foundry import runs.
302
+
303
+ ---
304
+
305
+ ## 7. Reuse mechanics (D4 = reuse-by-UUID)
306
+
307
+ The canonical DB **already holds the EF3.1 reference flows under their original UUIDs**, so the reference layer is reused **by UUID**, deterministically — the cheapest and most reliable path, and it sidesteps the mega-scope per-flow remote-search cost entirely.
308
+
309
+ **Mechanism** (the foundry has no by-UUID elementary matcher today, so this is a small new offline helper, not a pipeline change):
310
+
311
+ 1. From the converted process bundles, collect the distinct `(flow_id, version)` referenced by the 33 processes' exchanges.
312
+ 2. Batch-look-up each canonically (`flow get` by `id`+`version`, or a direct read of the canonical/state_code=100 set). **Resolve the version:** worldsteel ships e.g. `03.00.004` for reference flows; point the rewrite at whatever canonical version actually exists (capture `short_description` for the display name).
313
+ 3. Emit `exchange-reference-rewrites.jsonl` rows → canonical `{id, version, short_description}`, **always including `canonical_short_description`** (else committed exchanges show the UUID, not the name — the USLCI reused-flow-name bug).
314
+ 4. The runner applies rewrites deterministically with `applyResolutionRewrites:true`; identity-preflight remains independently receipt/report-bound and cannot be skipped by an unbound rewrite file.
315
+
316
+ **Still to verify during the run (not blockers, but cheap insurance):**
317
+
318
+ - Cross-reference which of the 1,332 elementary flows are actually referenced by the 33 processes (rebar alone references ~2,496 reference-elementary exchanges, so coverage is near-total — confirm to size the resolution).
319
+ - Spot-check version alignment on a ~20-flow sample (worldsteel ships _legacy_ ILCD versions like `03.00.004`; confirm the canonical rows carry a matching/expected version).
320
+ - Audit the ~97 non-canonical chemical-content FPs / ~135 unitgroups + amount-scaling dimensions. Under R5, a materialized canonical-cache miss is a task-authorized account-local candidate; there is no LANCA/name/count whitelist. Keep both `canonical_support_amount_scaling_required` and `canonical_support_amount_scale_unresolved` active, and defer the dependent scope on any support/closure/readback failure.
321
+
322
+ ---
323
+
324
+ ## 8. Mega-scope reality (worldsteel-specific)
325
+
326
+ **Every one of the 33 processes is a "mega-scope" by USLCI's definition** (~2,000–2,543 exchanges each; USLCI deferred scopes at 1,191–2,429 flows). The runner's serial per-flow **remote** identity-preflight costs tens of minutes to ~1 hr per scope. USLCI deferred 11 such; worldsteel has **33 — all of them.**
327
+
328
+ The vast majority of those exchanges point at EF3.1 reference flows that will reuse canonical. Deterministic rewrites reduce downstream authoring, but they no longer suppress live identity-preflight without a bound seed manifest. Treat the extra remote searches as the safe current cost; run megas at `--parallel 1` if needed and tune `IDENTITY_PREFLIGHT_CONCURRENCY`/`BAFU_BATCH_STAGE_TIMEOUT_MS` while the bound seed optimization is tracked separately.
329
+
330
+ ---
331
+
332
+ ## 9. Risk register (consolidated gotchas)
333
+
334
+ - **Use the project-installed CLI** — leave `TIANGONG_LCA_CLI_BIN` blank so Foundry resolves exact `@tiangong-lca/cli@0.1.12`; an override is only for an explicit local test binary. Credential-scoped execution still goes through the receipt-gated `pnpm account:run` wrapper.
335
+ - **Don't copy BAFU/USLCI profile wholesale** — Worldsteel reuses every canonical row by UUID, caps the R3 elementary tail, and enables R5 only for materialized FP/UG canonical-cache misses behind the full account-local support gates.
336
+ - **`databaseFallbackSourceConfig` silently inherits BAFU** for any unknown profile → ✅ worldsteel branch added.
337
+ - **`source_contact_rewrites` gated to bafu/uslci** → ✅ widened to include `worldsteel`.
338
+ - **Converter drops `referenceToDigitalFile`** → ✅ adapter preserves local refs + writer emits them; the CLI upload step runs before save-draft (ordering still matters operationally).
339
+ - **libxml2 XSD crash** on ~230 multilang files → ✅ eilcd XSD `default` attributes removed; validates cleanly.
340
+ - **`functionalUnitOrOther` is boilerplate** ("Steel hot rolled coil - 1kg (Mass)") on all 33 — never use it for product identity; use the reference exchange's flow shortDescription.
341
+ - **`Value of Scrap 2022` (91bd5958)** is economic/allocation, not a product — handle distinctly.
342
+ - **EPLCA-logo case/slash collision + pef_method.pdf shared ×7** — dedupe binary, normalize URIs, keep all source refs.
343
+ - **Classification queue sha binding** — same queue file at build/project/apply.
344
+ - **Over-mint carry-forward** — archive stale `decisions-*` out of `$RUN`; reuse-only governance makes this largely moot (unmatched block, not mint) but keep the discipline for process-level decisions.
345
+ - **No silent amount scaling** — `canonical-support-rewrites.ts` repoints FP refs but never converts amounts; keep the scale-mismatch blocker active.
346
+ - **Delete-reimport is a dead-end** — ledgers are append-only/deduped; reruns skip verified scopes. Fix code, don't delete to re-import.
347
+
348
+ ---
349
+
350
+ ## 10. Open questions
351
+
352
+ **All resolved (Decision Log):** ✅ D1 account = `data@worldsteel.org` · ✅ D2 upload owner = `tiangong-lca-cli` + account session · ✅ D3 land prereqs first · ✅ D4 reuse-by-UUID · ✅ R1 deterministic owner-draft World Steel Association contact (packaged id unavailable) · ✅ R2 worldsteel source branch · ✅ R3 capped ≤17 elementary mint (count decided after the UUID-reuse pass) · ✅ R4 source version in payload provenance + new DB row key `00.00.001` · ✅ R5 unmatched materialized FP/UG support mint enabled under canonical-first gates.
353
+
354
+ **Remaining operational decisions (not blocking the build):**
355
+
356
+ 1. **Final residual mint count (R3 follow-up):** after the UUID-reuse pass + AI matching, review how many of the ≤17 GaBi/Sphera pseudo-elementary flows actually have no canonical match. Set `allow_account_local_support_and_elementary.enabled=false` only when both the R3 elementary residual and R5 unmatched FP/UG support no longer require account-local authorization.
357
+ 2. **`allow_remote_commit`:** stays human-gated until the pilot scope is verified end-to-end (dry-run → commit → readback).
358
+
359
+ ---
360
+
361
+ ## 11. Sequenced checklist
362
+
363
+ 1. [x] **tidas-tools** ILCD adapter + `detect.py FORMAT_ILCD` + `cli.py` dispatch + `--from-format ilcd`; preserves UUIDs/versions/classification/exchanges/`referenceToDigitalFile`; skips LCIA. Tests green; full worldsteel package → valid TIDAS.
364
+ 2. [x] **tidas-tools** eilcd XSD `xml:lang`/`name` default-attribute fix + writer `referenceToDigitalFile` emission. Validate regression test green.
365
+ 3. [x] **tiangong-lca-cli** `dataset source upload-attachments` — authenticated `external_docs` upload + `referenceToDigitalFile` rewrite. 25 tests, 100% coverage.
366
+ 4. [x] **foundry** `worldsteel` profile (R3 capped elementary mint + R5 unmatched FP/UG support, full-context policy) + docs; `source-semantics.ts` worldsteel branch; widened `post-authoring-finalize.ts` gate; `worldsteel-batch-import-run.ts` wrapper (deterministic owner-draft World Steel Association contact) + registrations. New tests green.
367
+ 5. [ ] Implement a dedicated hash-bound library-resolution seed manifest before restoring any identity-preflight skip; unbound synthetic decisions remain disabled.
368
+ 6. [ ] `.foundry/account-profiles/worldsteel.env` with the exact expected project ref and canonical expected user id for `data@worldsteel.org`; obtain a fresh CLI 0.1.3 intent-bound receipt before the run. Library contact = deterministic same-owner World Steel Association identity at `00.00.001` (packaged id `d5710976` is unavailable). _(needs a live session)_
369
+ 7. [ ] Publish tidas-tools (≥ the version the CLI bundles) + the CLI, so the foundry run picks up the adapter + upload command. _(release action)_
370
+ 8. [ ] **Phase 1** convert (`--from-format ilcd`) → gates (0 error, LCIA=0 tolerated, extensions OK, Perc/CAS corrected, source versions preserved).
371
+ 9. [ ] **Phase 1.5** upload 13 external_docs + rewrite source URIs → signed-URL verify (CLI command, account-wrapped).
372
+ 10. [ ] **Reuse-by-UUID resolution** (§7): batch-look-up referenced flow UUIDs → `exchange-reference-rewrites.jsonl` (with `canonical_short_description`); author all decisions on conversion-v1 only.
373
+ 11. [ ] **Phase 2-3** index + decision rounds (identity / ≤17 GaBi semantic+AI tail / classification / location / canonical-support). Then review the actual residual mint count (R3).
374
+ 12. [ ] **Phase 3-apply** resolution (archive stale decisions out of `$RUN`) → **Phase 4** runner: dry-run → resumable `--commit` loop → post-write readback verify.
375
+ 13. [ ] **Phase 5** coverage gap 0 → trace workbook → PR per submodule to main (docpact gate) → meta-repo submodule bump.
@@ -0,0 +1,78 @@
1
+ ---
2
+ lastReviewedAt: 2026-09-08
3
+ lastReviewedCommit: 2c1a449c0af751067d5c05363128353e288b1126
4
+ lastReviewedNote: "Reviewed for Foundry #123: adopt independently verified CLI0.1.12 at immutable6df087b, including the corrected original Windows HTTP bootstrap. Exact package/runtime expectations, release input/source/script hashes and current examples advance together; Node/TIDAS pins, profile semantics, authorization and retained private-case evidence are unchanged. Final F1 publication remains separate."
5
+ title: worldsteel Import Profile
6
+ docType: profile
7
+ scope: import-profile
8
+ status: draft
9
+ authoritative: true
10
+ owner: tiangong-lca-data-foundry
11
+ language: en
12
+ whenToUse:
13
+ - when selecting the Worldsteel import profile, runner flags, or account-local support policy
14
+ - when interpreting which canonical references are reused and which candidates remain gated
15
+ whenToUpdate:
16
+ - when the frozen Worldsteel adapter/profile value or support candidate boundary changes
17
+ - when a retained delivery decision changes the Worldsteel import policy
18
+ checkPaths:
19
+ - specs/import-profiles.json
20
+ - scripts/commands/worldsteel-batch-import-run.ts
21
+ - docs/import-profiles/worldsteel/profile.md
22
+ - docs/import-profiles/worldsteel/constraints.md
23
+ - docs/import-profiles/worldsteel/import-plan.md
24
+ - docs/import-profiles/worldsteel/import-coverage.md
25
+ - test/unit/worldsteel-support-mint-truth.test.mts
26
+ related:
27
+ - specs/import-profiles.json
28
+ - docs/import-profiles/worldsteel/import-plan.md
29
+ - docs/import-profiles/worldsteel/constraints.md
30
+ - docs/foundry-task-contracts.md
31
+ - inputs/CUP2025-2_2022b_v10_worldsteel_products_Tiangong_v1 EF3.1 2026_01_27
32
+ ---
33
+
34
+ # worldsteel Import Profile
35
+
36
+ Current task authorization is defined by `docs/task-authorization-contract.md`. Distributed profiles grant no mint/write action or QA waiver. The dated R1–R5 decisions and inventories below are historical case evidence; new tasks require their own exact binding and action evidence. Local candidate preparation remains available, and old locks/seals/attempts are not rewritten or replayed.
37
+
38
+ Profile for the worldsteel EF3.1 native ILCD 1.1 package (`inputs/CUP2025-2_2022b_v10_worldsteel_products_Tiangong_v1 EF3.1 2026_01_27`). worldsteel stays data/profile configuration plus the small, reusable code touchpoints documented in `docs/import-profiles/worldsteel/import-plan.md` §5 — not a bespoke Foundry code path.
39
+
40
+ ## Lane
41
+
42
+ `external-dataset-curated-import` for a native ILCD package. Unified Rust `tidas` owns ILCD→TIDAS conversion and schema validation; the `tiangong-lca` CLI retains QA/curation and remote handoff. The reference data is validated against the locked schemas shipped by Rust tidas, never raw EF3.1.
43
+
44
+ ## Scope
45
+
46
+ - **New payload (authored):** 33 steel LCI-result processes (mass-based, GLO/Europe/EU, 2022; LCIAResult=0 on all 33 — expected for LCI results) + ~57 product/waste/other flows + up to 17 GaBi/Sphera pseudo-elementary flows + a thin worldsteel contact/source/flow-property overlay.
47
+ - **Reference payload (canonical-first):** ~1,315 EF3.1 reference elementary flows + most flowproperties/unitgroups, reused **by their original canonical UUID** via the offline library-resolution `exchange-reference-rewrites.jsonl` (`applyResolutionRewrites`). A canonical row is never minted. Materialized FP/UG absent from the canonical-support cache follow the separately gated account-local path below. The 25 LCIA methods are out of scope (reference/provenance only).
48
+
49
+ ## Resolved Decisions (2026-06-29, superseded where noted on 2026-07-01)
50
+
51
+ - **Historical account:** `data@worldsteel.org`. New runs use a CLI-owned OAuth session bound to the current task account. Writes require current task authorization and remain state_code=0 (My Data).
52
+ - **Reuse by UUID:** the canonical DB already holds the EF3.1 flows under their original UUIDs, so the ~1,315 reference flows are reused deterministically by UUID (no semantic search). See `docs/import-profiles/worldsteel/import-plan.md` §7.
53
+ - **Capped elementary mint:** The original R3 account decision authorized the ≤17 GaBi/Sphera pseudo-elementary flows (dataSetVersion 20.25.x) with no canonical match. These are NOT matched by UUID — the AI judges reuse-vs-mint from full context. Final elementary mint count is reviewed after the UUID-reuse pass.
54
+ - **Unmatched FP/UG support (2026-07-01):** the later delivery decision supersedes the earlier FP/UG reference-only statement. The executable contract is `mintUnmatchedFpUgSupport=true`: each materialized flow property or unit group whose UUID is absent from the canonical-support cache enters the task-authorized account-local support candidate set. The observed reason was 10+10 EF3.1 LANCA rows and the retained owner inventory was 11+11; neither the names nor the counts are a runtime whitelist/cap.
55
+ - **Library/attribution contact (2026-06-30 correction):** packaged id `d5710976@20.20.002` is occupied by another account and is neither public nor visible to the Worldsteel account. The runner therefore omits `contactId`/`contactVersion` and mints one deterministic same-owner `00.00.001` contact carrying the real World Steel Association name, address, classification, website, phone, and `steel@worldsteel.org` identity.
56
+ - **Database fallback source:** worldsteel processes whose data source resolves to a placeholder cite the synthesized `worldsteel LCI database` source (`source-semantics.ts` worldsteel branch), never the BAFU default.
57
+ - **External documents:** the 13 `referenceToDigitalFile` binaries are uploaded to the `external_docs` storage bucket and the source `@uri` rewritten by the `tiangong-lca dataset source upload-attachments` CLI command, authenticated as `data@worldsteel.org`, before write.
58
+ - **Version (2026-06-30 correction):** preserve source `dataSetVersion` inside the ILCD/TIDAS dataset for provenance. New Worldsteel-owned flows, support, processes, sources, and contact use DB row-version key `00.00.001` because native slots are occupied by other accounts; canonical references retain their current published versions.
59
+
60
+ ## Initial Policy
61
+
62
+ - `process_material_balance_deviation` remains blocking unless a current task grant includes both approval and exact source-model evidence. The original 33-process observation is historical evidence, not a new-user waiver.
63
+ - Full-context AI completion required for authored `flow`/`process`/`lifecyclemodel` scopes (identity/classification/location decision tasks with sha-bound proof).
64
+ - Build entity queues with `tiangong-lca dataset curation-queue build`; require `curation-queue verify` before write planning.
65
+
66
+ ## Support mint / blocked-review boundary
67
+
68
+ Canonical FP/UG are always reused. An unmatched candidate remains same-owner My Data (`state_code=0`, row version `00.00.001`), is ordered Unit Group before Flow Property, and never enters the public canonical cache. Unit-scale (`canonical_support_amount_scaling_required` and `canonical_support_amount_scale_unresolved`), schema, QA, curation, reference closure, dry-run, commit-handoff, and readback gates are unchanged. If support preparation, commit, or verification fails, the dependent flow/process scope is blocked and deferred; independent ready scopes may continue. This flag grants neither review nor publish authority.
69
+
70
+ ## Runner
71
+
72
+ `scripts/commands/worldsteel-batch-import-run.ts` (`dataset-worldsteel-batch-import-run`) wraps the BAFU per-scope engine with: `enableBafuAutofill=false`, `enableFamilySignatures=false`, `commitFlowSupportInline=true`, `mintUnmatchedFpUgSupport=true`, `applyResolutionRewrites=true`, and the real World Steel Association `libraryContact` identity fields used to derive the deterministic owner-draft contact.
73
+
74
+ ## Open Decisions
75
+
76
+ - The exact residual count of GaBi/Sphera pseudo-elementary flows that mint (≤17) — decided after the UUID-reuse pass. Retain the historical count evidence; a new task must bind its own residual scope and cannot inherit R3/R5 approval.
77
+ - Whether to land the finalize-trusts-resolution-rewrites speed-up before the full run (all 33 processes are ~2,000–2,543-exchange mega-scopes). See `docs/import-profiles/worldsteel/import-plan.md` §8.
78
+ - `allow_remote_commit` stays human-gated until the pilot scope is verified.