@kungfu-tech/buildchain 4.1.3-alpha.5 → 4.1.3-alpha.7

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 (89) hide show
  1. package/AGENTS.md +41 -75
  2. package/CONTRIBUTING.md +19 -26
  3. package/architecture/agent-change-map.md +7 -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/decisions/0008-pipeline-product-publication.md +29 -8
  8. package/architecture/internal-capabilities.json +1 -5
  9. package/architecture/maintainability-debt.json +43 -36
  10. package/architecture/maintainability-policy.json +8 -8
  11. package/architecture/minimal-consumer-migration.json +80 -1977
  12. package/architecture/platform-stage-checkpoints.json +31 -7
  13. package/architecture/release-topology.json +64 -84
  14. package/architecture/stage-capsule-qualification.json +3 -1
  15. package/architecture/universal-workflow-bootstrap.json +3 -1
  16. package/architecture/universal-workflow-capability-policy.json +4 -4
  17. package/architecture/universal-workflow-fault-campaign.json +3 -1
  18. package/architecture/workflow-taxonomy.json +24 -341
  19. package/dist/site/buildchain-contract.json +13 -67
  20. package/dist/site/buildchain-site.json +28 -23
  21. package/dist/site/capability-registry.json +2 -2
  22. package/dist/site/controller-registry.json +1 -47
  23. package/dist/site/kfd-claims.json +78 -448
  24. package/dist/site/kfd-upstream-aggregate.json +1 -1
  25. package/dist/site/manual-registry.json +3 -3
  26. package/dist/site/node-api-registry.json +24 -24
  27. package/dist/site/page-registry.json +21 -16
  28. package/dist/site/public-surface-audit.json +31 -347
  29. package/dist/site/publication-authority-registry.json +51 -511
  30. package/dist/site/publication-registry.json +4 -4
  31. package/dist/site/site-manifest.json +7 -7
  32. package/dist/site/workflow-registry.json +259 -1126
  33. package/docs/code-organization.md +9 -6
  34. package/docs/node-api-reference.md +57 -57
  35. package/docs/release-governance.md +10 -12
  36. package/docs/runtime-entry.md +10 -3
  37. package/docs/runtime-train-validation.md +39 -11
  38. package/docs/stable-candidate-patrol.md +6 -5
  39. package/docs/workflow-catalog.md +3 -32
  40. package/package.json +1 -1
  41. package/packages/core/adoption/buildchain-kfd-claims.js +7 -7
  42. package/packages/core/dev-delivery/dev-delivery-provider-heartbeat.js +18 -15
  43. package/packages/core/dev-delivery/native/actions.js +2 -0
  44. package/packages/core/dev-delivery/native/process-entry.js +19 -0
  45. package/packages/core/dev-delivery/queue/landing-action.js +49 -1
  46. package/packages/core/dev-delivery/warrant/failure-settlement.js +8 -6
  47. package/packages/core/dev-delivery/warrant/service.js +7 -0
  48. package/packages/core/governance/buildchain-publication-authority.js +2 -23
  49. package/packages/core/governance/github-governance-authority.js +1 -0
  50. package/packages/core/observability/controller-evidence.js +0 -8
  51. package/packages/core/providers/github/pipeline-entry-runs.js +8 -1
  52. package/packages/core/providers/github/pipeline-events.js +79 -0
  53. package/packages/core/providers/github/pipeline-product-release.js +10 -3
  54. package/packages/core/publication/npm/pipeline-channel.js +0 -51
  55. package/packages/core/publication/npm/pipeline-provider.js +29 -1
  56. package/packages/core/publication/pipeline/apply.js +2 -1
  57. package/packages/core/publication/pipeline/capsules.js +4 -1
  58. package/packages/core/publication/pipeline/distribution.js +29 -23
  59. package/packages/core/publication/pipeline/effects.js +34 -4
  60. package/packages/core/publication/pipeline/pack.js +31 -8
  61. package/packages/core/publication/pipeline/settle.js +0 -1
  62. package/packages/core/workflow/attempt/journal.js +11 -9
  63. package/packages/core/workflow/pipeline/actions.js +0 -23
  64. package/packages/core/workflow/pipeline/build-evidence.js +123 -5
  65. package/packages/core/workflow/pipeline/build-result.js +1 -0
  66. package/packages/core/workflow/pipeline/channel-control.js +25 -4
  67. package/packages/core/workflow/pipeline/controller.js +9 -1
  68. package/packages/core/workflow/pipeline/delivery-control.js +54 -9
  69. package/packages/core/workflow/pipeline/delivery-observation.js +16 -10
  70. package/packages/core/workflow/pipeline/group-control.js +1 -0
  71. package/packages/core/workflow/pipeline/guard-build.js +37 -0
  72. package/packages/core/workflow/pipeline/guard.js +4 -2
  73. package/packages/core/workflow/pipeline/host.js +23 -1
  74. package/packages/core/workflow/pipeline/integration-status.js +113 -0
  75. package/packages/core/workflow/pipeline/record-action.js +27 -0
  76. package/packages/core/workflow/pipeline/recorder-status.js +69 -0
  77. package/packages/core/workflow/pipeline/recovery-integration.js +14 -1
  78. package/packages/core/workflow/workflow-taxonomy.mjs +67 -47
  79. package/scripts/check-inventory.mjs +7 -70
  80. package/scripts/check-pipeline-publication-topology.mjs +2 -0
  81. package/scripts/check-public-dogfood-contract.mjs +38 -51
  82. package/scripts/check-release-topology.mjs +8 -7
  83. package/scripts/check-self-consumer-contract.mjs +133 -0
  84. package/scripts/check-universal-workflow-bootstrap.mjs +4 -6
  85. package/scripts/generate-minimal-consumer-contract.mjs +1 -1
  86. package/scripts/inventory/binary.mjs +9 -19
  87. package/scripts/inventory/promotion.mjs +2 -13
  88. package/scripts/prepare-product-toolchain.mjs +10 -0
  89. package/scripts/verify-product-platform.mjs +65 -0
@@ -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
+ );