@kungfu-tech/buildchain 3.0.2 → 3.0.3-alpha.1

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 (127) hide show
  1. package/AGENTS.md +1 -1
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +27 -1
  4. package/actions/promote-buildchain-ref/README.md +90 -19
  5. package/actions/report-buildchain-issue/README.md +20 -2
  6. package/actions/run-lifecycle/README.md +5 -0
  7. package/actions/validate-config/README.md +19 -1
  8. package/bin/buildchain.mjs +56 -2
  9. package/bin/internal/command-registry.mjs +82 -0
  10. package/bin/internal/trust-release-cli.mjs +1 -0
  11. package/contracts/auditable-demo-media-profiles-v1.json +116 -1
  12. package/contracts/buildchain-v2-residuals-v1.json +146 -0
  13. package/contracts/evidence/auditable-demo-responsive-web-delivery-v1.json +143 -0
  14. package/contracts/evidence/auditable-demo-web-delivery-v1.json +7 -3
  15. package/contracts/fixtures/auditable-demo-responsive-web-delivery-v1/complete-transcript.txt +2 -0
  16. package/contracts/fixtures/auditable-demo-responsive-web-delivery-v1/public-projection.json +16 -0
  17. package/contracts/fixtures/auditable-demo-responsive-web-delivery-v1/scene.json +12 -0
  18. package/dist/site/buildchain-contract.json +188 -46
  19. package/dist/site/buildchain-site.json +181 -90
  20. package/dist/site/capability-registry.json +5 -5
  21. package/dist/site/cli-registry.json +860 -98
  22. package/dist/site/controller-registry.json +118 -5
  23. package/dist/site/kfd-claims.json +233 -19
  24. package/dist/site/kfd-upstream-aggregate.json +1 -1
  25. package/dist/site/manual-registry.json +20 -20
  26. package/dist/site/node-api-registry.json +374 -59
  27. package/dist/site/page-registry.json +156 -65
  28. package/dist/site/public-surface-audit.json +231 -22
  29. package/dist/site/publication-registry.json +4 -4
  30. package/dist/site/release-provenance.json +3 -0
  31. package/dist/site/site-manifest.json +24 -24
  32. package/dist/site/workflow-registry.json +575 -79
  33. package/docs/MAP.md +22 -4
  34. package/docs/auditable-demo.md +54 -13
  35. package/docs/aws-us-elastic-runner-burst-plane.md +381 -0
  36. package/docs/cli.md +119 -12
  37. package/docs/consumer-issue-reporting.md +20 -2
  38. package/docs/dev-alpha-candidate-patrol.md +24 -10
  39. package/docs/github-governance-authority.md +24 -31
  40. package/docs/lifecycle-protocol.md +20 -2
  41. package/docs/migration-inventory.md +24 -5
  42. package/docs/observed-evidence-patrol.md +28 -12
  43. package/docs/ownership.md +19 -1
  44. package/docs/publication-artifacts.md +158 -18
  45. package/docs/publication-authority.md +4 -4
  46. package/docs/publish-transaction.md +78 -31
  47. package/docs/release-candidate.md +24 -0
  48. package/docs/release-flow.md +50 -32
  49. package/docs/release-governance.md +39 -32
  50. package/docs/release-passport.md +4 -0
  51. package/docs/release-propagation.md +57 -12
  52. package/docs/reusable-build-surface.md +218 -90
  53. package/docs/runtime-train-validation.md +20 -2
  54. package/docs/shifu-gate-profiles.md +7 -1
  55. package/docs/stable-candidate-patrol.md +6 -6
  56. package/docs/toolkit-observability.md +22 -0
  57. package/docs/versioning.md +46 -24
  58. package/docs/web-surface-deployments.md +82 -1
  59. package/package.json +7 -5
  60. package/packages/core/README.md +60 -4
  61. package/packages/core/artifact-signing.js +1 -0
  62. package/packages/core/buildchain-contract.js +9 -4
  63. package/packages/core/cache-evidence.js +1 -0
  64. package/packages/core/controller-evidence.js +2 -0
  65. package/packages/core/diagnostics.js +105 -30
  66. package/packages/core/github-governance-authority.js +25 -17
  67. package/packages/core/index.js +40 -0
  68. package/packages/core/paper.js +3226 -0
  69. package/packages/core/public-surface-audit.js +3 -0
  70. package/packages/core/publication-artifact.js +1 -6
  71. package/packages/core/publication-authority.js +1 -0
  72. package/packages/core/publication-control-plane-audit.js +28 -0
  73. package/packages/core/publication-reproducibility.js +947 -0
  74. package/packages/core/publication-sealed-bundle.js +190 -0
  75. package/packages/core/publish-transaction.js +147 -17
  76. package/packages/core/release-candidate.js +234 -0
  77. package/packages/core/release-passport.js +519 -228
  78. package/packages/core/release-propagation.js +175 -1
  79. package/packages/core/stable-release-gate.js +4 -1
  80. package/scripts/artifact-signing-delegation.mjs +268 -0
  81. package/scripts/audit-github-governance.mjs +32 -13
  82. package/scripts/audit-publication-control-plane.mjs +17 -8
  83. package/scripts/auditable-demo.mjs +266 -7
  84. package/scripts/aws-codebuild-toolchain.mjs +285 -0
  85. package/scripts/aws-macos-jit-core.mjs +378 -0
  86. package/scripts/aws-macos-jit.mjs +123 -0
  87. package/scripts/aws-runner-burst-core.mjs +248 -0
  88. package/scripts/aws-runner-burst.mjs +79 -0
  89. package/scripts/aws-windows-jit-core.mjs +374 -0
  90. package/scripts/aws-windows-jit.mjs +121 -0
  91. package/scripts/build-contract-core.mjs +69 -6
  92. package/scripts/build-standalone-binary.mjs +23 -0
  93. package/scripts/buildchain-contract-lock.mjs +1 -1
  94. package/scripts/buildchain-patrol.mjs +1 -1
  95. package/scripts/check-internal-architecture.mjs +69 -2
  96. package/scripts/check-inventory.mjs +70 -2
  97. package/scripts/check-javascript-syntax.mjs +31 -0
  98. package/scripts/check-maintainability.mjs +371 -0
  99. package/scripts/compiler-cache-evidence.mjs +221 -0
  100. package/scripts/dev-alpha-candidate-patrol.mjs +288 -43
  101. package/scripts/dispatch-artifact-signing-authority.mjs +7 -1
  102. package/scripts/finalize-native-artifact-signing-result.mjs +185 -31
  103. package/scripts/gate-profile-core.mjs +6 -1
  104. package/scripts/generate-channel-promotion-workflow.mjs +3 -12
  105. package/scripts/generate-release-candidate-passport.mjs +4 -0
  106. package/scripts/generate-site-bundle.mjs +84 -18
  107. package/scripts/import-artifact-signing-results.mjs +64 -5
  108. package/scripts/inspect-artifact-signing-requests.mjs +52 -14
  109. package/scripts/maintainability-metrics.mjs +339 -0
  110. package/scripts/npm-publish-transaction.mjs +57 -6
  111. package/scripts/observed-evidence.mjs +151 -33
  112. package/scripts/paper.mjs +645 -0
  113. package/scripts/promotion-channel-router.mjs +16 -4
  114. package/scripts/publication-reproducibility.mjs +62 -0
  115. package/scripts/reconcile-github-governance.mjs +8 -1
  116. package/scripts/release-propagation.mjs +39 -0
  117. package/scripts/resolve-artifact-signing-upload-route.mjs +55 -0
  118. package/scripts/resolve-build-contract.mjs +6 -0
  119. package/scripts/route-offline-runners.mjs +236 -0
  120. package/scripts/run-candidate-body-prefix-renderer.mjs +187 -0
  121. package/scripts/run-lifecycle-core.mjs +62 -1
  122. package/scripts/runtime-ref-core.mjs +36 -4
  123. package/scripts/seal-artifact-signing-requests.mjs +64 -12
  124. package/scripts/stable-candidate-qualification.mjs +50 -0
  125. package/scripts/verify-artifact-signing-results.mjs +26 -1
  126. package/scripts/web-surface-core.mjs +272 -86
  127. package/scripts/web-surface-production-decision.mjs +19 -3
@@ -106,6 +106,37 @@ for compatibility, but the passport records it as lower trust because
106
106
  Buildchain can record the command boundary without proving the compiler or
107
107
  LaTeX distribution digest.
108
108
 
109
+ ## Reproducibility Gate
110
+
111
+ Alpha and release admission require
112
+ `.buildchain/publication/reproducibility-receipt.json`. Buildchain creates the
113
+ receipt by cloning the exact checked-out Git commit into two independent local
114
+ repositories, assigning each build a separate home and npm cache, and deriving
115
+ `SOURCE_DATE_EPOCH` from the source commit. A pinned `latex-docker` build runs
116
+ with UTC, `C.UTF-8`, no build-time network, and the exact image digest declared
117
+ in `[publication.toolchain]`.
118
+
119
+ Each clean build independently creates the PDF set, source bundle, publication
120
+ manifest and passport, append-only registry, synthesized npm package directory,
121
+ and an actual npm tarball. After qualification, Buildchain copies the first
122
+ qualifying tarball into the promoted publication candidate instead of deleting
123
+ it with the temporary clean build. The receipt compares exact bytes and records:
124
+
125
+ - source repository, commit, tree, and `SOURCE_DATE_EPOCH`;
126
+ - toolchain image, digest, command, and toolchain identity root;
127
+ - every artifact and evidence path with byte size and SHA-256;
128
+ - npm tarball SHA-256, SHA-1 shasum, and `sha512` integrity;
129
+ - per-build output-set roots and the first differing field or artifact.
130
+
131
+ The gate is fail-closed. A build-only `custom-command` run can diagnose byte
132
+ drift and promote its byte-identical local output with
133
+ `--allow-unpinned-toolchain`, but it is never a qualifying publication receipt.
134
+ Any workflow that prepares a publishable paper package accepts only a
135
+ digest-pinned toolchain and promotes the first clean build into the publication
136
+ candidate only after both builds are byte-identical. The receipt remains
137
+ outside the npm tarball to avoid a circular digest; it binds the tarball bytes
138
+ from the surrounding sealed publication evidence.
139
+
109
140
  `publish.kind = "npm-paper-package"` declares that Buildchain, not the consumer
110
141
  repository, owns the standard paper npm package shape and release transaction
111
142
  mechanics. `publish.package` is the public npm package that contains the PDF,
@@ -134,14 +165,18 @@ The build-only workflow:
134
165
  any paper build runs;
135
166
  - resolves the declared publication toolchain from `[publication.toolchain]` or
136
167
  workflow inputs;
168
+ - hydrates authenticated registry history before building so both clean
169
+ candidates include the same append-only history;
137
170
  - for `latex-docker`, pulls the pinned build-images LaTeX builder digest and
138
- runs the declared command in the container;
171
+ runs two independent clean builds with the reproducibility policy above;
139
172
  - for `custom-command`, runs the declared command and records the lower-trust
140
- boundary in the passport;
173
+ boundary in the passport, but refuses publication qualification;
141
174
  - runs the verify command;
142
175
  - creates a source bundle from `publication.source_paths`;
143
176
  - writes `.buildchain/publication/publication-artifact.json`;
144
177
  - writes `.buildchain/publication/publication-artifact-passport.json`;
178
+ - writes a qualifying
179
+ `.buildchain/publication/reproducibility-receipt.json`;
145
180
  - when `[publication.archive]` is configured, writes
146
181
  `.buildchain/publication/publication-registry.json` and verifies same-version
147
182
  immutability;
@@ -174,36 +209,36 @@ on:
174
209
  - alpha/v1/v1.0
175
210
  - release/v1/v1.0
176
211
  workflow_dispatch:
177
- inputs:
178
- buildchain-ref:
179
- description: "Temporary Buildchain runtime ref"
180
- required: false
181
- default: ""
182
212
 
183
213
  jobs:
184
214
  paper-release:
185
- uses: kungfu-systems/buildchain/.github/workflows/paper-release-sealed.yml@v3
215
+ uses: kungfu-systems/buildchain/.github/workflows/paper-release-sealed.yml@<exact-buildchain-sha>
186
216
  permissions:
187
217
  actions: read
188
218
  checks: write
189
- contents: write
219
+ contents: read
190
220
  id-token: write
191
221
  issues: write
192
222
  with:
193
- buildchain-ref: ${{ inputs.buildchain-ref || '' }}
223
+ buildchain-ref: <exact-buildchain-sha>
194
224
  publisher-workflow-path: .github/workflows/paper-release.yml
195
225
  toolchain-type: config
196
226
  verify-command: make check
197
227
  artifact-paths: _build/paper-name.pdf
198
228
  buildchain-contract-lock-path: .buildchain/contract-lock.json
199
229
  secrets:
200
- BUILDCHAIN_PROMOTION_TOKEN: ${{ secrets.BUILDCHAIN_PROMOTION_TOKEN }}
230
+ BUILDCHAIN_GENERATED_WRITE_APP_CLIENT_ID: ${{ secrets.BUILDCHAIN_GENERATED_WRITE_APP_CLIENT_ID }}
231
+ BUILDCHAIN_GENERATED_WRITE_APP_PRIVATE_KEY: ${{ secrets.BUILDCHAIN_GENERATED_WRITE_APP_PRIVATE_KEY }}
232
+ BUILDCHAIN_GENERATED_WRITE_TOKEN: ${{ secrets.BUILDCHAIN_GENERATED_WRITE_TOKEN }}
201
233
  ```
202
234
 
203
- The sealed preset does not use a long-lived token for npm publication. It may
204
- accept an optional `BUILDCHAIN_PROMOTION_TOKEN` only for machine-generated
205
- version-state updates on protected channel branches; npm publication remains
206
- bound to GitHub OIDC trusted publishing. The preset builds and packages the
235
+ The sealed preset does not use a long-lived token for npm publication. It
236
+ prefers a repository-scoped GitHub App installation token for generated
237
+ repository writes and accepts `BUILDCHAIN_GENERATED_WRITE_TOKEN` as an
238
+ equivalent narrow compatibility authority. The deprecated
239
+ `BUILDCHAIN_PROMOTION_TOKEN` name remains accepted for existing consumers, but
240
+ there is no `github.token` fallback for generated writes. npm publication
241
+ remains bound to GitHub OIDC trusted publishing. The preset builds and packages the
207
242
  paper in a read-only job, then a credential-free authority job downloads that
208
243
  exact candidate, audits the external control plane, and seals a capability over
209
244
  the source tree, Buildchain runtime, controller receipt, PDF, and npm package
@@ -214,8 +249,9 @@ workflow named by `publisher-workflow-path`.
214
249
 
215
250
  The preset:
216
251
 
217
- - resolves the floating Buildchain runtime once and binds the exact SHA into the
218
- publication candidate and authority capability;
252
+ - uses the exact Buildchain SHA admitted by the provisioning authority and
253
+ binds it into the caller bytes, contract lock, publication candidate, and
254
+ authority capability;
219
255
  - builds the PDF through the declared pinned LaTeX Docker toolchain or custom
220
256
  command in a read-only job;
221
257
  - verifies the paper repository;
@@ -229,7 +265,13 @@ The preset:
229
265
  channel commit and requires `promote-buildchain-ref` to verify that lock
230
266
  before any publish side effect;
231
267
  - verifies the complete candidate again after authority and publishes the
232
- package through npm Trusted Publishing without rebuilding it;
268
+ package through npm Trusted Publishing without rebuilding or repacking it;
269
+ - writes a typed sealed-bundle manifest that binds the candidate root, exact
270
+ npm tarball, every GitHub Release asset, durable storage path, and resume
271
+ command;
272
+ - persists the complete binary bundle to the transaction's durable release-state
273
+ ref before npm receives credentials, allowing an empty runner to restore and
274
+ verify the same bytes after interruption;
233
275
  - writes Buildchain release/passport evidence; and
234
276
  - creates or updates the exact-version GitHub Release by default, uploading
235
277
  every file declared by `publication.primary_artifact` and
@@ -239,6 +281,17 @@ Consumers can opt out of the GitHub Release with `github-release: false`, but
239
281
  the default is on so downstream release propagation can observe
240
282
  `release.published` without hand-written `gh release` steps.
241
283
 
284
+ The transaction exposes a stable publication progression:
285
+
286
+ ```text
287
+ prepared -> sealed -> package-published -> alpha-complete
288
+ ```
289
+
290
+ Stable publication ends at `release-complete`. If a run stops after npm but
291
+ before GitHub Release completion, the next run starts from
292
+ `package-published`, restores the sealed PDF and companion assets, and finishes
293
+ the release without invoking the paper build or `npm pack` again.
294
+
242
295
  Declared publication artifacts are resolved from the generated publication
243
296
  manifest rather than repeated in consumer workflow YAML. Publication fails
244
297
  before upload if a declared artifact is missing or if its basename would
@@ -256,12 +309,92 @@ Buildchain rather than forking the mechanics into each paper repository.
256
309
 
257
310
  ## CLI And Node API
258
311
 
312
+ ### Unified paper operator surface
313
+
314
+ The `buildchain paper` command family assembles the existing publication
315
+ primitives into a resumable operator flow:
316
+
317
+ ```text
318
+ scaffold/new or migrate/existing -> preflight -> bootstrap npm -> build -> alpha -> status -> resume
319
+ ```
320
+
321
+ Each command emits a typed JSON envelope with `--json`. Dry-run is the default
322
+ for every external mutation. `scaffold --write` is limited to no-overwrite
323
+ local file creation. `migrate --write` is limited to the Buildchain-owned
324
+ contract lock, version pin, thin workflows, and provisioning authority; paper
325
+ content and publication configuration are preserved. `bootstrap npm --execute`, `alpha --execute`, and
326
+ `resume --execute` cross external authority boundaries and therefore require
327
+ explicit execution.
328
+
329
+ The evidence model is intentionally non-inferential:
330
+
331
+ | State | Required evidence |
332
+ | -------------------- | -------------------------------------------------------- |
333
+ | `scaffolded` | Complete managed scaffold inventory |
334
+ | `governed` | Compatible Buildchain contract lock |
335
+ | `admitted` | Repository admission receipt |
336
+ | `bootstrapped` | Successful public npm bootstrap receipt or registry fact |
337
+ | `trust-bound` | Trusted publisher binding receipt |
338
+ | `content-ready` | Declared source paths present |
339
+ | `artifact-sealed` | Verified sealed publication bundle |
340
+ | `package-published` | Exact package version visible in npm |
341
+ | `alpha-complete` | Protected Alpha PR completion evidence |
342
+ | `staging-visible` | Staging route evidence |
343
+ | `production-visible` | Production route evidence |
344
+
345
+ `paper status` reports `satisfied`, `not-reached`, `blocked`, or `unknown` for
346
+ each state. It does not promote a state merely because a prior state is
347
+ complete. This makes a later `paper resume` safe: the command dispatches the
348
+ thin repository release workflow, while the workflow re-verifies durable
349
+ evidence and remains the publication authority.
350
+
351
+ Operationally, responsibility remains split:
352
+
353
+ - the paper repository owns content, declared metadata, and its thin
354
+ build/release workflow;
355
+ - Buildchain owns scaffold shape, evidence contracts, reproducibility, sealed
356
+ bundle mechanics, npm transaction mechanics, and resumption planning;
357
+ - GitHub branch protection and trusted publishing own authority transitions;
358
+ - the papers site consumes publication evidence and owns reader-facing
359
+ rendering.
360
+
361
+ Run a local readiness check without network observations:
362
+
363
+ ```sh
364
+ buildchain paper preflight --offline --json
365
+ buildchain paper status --json
366
+ ```
367
+
368
+ Before real npm bootstrap, first inspect the default dry-run result:
369
+
370
+ ```sh
371
+ buildchain paper bootstrap npm --json
372
+ ```
373
+
374
+ Only after reviewing the package, repository, workflow, and dry-run evidence:
375
+
376
+ ```sh
377
+ buildchain paper bootstrap npm \
378
+ --execute \
379
+ --confirm-public-package @kungfu-tech/paper-example \
380
+ --json
381
+ ```
382
+
259
383
  Generate the publication manifest locally or in CI:
260
384
 
261
385
  ```sh
262
386
  buildchain publication-artifact manifest --source-sha "$(git rev-parse HEAD)" --json
263
387
  ```
264
388
 
389
+ Prove the complete candidate from two clean builds:
390
+
391
+ ```sh
392
+ buildchain publication-artifact reproducibility \
393
+ --source-sha "$(git rev-parse HEAD)" \
394
+ --promote \
395
+ --json
396
+ ```
397
+
265
398
  Generate the npm package contents after the manifest exists:
266
399
 
267
400
  ```sh
@@ -280,6 +413,13 @@ import {
280
413
  collectPublicationPackageFacts,
281
414
  preparePublicationNpmPackage,
282
415
  } from "@kungfu-tech/buildchain/publication-package";
416
+
417
+ import { verifyPublicationReproducibility } from "@kungfu-tech/buildchain/publication-reproducibility";
418
+
419
+ import {
420
+ createPublicationSealedBundle,
421
+ verifyPublicationSealedBundle,
422
+ } from "@kungfu-tech/buildchain/publication-sealed-bundle";
283
423
  ```
284
424
 
285
425
  `writePublicationArtifact()` is the single implementation used by the CLI and
@@ -8,7 +8,7 @@ confidence: high
8
8
  sensitivity: public
9
9
  evidence_grade: B
10
10
  review_state: unreviewed
11
- last_reviewed: 2026-07-15
11
+ last_reviewed: 2026-07-31
12
12
  ai_provenance:
13
13
  model_family: GPT-5
14
14
  product: Codex
@@ -212,7 +212,7 @@ providers select an explicit adapter:
212
212
  ```bash
213
213
  buildchain audit publication-control-plane \
214
214
  --repository kungfu-systems/buildchain \
215
- --branch dev/v2/v2.12 \
215
+ --branch dev/v3/v3.0 \
216
216
  --source-sha <exact-merged-branch-sha> \
217
217
  --workflow .github/workflows/release-candidate-promote.yml \
218
218
  --workflow-ref <exact-buildchain-sha> \
@@ -223,7 +223,7 @@ buildchain audit publication-control-plane \
223
223
  # Optional stronger external evidence; generate the JSON outside the workflow.
224
224
  buildchain audit publication-control-plane \
225
225
  --repository kungfu-systems/buildchain \
226
- --branch dev/v2/v2.12 \
226
+ --branch dev/v3/v3.0 \
227
227
  --workflow .github/workflows/release-candidate-promote.yml \
228
228
  --publisher-workflow .github/workflows/buildchain-ref-promotion.yml \
229
229
  --job promote \
@@ -232,7 +232,7 @@ buildchain audit publication-control-plane \
232
232
 
233
233
  buildchain audit publication-control-plane \
234
234
  --repository kungfu-systems/buildchain \
235
- --branch release/v2/v2.12 \
235
+ --branch release/v3/v3.0 \
236
236
  --workflow .github/workflows/.binary-release-assets.yml \
237
237
  --job publish \
238
238
  --environment buildchain-release-assets \
@@ -1,3 +1,21 @@
1
+ ---
2
+ status: active
3
+ period: ongoing
4
+ theme: buildchain-publish-transaction
5
+ doc_type: technical-reference
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-07-31
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-07-31
16
+ invisible_context: not asserted
17
+ ---
18
+
1
19
  # Publish Transaction
2
20
 
3
21
  Buildchain release promotion is not just tag movement. A release can also publish
@@ -7,7 +25,7 @@ than Git refs because most registries are append-only: a failed rerun must know
7
25
  which artifacts already exist, which are still missing, and whether any existing
8
26
  artifact conflicts with the release material.
9
27
 
10
- Buildchain v2 models that work as a release transaction.
28
+ Buildchain v3 models that work as a release transaction.
11
29
 
12
30
  ## Why This Exists
13
31
 
@@ -47,6 +65,7 @@ The branch contains:
47
65
  ```text
48
66
  state.json
49
67
  evidence.json # present after publish evidence exists
68
+ sealed-bundle/<candidate-root>/files/** # present for build-once publication
50
69
  ```
51
70
 
52
71
  The local `.buildchain/release-state/...` and
@@ -62,6 +81,16 @@ for transient service failures such as HTTP 5xx responses, connection resets,
62
81
  timeouts, and "other side closed" socket failures. If the durable write still
63
82
  cannot be persisted after retries, the action fails closed.
64
83
 
84
+ For a sealed publication, `state.json` also carries the typed sealed-bundle
85
+ manifest, its candidate root, publication milestones, stable
86
+ `publication_state`, and an exact resume command. The durable ref stores every
87
+ declared bundle file as binary Git blobs before the publish lifecycle starts.
88
+ A fresh runner restores those blobs into
89
+ `.buildchain/recovered-publication/<version>/`, verifies every size and SHA-256
90
+ against the manifest, and only then supplies the recovered paths to the publish
91
+ lifecycle. A missing or changed tarball, PDF, source bundle, or manifest fails
92
+ before registry publication.
93
+
65
94
  Durable release-state refs reserve their exact version even when the public exact
66
95
  tag was never created. If a later machine run sees a failed or repair-required
67
96
  state for `vX.Y.Z-alpha.N` and cannot resume it with the same transaction
@@ -103,6 +132,10 @@ BUILDCHAIN_RELEASE_SHA
103
132
  BUILDCHAIN_RELEASE_MATERIAL_SHA
104
133
  BUILDCHAIN_PUBLISH_TOOLING_SHA
105
134
  BUILDCHAIN_PUBLISH_EVIDENCE
135
+ BUILDCHAIN_SEALED_BUNDLE_ROOT
136
+ BUILDCHAIN_SEALED_NPM_TARBALL
137
+ BUILDCHAIN_SEALED_NPM_INTEGRITY
138
+ BUILDCHAIN_SEALED_NPM_SHA256
106
139
  BUILDCHAIN_REQUIRED_ARTIFACTS
107
140
  BUILDCHAIN_PUBLISH_MODE
108
141
  BUILDCHAIN_PUBLISH_AUTH
@@ -121,7 +154,8 @@ command = "node scripts/npm-publish-transaction.mjs"
121
154
  That script validates that `package.json` matches `BUILDCHAIN_VERSION`, runs
122
155
  `npm publish --access public --tag <BUILDCHAIN_NPM_DIST_TAG>` through npm Trusted
123
156
  Publishing, and writes npm artifact evidence before the promotion action moves
124
- public refs.
157
+ public refs. When the sealed npm variables are present, the script verifies and
158
+ publishes that exact `.tgz` file. It does not run `npm pack` again.
125
159
 
126
160
  `BUILDCHAIN_RELEASE_MATERIAL_SHA` is the source material whose artifacts must
127
161
  match. `BUILDCHAIN_PUBLISH_TOOLING_SHA` identifies the publishing code. A repair
@@ -253,7 +287,7 @@ fields and required artifact identities before final refs move.
253
287
  "channel": "release",
254
288
  "source_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
255
289
  "release_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
256
- "target_ref": "release/v2/v2.0",
290
+ "target_ref": "release/v3/v3.0",
257
291
  "release_material_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
258
292
  "publish_tooling_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
259
293
  "artifacts": [
@@ -323,33 +357,42 @@ however they need, as long as they emit the common evidence contract.
323
357
  The state machine is:
324
358
 
325
359
  ```text
326
- prepared -> publishing -> published -> finalizing -> complete
327
- | | |
328
- v v v
329
- publish_failed repair_required failed_permanently
330
- |
331
- v
332
- abandoned
360
+ prepared -> sealed -> publishing -> published -> finalizing -> complete
361
+ | | |
362
+ v v v
363
+ publish_failed repair_required failed_permanently
364
+ |
365
+ v
366
+ abandoned
333
367
  ```
334
368
 
335
369
  Supported states:
336
370
 
337
- | State | Meaning |
338
- | --- | --- |
339
- | `prepared` | Transaction identity was created, but publish has not started. |
340
- | `publishing` | Publish lifecycle is running or may have been interrupted. |
341
- | `publish_failed` | Publish command failed before valid evidence was produced. |
342
- | `published` | Evidence is valid; refs have not necessarily finalized. |
343
- | `finalizing` | Buildchain is moving exact/floating refs or needs a later run to do it. |
344
- | `complete` | Required evidence is valid and refs have finalized. |
345
- | `repair_required` | Existing evidence or artifact state conflicts with expected release material. |
346
- | `abandoned` | A human or controlled process abandoned this transaction, usually because a newer version supersedes it. |
347
- | `failed_permanently` | Recovery should not continue without explicit override. |
371
+ | State | Meaning |
372
+ | -------------------- | -------------------------------------------------------------------------------------------------------- |
373
+ | `prepared` | Transaction identity was created, but publish has not started. |
374
+ | `sealed` | Exact candidate bytes and manifest are verified and durable; registry publication has not started. |
375
+ | `publishing` | Publish lifecycle is running or may have been interrupted. |
376
+ | `publish_failed` | Publish command failed before valid evidence was produced. |
377
+ | `published` | Evidence is valid; refs have not necessarily finalized. |
378
+ | `finalizing` | Buildchain is moving exact/floating refs or needs a later run to do it. |
379
+ | `complete` | Required evidence is valid and refs have finalized. |
380
+ | `repair_required` | Existing evidence or artifact state conflicts with expected release material. |
381
+ | `abandoned` | A human or controlled process abandoned this transaction, usually because a newer version supersedes it. |
382
+ | `failed_permanently` | Recovery should not continue without explicit override. |
348
383
 
349
384
  `repair_required`, `abandoned`, and `failed_permanently` fail closed unless the
350
385
  operator passes an explicit override. That override is for controlled repair
351
386
  runs, not normal retry behavior.
352
387
 
388
+ `publication_state` is a stable operator-facing projection over the detailed
389
+ transaction state. Its successful progression is
390
+ `prepared -> sealed -> package-published -> alpha-complete` for Alpha or
391
+ `release-complete` for stable release. If npm succeeds but GitHub Release work
392
+ is interrupted, the durable record remains `package-published`; the next run
393
+ reuses the exact npm evidence and sealed release assets instead of rebuilding
394
+ or republishing them.
395
+
353
396
  ## Ref Ordering
354
397
 
355
398
  When publish transactions are enabled, promotion order is:
@@ -357,11 +400,15 @@ When publish transactions are enabled, promotion order is:
357
400
  1. verify target source and governance;
358
401
  2. create or reuse the version-state release commit;
359
402
  3. acquire or resume the release transaction;
360
- 4. run `lifecycle.publish` or accept already-valid evidence;
361
- 5. validate evidence and required artifacts;
362
- 6. move exact release/prerelease tag;
363
- 7. move floating tags and channel refs;
364
- 8. mark the transaction `complete`.
403
+ 4. for build-once publication, verify and persist the complete sealed bundle;
404
+ 5. run `lifecycle.publish` from the exact sealed tarball or accept already-valid
405
+ evidence;
406
+ 6. validate evidence and required artifacts;
407
+ 7. move exact release/prerelease tag;
408
+ 8. move floating tags and channel refs;
409
+ 9. mark the transaction `complete`;
410
+ 10. create or update the GitHub Release from restored sealed assets and record
411
+ the `github_release` milestone.
365
412
 
366
413
  When a protected channel requires a generated version-state pull request, the
367
414
  first run can stop at `finalizing` after registry publication. If the reviewed
@@ -497,10 +544,10 @@ different SHA is a material conflict and blocks recovery.
497
544
  Local recovery commands operate on the same state/evidence files:
498
545
 
499
546
  ```bash
500
- node scripts/release-transaction.mjs inspect --version v2.0.11
501
- node scripts/release-transaction.mjs recover --version v2.0.11
502
- node scripts/release-transaction.mjs finalize --version v2.0.11
503
- node scripts/release-transaction.mjs abort --version v2.0.11 --superseded-by v2.0.12
547
+ node scripts/release-transaction.mjs inspect --version v3.0.2
548
+ node scripts/release-transaction.mjs recover --version v3.0.2
549
+ node scripts/release-transaction.mjs finalize --version v3.0.2
550
+ node scripts/release-transaction.mjs abort --version v3.0.2 --superseded-by v3.0.3
504
551
  ```
505
552
 
506
553
  The CLI is a diagnostic and local repair surface. It reports the durable
@@ -517,7 +564,7 @@ When no state file exists, creation commands also require:
517
564
  --repository kungfu-systems/buildchain \
518
565
  --source-sha <sha> \
519
566
  --release-sha <sha> \
520
- --target-ref release/v2/v2.0 \
567
+ --target-ref release/v3/v3.0 \
521
568
  --channel release
522
569
  ```
523
570
 
@@ -41,6 +41,21 @@ contains:
41
41
  - normalized platform matrix and artifact summaries;
42
42
  - the hash of the aggregate `build-summary.json`.
43
43
 
44
+ ## Initiative-family release evidence
45
+
46
+ A consumer may pass `release-candidate-family-evidence-json` to the reusable
47
+ build. Buildchain normalizes that value as
48
+ `kungfu-buildchain-initiative-family-release-evidence/v1`, binds it into the
49
+ candidate hash, and carries it unchanged into publication authority. The
50
+ envelope can identify one Initiative family root plus the exact Initiative and
51
+ Assignment responsible for the release; continuation evidence can also bind
52
+ the previous family root.
53
+
54
+ This is an adapter-edge release contract, not a second Work Control authority.
55
+ The immutable native Family State v1 projection and the additive Family State
56
+ v2 typed envelope remain owned by Kungfu. Buildchain only proves that the
57
+ release candidate consumed the caller-supplied family evidence exactly.
58
+
44
59
  Promotion workflows that should not rebuild artifacts can enable:
45
60
 
46
61
  ```yaml
@@ -52,6 +67,10 @@ Promotion workflows that should not rebuild artifacts can enable:
52
67
  promote-only-release-candidate: "true"
53
68
  release-candidate-passport-path: .buildchain/artifacts/release-candidate-passport.json
54
69
  release-candidate-build-summary-path: .buildchain/artifacts/build-summary.json
70
+ release-candidate-family-evidence-required: "true"
71
+ release-candidate-family-evidence-root: sha256:<initiative-family-root>
72
+ release-candidate-family-initiative-id: 2026-07-30-example-initiative
73
+ release-candidate-family-assignment-id: 2026-07-30-example-release
55
74
  ```
56
75
 
57
76
  With `promote-only-release-candidate: "true"`, promotion fails before
@@ -82,6 +101,11 @@ other package as `role: platform`. Consumer workflows therefore stay
82
101
  declarative and do not need their own artifact download or publish-evidence
83
102
  generation scripts.
84
103
 
104
+ When `release-candidate-family-evidence-required` is true, the promotion
105
+ boundary additionally requires the exact family root and may require the
106
+ Initiative and Assignment ids. Missing, mismatched, or source-drifted family
107
+ evidence fails before version-state, release-state, tag, or branch mutation.
108
+
85
109
  Because a channel merge can trigger promotion before its PR-stage matrix has
86
110
  finished uploading evidence, the resolver waits up to ten minutes for the exact
87
111
  merged PR's successful workflow run and paired artifacts. Polling remains bound