@kungfu-tech/buildchain 2.8.0 → 2.8.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.
@@ -98,6 +98,7 @@ buildchain collect github-release \
98
98
  --platform-manifest-json .buildchain/artifacts/win32-x64/manifest.json \
99
99
  --dist-tag-evidence-json .buildchain/release-evidence/v2.2.0/dist-tag-evidence.json \
100
100
  --kfd-1-witness-json .buildchain/kfd-1/contract-world.witness.json \
101
+ --kfd-2-claim-json .buildchain/kfd-2/release-claims.json \
101
102
  --output-dir .buildchain/release-passport
102
103
  ```
103
104
 
@@ -120,6 +121,12 @@ the Kungfu SDK. The authority chain is:
120
121
  3. Consumers only pass declarative witness JSON plus the artifact payloads their
121
122
  build already produced.
122
123
 
124
+ This gives agents a concrete answer to "what changed and can I trust it?" A
125
+ release can include both normal release passport evidence and KFD-1 evidence:
126
+ the passport proves the release transaction and artifacts are complete, while
127
+ KFD-1 proves selected contract-world surfaces inside those artifacts are the
128
+ byte-for-byte surfaces the release intended to ship.
129
+
123
130
  The witness JSON names the contract world, the canonical serialization policy,
124
131
  and the release surfaces that must be byte-for-byte verified:
125
132
 
@@ -156,6 +163,125 @@ the actual artifact digest observed after the build. Verification fails closed
156
163
  when the witness is missing required facts, an artifact cannot be found, or a
157
164
  post-build digest does not match the frozen witness.
158
165
 
166
+ For the KFD repository itself, the KFD-1 witness can be a self-hosted standard
167
+ contract witness. In that mode KFD owns the standard-contract facts and
168
+ Buildchain verifies declared source standard metadata, schemas, package
169
+ exports, and site-consumption entrypoints against the packaged artifact. The
170
+ passport records source and artifact hash summaries, schema ids, the
171
+ self-hosting boundary, result, residual risk, and responsibility state for
172
+ source ownership, artifact verification, and release-passport proof ownership.
173
+
174
+ Good KFD-1 witnesses should point at release payload surfaces, not at private
175
+ build-machine state. For Buildchain itself, the natural witness set is the
176
+ release passport schema and implementation, KFD-1 gate implementation,
177
+ `dist/site/buildchain-contract.json`, and the npm package payload files that
178
+ expose the public CLI, reusable workflow/action contracts, and site facts.
179
+ The final `buildchain.release.json` file should not be used as an ordinary
180
+ byte-for-byte KFD surface because it contains KFD evidence; instead, the
181
+ passport is audited through release-state SHA, `check-report.json`, and the
182
+ contract files that generate and verify it.
183
+
184
+ ### KFD-2 release trust passport audit
185
+
186
+ Buildchain can write a KFD-2 release trust passport audit under the top-level
187
+ `kfd-2` section. The section is generated automatically from KFD-1 and KFD-3
188
+ release-gate evidence, and callers may add explicit public release claims with
189
+ `--kfd-2-claim-json`.
190
+
191
+ Every public claim must bind:
192
+
193
+ - declared sources;
194
+ - machine-readable evidence;
195
+ - source/evidence/artifact hashes;
196
+ - artifact coordinates;
197
+ - verification results;
198
+ - audit boundary;
199
+ - responsibility state;
200
+ - residual risk, even when the array is empty.
201
+
202
+ Unbound public claims fail release passport verification. Claims that are
203
+ machine-bound but only supported by prose downgrade the KFD-2 audit and produce
204
+ a warning, so agents can distinguish "verified", "needs review", and "not
205
+ bound to evidence" without reading release notes.
206
+
207
+ ### KFD-3 collaboration-interface release gate
208
+
209
+ KFD-3 asks a different release question than KFD-1. KFD-1 proves that named
210
+ payload bytes match one contract world. KFD-3 proves that a product's shipped
211
+ participant-facing collaboration/control surface is closed over its declared
212
+ interface.
213
+
214
+ The product remains the fact source. Before build/publish, the product writes a
215
+ pre-build witness:
216
+
217
+ ```bash
218
+ kungfu sdk collaboration-interface witness --json \
219
+ > .buildchain/kfd-3/collaboration-interface.prebuild.json
220
+ ```
221
+
222
+ That witness must contain, or point to, the product-owned KFD-3 collaboration
223
+ interface, registry digest, participants, and declared public shipped surfaces.
224
+ KFD repository self-verification can declare the same facts as grouped machine
225
+ surfaces: docs, schemas, standards metadata, package exports, and
226
+ site-consumption contracts.
227
+ After the artifact is built, the product also provides artifact-side evidence,
228
+ either as a JSON file or a command:
229
+
230
+ ```bash
231
+ buildchain collect github-release \
232
+ --kfd-3-prebuild-witness-json .buildchain/kfd-3/collaboration-interface.prebuild.json \
233
+ --kfd-3-artifact-verify-cmd "kungfu agent verify --json"
234
+ ```
235
+
236
+ Buildchain imports the KFD-3 metadata from `@kungfu-tech/kfd`, freezes the
237
+ pre-build witness digest, ingests the artifact witness, and compares the two
238
+ sets:
239
+
240
+ - every declared `shipped` public participant-facing surface must appear in the
241
+ artifact witness;
242
+ - every artifact-exposed public participant-facing surface must be declared by
243
+ the pre-build witness;
244
+ - if both witnesses record `collaborationInterface.digest`, the digests must
245
+ match;
246
+ - contradictory, missing, stale, or schema-incomplete evidence fails closed.
247
+
248
+ The generated release passport records the result under the KFD-provided
249
+ top-level key currently named `kfd-3`. The section includes the KFD package
250
+ version, schema ids/paths, pre-build witness digest, artifact witness digest,
251
+ declared/exposed surface counts, missing declared shipped surfaces, and
252
+ unclassified artifact public surfaces. It also records the KFD-2 trust proof
253
+ view of that evidence: `releaseStatus`, witness file hashes and canonical
254
+ hashes, declared capability verification, reverse audit boundary, residual
255
+ risk, and responsibility state.
256
+
257
+ The trust proof makes the strongest claim only when the witnesses justify it:
258
+ `No unclassified reachable surface within the declared audit boundary.` If the
259
+ product declares non-exhaustive surfaces, Buildchain keeps the passport
260
+ verifiable but marks the interface `audited` instead of `enforced` and records
261
+ the residual risk explicitly. Draft or partial KFD-3 declarations are
262
+ downgraded; missing declared capabilities, undeclared public artifact surfaces,
263
+ or stale collaboration-interface digests fail the proof.
264
+
265
+ This makes KFD-3 support usable by readers and agents immediately: they can
266
+ inspect `buildchain.release.json` and know whether the released package
267
+ actually exposes no more and no less than the declared collaboration interface,
268
+ instead of trusting docs or release notes.
269
+
270
+ ### Floating Buildchain contract lock
271
+
272
+ KFD-1 protects release payload surfaces. Floating ref contract locks protect the
273
+ consumer's relationship to Buildchain itself. A consumer can keep
274
+ `buildchain.contract-lock.json` with the Buildchain floating ref it accepted,
275
+ the resolved SHA, the contract digest, and the compatibility policy. Each
276
+ Buildchain run reads the actual contract from the checked-out Buildchain ref
277
+ and compares it before heavy build or publish work begins.
278
+
279
+ Compatible drift, such as optional inputs or extra diagnostics, continues and
280
+ creates a consumer-local issue for review. Breaking drift fails fast. This means
281
+ consumers can use `@v2` without silently accepting incompatible changes, while
282
+ Buildchain maintainers can still ship compatible improvements under the same
283
+ major floating tag.
284
+
159
285
  `impact.json` can be supplied with `--impact-json`. Production release
160
286
  passports (`release/*`) and major publish-gate passports require
161
287
  `surfaceImpacts[]`; alpha, local, and legacy passport contexts keep the field
@@ -164,6 +164,56 @@ the outer reusable workflow YAML itself to change, such as new jobs,
164
164
  permissions, workflow outputs, or matrix topology. Those changes need a canary
165
165
  workflow path or a temporary explicit workflow ref.
166
166
 
167
+ ## Floating Ref Contract Lock
168
+
169
+ Stable consumers should use floating major refs such as `@v2`, but a floating
170
+ ref is not blind trust. Each released Buildchain ref carries a package-owned
171
+ runtime contract world in `dist/site/buildchain-contract.json`. Consumers may
172
+ keep a small lock file, `buildchain.contract-lock.json`, recording the
173
+ Buildchain ref, resolved SHA, contract digest, compatibility digest, accepted
174
+ major line, and compatibility policy they reviewed.
175
+
176
+ The reusable build trust gate checks this lock before any heavy matrix job:
177
+
178
+ 1. resolve the Buildchain runtime ref, for example `v2`, to an immutable SHA;
179
+ 2. read `dist/site/buildchain-contract.json` from that checked-out Buildchain
180
+ ref;
181
+ 3. read the consumer's `buildchain.contract-lock.json`;
182
+ 4. compare the accepted contract with the current contract.
183
+
184
+ SHA drift alone is not a failure. `v2` is expected to advance. Buildchain only
185
+ fails fast when the accepted contract is no longer compatible, for example a
186
+ required input is removed, a required output disappears, a protected behavior
187
+ promise changes, or the major line changes. Additive changes such as optional
188
+ inputs, optional outputs, diagnostics, or documentation updates continue under
189
+ the default `major-compatible` policy.
190
+
191
+ ```yaml
192
+ jobs:
193
+ build:
194
+ uses: kungfu-systems/buildchain/.github/workflows/.build.yml@v2
195
+ permissions:
196
+ contents: read
197
+ issues: write
198
+ id-token: write
199
+ with:
200
+ buildchain-contract-lock-path: buildchain.contract-lock.json
201
+ buildchain-contract-compatibility-policy: major-compatible
202
+ buildchain-contract-drift-issue-mode: compatible-and-breaking
203
+ ```
204
+
205
+ When compatible drift is detected, the build continues and Buildchain opens or
206
+ updates a low-priority issue in the consumer repository. The issue records the
207
+ old SHA/digest, new SHA/digest, compatibility result, workflow run, and the next
208
+ action: review the Buildchain release notes and update the lock. When breaking
209
+ drift is detected, the same issue path is used, but the trust gate fails before
210
+ matrix build or publish work starts. If the workflow token cannot write issues,
211
+ Buildchain writes a copyable issue body into the job summary.
212
+
213
+ The lock is intentionally small. It does not copy the full contract. The full
214
+ contract remains in the Buildchain ref and package; the consumer records only
215
+ what it accepted and the policy used to compare future floating-ref movement.
216
+
167
217
  When a Buildchain maintainer asks for downstream validation, the expected
168
218
  request is:
169
219
 
@@ -201,6 +251,9 @@ The reusable workflow exposes the resolved contract:
201
251
  | `buildchain-runtime-class` | `stable`, `alpha`, `train`, `exact-sha`, or `development` |
202
252
  | `buildchain-runtime-override` | `true` when a non-empty `buildchain-ref` override was accepted |
203
253
  | `buildchain-runtime-trust-decision` | Runtime override trust decision |
254
+ | `buildchain-contract-lock-status` | `unchanged`, `compatible-drift`, `breaking-drift`, `missing-lock`, `non-floating-runtime`, or first-release `runtime-contract-unavailable` |
255
+ | `buildchain-contract-lock-drift` | `true` when the floating runtime SHA or contract digest changed |
256
+ | `buildchain-contract-digest` | Current Buildchain runtime contract digest |
204
257
  | `publish-channel` | Resolved publish channel requested by the caller |
205
258
  | `publish-allowed` | `true` only when this event/ref may publish after verification |
206
259
  | `publish-reason` | Human-readable reason for the publish gate decision |
@@ -453,9 +506,13 @@ payload artifacts from the same PR-stage run, validates the payload count,
453
506
  compares the built tree with the promotion channel tree, locks
454
507
  `publish-gate/{alpha,release,major}` to the promotion channel commit, and then
455
508
  calls `actions/promote-buildchain-ref` with
456
- `promote-only-release-candidate: "true"`. It does not call `.build.yml`, does
457
- not create a matrix, and must fail before publish if the RC evidence or payload
458
- set is missing or ambiguous.
509
+ `promote-only-release-candidate: "true"` and
510
+ `require-publish-source-lock: "true"`. The wrapper passes the created
511
+ `publish-gate/*` ref, target SHA, and `locked=true` into the promote action, so
512
+ floating `@v2` consumers receive publish-side source-lock drift protection by
513
+ default. It does not call `.build.yml`, does not create a matrix, and must fail
514
+ before publish if the RC evidence, payload set, or source-lock ref is missing or
515
+ ambiguous.
459
516
 
460
517
  ```yaml
461
518
  jobs:
@@ -476,12 +533,15 @@ jobs:
476
533
  publish-target: npm
477
534
  runner-preset: github-hosted
478
535
  trusted-publishing: true
536
+ github-release: true
479
537
  required-status-check: check
480
538
  required-artifact-count: 3
481
539
  publish-dist-tag: alpha
482
540
  publish-package-set-order: platforms-first-main-last
483
541
  publish-package-main: "@kungfu-tech/libnode"
484
542
  release-passport-product-name: Libnode
543
+ buildchain-contract-lock-path: buildchain.contract-lock.json
544
+ buildchain-contract-drift-issue-mode: compatible-and-breaking
485
545
  ```
486
546
 
487
547
  `buildchain-issue-app-id` and `buildchain-issue-app-private-key` are optional
@@ -505,6 +565,22 @@ main`, marks the rest as `role: platform`, and passes the generated
505
565
  `publish-required-artifacts-json` to `promote-buildchain-ref` before any publish
506
566
  side effect. Downloaded platform manifests are still passed into the release
507
567
  passport unless `release-passport-platform-manifest-paths` is set explicitly.
568
+ The same Buildchain contract lock check runs before release-candidate
569
+ resolution and before publish. A compatible `v2` drift leaves an issue in the
570
+ consumer repository but does not trigger a second heavy build; an incompatible
571
+ drift fails before publish side effects.
572
+
573
+ Set `github-release: true` when the promoted exact tag should also publish a
574
+ GitHub Release. After `promote-buildchain-ref` reports a complete release
575
+ transaction, the wrapper creates or updates the exact-tag release, marks semver
576
+ prerelease tags such as `v1.2.3-alpha.0`, `v1.2.3-rc.1`, or
577
+ `v22.22.3-kf.3-alpha.7` as `prerelease=true` and `make_latest=false`, marks
578
+ stable semver tags as latest, and uploads the publish evidence file plus every
579
+ file in the generated release passport directory, including
580
+ `buildchain.release.json` and `check-report.json`. Consumers do not need to
581
+ hand-write `gh release` logic to trigger `release.published` propagation.
582
+ If the transaction still needs protected-ref finalization, the wrapper defers
583
+ GitHub Release creation until the later run that reaches `state=complete`.
508
584
 
509
585
  Custom publish jobs can also repeat the channel-ref preflight:
510
586
 
@@ -17,12 +17,17 @@ dist/site/
17
17
  workflow-registry.json
18
18
  release-model.json
19
19
  artifact-schemas.json
20
+ buildchain-contract.json
20
21
  product-mechanism.json
21
22
  release-provenance.json
22
23
  agent-index.json
23
24
  ```
24
25
 
25
26
  `buildchain-site.json` is the top-level bundle entrypoint.
27
+ `buildchain-contract.json` is the machine-readable Buildchain runtime contract
28
+ world used by floating-ref contract locks. It records public workflow/action/CLI
29
+ surfaces, compatibility digests, and audit digests for the files that implement
30
+ those surfaces.
26
31
 
27
32
  ## npm Consumption
28
33
 
@@ -61,6 +66,7 @@ The P0 bundle includes:
61
66
  - workflow/action registry;
62
67
  - release model facts;
63
68
  - artifact and evidence schema index;
69
+ - Buildchain runtime contract world for `@v2` floating-ref compatibility checks;
64
70
  - product mechanism manifest;
65
71
  - release provenance;
66
72
  - agent read order.
@@ -61,7 +61,7 @@ repository changes are patch".
61
61
 
62
62
  | Date | Action | Line | Faces | Class | Rationale | PR |
63
63
  | --- | --- | --- | --- | --- | --- | --- |
64
- | 2026-07-06 | open-minor | `v2.8` | kfd-1-contract-world-release-gate, required-check-protection | additive | KFD-1 contract-world release gates add a public witness API, Buildchain-owned passport evidence, and fail-closed byte verification, while protected channel required checks are repaired to bind GitHub Actions check runs instead of legacy commit status contexts. | |
64
+ | 2026-07-06 | open-minor | `v2.8` | kfd-1-contract-world-release-gate, kfd-2-release-trust-passport-audit, kfd-3-collaboration-interface-trust-proof, publish-source-lock-enforcement, required-check-protection | additive | KFD release gates add KFD-1 self contract verification, KFD-2 public release trust claim audit, KFD-3 collaboration-interface trust proofs, publish-side source-lock enforcement for promote-only wrappers, and protected channel required checks repaired to bind GitHub Actions check runs instead of legacy commit status contexts. | |
65
65
  | 2026-07-04 | open-minor | `v2.5` | scheduled-integration-governance | additive | Scheduled integration governance adds scheduled feature-branch discovery, conflict-free integration, reporting, and agent-visible governance automation for dev-line maintenance. | |
66
66
  | 2026-07-03 | open-minor | `v2.4` | infra-contract-lifecycle | additive | Infra contract lifecycle adds the provider-neutral `infra-contract` CLI command family, project type, adapter capability contract, lifecycle evidence bundle, propagation evidence, CI evidence mode, and consumer-facing contract artifacts. | |
67
67
  | 2026-07-02 | open-minor | `v2.3` | web-surface-host-mapping | additive | Web surface host mapping adds first-class multi-host surface bindings, reusable workflow URL outputs, per-surface deployment overrides, and an agent-readable fixture contract. | |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungfu-tech/buildchain",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "private": false,
5
5
  "description": "Buildchain Release Passport, release governance, CLI toolkit, and site facts.",
6
6
  "repository": "https://github.com/kungfu-systems/buildchain",
@@ -14,6 +14,7 @@
14
14
  ".": "./packages/core/index.js",
15
15
  "./core": "./packages/core/index.js",
16
16
  "./artifact-passport": "./packages/core/artifact-passport.js",
17
+ "./buildchain-contract": "./packages/core/buildchain-contract.js",
17
18
  "./diagnostics": "./packages/core/diagnostics.js",
18
19
  "./issue-reporting": "./packages/core/issue-reporting.js",
19
20
  "./logging": "./packages/core/logging.js",
@@ -27,6 +28,7 @@
27
28
  "./site/workflow-registry.json": "./dist/site/workflow-registry.json",
28
29
  "./site/release-model.json": "./dist/site/release-model.json",
29
30
  "./site/artifact-schemas.json": "./dist/site/artifact-schemas.json",
31
+ "./site/buildchain-contract.json": "./dist/site/buildchain-contract.json",
30
32
  "./site/product-mechanism.json": "./dist/site/product-mechanism.json",
31
33
  "./site/release-provenance.json": "./dist/site/release-provenance.json",
32
34
  "./site/agent-index.json": "./dist/site/agent-index.json",
@@ -92,7 +94,7 @@
92
94
  "vitest": "^4.1.9"
93
95
  },
94
96
  "dependencies": {
95
- "@kungfu-tech/kfd": "1.0.0-alpha.2",
97
+ "@kungfu-tech/kfd": "1.0.0-alpha.3",
96
98
  "smol-toml": "1.7.0"
97
99
  }
98
100
  }