@kungfu-tech/buildchain 3.0.2-alpha.0 → 3.0.2-alpha.10

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 (83) hide show
  1. package/README.md +4 -2
  2. package/actions/github-artifact-attestation/README.md +10 -0
  3. package/actions/promote-buildchain-ref/README.md +7 -0
  4. package/bin/buildchain.mjs +5 -0
  5. package/bin/internal/trust-release-cli.mjs +74 -3
  6. package/contracts/auditable-demo-media-profiles-v1.json +168 -0
  7. package/contracts/evidence/auditable-demo-web-delivery-v1.json +103 -0
  8. package/contracts/fixtures/auditable-demo-web-delivery-v1/complete-transcript.txt +2 -0
  9. package/contracts/fixtures/auditable-demo-web-delivery-v1/public-projection.json +16 -0
  10. package/contracts/fixtures/auditable-demo-web-delivery-v1/scene.json +12 -0
  11. package/dist/site/artifact-schemas.json +5 -1
  12. package/dist/site/buildchain-contract.json +133 -34
  13. package/dist/site/buildchain-site.json +159 -40
  14. package/dist/site/capability-registry.json +14 -13
  15. package/dist/site/cli-registry.json +12 -0
  16. package/dist/site/controller-registry.json +72 -4
  17. package/dist/site/kfd-claims.json +338 -20
  18. package/dist/site/kfd-upstream-aggregate.json +1 -1
  19. package/dist/site/manual-registry.json +24 -9
  20. package/dist/site/node-api-registry.json +89 -11
  21. package/dist/site/page-registry.json +135 -25
  22. package/dist/site/public-surface-audit.json +203 -21
  23. package/dist/site/publication-authority-registry.json +72 -2
  24. package/dist/site/publication-registry.json +4 -4
  25. package/dist/site/release-model.json +2 -1
  26. package/dist/site/release-passport-check-manifest.json +1 -0
  27. package/dist/site/release-provenance.json +6 -0
  28. package/dist/site/schemas/release-passport-v1.schema.json +6 -0
  29. package/dist/site/site-manifest.json +21 -13
  30. package/dist/site/workflow-registry.json +167 -13
  31. package/docs/MAP.md +5 -1
  32. package/docs/auditable-demo.md +55 -3
  33. package/docs/binary-distribution.md +7 -0
  34. package/docs/cli.md +9 -0
  35. package/docs/dev-alpha-candidate-patrol.md +111 -0
  36. package/docs/github-artifact-attestation.md +219 -0
  37. package/docs/release-governance.md +32 -0
  38. package/docs/release-passport.md +13 -0
  39. package/docs/reusable-build-surface.md +83 -61
  40. package/docs/runtime-train-validation.md +21 -0
  41. package/docs/versioning.md +1 -0
  42. package/package.json +8 -1
  43. package/packages/core/artifact-signing-result.js +228 -0
  44. package/packages/core/artifact-signing.js +412 -0
  45. package/packages/core/buildchain-config.js +58 -0
  46. package/packages/core/buildchain-contract.js +14 -0
  47. package/packages/core/buildchain-kfd-claims.js +5 -0
  48. package/packages/core/buildchain-publication-authority.js +3 -0
  49. package/packages/core/cache-evidence.js +288 -0
  50. package/packages/core/channel-candidate.js +186 -0
  51. package/packages/core/detached-artifact-signature.js +121 -0
  52. package/packages/core/diagnostics.js +276 -10
  53. package/packages/core/github-artifact-attestation.js +642 -0
  54. package/packages/core/github-governance-authority.js +77 -16
  55. package/packages/core/index.js +62 -0
  56. package/packages/core/publication-authority.js +1 -1
  57. package/packages/core/release-passport-contract.js +2 -0
  58. package/packages/core/release-passport.js +60 -3
  59. package/scripts/auditable-demo.mjs +520 -28
  60. package/scripts/build-contract-core.mjs +31 -0
  61. package/scripts/buildchain-channel-router.mjs +8 -2
  62. package/scripts/check-inventory.mjs +9 -0
  63. package/scripts/create-github-artifact-attestation-policy.mjs +62 -0
  64. package/scripts/dev-alpha-candidate-patrol.mjs +864 -0
  65. package/scripts/dispatch-artifact-signing-authority.mjs +152 -0
  66. package/scripts/finalize-native-artifact-signing-result.mjs +96 -0
  67. package/scripts/generate-channel-promotion-workflow.mjs +6 -0
  68. package/scripts/generate-site-bundle.mjs +20 -0
  69. package/scripts/import-artifact-signing-results.mjs +76 -0
  70. package/scripts/inspect-artifact-signing-requests.mjs +101 -0
  71. package/scripts/locked-source-checkout.mjs +48 -0
  72. package/scripts/materialize-artifact-signing-request.mjs +66 -0
  73. package/scripts/merge-artifact-signing-results.mjs +76 -0
  74. package/scripts/publish-github-artifact-attestation-evidence.mjs +201 -0
  75. package/scripts/reconcile-github-governance.mjs +158 -25
  76. package/scripts/release-candidate-resolver.mjs +12 -0
  77. package/scripts/release-line-policy.mjs +27 -0
  78. package/scripts/runtime-ref-core.mjs +10 -6
  79. package/scripts/seal-artifact-signing-requests.mjs +368 -0
  80. package/scripts/shifu-gate-profile.mjs +26 -20
  81. package/scripts/sign-detached-artifact-requests.mjs +237 -0
  82. package/scripts/stage-github-artifact-attestation-inputs.mjs +65 -0
  83. package/scripts/verify-artifact-signing-results.mjs +99 -0
@@ -0,0 +1,111 @@
1
+ ---
2
+ status: preview
3
+ period: ongoing
4
+ theme: dev-alpha-candidate-patrol
5
+ doc_type: architecture-and-usage
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: self-reviewed
11
+ last_reviewed: 2026-07-27
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-07-27
16
+ visible_context: Existing Buildchain stable-candidate source locks, Kungfu exact-source Alpha preflight, Dev Patrol, and repository release governance.
17
+ invisible_context_boundary: No credentials, private logs, or private configuration were used.
18
+ ---
19
+
20
+ # Dev to Alpha Candidate Patrol
21
+
22
+ Buildchain provides a reusable observation and single-flight PR controller for
23
+ repositories that promote a development branch into a protected Alpha branch.
24
+ It does not publish Alpha. The read-only observer reads the exact heads of both
25
+ branches, walks the
26
+ bounded development history from newest to oldest (stopping early at the Alpha
27
+ head), and selects the newest commit that satisfies all of these conditions:
28
+
29
+ - the source is strictly ahead of the recorded target head;
30
+ - the latest completed Dev Patrol for that exact commit SHA succeeded;
31
+ - the latest completed Alpha preflight for the same commit SHA succeeded; and
32
+ - both runs are within the caller's evidence age limit.
33
+
34
+ The selected commit can be behind the observed development head when newer
35
+ commits have not completed both workflows yet. The decision binds the observed
36
+ head, selected SHA, and count of skipped newer commits. This makes a slow native
37
+ verification lane live under continuous development without silently treating
38
+ an unqualified head as releasable.
39
+
40
+ History discovery is bounded to the newest 1000 development commits. The
41
+ controller then compares the selected SHA to the exact Alpha head before it can
42
+ be eligible, so a bounded scan cannot turn a commit outside the promotion
43
+ ancestry into a candidate.
44
+
45
+ The decision is `kungfu-buildchain-channel-candidate-decision/v1`. It records the
46
+ source and target branches and SHAs, comparison distance, workflow paths, run
47
+ identities and attempts, completion times, URLs, policy, and a canonical decision
48
+ root. Missing, stale, failed, duplicate, or source-mismatched evidence fails
49
+ closed as an auditable `blocked` or `stale` observation and cannot enter
50
+ settlement.
51
+
52
+ The companion state is
53
+ `kungfu-buildchain-dev-alpha-candidate-state/v1`. Its current state is one of:
54
+
55
+ - `observed`: no exact candidate is currently settleable;
56
+ - `eligible-for-settlement`: a qualified candidate exists and no managed Alpha
57
+ candidate PR is active;
58
+ - `active`: exactly one managed candidate PR is open;
59
+ - `retained-next`: an active PR remains authoritative and the newest different
60
+ qualified SHA is retained as `nextCandidate`;
61
+ - `stale`: the available exact-SHA evidence pair is outside policy age; or
62
+ - `blocked`: qualification or reconciliation failed closed.
63
+
64
+ When a newer qualified SHA replaces an earlier `nextCandidate`, the state also
65
+ records that earlier SHA as `supersededCandidate`. Every state carries exact
66
+ repository, source/target refs and SHAs, workflow-run evidence through the
67
+ candidate decision, and canonical decision/state roots.
68
+
69
+ ## Reusable workflow
70
+
71
+ Call `.github/workflows/dev-alpha-candidate-patrol.yml` from a thin repository
72
+ workflow. Start with `dry-run: true`. The reusable workflow always runs an
73
+ `observe` job with only Actions/content/pull-request read permissions. Once the
74
+ repository has proven that its two workflow names and branch topology produce
75
+ exact same-SHA evidence, it may set `settlement-authorized: true` and
76
+ `dry-run: false`. The older `create-pull-request` input remains a compatibility
77
+ alias for settlement authorization.
78
+
79
+ Repositories whose promotion policy requires a machine-readable PR declaration
80
+ can pass it through `pull-request-body-prefix`. Buildchain prepends that trusted,
81
+ repository-owned text only when it creates the candidate PR and preserves it
82
+ when later controller observations update the managed state marker. Keep the
83
+ declaration source-controlled in the caller workflow and update it whenever the
84
+ qualified development delta changes its release or architecture settlement.
85
+ Buildchain rejects a prefix that attempts to inject its managed controller
86
+ marker.
87
+
88
+ The separately permissioned `settle` job re-runs the exact observation before
89
+ any write. With no active managed candidate, it creates one branch named from
90
+ the target branch and the first 12 characters of the full source SHA. An
91
+ existing branch must point to the same full SHA or the run fails. With one
92
+ active managed candidate, it only updates the machine-readable state marker in
93
+ that PR body so repeated events and rapid dev progress cannot create another
94
+ candidate PR or another heavy candidate build. Foreign human-authored Alpha PRs
95
+ are ignored. More than one open Buildchain-managed candidate fails closed.
96
+
97
+ The PR body is the bounded durable controller state: it preserves the active
98
+ candidate and newest retained `nextCandidate` without introducing an always-on
99
+ service. Once the active PR settles or is abandoned, the next execution
100
+ recomputes current exact-SHA qualification and creates only the newest still
101
+ fresh candidate. It never trusts a `workflow_run` trigger SHA as evidence.
102
+
103
+ Consumers should invoke this workflow after relevant qualification workflow
104
+ completion and from an offset periodic fallback. GitHub may delay scheduled
105
+ runs, so the event path supplies low latency while the fallback supplies
106
+ recovery. Workflow concurrency plus the server-side open-PR reconciliation
107
+ makes duplicate or delayed events idempotent.
108
+
109
+ The workflow never moves the Alpha ref directly, merges or auto-merges the pull
110
+ request, publishes npm, creates a Git tag or GitHub Release, or changes branch
111
+ protection. Those remain repository-owned protected settlement actions.
@@ -0,0 +1,219 @@
1
+ ---
2
+ status: draft
3
+ period: 2026-07
4
+ theme: buildchain-linux-artifact-provenance
5
+ doc_type: protocol
6
+ source_level: code-and-official-docs
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-07-24
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-07-24
16
+ visible_context: Buildchain source, tests, GitHub Actions documentation, and actions/attest documentation
17
+ invisible_context: Model internals and provider-side implementation details are not visible
18
+ ---
19
+
20
+ # GitHub-native Linux Artifact Attestation
21
+
22
+ Buildchain can bind a Linux release artifact to its original compiler run, exact
23
+ source revision, platform manifest, Release Passport, and an immutable
24
+ Buildchain attester workflow. GitHub's OIDC identity and artifact attestation
25
+ service provide the keyless signature; Buildchain provides the release contract
26
+ and fail-closed local verification.
27
+
28
+ This capability proves provenance and integrity. It does not prove that source
29
+ code is safe, that a compiler was uncompromised, or that a self-hosted build
30
+ runner had no privileged observer.
31
+
32
+ ## Trust Boundary
33
+
34
+ The original Linux runner remains the compiler identity. The reusable attester
35
+ runs on `ubuntu-24.04` only after the artifact, platform manifest, and Release
36
+ Passport have been sealed and uploaded. It downloads those files as data and
37
+ never checks out or executes consumer source.
38
+
39
+ The attester checks out only
40
+ `actions/github-artifact-attestation` from an exact Buildchain commit. It
41
+ rejects a floating Buildchain ref, a different caller repository, a different
42
+ source SHA, a different workflow run, a non-Linux platform manifest, or a
43
+ subject digest absent from the Release Passport.
44
+
45
+ The protected Environment defaults to `buildchain-artifact-attestation`.
46
+ Consumer repositories should require review or restrict deployment branches on
47
+ that Environment when their release policy requires an independent gate.
48
+
49
+ ## Non-circular Passport Binding
50
+
51
+ The Release Passport first records
52
+ `githubArtifactAttestations[]`, an immutable expected-attestation policy:
53
+
54
+ - artifact name, relative path, byte size, and SHA-256;
55
+ - caller repository, source commit, and source tree;
56
+ - original Linux platform and platform-manifest digest; the initial v3 contract
57
+ requires the runner receipt root to equal that exact manifest digest;
58
+ - Buildchain signer workflow path and exact signer-bootstrap commit;
59
+ - exact Buildchain runtime commit used to build and release the artifact;
60
+ - exact GitHub permission set.
61
+
62
+ The GitHub attestation predicate then records the completed Release Passport
63
+ file digest. The returned attestation id, URL, Sigstore bundle digest, and
64
+ predicate root are written to a separate
65
+ `buildchain.github-artifact-attestation-evidence/v1` document. Keeping dynamic
66
+ provider evidence outside the Passport avoids a self-referential hash while
67
+ still binding both directions.
68
+
69
+ ## GitHub Permissions and Runtime Pins
70
+
71
+ Both caller and reusable workflow grant only:
72
+
73
+ ```yaml
74
+ permissions:
75
+ actions: read
76
+ artifact-metadata: write
77
+ attestations: write
78
+ contents: read
79
+ id-token: write
80
+ ```
81
+
82
+ The reusable workflow pins `actions/checkout`, `actions/download-artifact`,
83
+ `actions/upload-artifact`, and `actions/attest` by full commit SHA. The workflow
84
+ itself must also be called at its exact signer-bootstrap commit. The signer
85
+ commit and the later Buildchain runtime commit are separately bound so the
86
+ first v3 integration never relies on a mutable or self-referential workflow ref.
87
+
88
+ ## Prepare the Release Passport
89
+
90
+ Create one input document for each Linux artifact and seal it as a policy:
91
+
92
+ ```bash
93
+ buildchain create github-artifact-attestation-policy \
94
+ --input-json .buildchain/github-artifact-attestation/policy-input.json \
95
+ --output .buildchain/github-artifact-attestation/policy.json
96
+ ```
97
+
98
+ The input object contains `subject`, `caller`, `signer`, and `build` objects.
99
+ The CLI computes no trusted values implicitly: the caller supplies the already
100
+ measured subject size/digest, source commit/tree, platform-manifest digest,
101
+ runner receipt root, and exact Buildchain workflow commit.
102
+
103
+ Pass the policy into Release Passport collection:
104
+
105
+ ```bash
106
+ buildchain collect github-release \
107
+ --github-artifact-attestation-policy-json \
108
+ .buildchain/github-artifact-attestation/policy.json \
109
+ --output-dir .buildchain/release-passport \
110
+ # ...the existing release inputs
111
+ ```
112
+
113
+ The build, Passport, and attestation jobs must stay in the same workflow run.
114
+ The release-candidate build declares both the subject and the already-merged
115
+ signer bootstrap commit. The Buildchain runtime remains the exact runtime ref
116
+ used by the build workflow and may be a later commit:
117
+
118
+ ```yaml
119
+ with:
120
+ github-artifact-attestation-subject-path: dist/kungfu-linux-x64.tar.gz
121
+ github-artifact-attestation-signer-sha: <exact-signer-bootstrap-sha>
122
+ github-artifact-attestation-platform-id: linux-x64
123
+ ```
124
+
125
+ For release promotion, prefer the integrated v3 route. The policy must already
126
+ be present in the downloaded release-candidate payload:
127
+
128
+ ```yaml
129
+ permissions:
130
+ actions: write
131
+ artifact-metadata: write
132
+ attestations: write
133
+ checks: write
134
+ contents: write
135
+ id-token: write
136
+ issues: write
137
+
138
+ jobs:
139
+ promote:
140
+ uses: kungfu-systems/buildchain/.github/workflows/release-candidate-promote.yml@<exact-buildchain-v3-runtime-sha>
141
+ with:
142
+ buildchain-ref: <exact-buildchain-v3-runtime-sha>
143
+ github-release: true
144
+ release-passport: true
145
+ github-artifact-attestation-policy-json: .buildchain/release-candidate/payload/<artifact>/policy.json
146
+ github-artifact-attestation-environment: buildchain-artifact-attestation
147
+ ```
148
+
149
+ Promotion binds the policy into the Passport, stages only digest-matching data,
150
+ calls the exact v3 signer, verifies the provider identity a second time, and
151
+ publishes immutable bundle, predicate, verification, evidence, and receipt
152
+ assets beside the release artifact. A same-name Release asset with different
153
+ bytes is rejected instead of overwritten.
154
+
155
+ Low-level callers may call the reusable attester directly after their Passport
156
+ job. Both the reusable workflow ref and `buildchain-ref` use the same exact
157
+ 40-hex signer-bootstrap commit and fail closed if the provider identity differs:
158
+
159
+ ```yaml
160
+ jobs:
161
+ attest-linux:
162
+ needs: [build-linux, release-passport]
163
+ permissions:
164
+ actions: read
165
+ artifact-metadata: write
166
+ attestations: write
167
+ contents: read
168
+ id-token: write
169
+ uses: kungfu-systems/buildchain/.github/workflows/github-artifact-attestation.yml@<exact-signer-bootstrap-sha>
170
+ with:
171
+ buildchain-ref: <exact-signer-bootstrap-sha>
172
+ evidence-run-id: ${{ github.run_id }}
173
+ source-sha: ${{ github.sha }}
174
+ subject-artifact-name: linux-release
175
+ subject-relative-path: libnode-linux-x64.tar.gz
176
+ platform-manifest-artifact-name: linux-platform-manifest
177
+ platform-manifest-relative-path: manifest.json
178
+ release-passport-artifact-name: release-passport
179
+ release-passport-relative-path: buildchain.release.json
180
+ policy-json: ${{ needs.release-passport.outputs.github-attestation-policy-json }}
181
+ evidence-artifact-name: linux-attestation-evidence
182
+ ```
183
+
184
+ ## Verify Online and Offline
185
+
186
+ The Buildchain verifier reconstructs exact `gh attestation verify` arguments
187
+ from the policy, including repository, signer workflow, signer digest, source
188
+ digest, predicate type, and self-hosted-runner denial. It then verifies the
189
+ local artifact, platform manifest, Release Passport, retained Sigstore bundle,
190
+ custom predicate, and Buildchain evidence root:
191
+
192
+ The reusable workflow runs that same exact signer/source verification
193
+ immediately after `actions/attest` and before it finalizes or uploads evidence.
194
+ Passing a different `buildchain-ref` than the commit used to invoke the reusable
195
+ workflow therefore fails in the signer job, not only during later consumption.
196
+ The policy additionally retains the distinct Buildchain runtime SHA that
197
+ created the build and release evidence.
198
+
199
+ ```bash
200
+ buildchain verify github-artifact-attestation \
201
+ libnode-linux-x64.tar.gz \
202
+ --platform-manifest manifest.json \
203
+ --release-passport buildchain.release.json \
204
+ --bundle attestation.sigstore.json \
205
+ --evidence github-artifact-attestation.evidence.json
206
+ ```
207
+
208
+ Verification fails if a single artifact byte changes, the source commit or
209
+ repository differs, the signer workflow or Buildchain commit differs, the
210
+ Passport was replaced, the platform manifest drifts, the bundle omits the
211
+ expected statement, or GitHub reports a self-hosted signer.
212
+
213
+ ## Qualification Policy
214
+
215
+ New protocol work qualifies on the Buildchain v3 alpha line first. The v2
216
+ development branch is not a supported landing target. Production
217
+ adoption waits for the exact v3 implementation commit to pass the repository
218
+ suite and a real GitHub OIDC/Sigstore qualification run, including the negative
219
+ cases above. A successful local fixture is necessary but not sufficient.
@@ -1,3 +1,21 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: buildchain-release-governance
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-27
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-07-27
16
+ invisible_context: not asserted
17
+ ---
18
+
1
19
  # Release Governance
2
20
 
3
21
  Buildchain v2 preserves the release semantics of the older ABV workflow while
@@ -235,6 +253,20 @@ declared install, build, and verify fixture, proving that a single consumer
235
253
  surface routes to distinct released runtimes without duplicating lifecycle
236
254
  configuration in the consumer.
237
255
 
256
+ Buildchain's generic artifact-signing contract seals source-, tree-, runtime-,
257
+ platform-, and digest-bound requests from ordinary credential-free build jobs.
258
+ Provider-specific authority jobs consume only those sealed payloads. Apple
259
+ Developer ID, Windows Authenticode, and detached cryptographic signatures share
260
+ the request/receipt model, while each profile retains its honest platform
261
+ semantics and fail-closed verification requirements.
262
+
263
+ The central `buildchain-artifact-signing` environment reuses the established
264
+ macOS Credential Island names (`BUILDCHAIN_MACOS_CERTIFICATE_*`,
265
+ `BUILDCHAIN_MACOS_NOTARY_API_*`, and
266
+ `BUILDCHAIN_MACOS_EXPECTED_TEAM_ID`). Those authority-only values are never
267
+ declared by or forwarded through a consumer repository. Windows and detached
268
+ providers follow the same central-environment boundary.
269
+
238
270
  The reusable build trust gate reads `job.workflow_ref`, which identifies the
239
271
  called workflow and its selected ref. It does not infer the runtime from
240
272
  `github.workflow_ref`, because GitHub defines that context as the caller
@@ -8,6 +8,14 @@ promotion PRs, exact tags, GitHub Releases, npm Trusted Publishing, and
8
8
  machine-readable evidence. A project can keep its existing build system and use
9
9
  Buildchain to make the release record auditable.
10
10
 
11
+ Linux release artifacts can additionally carry a GitHub keyless attestation
12
+ policy in `githubArtifactAttestations[]`. The policy binds the exact subject,
13
+ consumer source, original Linux build evidence, immutable Buildchain signer
14
+ workflow, and minimum permissions before the provider attestation exists. The
15
+ completed provider bundle and attestation identifier remain separate evidence,
16
+ avoiding a Passport hash cycle. See
17
+ [`github-artifact-attestation.md`](github-artifact-attestation.md).
18
+
11
19
  Release-candidate and final passports may also include compact
12
20
  `controllerReceipts[]` references. These bind a real reusable-workflow receipt
13
21
  to its plan digest, consumer source SHA, and exact Buildchain runtime SHA; they
@@ -91,6 +99,10 @@ Additive passport sections:
91
99
  semantic Passport root, exact clean source revision, complete platform
92
100
  coverage, verdict, and residual risk. Buildchain owns release admission, not
93
101
  the meaning of the product invariants.
102
+ - `githubArtifactAttestations`: expected GitHub keyless attestation identities
103
+ for Linux release artifacts, including subject, caller source, original build
104
+ evidence, exact Buildchain signer workflow digest, and least-privilege
105
+ permissions. Dynamic provider evidence is stored beside the Passport.
94
106
 
95
107
  Buildchain's own binary lane also publishes observability artifacts generated by
96
108
  the Buildchain logging API and CLI:
@@ -144,6 +156,7 @@ buildchain collect github-release \
144
156
  --kfd-1-witness-json .buildchain/kfd/kfd-1/contract-world.witness.json \
145
157
  --kfd-2-claim-json .buildchain/kfd/kfd-2/release-claims.json \
146
158
  --invariant-passport-json product/release/qualification/invariant-passport.json \
159
+ --github-artifact-attestation-policy-json .buildchain/github-artifact-attestation/policy.json \
147
160
  --output-dir .buildchain/release-passport
148
161
  ```
149
162
 
@@ -1,3 +1,21 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: buildchain-reusable-build
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-27
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-07-27
16
+ invisible_context: not asserted
17
+ ---
18
+
1
19
  # Reusable Build Surface
2
20
 
3
21
  Buildchain v2 provides a reusable build workflow for repositories that need
@@ -5,6 +23,12 @@ Buildchain's release semantics but cannot be described as a simple Node package.
5
23
  The first target shape is `libnode`: expensive native builds, multiple operating
6
24
  systems, self-hosted runner labels, and release artifacts that must be auditable.
7
25
 
26
+ For Linux release artifacts, the build workflow can hand the sealed artifact,
27
+ platform manifest, and Release Passport to the separate GitHub-hosted keyless
28
+ attester. The compiler runner remains the recorded build identity; the attester
29
+ only signs and verifies immutable data. See
30
+ [`github-artifact-attestation.md`](github-artifact-attestation.md).
31
+
8
32
  ## Automatic Channel Router
9
33
 
10
34
  The preferred consumer surface is one reusable workflow call. After v2.12
@@ -29,7 +53,7 @@ jobs:
29
53
 
30
54
  `buildchain-channel` defaults to `auto`. Selection uses this precedence:
31
55
 
32
- 1. an explicit `buildchain-ref` train, SHA, or official channel;
56
+ 1. an explicit `buildchain-ref` protected authority, train, SHA, or official channel;
33
57
  2. an explicit `buildchain-channel: alpha|stable`;
34
58
  3. `publish-channel: alpha|release|major`;
35
59
  4. GitHub release prerelease metadata;
@@ -94,9 +118,10 @@ jobs:
94
118
 
95
119
  | Preset | Platforms |
96
120
  | ----------------------- | ------------------------------------------------------------------------ |
97
- | `github-hosted` | `ubuntu-24.04`, `macos-latest`, `windows-2022` |
98
- | `kungfu-v4-self-hosted` | Kungfu Linux x64, macOS ARM64, and Windows x64 self-hosted runner labels |
99
- | `custom` | Requires `platforms-json` |
121
+ | `github-hosted` | `ubuntu-24.04`, `macos-latest`, `windows-2022` |
122
+ | `kungfu-v4-self-hosted` | Kungfu Linux x64, macOS ARM64, and Windows x64 self-hosted runner labels |
123
+ | `kungfu-v4-native` | Kungfu Linux x64, Linux ARM64, macOS ARM64, and Windows x64; Linux ARM64 uses GitHub-hosted `ubuntu-24.04-arm` |
124
+ | `custom` | Requires `platforms-json` |
100
125
 
101
126
  Callers can still provide a custom matrix with `platforms-json`. Each platform
102
127
  object has:
@@ -475,8 +500,8 @@ The reusable workflow exposes the resolved contract:
475
500
  | `trusted-event` | `true` when the event is trusted enough to reach build runners |
476
501
  | `buildchain-runtime-ref` | Runtime ref selected after applying the empty-default or override policy |
477
502
  | `buildchain-runtime-sha` | Immutable Buildchain runtime commit used by all runtime checkouts |
478
- | `buildchain-runtime-class` | `stable`, `alpha`, `train`, `exact-sha`, or `development` |
479
- | `buildchain-runtime-override` | `true` when a train or exact-SHA `buildchain-ref` override was accepted |
503
+ | `buildchain-runtime-class` | `stable`, `alpha`, `authority`, `train`, `exact-sha`, or `development` |
504
+ | `buildchain-runtime-override` | `true` when an authority, train, or exact-SHA `buildchain-ref` override was accepted |
480
505
  | `buildchain-runtime-trust-decision` | Runtime override trust decision |
481
506
  | `buildchain-contract-lock-status` | `unchanged`, `compatible-drift`, `breaking-drift`, `missing-lock`, `non-floating-runtime`, or first-release `runtime-contract-unavailable` |
482
507
  | `buildchain-contract-lock-drift` | `true` when the floating runtime SHA or contract digest changed |
@@ -516,65 +541,62 @@ release jobs can detect drifting diagnostics JSON contracts and missing or
516
541
  drifting diagnostics sidecar manifests without downloading the per-platform
517
542
  diagnostics artifacts first.
518
543
 
519
- ## macOS Credential Island
520
-
521
- Alpha consumers can ask the build controller to seal one exact macOS app and
522
- hand it to a separate protected signing job. The built-in mode is suitable
523
- when the protected environment belongs to the repository that defines the
524
- reusable workflow:
525
-
526
- ```yaml
527
- with:
528
- credential-island-macos-app-path: product/dist/desktop/mac-arm64/Kungfu Episodes.app
529
- credential-island-environment: alpha-macos-signing
530
- credential-island-macos-platform-id: macos-arm64
531
- ```
544
+ ## Artifact Signing Authority
532
545
 
533
- For a cross-repository reusable workflow, keep the credentials in the consumer
534
- repository and select caller-owned mode:
546
+ Artifact signing is a Buildchain capability, not a macOS application workflow.
547
+ Consumers declare desired signature state next to their artifact facts; they do
548
+ not configure certificates, Team IDs, notary credentials, protected
549
+ environments, authority roles, or signing jobs:
535
550
 
536
- ```yaml
537
- with:
538
- credential-island-macos-app-path: product/dist/desktop/mac-arm64/Kungfu Episodes.app
539
- credential-island-caller-owned: true
540
- credential-island-macos-platform-id: macos-arm64
551
+ ```toml
552
+ [[signing.artifacts]]
553
+ id = "native-engine"
554
+ path = "dist/kungfu-engine"
555
+ profile = "auto"
556
+ kind = "mach-o"
557
+ platforms = ["macos-arm64", "macos-x64"]
541
558
  ```
542
559
 
543
- The caller then runs its own no-checkout macOS job after the reusable build,
544
- binds the consumer-owned protected environment on that job, and downloads the
545
- source-bound input plus immutable action runtime from the same workflow run.
546
- This is required for cross-repository callers because environment credentials
547
- must never be widened into repository secrets merely to cross a reusable
548
- workflow boundary.
549
-
550
- The ordinary matrix uploads
551
- `credential-island-input-<platform>-<source-sha>`, containing a `ditto`
552
- archive and a manifest bound to the caller repository, source commit, source
553
- tree, bundle identity, version, size, and digest. The pinned reusable workflow
554
- either starts its built-in GitHub-hosted macOS job or leaves that job to the
555
- caller. In both modes the credential-bearing job has no source checkout or
556
- package-manager step: it downloads the immutable Buildchain action runtime plus
557
- the sealed app and never invokes consumer code.
558
-
559
- The protected environment supplies these non-secret variables:
560
-
561
- - `BUILDCHAIN_MACOS_EXPECTED_BUNDLE_ID`
562
- - `BUILDCHAIN_MACOS_EXPECTED_TEAM_ID`
563
- - `BUILDCHAIN_MACOS_CERTIFICATE_SHA1`
564
-
565
- and these secrets:
566
-
567
- - `BUILDCHAIN_MACOS_CERTIFICATE_P12_BASE64`
568
- - `BUILDCHAIN_MACOS_CERTIFICATE_PASSWORD`
569
- - `BUILDCHAIN_MACOS_NOTARY_API_KEY_P8_BASE64`
570
- - `BUILDCHAIN_MACOS_NOTARY_API_KEY_ID`
571
- - `BUILDCHAIN_MACOS_NOTARY_API_ISSUER`
572
-
573
- The signed DMG, signed app ZIP, credential evidence, and their source-bound
574
- platform manifest form one additional release-candidate platform. Reviewers can
575
- therefore verify the exact caller source and immutable Buildchain runtime that
576
- entered the credential island before admitting or publishing the signed
577
- artifacts.
560
+ Every native and container build lane reads this declaration after the build
561
+ lifecycle and before verification. Buildchain binds the exact artifact bytes or directory tree to
562
+ the caller repository, source commit, source tree, immutable runtime, platform,
563
+ and requested signature semantics, then publishes a deterministic
564
+ `<artifact>-signing-request-<platform>-<source-sha>` request. No consumer
565
+ workflow step is required.
566
+
567
+ `profile = "auto"` resolves signable Apple artifacts such as Mach-O files,
568
+ `.dylib`, `.framework`, `.app`, `.xpc`, `.plugin`, `.pkg`, and `.dmg` to the
569
+ native `apple-developer-id` provider. Windows `pe` and `binary` artifacts
570
+ resolve to timestamped native `windows-authenticode`; Windows PE never falls
571
+ back to a detached signature. Linux and other non-native binary files,
572
+ archives, blobs, and directories resolve to `detached-signature-v1`. Buildchain records that as a
573
+ detached cryptographic signature and never misrepresents it as an operating
574
+ system code signature. Explicit incompatible provider/kind/platform
575
+ combinations fail closed.
576
+
577
+ The request schema rejects credential and authority-infrastructure fields. The
578
+ Buildchain-owned signing authority is responsible for credential selection,
579
+ native signing, notarization where applicable, immutable result delivery, and a
580
+ receipt bound to the request digest, runtime SHA, output digest, and signature
581
+ evidence. Consumer repositories neither receive nor duplicate credential-island
582
+ material. The reusable workflow dispatches the sealed request to the
583
+ Buildchain repository, waits for its protected authority workflow, verifies the
584
+ immutable result, replaces only the declared artifact with the returned final
585
+ bytes, and then runs the consumer's normal verification. Platform manifests,
586
+ KFD evidence, checksums, and Release Passport inputs therefore observe the
587
+ final signed artifact rather than the pre-signing build output.
588
+
589
+ The durable v3 authority runtime is
590
+ `authority/v3/v3.0/artifact-signing`. It is channel-neutral: alpha and stable
591
+ release work use the same protected `buildchain-artifact-signing` environment
592
+ and provider identities. The authority ref is protected independently from
593
+ release channels and can advance only through reviewed, checked changes; the
594
+ temporary `train/v3/v3.0/artifact-signing-authority` ref is retained only as a
595
+ bounded migration rollback.
596
+
597
+ The older `credential-island-macos-*` reusable-workflow inputs remain a
598
+ compatibility surface while existing callers migrate. They are not the target
599
+ consumer contract and must not be used to design new integrations.
578
600
 
579
601
  ## Artifact Transfer Relay
580
602
 
@@ -64,6 +64,27 @@ item that still needs to be merged; it is only a temporary fast-use,
64
64
  diagnostic, and rollback channel for initiating repositories. Retained trains
65
65
  are cleaned up by a separate periodic Buildchain cleanup task.
66
66
 
67
+ ## Formal artifact-signing authority ref
68
+
69
+ Artifact signing uses a durable, channel-neutral authority ref after its
70
+ runtime has passed downstream validation:
71
+
72
+ ```text
73
+ authority/v3/v3.0/artifact-signing
74
+ ```
75
+
76
+ Unlike a train, this ref is a protected execution boundary. Alpha and stable
77
+ release intent use the same authority ref and the same
78
+ `buildchain-artifact-signing` environment; channel promotion never selects a
79
+ different certificate environment. Updates to the authority ref require a
80
+ reviewed pull request, the normal `check` and `verify` status contexts, and a
81
+ fast-forward-safe protected branch policy. Deletion and non-fast-forward
82
+ updates are forbidden.
83
+
84
+ The temporary `train/v3/v3.0/artifact-signing-authority` ref remains a bounded
85
+ rollback and diagnostic pointer during migration. It is not the production
86
+ identity and must not regain credential ownership.
87
+
67
88
  ## Consumer workflow requirement
68
89
 
69
90
  Consumers keep their reusable workflow pinned to the stable shell:
@@ -61,6 +61,7 @@ repository changes are patch".
61
61
 
62
62
  | Date | Action | Line | Faces | Class | Rationale | PR |
63
63
  | --- | --- | --- | --- | --- | --- | --- |
64
+ | 2026-07-28 | extend-minor | `v3.0` | auditable-demo-workflow, auditable-demo-media-profile, auditable-demo-media-receipt | additive | Add opt-in archive, web-delivery, and site-hero profiles; independently bind codec, container, audio, layout, byte-budget, role, and fast-start facts into a v2 media receipt while preserving the existing archive default. | |
64
65
  | 2026-07-26 | extend-minor | `v3.0` | auditable-demo-workflow, auditable-demo-evidence | additive | Forward-port the consumer-neutral reusable Gate that binds exact same-run GitHub Artifacts to checked-in adapters and immutable renderer evidence, with optional media rendering only from the exact passing Gate bundle. | #1862 |
65
66
  | 2026-07-23 | extend-minor | `v2.14` | credential-island-macos-input, protected-signer-job, macos-signing-evidence, action-subpaths | additive | The reusable build surface can seal an exact source-bound macOS app and hand it to a protected caller environment, where an immutable Buildchain action signs, notarizes, staples, Gatekeeper-assesses, and returns an auditable additional release-candidate platform without exposing credentials to consumer lifecycle jobs. | |
66
67
  | 2026-07-20 | extend-minor | `v2.14` | anchored-derived-version-material, build-controller-evidence, release-passport, package-subpaths, release-propagation-controller | additive | Anchored/manual consumers can declare derived version witnesses that Buildchain regenerates and verifies before heavy builds, binds to exact alpha/release trees and passports, and admits during protected promotion; propagation receipts now model their existing optional consumer stages. | |