@kungfu-tech/buildchain 4.1.3-alpha.1 → 4.1.3-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/architecture/action-taxonomy.json +24 -0
  2. package/architecture/agent-change-map.md +256 -2
  3. package/architecture/ci-lane-change-budget.json +374 -0
  4. package/architecture/decisions/0005-minimal-consumer-contract.md +122 -0
  5. package/architecture/decisions/0006-business-attempt-journal.md +89 -0
  6. package/architecture/decisions/0007-hosted-pipeline-controller.md +106 -0
  7. package/architecture/decisions/0008-pipeline-product-publication.md +99 -0
  8. package/architecture/decisions/0009-pipeline-version-preparation.md +186 -0
  9. package/architecture/internal-capabilities.json +361 -2
  10. package/architecture/maintainability-debt.json +6 -4
  11. package/architecture/maintainability-policy.json +8 -8
  12. package/architecture/minimal-consumer-migration.json +7567 -0
  13. package/architecture/product-upstreams.json +20 -0
  14. package/architecture/release-topology.json +282 -11
  15. package/architecture/universal-workflow-bootstrap.json +12 -0
  16. package/architecture/universal-workflow-capability-policy.json +1 -1
  17. package/architecture/workflow-taxonomy.json +66 -0
  18. package/dist/readers/business-attempt.cjs +809 -0
  19. package/dist/site/buildchain-contract.json +7 -5
  20. package/dist/site/buildchain-site.json +18 -13
  21. package/dist/site/capability-registry.json +3 -3
  22. package/dist/site/kfd-claims.json +385 -10
  23. package/dist/site/kfd-upstream-aggregate.json +1 -1
  24. package/dist/site/manual-registry.json +1 -1
  25. package/dist/site/node-api-registry.json +21 -21
  26. package/dist/site/page-registry.json +13 -8
  27. package/dist/site/public-surface-audit.json +258 -7
  28. package/dist/site/publication-authority-registry.json +141 -1
  29. package/dist/site/publication-registry.json +4 -4
  30. package/dist/site/site-manifest.json +5 -5
  31. package/dist/site/workflow-registry.json +522 -7
  32. package/docs/node-api-reference.md +39 -39
  33. package/docs/runtime-entry.md +45 -5
  34. package/docs/workflow-catalog.md +6 -0
  35. package/package.json +4 -3
  36. package/packages/core/build/standalone/build.js +7 -1
  37. package/packages/core/consumer/buildchain-config.js +2 -21
  38. package/packages/core/consumer/contract/entries.js +85 -0
  39. package/packages/core/consumer/contract/examples.js +96 -0
  40. package/packages/core/consumer/contract/identity.js +65 -0
  41. package/packages/core/consumer/contract/inspection.js +45 -0
  42. package/packages/core/consumer/contract/plan.js +146 -0
  43. package/packages/core/consumer/contract/products.js +119 -0
  44. package/packages/core/consumer/contract/reader.js +47 -0
  45. package/packages/core/consumer/contract/shape.js +46 -0
  46. package/packages/core/dev-delivery/candidate/admission.js +9 -5
  47. package/packages/core/dev-delivery/candidate/reservation.js +11 -0
  48. package/packages/core/dev-delivery/candidate/source-paths.js +12 -4
  49. package/packages/core/dev-delivery/commands/project-cut-merge-queue-admission.mjs +47 -20
  50. package/packages/core/dev-delivery/native/actions.js +7 -1
  51. package/packages/core/dev-delivery/native/heartbeat-action.js +16 -0
  52. package/packages/core/dev-delivery/native/heartbeat.js +6 -4
  53. package/packages/core/dev-delivery/queue/landing-action.js +5 -0
  54. package/packages/core/governance/buildchain-publication-authority.js +6 -0
  55. package/packages/core/paper/operations/bootstrap.js +2 -0
  56. package/packages/core/paper/paper-npm-bootstrap.js +2 -2
  57. package/packages/core/providers/github/attempt-index.js +60 -0
  58. package/packages/core/providers/github/attempt-journal.js +154 -0
  59. package/packages/core/providers/github/discussions/materials.js +7 -2
  60. package/packages/core/providers/github/pipeline-checkout.js +49 -0
  61. package/packages/core/providers/github/pipeline-entry-runs.js +203 -0
  62. package/packages/core/providers/github/pipeline-events.js +52 -0
  63. package/packages/core/providers/github/pipeline-integration.js +95 -0
  64. package/packages/core/providers/github/pipeline-policy.js +213 -0
  65. package/packages/core/providers/github/pipeline-product-payload.js +50 -0
  66. package/packages/core/providers/github/pipeline-product-release.js +191 -0
  67. package/packages/core/providers/github/pipeline-publication-artifacts.js +153 -0
  68. package/packages/core/providers/github/pipeline-release-evidence.js +111 -0
  69. package/packages/core/providers/github/pipeline-run-entry.js +86 -0
  70. package/packages/core/providers/github/pipeline-runs.js +132 -0
  71. package/packages/core/providers/github/pipeline-source.js +178 -0
  72. package/packages/core/providers/github/pipeline-stable-source.js +354 -0
  73. package/packages/core/providers/github/pipeline-version-artifacts.js +91 -0
  74. package/packages/core/providers/github/pipeline-version-readback.js +117 -0
  75. package/packages/core/providers/github/pipeline-version.js +199 -0
  76. package/packages/core/providers/github/pipeline-worker.js +108 -0
  77. package/packages/core/publication/candidate/registry-hydration.js +2 -2
  78. package/packages/core/publication/npm/pack-preview.js +2 -2
  79. package/packages/core/publication/npm/pack-result.js +31 -0
  80. package/packages/core/publication/npm/package.js +3 -6
  81. package/packages/core/publication/npm/pipeline-channel.js +87 -0
  82. package/packages/core/publication/npm/pipeline-provider.js +109 -0
  83. package/packages/core/publication/npm/registry.js +12 -9
  84. package/packages/core/publication/pipeline/actions.js +116 -0
  85. package/packages/core/publication/pipeline/apply.js +188 -0
  86. package/packages/core/publication/pipeline/build-segments.js +107 -0
  87. package/packages/core/publication/pipeline/capsules.js +89 -0
  88. package/packages/core/publication/pipeline/context.js +39 -0
  89. package/packages/core/publication/pipeline/development-anchor.js +91 -0
  90. package/packages/core/publication/pipeline/development-current.js +63 -0
  91. package/packages/core/publication/pipeline/development-pr.js +112 -0
  92. package/packages/core/publication/pipeline/development-proof.js +76 -0
  93. package/packages/core/publication/pipeline/development-transition.js +112 -0
  94. package/packages/core/publication/pipeline/distribution.js +124 -0
  95. package/packages/core/publication/pipeline/documents.js +192 -0
  96. package/packages/core/publication/pipeline/effects.js +162 -0
  97. package/packages/core/publication/pipeline/files.js +66 -0
  98. package/packages/core/publication/pipeline/imported-materials.js +32 -0
  99. package/packages/core/publication/pipeline/journal.js +110 -0
  100. package/packages/core/publication/pipeline/next-development.js +117 -0
  101. package/packages/core/publication/pipeline/pack.js +157 -0
  102. package/packages/core/publication/pipeline/package-policy.js +22 -0
  103. package/packages/core/publication/pipeline/plan.js +136 -0
  104. package/packages/core/publication/pipeline/prepare.js +139 -0
  105. package/packages/core/publication/pipeline/qualification.js +175 -0
  106. package/packages/core/publication/pipeline/qualify.js +104 -0
  107. package/packages/core/publication/pipeline/recovery-admission.js +122 -0
  108. package/packages/core/publication/pipeline/recovery-build-download.js +80 -0
  109. package/packages/core/publication/pipeline/recovery-build-plan.js +122 -0
  110. package/packages/core/publication/pipeline/recovery-build-readback.js +68 -0
  111. package/packages/core/publication/pipeline/recovery-capsules.js +54 -0
  112. package/packages/core/publication/pipeline/recovery-import.js +80 -0
  113. package/packages/core/publication/pipeline/recovery-inspection.js +218 -0
  114. package/packages/core/publication/pipeline/recovery-materials.js +104 -0
  115. package/packages/core/publication/pipeline/recovery-plan.js +46 -0
  116. package/packages/core/publication/pipeline/recovery-prepare.js +73 -0
  117. package/packages/core/publication/pipeline/recovery-qualification.js +128 -0
  118. package/packages/core/publication/pipeline/recovery-readback.js +56 -0
  119. package/packages/core/publication/pipeline/recovery-signing.js +58 -0
  120. package/packages/core/publication/pipeline/sealed-products.js +79 -0
  121. package/packages/core/publication/pipeline/settle.js +43 -0
  122. package/packages/core/publication/pipeline/signing.js +140 -0
  123. package/packages/core/publication/pipeline/source-plan.js +83 -0
  124. package/packages/core/publication/pipeline/stable-entry.js +215 -0
  125. package/packages/core/publication/pipeline/stable-products.js +317 -0
  126. package/packages/core/publication/pipeline/stable-wait.js +170 -0
  127. package/packages/core/publication/pipeline/stable.js +82 -0
  128. package/packages/core/publication/pipeline/version-actions.js +93 -0
  129. package/packages/core/publication/pipeline/version-build.js +130 -0
  130. package/packages/core/publication/pipeline/version-context.js +143 -0
  131. package/packages/core/publication/pipeline/version-material.js +36 -0
  132. package/packages/core/publication/pipeline/version-preparation.js +69 -0
  133. package/packages/core/publication/pipeline/version-regeneration.js +162 -0
  134. package/packages/core/publication/pipeline/version-source-guard.js +69 -0
  135. package/packages/core/publication/pipeline/version.js +81 -0
  136. package/packages/core/publication/pipeline/worker.js +72 -0
  137. package/packages/core/publication/publication-reproducibility.js +2 -2
  138. package/packages/core/release/promote-candidate/product-provider-adapters.js +4 -3
  139. package/packages/core/release/promote-ref/internal/npm-existing-evidence.js +2 -1
  140. package/packages/core/release/promote-ref/internal/publish-command.js +16 -5
  141. package/packages/core/release/stable-release-gate.js +11 -0
  142. package/packages/core/runtime/buildchain-domain.wasm +0 -0
  143. package/packages/core/runtime/domain-wasm-artifact.js +2 -2
  144. package/packages/core/runtime/entry/actions.js +27 -25
  145. package/packages/core/runtime/entry/attempt.js +25 -0
  146. package/packages/core/runtime/entry/selection.js +14 -0
  147. package/packages/core/runtime/entry/source.js +62 -0
  148. package/packages/core/workflow/attempt/identity.js +170 -0
  149. package/packages/core/workflow/attempt/journal.js +87 -0
  150. package/packages/core/workflow/attempt/materials.js +72 -0
  151. package/packages/core/workflow/attempt/reader-entry.js +12 -0
  152. package/packages/core/workflow/attempt/reader.js +149 -0
  153. package/packages/core/workflow/attempt/records.js +153 -0
  154. package/packages/core/workflow/attempt/store.js +75 -0
  155. package/packages/core/workflow/commands/pipeline-build.mjs +23 -0
  156. package/packages/core/workflow/pipeline/action-output.js +11 -0
  157. package/packages/core/workflow/pipeline/actions.js +75 -0
  158. package/packages/core/workflow/pipeline/build-control.js +140 -0
  159. package/packages/core/workflow/pipeline/build-evidence.js +92 -0
  160. package/packages/core/workflow/pipeline/build-qualification.js +145 -0
  161. package/packages/core/workflow/pipeline/build-result.js +69 -0
  162. package/packages/core/workflow/pipeline/build.js +142 -0
  163. package/packages/core/workflow/pipeline/cancellation.js +169 -0
  164. package/packages/core/workflow/pipeline/channel-control.js +127 -0
  165. package/packages/core/workflow/pipeline/controller.js +133 -0
  166. package/packages/core/workflow/pipeline/delivery-control.js +204 -0
  167. package/packages/core/workflow/pipeline/delivery-observation.js +118 -0
  168. package/packages/core/workflow/pipeline/delivery-request.js +198 -0
  169. package/packages/core/workflow/pipeline/events.js +84 -0
  170. package/packages/core/workflow/pipeline/fence.js +42 -0
  171. package/packages/core/workflow/pipeline/group-control.js +56 -0
  172. package/packages/core/workflow/pipeline/guard-build.js +37 -0
  173. package/packages/core/workflow/pipeline/guard.js +156 -0
  174. package/packages/core/workflow/pipeline/host.js +114 -0
  175. package/packages/core/workflow/pipeline/materials.js +58 -0
  176. package/packages/core/workflow/pipeline/notifications.js +36 -0
  177. package/packages/core/workflow/pipeline/parent-notification.js +27 -0
  178. package/packages/core/workflow/pipeline/platforms.js +21 -0
  179. package/packages/core/workflow/pipeline/progress.js +108 -0
  180. package/packages/core/workflow/pipeline/projection.js +20 -0
  181. package/packages/core/workflow/pipeline/reconcile.js +194 -0
  182. package/packages/core/workflow/pipeline/recovery-action.js +30 -0
  183. package/packages/core/workflow/pipeline/recovery-admission.js +122 -0
  184. package/packages/core/workflow/pipeline/recovery-build-control.js +95 -0
  185. package/packages/core/workflow/pipeline/recovery-build-evidence.js +71 -0
  186. package/packages/core/workflow/pipeline/recovery-build.js +121 -0
  187. package/packages/core/workflow/pipeline/recovery-controller.js +91 -0
  188. package/packages/core/workflow/pipeline/recovery-integration.js +66 -0
  189. package/packages/core/workflow/pipeline/recovery-merge-proof.js +90 -0
  190. package/packages/core/workflow/pipeline/recovery-ownership-settlement.js +150 -0
  191. package/packages/core/workflow/pipeline/recovery-ownership.js +91 -0
  192. package/packages/core/workflow/pipeline/recovery-plan.js +126 -0
  193. package/packages/core/workflow/pipeline/recovery-runtime.js +68 -0
  194. package/packages/core/workflow/pipeline/recovery-session.js +129 -0
  195. package/packages/core/workflow/pipeline/recovery-transition.js +135 -0
  196. package/packages/core/workflow/pipeline/recovery-unrecorded-build.js +74 -0
  197. package/packages/core/workflow/pipeline/runtime-source.js +111 -0
  198. package/packages/core/workflow/pipeline/selection.js +106 -0
  199. package/packages/core/workflow/pipeline/session.js +72 -0
  200. package/packages/core/workflow/pipeline/settlement.js +137 -0
  201. package/packages/core/workflow/pipeline/wake.js +38 -0
  202. package/packages/core/workflow/pipeline/web-status.js +108 -0
  203. package/scripts/build-release-discussion-reader.mjs +11 -7
  204. package/scripts/check-pipeline-publication-topology.mjs +48 -0
  205. package/scripts/check-release-topology.mjs +7 -1
  206. package/scripts/generate-minimal-consumer-contract.mjs +155 -0
  207. package/scripts/generate-site-bundle.mjs +1 -1
  208. package/scripts/verify-golden-path.mjs +5 -1
  209. package/scripts/verify-standalone-product.mjs +42 -0
  210. package/templates/minimal-consumer/binary/.buildchain/buildchain.toml +45 -0
  211. package/templates/minimal-consumer/binary/.github/workflows/buildchain-recover.yml +30 -0
  212. package/templates/minimal-consumer/binary/.github/workflows/buildchain.yml +28 -0
  213. package/templates/minimal-consumer/binary/package.json +6 -0
  214. package/templates/minimal-consumer/binary/src/build.mjs +5 -0
  215. package/templates/minimal-consumer/binary/src/hello.c +2 -0
  216. package/templates/minimal-consumer/binary/src/verify.mjs +3 -0
  217. package/templates/minimal-consumer/npm/.buildchain/buildchain.toml +46 -0
  218. package/templates/minimal-consumer/npm/.github/workflows/buildchain-recover.yml +30 -0
  219. package/templates/minimal-consumer/npm/.github/workflows/buildchain.yml +28 -0
  220. package/templates/minimal-consumer/npm/package.json +6 -0
  221. package/templates/minimal-consumer/npm/src/build.mjs +5 -0
  222. package/templates/minimal-consumer/npm/src/verify.mjs +3 -0
  223. package/templates/minimal-consumer/paper/.buildchain/buildchain.toml +45 -0
  224. package/templates/minimal-consumer/paper/.github/workflows/buildchain-recover.yml +30 -0
  225. package/templates/minimal-consumer/paper/.github/workflows/buildchain.yml +28 -0
  226. package/templates/minimal-consumer/paper/package.json +6 -0
  227. package/templates/minimal-consumer/paper/src/build.mjs +12 -0
  228. package/templates/minimal-consumer/paper/src/verify.mjs +3 -0
@@ -0,0 +1,106 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: minimal-consumer-pipeline
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: medium
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-13
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-13
16
+ visible_context: Third-child Assignment, existing Warrant domain, GitHub adapter source and local fault tests.
17
+ invisible_context_boundary: Hosted integration and published consumer qualification have not yet completed.
18
+ ---
19
+
20
+ # ADR 0007: Hosted pipeline history and provider effects
21
+
22
+ The normal pipeline admits repository-owned channel PRs using policy read from
23
+ the protected base. PR TOML supplies the product commands to the credentialless
24
+ build job. It cannot grant itself a channel route or lower protected review
25
+ requirements. Source commit, tree, configuration blob and bytes are verified;
26
+ the PR and protected branch are read again before returning an observation.
27
+ Webhook fields select readback work and do not authorize effects. Terminal-only
28
+ events cannot start product execution. Internal journal ref pushes are ignored.
29
+
30
+ The hosted writer refines ADR 0006's storage boundary. GitHub Discussion appends
31
+ do not provide atomic expected-head updates, and workflow concurrency alone
32
+ does not fence an in-flight append from an interrupted writer. The pipeline
33
+ therefore admits the existing immutable attempt records through one Git-ref
34
+ journal. Each update has exactly one observed parent and uses a non-force
35
+ fast-forward update; competing children cannot both advance that parent.
36
+ The writer reads committed bytes back, including after a lost HTTP response.
37
+ Discussion is a readable projection of the admitted records. It is not a
38
+ second authority, and the earlier Discussion reader and histories remain
39
+ available. The hosted path does not claim that the library's injected
40
+ Discussion lock provides cross-process exclusion.
41
+
42
+ An attempt's source generation, phase order and terminal history retain their
43
+ ADR 0006 identities. Recovery opens a successor after terminal reconciliation;
44
+ it does not inherit successful phases or rewrite prior results. Duplicate
45
+ event keys must retain the same meaning. Product commands execute through the
46
+ existing consumer-shell session with a credential allowlist and private file
47
+ command channels. A subprocess result is an observation; independent hosted
48
+ completion, artifact and source qualification remain necessary for reuse.
49
+
50
+ Cancellation retains its exact provider readback material and commits a pending
51
+ attempt record before invoking the existing Warrant domain transaction. Queued
52
+ cleanup selects its own candidate even when another candidate is active.
53
+ Active cleanup requires the admitted run attempt and separate native/seal jobs
54
+ to be terminal in fresh provider readbacks. Lease expiry alone cannot release
55
+ the Warrant. The credentialed independent heartbeat and finalizer check attempt
56
+ stop requests. The native job retains its credentialless boundary and must
57
+ finish or reach its hosted timeout before ownership can transfer; the controller
58
+ does not cancel an entire GitHub run that could have acquired a newer run
59
+ attempt. Domain expected-old roots and active fences are derived
60
+ internally from fresh queue state.
61
+
62
+ The public normal entry accepts only `config-path`. Its jobs separate runtime
63
+ selection, provider control, credentialless product commands, independent build
64
+ readback and guarded native delivery. The internal delivery component transports
65
+ the retained request; admission, qualification and landing reject changed request
66
+ fields and a different provider run attempt. Candidate source roots include the
67
+ business attempt, so a terminal candidate cannot block a later attempt of the
68
+ same source. Scheduling uses an expected journal head and retains live executions
69
+ when jobs have not yet appeared in the provider inventory.
70
+
71
+ Attempt wake selects its runtime lock from the recorded source commit. A changed
72
+ source generation opens a successor only after old-candidate cleanup, then wakes
73
+ again if its source requires another runtime selection. Branch notifications wake
74
+ existing intents without inventing historical releases. Every declared product
75
+ platform runs on the standard hosted matrix; the independent native command uses
76
+ one declared platform, while exact merge-group verification repeats the complete
77
+ product matrix. No additional native platform coverage is inferred from that
78
+ single native execution.
79
+
80
+ The protected base supplies review policy. Fresh GitHub readback must enforce
81
+ the declared independent approval count, Code Owners, merge queue and required
82
+ checks. PR approvals bind the exact source commit. Release-channel PRs use that
83
+ protected queue; their merged source enters the separate publication stage.
84
+ Development settlement requires the exact source PR, protected ancestry,
85
+ successful exact merge-group execution and retained integration proof before
86
+ the Warrant state changes. Terminal notifications replay retained receipts if a
87
+ successor wake was interrupted.
88
+
89
+ If a cancellation write succeeds but its response is lost, the retained pending
90
+ material must match the candidate's terminal evidence before its attempt
91
+ projection is completed. An interrupted successor dispatch can be retried from
92
+ the same terminal evidence without rewriting history. Receipt material uses
93
+ the existing immutable recovery archive and verifies digest and size on read.
94
+ Neither the archive nor a planned operation grants merge or publication rights.
95
+
96
+ Local tests currently cover the journal's competing writers and response loss,
97
+ corrupt bytes, stale events and source drift, protected-policy selection,
98
+ credentialless subprocess exit failures, native stop fencing, exact provider
99
+ worker readback, queued versus active cleanup, lost settlement responses and
100
+ interrupted successor wake. Tests also exercise the public controller's build
101
+ and delivery handoff, duplicate-event retention, same-source successor identity,
102
+ runtime source selection, exact merged settlement response loss and readable
103
+ Discussion projection. Public workflow wiring is implemented; hosted execution
104
+ and published qualification have not been claimed from these local tests. Product release
105
+ drivers, the public recovery interface, self publication and final minimal
106
+ consumer qualification remain the responsibilities of subsequent children.
@@ -0,0 +1,99 @@
1
+ ---
2
+ status: draft
3
+ period: 2026-09-13
4
+ theme: minimal-consumer-product-publication
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: medium
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-13
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-13
16
+ visible_context: Product contract, hosted pipeline, provider adapters and local failure-path tests.
17
+ invisible_context_boundary: No published entry qualification, production publication or external consumer adoption is established by this document.
18
+ ---
19
+
20
+ # ADR 0008: Product publication stays inside the business attempt
21
+
22
+ The normal pipeline reads the existing schema-2 TOML and derives every declared
23
+ product/platform/artifact and publication target. npm packages, native archives
24
+ and Paper PDFs use the same entry and product build/verify boundary. Consumers
25
+ do not supply standard packaging, signing, publication or recovery commands.
26
+
27
+ After exact protected integration, the internal product component reserves one
28
+ provider execution in the existing attempt journal. Its repository concurrency
29
+ group serializes publication effects. Product commands run on separate hosted
30
+ jobs with read-only checkout credentials and a credential-filtered subprocess
31
+ environment. Qualification independently reads every completed platform job,
32
+ artifact coordinate, manifest and actual payload. Missing platforms, redirected
33
+ npm provider configuration and conflicting bytes are rejected.
34
+
35
+ The plan binds the protected merge source, the original channel PR source, the
36
+ selected runtime commit/tree and the defining publisher workflow SHA separately.
37
+ Stable version materialization changes only declared version fields in an
38
+ isolated Git ref. Its actual commit/tree and original protected source remain in
39
+ the Passport; this is not a tree-equivalence claim. The Rust release domain admits
40
+ the exact canonical product `apply` job and retains QUALIFY/APPLY/SETTLE ownership.
41
+
42
+ When a preceding floating channel already names a version overlay, a new overlay
43
+ retains that exact observed commit as a second Git parent. Its first parent is
44
+ the current protected source, and independent tree comparison still permits only
45
+ the declared version-file changes. This explicit merge ancestry preserves the
46
+ previous release while allowing a provider-enforced fast-forward of the channel.
47
+
48
+ The signer attests the complete qualified-product manifest with a predicate that
49
+ binds both product sources, runtime, publisher and provider execution. The
50
+ publisher verifies the GitHub/Sigstore bundle independently with the actual
51
+ defining workflow SHA and provider run source SHA. A custom predicate carries the
52
+ distinct materialized product source. This keyless signature is not an
53
+ Authenticode or macOS application signature. npm's automatic provenance is
54
+ disabled for this sealed publication path because its default workflow source
55
+ would describe the controller checkout as the product build source. The retained
56
+ custom attestation is published with the qualification and Capsule documents.
57
+
58
+ Sealed payloads and signing bundles are retained in the existing immutable
59
+ material archive before publication. Each provider operation records its intent
60
+ before effects and retains exact successful readback before moving on. npm uses
61
+ the sealed tarball, ignores lifecycle scripts and requires the registry integrity
62
+ to match. GitHub assets and exact tags are never replaced. A lost response is
63
+ reconciled from current provider state; completed packages are not republished.
64
+ The Release contains product assets requested by TOML, its Passport, qualification,
65
+ Capsule aggregate, invocation and attestation bundle.
66
+
67
+ Publication success does not finish the business attempt. Distribution moves the
68
+ npm channel and the major Git channel, with exact prior readback and no forced
69
+ Git update or npm version regression. Divergent Git channel history stops for
70
+ source reconciliation. Alpha then prepares the next development version through
71
+ an ordinary protected PR. Its original publication and receipts remain successful
72
+ while that PR waits for review, queue integration or verification. Anchored
73
+ projects wait for a protected change to their declared version authority; the
74
+ pipeline does not invent an upstream anchor. Stable publication prepares the next
75
+ patch at Alpha zero from the current protected development source. A late
76
+ completion observes already advanced development through exact protected PR
77
+ proof and cannot regress its version. Stable and Alpha retain their distinct
78
+ transition identities and the original successful publication.
79
+
80
+ Provider authorization is a one-time repository setup. Hosted npm trusted
81
+ publishing is preferred; `BUILDCHAIN_NPM_TOKEN` is an optional publisher-only
82
+ credential. Internal PR creation uses the repository's automation App
83
+ (`BUILDCHAIN_APP_CLIENT_ID` variable and `BUILDCHAIN_APP_PRIVATE_KEY` secret), or
84
+ `BUILDCHAIN_AUTOMATION_TOKEN`. It does not use `GITHUB_TOKEN` to create a PR whose
85
+ ordinary checks would be suppressed. No such credential reaches product commands.
86
+ Review and branch protections still apply to generated PRs.
87
+
88
+ The local tests cover real npm packing, native archives and PDFs, source and
89
+ version drift, independent provider inventory, signature-verifier rejection,
90
+ immutable retention, lost provider responses and protected next-development
91
+ waiting/settlement. Hosted publication and the published floating consumer entry
92
+ require separate execution evidence; passing these tests alone does not qualify
93
+ that distribution boundary.
94
+
95
+ Restricted npm products require the configured package read credential for provider
96
+ readback; anonymous 404 responses cannot qualify private-package absence. This
97
+ credential is confined to the fixed npm registry and is not supplied to product
98
+ commands. npm OIDC publication does not imply private-package read authority
99
+ ([npm trusted publishing](https://docs.npmjs.com/trusted-publishers/)).
@@ -0,0 +1,186 @@
1
+ ---
2
+ status: draft
3
+ period: 2026-09-13
4
+ theme: minimal-consumer-version-preparation
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: medium
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-13
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-13
16
+ visible_context: Consumer compiler, prepared self product contract, product execution, version materialization, provider adapters and local adversarial tests.
17
+ invisible_context_boundary: Local tests do not establish published entry qualification, hosted provider authorization or completed self migration.
18
+ ---
19
+
20
+ # ADR 0009: Regenerate version data before qualifying the final product source
21
+
22
+ Changing a package version can invalidate generated documents that embed that
23
+ version or hashes of other documents. Both publication and next-development
24
+ preparation must regenerate those declared documents before creating the final
25
+ Git source. Leaving the old documents in place would fail the ordinary clean
26
+ source build, or publish facts that disagree with the product version.
27
+
28
+ The runtime retains an exact preparation in the current attempt. It binds the
29
+ source and TOML, selected runtime, target version, parent plan, purpose and
30
+ declared platforms. An internal component checks out that source on separate
31
+ product runners, patches only declared primary version fields, and executes the
32
+ existing product install/build/verify commands without publication credentials.
33
+ No new consumer command or workflow input is needed.
34
+
35
+ The product result contains every declared version document and derived file.
36
+ The source guard compares all original tracked bytes, types, executable modes,
37
+ HEAD and tree directly; index flags cannot hide modifications. Only declared
38
+ material bytes may change. Primary documents must exactly equal the pure version
39
+ field patch. Changed derived documents from different platforms must agree.
40
+ The source TOML, managed runtime locks and workflow authority cannot be generated
41
+ as version material. Paths are literal, regular UTF-8 files with bounded size;
42
+ symlink and submodule sources are not qualified by this preparation implementation.
43
+
44
+ The ordinary product build also compares every tracked file directly with its
45
+ admitted Git blob before and after executing commands. Index flags, local clean
46
+ filters and ignored executable-mode changes cannot make altered bytes qualify.
47
+ Tracked symbolic links retain their exact target bytes; parent directories
48
+ cannot become links. Source checkout transformations must preserve the admitted
49
+ bytes (Buildchain declares LF checkout in `.gitattributes`); unresolved submodules
50
+ are rejected. This strengthens both the initial version-preparation source check
51
+ and ordinary build qualification without granting product commands credentials.
52
+
53
+ Project Cut replay transfers generated source patches through private temporary
54
+ files instead of buffering them as command metadata. Git still applies the exact
55
+ binary patch to an isolated index and compares stable patch identity and changed
56
+ paths against the source. This permits large committed action bundles without
57
+ changing the source composition, family receipt, conflict rejection or metadata
58
+ output bound. Temporary descriptors and files are closed on success and failure.
59
+
60
+ A separate job checks the original published caller, exact reusable definitions,
61
+ provider run and retry, every successful platform job, and immutable artifact
62
+ digests before reading results. The retained preparation and actual source
63
+ contract are checked again before the qualified material enters the journal.
64
+ Git materialization verifies the resulting tree, exact document bytes and ref.
65
+ The final product build then runs against that exact materialized source and is
66
+ qualified and signed through the existing publication boundary.
67
+
68
+ For next-development, the same preparation starts from the retained current
69
+ protected development source. It creates an ordinary PR and preserves the
70
+ completed publication while waiting for protected review and integration.
71
+ Recovery can reuse retained material only for the same parent and runtime;
72
+ conflicting qualified results fail closed. Published payloads and provider
73
+ receipts remain immutable under the existing recovery contract.
74
+
75
+ This adds actual product execution when derived version files are declared.
76
+ The publication component calls one shared internal version component for its
77
+ two purposes. Each component stays within the existing job, step and module
78
+ budgets. Local tests cover real child processes and Git byte guards, artifact
79
+ transport rejection, retained request admission, materialization and existing
80
+ recovery regressions. Hosted platform and provider qualification remain separate
81
+ delivery requirements.
82
+
83
+ An npm artifact may declare `path = "."` to pack the product directory through
84
+ the standard runtime packer with lifecycle hooks disabled. Optional artifact
85
+ `filename` data preserves established download names. Names are single bounded
86
+ filenames with the declared format, unique across the full publication plan,
87
+ and independently verified against the packed file. These fields do not expose
88
+ publication commands or provider control to the consumer.
89
+
90
+ The prepared `.buildchain/minimal-consumer.toml` declares Buildchain's npm
91
+ package and the three existing binary downloads using those ordinary product
92
+ fields. It retains all seven primary version documents and three derived
93
+ documents. The contract is inactive: the current callers still select
94
+ `.buildchain/buildchain.toml`. Publishing this preparation does not activate a
95
+ second publisher or prove the self migration. The protected transition must
96
+ qualify the published entry and selected runtime, preserve the existing stable
97
+ qualification gates, retire the old consumer callers with a single writer,
98
+ and finally use the shared normal/recovery pair and canonical TOML path.
99
+
100
+ Each declared native checkpoint platform retains a full candidate action build,
101
+ site generation and repository check through ordinary product commands. Linux
102
+ runs this with the npm product; macOS and Windows run it with their standalone
103
+ product. The full check includes the product's checkpoint clean-process and
104
+ recovery tests; a binary version/help smoke test alone cannot replace source
105
+ qualification. Rust formatting, lint and WASM toolchain components are explicit
106
+ install commands on each platform. Local configuration checks establish this
107
+ wiring only; the protected hosted executions and any remaining container-specific
108
+ qualification must still pass before retiring the existing verification caller.
109
+
110
+ Site generation reads its KFD upstream declarations from the product-owned
111
+ `architecture/product-upstreams.json`. The existing collector receives this
112
+ data explicitly, so changing the consumer TOML to the minimal schema preserves
113
+ the product's seven upstream evidence assets and their digests. The legacy
114
+ configuration retains its declarations until the protected caller cutover;
115
+ the new data contains no build, publication or recovery orchestration.
116
+
117
+ The prepared contract also declares stable eligibility as a closed `stable`
118
+ table: minimum publication interval and canary soak in seconds, literal product
119
+ paths, a product impact document, and whether published-entry qualification is
120
+ required. It carries no workflow names, provider commands or evidence selectors.
121
+ The publication plan retains an independent copy under its immutable root.
122
+ The self preparation preserves the existing 86,400-second interval and
123
+ 3,600-second soak. The shared stable evaluator now rejects impact from another
124
+ candidate version and duplicate canary observations instead of selecting the
125
+ last observation. These declarations and local checks do not activate the new
126
+ publisher: independent provider collection and enforcement in the pipeline
127
+ remain required before the protected self cutover.
128
+ Stable preparation and application now collect source facts after verifying
129
+ the authoritative attempt. The collector resolves the exact public Alpha tag,
130
+ requires the same channel PR source and compiled contract, and verifies every
131
+ declared version document. It reads product impact from a bounded regular Git
132
+ blob in that exact tree, independently checking its bytes and version. Product
133
+ differences include added, removed and mode-changed files from complete Git
134
+ trees; a short comparison listing cannot silently hide product changes.
135
+
136
+ Complete bounded release pagination identifies the previous published product
137
+ and the most recent earlier stable publication, including backports for the
138
+ cooldown. The comparison must match the plan's retained previous channel.
139
+ Fresh tag, release and predecessor observations reject concurrent changes.
140
+ Same-version recovery does not count its own completed publication as an older
141
+ release. These facts carry their own root and the exact publication plan root.
142
+
143
+ New publication plans declare evidence version 1 and publish their full plan
144
+ alongside qualification, capsules, invocation, attestation and Passport. The
145
+ plan root is already bound by the signed product predicate. Recovery of an older
146
+ retained transaction preserves its original evidence inventory and provider
147
+ receipts; it does not retroactively add a plan or replace public bytes.
148
+
149
+ Stable product qualification reads those fixed evidence assets from the exact
150
+ Alpha release, with complete bounded pagination, unique identities, byte digests
151
+ and a second asset readback. It checks the original signature through the
152
+ central publisher workflow and exact provider source, reconstructs the Passport
153
+ and invocation, and requires every declared product/platform output. Original
154
+ build jobs and the signing job must still match provider readback, including
155
+ their attempt, source, publisher definition and completion times. Historical
156
+ qualification is checked at its issue time; it does not renew that receipt or
157
+ authorize the current Stable publisher. Successful product evidence also causes
158
+ another source observation before the eligibility decision.
159
+
160
+ Published-entry qualification independently inventories completed normal PR
161
+ runs after the exact Alpha release. It verifies the generated thin caller,
162
+ published entry definition, managed source lock and selected candidate runtime,
163
+ then reads the original native Attempt and retained product-build receipt.
164
+ The normal consumer commit can differ from the released runtime commit; its
165
+ compiled product contract must be identical. Every declared platform and the
166
+ exact recorder job must agree with fresh provider readback. A newer failed or
167
+ unrecorded matching build blocks fallback to older successful evidence. Recovery
168
+ runs, foreign entries and an old runtime behind a new entry do not qualify.
169
+
170
+ When only the publication interval or canary soak remains unsatisfied, preparation
171
+ retains the eligibility and a source-bound waiting receipt in the same Attempt.
172
+ An internal job outside the repository publication lock waits at most fifteen
173
+ minutes, checks native ownership every thirty seconds, and wakes the same normal
174
+ entry. The next execution recollects qualification; the waiting receipt grants
175
+ no publication authority. Publication checks again before provider effects and
176
+ can return to this waiting path if new evidence moves the soak deadline.
177
+
178
+ The timer stops if its retained receipt is superseded, the Attempt changes or
179
+ the phase advances. A successor can claim the exact waiting native head while
180
+ the old outer run finishes its wake job; the existing worker fence then rejects
181
+ the old publisher. Missing qualification and non-time failures remain errors.
182
+ Local tests exercise real native records with deterministic provider facts and
183
+ an injected clock, including bounded waits and stale-worker races. They do not
184
+ establish live published qualification or activate the prepared self contract.
185
+ Alpha preparation remains available for the protected transition; the legacy
186
+ stable publisher retains its existing policy until the protected self cutover.