@kungfu-tech/buildchain 4.1.3-alpha.4 → 4.1.3-alpha.6

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 (79) hide show
  1. package/AGENTS.md +41 -75
  2. package/CONTRIBUTING.md +19 -26
  3. package/architecture/agent-change-map.md +8 -12
  4. package/architecture/capability-state-machine-manifest.json +1 -4
  5. package/architecture/ci-lane-change-budget.json +35 -1026
  6. package/architecture/core-mechanisms.json +3 -6
  7. package/architecture/internal-capabilities.json +1 -5
  8. package/architecture/maintainability-debt.json +44 -36
  9. package/architecture/maintainability-policy.json +8 -8
  10. package/architecture/minimal-consumer-migration.json +80 -1977
  11. package/architecture/platform-stage-checkpoints.json +31 -7
  12. package/architecture/release-topology.json +64 -84
  13. package/architecture/stage-capsule-qualification.json +3 -1
  14. package/architecture/universal-workflow-bootstrap.json +3 -1
  15. package/architecture/universal-workflow-capability-policy.json +4 -4
  16. package/architecture/universal-workflow-fault-campaign.json +3 -1
  17. package/architecture/workflow-taxonomy.json +24 -341
  18. package/dist/site/buildchain-contract.json +13 -67
  19. package/dist/site/buildchain-site.json +33 -23
  20. package/dist/site/capability-registry.json +2 -2
  21. package/dist/site/controller-registry.json +1 -47
  22. package/dist/site/kfd-claims.json +78 -448
  23. package/dist/site/kfd-upstream-aggregate.json +1 -1
  24. package/dist/site/manual-registry.json +3 -3
  25. package/dist/site/node-api-registry.json +24 -24
  26. package/dist/site/page-registry.json +26 -16
  27. package/dist/site/public-surface-audit.json +35 -349
  28. package/dist/site/publication-authority-registry.json +51 -511
  29. package/dist/site/publication-registry.json +4 -4
  30. package/dist/site/site-manifest.json +7 -7
  31. package/dist/site/workflow-registry.json +263 -1128
  32. package/docs/code-organization.md +9 -6
  33. package/docs/node-api-reference.md +57 -57
  34. package/docs/release-governance.md +10 -12
  35. package/docs/runtime-entry.md +31 -3
  36. package/docs/runtime-train-validation.md +39 -11
  37. package/docs/stable-candidate-patrol.md +6 -5
  38. package/docs/workflow-catalog.md +3 -32
  39. package/package.json +1 -1
  40. package/packages/core/adoption/buildchain-kfd-claims.js +7 -7
  41. package/packages/core/dev-delivery/dev-delivery-provider-heartbeat.js +18 -15
  42. package/packages/core/dev-delivery/native/actions.js +2 -0
  43. package/packages/core/dev-delivery/native/process-entry.js +19 -0
  44. package/packages/core/dev-delivery/queue/landing-action.js +49 -1
  45. package/packages/core/dev-delivery/warrant/failure-settlement.js +8 -6
  46. package/packages/core/dev-delivery/warrant/service.js +7 -0
  47. package/packages/core/governance/buildchain-publication-authority.js +2 -23
  48. package/packages/core/governance/github-governance-authority.js +1 -0
  49. package/packages/core/observability/controller-evidence.js +0 -8
  50. package/packages/core/providers/github/pipeline-entry-runs.js +8 -1
  51. package/packages/core/providers/github/pipeline-events.js +79 -0
  52. package/packages/core/providers/github/pipeline-source.js +24 -7
  53. package/packages/core/publication/pipeline/pack.js +31 -8
  54. package/packages/core/workflow/pipeline/actions.js +0 -23
  55. package/packages/core/workflow/pipeline/build-evidence.js +123 -5
  56. package/packages/core/workflow/pipeline/build-result.js +1 -0
  57. package/packages/core/workflow/pipeline/channel-control.js +25 -4
  58. package/packages/core/workflow/pipeline/controller.js +9 -1
  59. package/packages/core/workflow/pipeline/delivery-control.js +54 -9
  60. package/packages/core/workflow/pipeline/delivery-observation.js +16 -10
  61. package/packages/core/workflow/pipeline/group-control.js +1 -0
  62. package/packages/core/workflow/pipeline/guard-build.js +37 -0
  63. package/packages/core/workflow/pipeline/guard.js +4 -2
  64. package/packages/core/workflow/pipeline/host.js +23 -1
  65. package/packages/core/workflow/pipeline/integration-status.js +113 -0
  66. package/packages/core/workflow/pipeline/record-action.js +27 -0
  67. package/packages/core/workflow/pipeline/recorder-status.js +69 -0
  68. package/packages/core/workflow/workflow-taxonomy.mjs +67 -47
  69. package/scripts/check-inventory.mjs +7 -70
  70. package/scripts/check-pipeline-publication-topology.mjs +2 -0
  71. package/scripts/check-public-dogfood-contract.mjs +38 -51
  72. package/scripts/check-release-topology.mjs +8 -7
  73. package/scripts/check-self-consumer-contract.mjs +133 -0
  74. package/scripts/check-universal-workflow-bootstrap.mjs +4 -6
  75. package/scripts/generate-minimal-consumer-contract.mjs +1 -1
  76. package/scripts/inventory/binary.mjs +9 -19
  77. package/scripts/inventory/promotion.mjs +2 -13
  78. package/scripts/prepare-product-toolchain.mjs +10 -0
  79. package/scripts/verify-product-platform.mjs +65 -0
@@ -4,6 +4,7 @@ import fs from "node:fs";
4
4
  import YAML from "yaml";
5
5
  import path from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
+ import { checkSelfConsumerContract } from "./check-self-consumer-contract.mjs";
7
8
 
8
9
  const DEFAULT_ROOT = path.resolve(
9
10
  path.dirname(fileURLToPath(import.meta.url)),
@@ -15,35 +16,6 @@ export const PUBLIC_DOGFOOD_ENTRY_REF = "v4";
15
16
  const PRIVATE_CONSUMER = ["buildchain", "self", "dogfood"].join("-");
16
17
  const PRIVATE_SHADOW = ["kungfu", "shadow"].join("-");
17
18
 
18
- export function expectedPublicDogfoodWorkflow(validationRef) {
19
- return `name: V4 Public Consumer Dogfood
20
-
21
- on:
22
- pull_request:
23
- workflow_dispatch:
24
- inputs:
25
- runtime-ref:
26
- description: Transient runtime selected by the public entry.
27
- type: string
28
- default: ""
29
-
30
- permissions:
31
- contents: read
32
-
33
- jobs:
34
- dogfood:
35
- uses: kungfu-systems/buildchain/.github/workflows/public-build-stage-capsule-canary.yml@${validationRef}
36
- with:
37
- runtime-ref: \${{ inputs.runtime-ref }}
38
- consumer: buildchain
39
- node-version: "24"
40
- go-version: "1.25.x"
41
- install-artifact-path: node_modules/.modules.yaml
42
- build-artifact-path: actions/build/lifecycle/run/dist/index.js
43
- verify-artifact-path: dist/site
44
- `;
45
- }
46
-
47
19
  function fail(message) {
48
20
  throw new Error(`v4-public-dogfood-contract: ${message}`);
49
21
  }
@@ -238,17 +210,22 @@ function assertWorkflowInventory(root) {
238
210
  }
239
211
 
240
212
  function assertProtectedVerify(root) {
241
- const verify = read(root, ".github/workflows/self-build-verify.yml");
242
- const parsed = YAML.parse(verify);
243
- const nodePath = "actions/build/verification/repository/action.yml";
213
+ checkSelfConsumerContract(root);
214
+ const verify = read(root, "scripts/verify-product-platform.mjs");
244
215
  if (
245
- ![parsed.jobs.check.needs].flat().includes("stage-capsule-checkpoints") ||
246
- parsed.jobs.check.steps.at(-1).uses !==
247
- `./.buildchain/runtime/${nodePath.replace(/\/action.yml$/, "")}`
216
+ !verify.includes("verifyStageCapsuleCheckpoints({") ||
217
+ !verify.includes('"--network=none"') ||
218
+ !verify.includes(
219
+ "sha256:11f0ba64267ce88174a4f73a9bf833ff4e9c59cd16ec3d08a6432a06c2be6fb1",
220
+ ) ||
221
+ !verify.includes("tests/build-orchestration.test.mjs") ||
222
+ !verify.includes("tests/build-artifact-pipeline.test.mjs") ||
223
+ !verify.includes("tests/dev-delivery-minimal-request.test.mjs")
248
224
  )
249
225
  fail(
250
- "Verify must bind the protected check node after Stage Capsule checkpoints",
226
+ "Product verification must retain checkpoint recovery and the isolated container backbone lane",
251
227
  );
228
+ const nodePath = "actions/build/verification/repository/action.yml";
252
229
  const implementation = read(root, nodePath);
253
230
  const steps = YAML.parse(implementation).runs.steps;
254
231
  const qualify = steps.find((step) => step.id === "source-verification");
@@ -283,12 +260,13 @@ function assertArchitecture(root) {
283
260
  const validationRef = dogfood?.validationRef;
284
261
  if (validationRef !== PUBLIC_DOGFOOD_ENTRY_REF)
285
262
  fail("architecture validationRef must use the public v4 entry");
286
- const caller = read(root, CALLER_PATH);
287
263
  if (
288
- JSON.stringify(YAML.parse(caller)) !==
289
- JSON.stringify(YAML.parse(expectedPublicDogfoodWorkflow(validationRef)))
264
+ dogfood?.active !== false ||
265
+ dogfood.supersededBy !== ".github/workflows/buildchain.yml"
290
266
  )
291
- fail(`${CALLER_PATH} must remain the exact thin public consumer caller`);
267
+ fail(
268
+ "Historical Canary caller must be explicitly superseded by the minimal pipeline",
269
+ );
292
270
  if (JSON.stringify(architecture.campaign?.consumers) !== '["buildchain"]')
293
271
  fail(
294
272
  "architecture must qualify only the public Buildchain consumer identity",
@@ -335,17 +313,25 @@ function assertArchitecture(root) {
335
313
  }
336
314
 
337
315
  function assertConsumerLifecycle(root) {
338
- const lifecycle = read(root, ".buildchain/buildchain.toml");
339
- for (const declaration of [
340
- '[lifecycle.install]\ncommand = "corepack enable pnpm && corepack pnpm@11.7.0 install --frozen-lockfile"',
341
- '[lifecycle.build]\ncommand = "corepack pnpm@11.7.0 run build && corepack pnpm@11.7.0 run generate:site"',
342
- "[lifecycle.verify]\ncommands = [",
343
- '"corepack pnpm@11.7.0 run check",',
344
- ])
345
- if (!lifecycle.includes(declaration))
316
+ const { plan } = checkSelfConsumerContract(root);
317
+ for (const platform of ["linux-x64", "macos-arm64", "windows-x64"]) {
318
+ const product = plan.products.find(
319
+ (product) =>
320
+ product.platforms.includes(platform) &&
321
+ product.verify.includes("corepack pnpm@11.7.0 run check"),
322
+ );
323
+ if (
324
+ !product?.install.includes("corepack enable pnpm") ||
325
+ !product.install.includes(
326
+ "corepack pnpm@11.7.0 install --frozen-lockfile",
327
+ ) ||
328
+ !product.build.includes("corepack pnpm@11.7.0 run build") ||
329
+ !product.build.includes("corepack pnpm@11.7.0 run generate:site")
330
+ )
346
331
  fail(
347
- `tracked consumer lifecycle is missing ${declaration.split("\n")[0]}`,
332
+ `${platform}: tracked consumer lifecycle is missing its pinned install or full generated build`,
348
333
  );
334
+ }
349
335
  const attributes = read(root, ".gitattributes");
350
336
  if (!attributes.split("\n").includes("* text=auto eol=lf"))
351
337
  fail("consumer checkout is missing the cross-platform LF contract");
@@ -394,8 +380,9 @@ export function checkPublicDogfoodContract(root = DEFAULT_ROOT) {
394
380
  return {
395
381
  schema: "buildchain-v4-public-dogfood-contract-check/v1",
396
382
  ok: true,
397
- caller: CALLER_PATH,
398
- reusable: REUSABLE_PATH,
383
+ caller: ".github/workflows/buildchain.yml",
384
+ reusable: ".github/workflows/public-ops-pipeline.yml",
385
+ historicalCanary: REUSABLE_PATH,
399
386
  validationRef,
400
387
  productionAuthority: "v4-native",
401
388
  };
@@ -186,7 +186,10 @@ export function discoverReleaseAuthorityClosure() {
186
186
  ]),
187
187
  ].sort(),
188
188
  runtimeSelectors,
189
- runtimeEngines: ["packages/core/release/promote-candidate/action.js"],
189
+ runtimeEngines: [
190
+ "packages/core/release/promote-candidate/action.js",
191
+ "packages/core/publication/pipeline/apply.js",
192
+ ],
190
193
  terminalProjections,
191
194
  privilegedExecutableClosure: {
192
195
  entrypoints: PRIVILEGED_ENTRYPOINTS,
@@ -382,7 +385,7 @@ export function findUnknownReleaseTopology(
382
385
  .filter((relative) => {
383
386
  const source = readWorkflow(relative);
384
387
  const usesReleaseAuthority = parseYamlUses(source).some(({ value }) =>
385
- /(?:release-candidate-promote|promote-buildchain-ref|release-tail|actions\/release\/promotion\/(?:candidate|ref)|\.github\/workflows\/(?:public-release-promote|\.release-promote))/u.test(
388
+ /(?:release-candidate-promote|promote-buildchain-ref|release-tail|actions\/release\/promotion\/(?:candidate|ref)|\.github\/workflows\/(?:public-release-promote|\.release-promote|public-ops-pipeline|public-ops-recover|\.release-pipeline-products))/u.test(
386
389
  value,
387
390
  ),
388
391
  );
@@ -461,14 +464,12 @@ function assertAuthorityClosure(ledger) {
461
464
  );
462
465
  assert.deepEqual(closure.runtimeEngines, [
463
466
  "packages/core/release/promote-candidate/action.js",
467
+ "packages/core/publication/pipeline/apply.js",
464
468
  ]);
465
- assert.equal(
466
- closure.freshEntry,
467
- ".github/workflows/public-release-promote.yml",
468
- );
469
+ assert.equal(closure.freshEntry, ".github/workflows/public-ops-pipeline.yml");
469
470
  assert.equal(
470
471
  closure.recoveryEntry,
471
- ".github/workflows/self-ops-promotion-recovery.yml",
472
+ ".github/workflows/public-ops-recover.yml",
472
473
  );
473
474
  const engineSurface = [
474
475
  ".github/workflows/.release-promote.yml",
@@ -0,0 +1,133 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { parse as yaml } from "yaml";
5
+ import { compileConsumerPlan } from "../packages/core/consumer/contract/plan.js";
6
+ import { consumerWorkflows } from "../packages/core/consumer/contract/entries.js";
7
+ import { workflowPath } from "../packages/core/workflow/workflow-taxonomy.mjs";
8
+
9
+ export const SELF_ENTRY_CHANNEL = "v4-alpha";
10
+ export const SELF_CONFIG_PATH = ".buildchain/minimal-consumer.toml";
11
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
12
+ const PLATFORMS = ["linux-x64", "macos-arm64", "windows-x64"];
13
+
14
+ // Repository policy checks the consumer-facing wiring. Product implementation
15
+ // libraries are separately registered and may not own repository event triggers.
16
+ // This policy supplies no repository identity exception to runtime admission.
17
+ export function checkSelfConsumerContract(root = ROOT) {
18
+ const read = (file) => fs.readFileSync(path.join(root, file), "utf8");
19
+ const fail = (message) => {
20
+ throw new Error(`self-consumer-contract: ${message}`);
21
+ };
22
+ const plan = compileConsumerPlan(read(SELF_CONFIG_PATH));
23
+ if (read(SELF_CONFIG_PATH) !== read(".buildchain/buildchain.toml"))
24
+ fail("transition config must match the canonical product plan");
25
+ const callers = consumerWorkflows(SELF_ENTRY_CHANNEL, SELF_CONFIG_PATH);
26
+ for (const [file, bytes] of Object.entries(callers))
27
+ if (read(file) !== bytes) fail(`${file}: generated caller drift`);
28
+ const taxonomy = JSON.parse(read("architecture/workflow-taxonomy.json"));
29
+ const registered = new Set(taxonomy.entries.map(workflowPath));
30
+ const observed = fs
31
+ .readdirSync(path.join(root, ".github/workflows"))
32
+ .filter((file) => /\.ya?ml$/u.test(file))
33
+ .map((file) => `.github/workflows/${file}`);
34
+ if (
35
+ observed.length !== registered.size ||
36
+ observed.some((file) => !registered.has(file))
37
+ )
38
+ fail("workflow inventory is not closed");
39
+ const self = taxonomy.entries
40
+ .filter((entry) => entry.role === "self")
41
+ .map(workflowPath)
42
+ .sort();
43
+ if (JSON.stringify(self) !== JSON.stringify(Object.keys(callers).sort()))
44
+ fail("self automation must contain exactly the generated caller pair");
45
+ for (const entry of taxonomy.entries.filter(
46
+ (entry) => entry.role !== "self",
47
+ )) {
48
+ const file = workflowPath(entry);
49
+ const document = yaml(read(file));
50
+ if (
51
+ Object.keys(document.on || {}).some(
52
+ (event) => !["workflow_call", "workflow_dispatch"].includes(event),
53
+ )
54
+ )
55
+ fail(`${file}: product library owns a repository event`);
56
+ }
57
+ for (const prefix of ["feature", "fix", "chore", "docs", "ci", "refactor"])
58
+ if (
59
+ !plan.channels.some(
60
+ (route) =>
61
+ route.from === `${prefix}/*` &&
62
+ route.to === "dev/v4/v4.1" &&
63
+ route.operation === "develop",
64
+ )
65
+ )
66
+ fail(`missing protected development route for ${prefix}`);
67
+ for (const platform of PLATFORMS) {
68
+ const verified = plan.products.some(
69
+ (product) =>
70
+ product.platforms.includes(platform) &&
71
+ product.verify.includes("corepack pnpm@11.7.0 run check") &&
72
+ product.verify.includes("node scripts/verify-product-platform.mjs"),
73
+ );
74
+ if (!verified)
75
+ fail(
76
+ `${platform}: full check and platform recovery verification are required`,
77
+ );
78
+ }
79
+ if (
80
+ !plan.products.some(
81
+ (product) =>
82
+ product.type === "npm" &&
83
+ product.targets.some((target) => target.provider === "npm"),
84
+ )
85
+ )
86
+ fail("npm publication is missing");
87
+ for (const platform of PLATFORMS)
88
+ if (
89
+ !plan.products.some(
90
+ (product) =>
91
+ product.type === "binary" &&
92
+ product.platforms.includes(platform) &&
93
+ product.targets.some(
94
+ (target) => target.provider === "github-release",
95
+ ),
96
+ )
97
+ )
98
+ fail(`${platform}: binary release asset is missing`);
99
+ const commands = plan.products.flatMap((product) => [
100
+ ...(product.install || []),
101
+ ...product.build,
102
+ ...product.verify,
103
+ ]);
104
+ if (
105
+ commands.some((command) =>
106
+ /\b(?:npm publish|gh release|buildchain (?:dev warrant|release|promote|recover|publish))\b|request-json|fencingToken/u.test(
107
+ command,
108
+ ),
109
+ )
110
+ )
111
+ fail("product lifecycle contains consumer-owned publication orchestration");
112
+ if (!read(".gitattributes").split("\n").includes("* text=auto eol=lf"))
113
+ fail("cross-platform LF checkout contract is missing");
114
+ return {
115
+ ok: true,
116
+ channel: SELF_ENTRY_CHANNEL,
117
+ callers: Object.keys(callers),
118
+ plan,
119
+ };
120
+ }
121
+
122
+ if (
123
+ process.argv[1] &&
124
+ path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)
125
+ ) {
126
+ const { plan, ...result } = checkSelfConsumerContract();
127
+ console.log(
128
+ JSON.stringify({
129
+ ...result,
130
+ products: plan.products.map((product) => product.id),
131
+ }),
132
+ );
133
+ }
@@ -43,10 +43,8 @@ assert.doesNotMatch(read(contract.bootstrap.publicWorkflow), /admission-policy-j
43
43
  const template = parse(contract.bootstrap.consumerTemplate);
44
44
  assert.equal(template.jobs.bootstrap.uses, "kungfu-systems/buildchain/.github/workflows/public-ops-bootstrap.yml@v4");
45
45
  assert.equal(template.jobs.bootstrap.with["runtime-ref"], "${{ inputs.runtime-ref }}");
46
- const dogfood = parse(contract.bootstrap.selfDogfoodWorkflow);
47
- for (const channel of ["conformance", "alpha", "stable"]) for (const mode of ["primary", "recovery"]) {
48
- const job = dogfood.jobs[`${mode}-${channel}`];
49
- assert.equal(job.uses, "kungfu-systems/buildchain/.github/workflows/public-ops-bootstrap.yml@v4");
50
- assert.equal(job.with["runtime-ref"], mode === "primary" ? "${{ inputs.runtime-ref }}" : "${{ inputs.recovery-runtime-ref }}");
51
- }
46
+ assert.equal(contract.bootstrap.selfDogfoodActive, false);
47
+ assert.equal(fs.existsSync(path.join(root, contract.bootstrap.selfDogfoodWorkflow)), false,
48
+ "The retired bootstrap self controller must not coexist with the minimal pipeline");
49
+ assert.equal(contract.bootstrap.selfDogfoodSupersededBy, ".github/workflows/buildchain.yml");
52
50
  console.log(JSON.stringify({ ok: true, reusableWorkflowCount: reusable.length, runtimeAcquisitionOwners: 1 }));
@@ -143,7 +143,7 @@ output(
143
143
  await format(
144
144
  JSON.stringify({
145
145
  schema: "buildchain.consumer-migration/v1",
146
- stage: "contract-defined; execution-entry-not-yet-published",
146
+ stage: "self-cutover-in-progress; final-release-qualification-pending",
147
147
  workflows: workflowInventory(),
148
148
  consumerSources: consumerSourceInventory(),
149
149
  }),
@@ -1,26 +1,16 @@
1
1
  import assert from "node:assert/strict";
2
+ import { checkSelfConsumerContract } from "../check-self-consumer-contract.mjs";
2
3
  import { inspectWorkflowJob, readWorkflow } from "../workflow-action-graph.mjs";
3
4
 
4
5
  export function assertBinaryInventory(root) {
5
- const file = ".github/workflows/self-build-binary-distribution.yml";
6
- const workflow = readWorkflow(file, root);
7
- assert.equal(workflow.name, "Binary Distribution");
8
- assert.deepEqual(Object.keys(workflow.jobs).filter(id => id !== "execution-runtime"), ["preflight", "binary", "passport", "dispatch-publication"]);
9
- const graphs = Object.keys(workflow.jobs).filter(id => id !== "execution-runtime").map(id => inspectWorkflowJob(file, id, root));
10
- for (const graph of graphs) {
11
- assert.equal(graph.job.permissions.contents, "read");
12
- assert.notEqual(graph.job.permissions["id-token"], "write");
13
- assert.ok(!JSON.stringify(graph.job["runs-on"]).includes("self-hosted"));
14
- for (const step of graph.steps) assert.ok(!/gh release (?:upload|create)/u.test(step.run || ""));
15
- assert.ok(graph.actions.has(`actions/build/binary/${["preflight", "build", "passport", "dispatch-publication"][graphs.indexOf(graph)]}`));
16
- }
17
- const binary = graphs[1];
18
- assert.deepEqual(binary.job.strategy.matrix.include.map(entry => entry.os).sort(), ["macos-latest", "ubuntu-24.04", "windows-2022"]);
19
- const passport = graphs[2];
20
- const executable = passport.modules.get("packages/core/build/binary/distribution.js");
21
- for (const command of ["verifyBuildchainLogEvents", "verifyReleasePassport", "verifyArtifactPassport", "createReleaseEvidenceBundle", "buildchain-log-events", "buildchain-log-summary"])
22
- assert.ok(executable.includes(command), `Binary evidence is missing ${command}`);
23
- assert.ok(passport.actions.has("actions/build/binary/qualify"));
6
+ const { plan } = checkSelfConsumerContract(root);
7
+ assert.deepEqual(plan.products.filter(product => product.type === "binary")
8
+ .flatMap(product => product.platforms).sort(), ["linux-x64", "macos-arm64", "windows-x64"]);
9
+ const build = inspectWorkflowJob(".github/workflows/.release-pipeline-products.yml", "build", root);
10
+ assert.equal(build.job.permissions.contents, "read");
11
+ assert.notEqual(build.job.permissions["id-token"], "write");
12
+ assert.ok(!JSON.stringify(build.job["runs-on"]).includes("self-hosted"));
13
+ for (const step of build.steps) assert.ok(!/gh release (?:upload|create)/u.test(step.run || ""));
24
14
  const publish = inspectWorkflowJob(".github/workflows/.release-binary-assets.yml", "publish", root);
25
15
  assert.equal(publish.workflow.jobs["publication-authority"].uses, "./.github/workflows/.release-authority.yml");
26
16
  assert.ok(publish.job.needs.includes("publication-authority"));
@@ -1,4 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
+ import { checkSelfConsumerContract } from "../check-self-consumer-contract.mjs";
2
3
  import fs from "node:fs";
3
4
  import path from "node:path";
4
5
  import YAML from "yaml";
@@ -35,19 +36,7 @@ export function assertPromotionInventory(root) {
35
36
  "publish-command",
36
37
  ])
37
38
  assert.ok(!request.properties[key]);
38
- for (const file of [
39
- "self-release-promote",
40
- "self-release-tail-dogfood",
41
- "self-ops-promotion-recovery",
42
- ]) {
43
- const caller = YAML.parse(read(`.github/workflows/${file}.yml`));
44
- const calls = Object.values(caller.jobs).filter(
45
- (job) => job.uses === `kungfu-systems/buildchain/${publicPath}@v4`,
46
- );
47
- assert.equal(calls.length, 1, file);
48
- assert.ok(calls[0].with["request-json"]);
49
- assert.ok(Object.keys(calls[0].with).every(key => ["request-json", "runtime-ref", "contract-lock", "runtime-selection"].includes(key)));
50
- }
39
+ checkSelfConsumerContract(root);
51
40
  const component = ".github/workflows/.release-promote.yml";
52
41
  const expected = {
53
42
  qualify: "promotion/qualify",
@@ -0,0 +1,10 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+
5
+ // Product prerequisites cross command phases through the runner file protocol.
6
+ // An explicit cache works with the credential-isolated Windows environment too.
7
+ fs.appendFileSync(
8
+ process.env.GITHUB_ENV,
9
+ `GOTOOLCHAIN=go1.25.14+auto\nGOCACHE=${path.join(os.tmpdir(), "buildchain-go-cache")}\nGOPATH=${path.join(os.tmpdir(), "buildchain-go")}\n`,
10
+ );
@@ -0,0 +1,65 @@
1
+ import path from "node:path";
2
+ import { execFileSync } from "node:child_process";
3
+ import { verifyStageCapsuleCheckpoints } from "../packages/core/build/stage-capsule/rehearsal/verify.js";
4
+
5
+ const platform = {
6
+ linux: "linux-x64",
7
+ darwin: "macos-arm64",
8
+ win32: "windows-x64",
9
+ }[process.platform];
10
+ if (!platform)
11
+ throw new Error(
12
+ `Unsupported product verification platform: ${process.platform}`,
13
+ );
14
+ const goVersion = execFileSync("go", ["version"], { encoding: "utf8" }).trim();
15
+ const goMatch = /^go version go1\.(\d+)\./u.exec(goVersion);
16
+ if (!goMatch || Number(goMatch[1]) < 25)
17
+ throw new Error(
18
+ `Product verification requires Go 1.25 or newer in major 1: ${goVersion}`,
19
+ );
20
+ const workspace = process.cwd();
21
+ const result = verifyStageCapsuleCheckpoints({
22
+ runtimeRoot: workspace,
23
+ workspace,
24
+ platform,
25
+ environment: process.env,
26
+ });
27
+ if (platform === "linux-x64") {
28
+ // Same immutable image and backbone tests as the retired container CI lane.
29
+ // Supply the selected Node as the hosted container runner did; no credentials.
30
+ const image =
31
+ "ghcr.io/kungfu-systems/build-images/kungfu-verify@sha256:11f0ba64267ce88174a4f73a9bf833ff4e9c59cd16ec3d08a6432a06c2be6fb1";
32
+ execFileSync(
33
+ "docker",
34
+ [
35
+ "run",
36
+ "--rm",
37
+ "--network=none",
38
+ "--cap-drop=ALL",
39
+ "--security-opt=no-new-privileges",
40
+ "--mount",
41
+ `type=bind,source=${path.resolve(workspace)},target=/source,readonly`,
42
+ "--mount",
43
+ `type=bind,source=${process.execPath},target=/toolchain/node,readonly`,
44
+ "--env",
45
+ "PATH=/toolchain:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
46
+ "--workdir",
47
+ "/source",
48
+ image,
49
+ "node",
50
+ "--test",
51
+ "tests/build-orchestration.test.mjs",
52
+ "tests/build-artifact-pipeline.test.mjs",
53
+ "tests/dev-delivery-minimal-request.test.mjs",
54
+ ],
55
+ { stdio: "inherit" },
56
+ );
57
+ }
58
+ console.log(
59
+ JSON.stringify({
60
+ platform,
61
+ checkpoint: result.checkpoint,
62
+ resume: result.resume,
63
+ tail: result.tail,
64
+ }),
65
+ );