@kungfu-tech/buildchain 4.1.0-alpha.0 → 4.1.0-alpha.2

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 (295) hide show
  1. package/AGENTS.md +30 -41
  2. package/CONTRIBUTING.md +6 -7
  3. package/architecture/action-taxonomy.json +5 -21
  4. package/architecture/agent-change-map.md +74 -56
  5. package/architecture/build-orchestration.json +8 -1
  6. package/architecture/ci-lane-change-budget.json +179 -69
  7. package/architecture/floating-consumer-policy.json +7 -17
  8. package/architecture/internal-capabilities.json +58 -72
  9. package/architecture/maintainability-debt.json +138 -52
  10. package/architecture/maintainability-policy.json +6 -15
  11. package/architecture/promotion-job-topology.json +39 -20
  12. package/architecture/release-topology.json +26 -37
  13. package/architecture/runtime-entry.json +26 -0
  14. package/architecture/runtime-resume-lineage.json +23 -0
  15. package/architecture/stage-capsule-qualification.json +2 -2
  16. package/architecture/universal-workflow-bootstrap.json +10 -25
  17. package/architecture/universal-workflow-capability-policy.json +61 -0
  18. package/architecture/universal-workflow-fault-campaign.json +18 -24
  19. package/architecture/workflow-taxonomy.json +0 -11
  20. package/contracts/fixtures/{v4-runtime-ref-resume-authority-v1 → runtime-resume-lineage-v2}/scenario.json +2 -3
  21. package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +2 -2
  22. package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
  23. package/contracts/promotion-invocation-v1.schema.json +0 -44
  24. package/contracts/promotion-request-v1.schema.json +0 -39
  25. package/contracts/runtime-resume-lineage-v2.schema.json +182 -0
  26. package/dist/site/buildchain-contract.json +472 -361
  27. package/dist/site/buildchain-site.json +99 -99
  28. package/dist/site/capability-registry.json +3 -3
  29. package/dist/site/cli-registry.json +4 -4
  30. package/dist/site/controller-registry.json +94 -78
  31. package/dist/site/kfd-claims.json +224 -343
  32. package/dist/site/kfd-upstream-aggregate.json +1 -1
  33. package/dist/site/manual-registry.json +15 -15
  34. package/dist/site/node-api-registry.json +239 -354
  35. package/dist/site/page-registry.json +80 -80
  36. package/dist/site/public-surface-audit.json +203 -254
  37. package/dist/site/publication-authority-registry.json +1 -24
  38. package/dist/site/publication-registry.json +4 -4
  39. package/dist/site/release-provenance.json +1 -1
  40. package/dist/site/site-manifest.json +19 -19
  41. package/dist/site/workflow-registry.json +197 -357
  42. package/docs/MAP.md +3 -3
  43. package/docs/auditable-demo.md +4 -4
  44. package/docs/cli-reference.md +2 -2
  45. package/docs/code-organization.md +5 -4
  46. package/docs/controller-evidence.md +2 -2
  47. package/docs/dev-alpha-candidate-patrol.md +5 -5
  48. package/docs/dev-delivery-warrant.md +14 -24
  49. package/docs/engineering-housekeeper.md +3 -3
  50. package/docs/github-artifact-attestation.md +9 -12
  51. package/docs/github-governance-authority.md +4 -4
  52. package/docs/node-api-reference.md +153 -167
  53. package/docs/publication-artifacts.md +3 -4
  54. package/docs/publication-authority.md +2 -2
  55. package/docs/release-candidate.md +21 -27
  56. package/docs/release-governance.md +10 -10
  57. package/docs/release-promotion-request.md +11 -18
  58. package/docs/release-propagation.md +5 -6
  59. package/docs/release-tail-provider-plane.md +2 -3
  60. package/docs/reusable-build-surface.md +13 -7
  61. package/docs/runtime-entry.md +122 -0
  62. package/docs/runtime-train-validation.md +30 -41
  63. package/docs/v4-publication-rehearsal.md +5 -5
  64. package/docs/v4-stage-capsule.md +9 -10
  65. package/docs/web-surface-deployments.md +16 -20
  66. package/docs/workflow-catalog.md +0 -1
  67. package/package.json +6 -6
  68. package/packages/core/adoption/commands/init-repo.mjs +2 -2
  69. package/packages/core/adoption/cross-platform-adopter-qualification.js +2 -13
  70. package/packages/core/adoption/qualification/actions.js +3 -5
  71. package/packages/core/adoption/qualification/admission.js +2 -3
  72. package/packages/core/build/artifact/attestation.js +0 -1
  73. package/packages/core/build/artifact/contracts.js +1 -4
  74. package/packages/core/build/artifact/store.js +6 -5
  75. package/packages/core/build/artifact-signing.js +4 -10
  76. package/packages/core/build/binary/actions.js +15 -9
  77. package/packages/core/build/binary-publication-dispatch.js +2 -6
  78. package/packages/core/build/demo/action-context.js +2 -11
  79. package/packages/core/build/demo/binary-action.js +8 -10
  80. package/packages/core/build/gate/controller.js +0 -2
  81. package/packages/core/build/github-attestation/action.js +2 -7
  82. package/packages/core/build/github-attestation/admission.js +0 -8
  83. package/packages/core/build/github-attestation/transaction.js +1 -2
  84. package/packages/core/build/lifecycle/stage-action.js +2 -0
  85. package/packages/core/build/lifecycle/stage.js +6 -3
  86. package/packages/core/build/macos-credential-island/dmg-assembly.js +0 -2
  87. package/packages/core/build/macos-credential-island/lib.js +2 -6
  88. package/packages/core/build/plan/action-context.js +0 -7
  89. package/packages/core/build/plan/action.js +7 -11
  90. package/packages/core/build/plan/admission.js +6 -73
  91. package/packages/core/build/plan/configuration.js +1 -1
  92. package/packages/core/build/plan/environment.js +1 -1
  93. package/packages/core/build/plan/identity.js +1 -5
  94. package/packages/core/build/plan/resolve.js +7 -1
  95. package/packages/core/build/recovery/checkpoint.js +158 -0
  96. package/packages/core/build/recovery/transaction.js +51 -0
  97. package/packages/core/build/signing/authority-actions.js +2 -11
  98. package/packages/core/build/signing/control.js +0 -5
  99. package/packages/core/build/signing/controller-transaction.js +0 -1
  100. package/packages/core/build/signing/delegation.js +2 -4
  101. package/packages/core/build/signing/dispatch.js +10 -56
  102. package/packages/core/build/signing/intake.js +0 -4
  103. package/packages/core/build/signing/prepare.js +1 -1
  104. package/packages/core/build/signing/request.js +3 -8
  105. package/packages/core/build/source/checkout-action.js +6 -10
  106. package/packages/core/build/source/controller.js +1 -4
  107. package/packages/core/build/source/lifecycle.js +3 -13
  108. package/packages/core/build/stage-capsule/actions.js +3 -13
  109. package/packages/core/build/stage-capsule/campaign/resume.js +10 -5
  110. package/packages/core/build/stage-capsule/rehearsal/verify.js +3 -4
  111. package/packages/core/build/stage-capsule-resume-planner.js +0 -1
  112. package/packages/core/build/summary/aggregation.js +5 -5
  113. package/packages/core/build/summary/finalization.js +1 -1
  114. package/packages/core/build/verification/actions.js +3 -12
  115. package/packages/core/build/verification/runner.js +22 -20
  116. package/packages/core/consumer/floating-consumer-evidence.js +3 -21
  117. package/packages/core/consumer/floating-consumer-policy.js +2 -93
  118. package/packages/core/consumer/floating-consumer-release-passport.js +1 -34
  119. package/packages/core/consumer/policy-admission.js +1 -3
  120. package/packages/core/contracts/buildchain-contract.js +12 -146
  121. package/packages/core/contracts/workflow-yaml-contract.js +11 -1
  122. package/packages/core/dev-delivery/candidate/admission.js +3 -4
  123. package/packages/core/dev-delivery/candidate/coordinates.js +0 -8
  124. package/packages/core/dev-delivery/commands/dev-delivery-request.sh +5 -13
  125. package/packages/core/dev-delivery/commands/dev-delivery-source-proof-reuse.mjs +0 -3
  126. package/packages/core/dev-delivery/dev-delivery-contract-surface.js +4 -52
  127. package/packages/core/dev-delivery/dev-delivery-execution-transfer.js +2 -15
  128. package/packages/core/dev-delivery/native/action-context.js +4 -32
  129. package/packages/core/dev-delivery/native/provider-boundary.js +0 -2
  130. package/packages/core/dev-delivery/native/transactions.js +1 -2
  131. package/packages/core/dev-delivery/queue/reconciliation-action.js +6 -10
  132. package/packages/core/dev-delivery/source-proof/predicates.js +0 -6
  133. package/packages/core/dev-delivery/source-proof/reuse.js +0 -2
  134. package/packages/core/dev-delivery/source-proof/seal.js +0 -2
  135. package/packages/core/governance/alpha-candidate/action.js +1 -10
  136. package/packages/core/governance/audit/actions.js +1 -3
  137. package/packages/core/governance/audit/collection.js +1 -3
  138. package/packages/core/governance/audit/identity.js +3 -31
  139. package/packages/core/governance/audit/transactions.js +2 -4
  140. package/packages/core/governance/buildchain-publication-authority.js +0 -1
  141. package/packages/core/governance/commands/audit-github-governance.mjs +3 -2
  142. package/packages/core/governance/github-governance-authority.js +0 -5
  143. package/packages/core/governance/receipt-admission.js +0 -15
  144. package/packages/core/index.js +1 -1
  145. package/packages/core/observability/controller/identity.js +4 -5
  146. package/packages/core/observability/controller-evidence.js +5 -10
  147. package/packages/core/paper/commands/paper.mjs +6 -6
  148. package/packages/core/paper/operations/plans.js +2 -2
  149. package/packages/core/paper/operations/provisioning-validation.js +1 -1
  150. package/packages/core/paper/operations/scaffold-workflows.js +29 -12
  151. package/packages/core/paper/operations/scaffold.js +97 -69
  152. package/packages/core/paper/paper-agent-entry.js +0 -11
  153. package/packages/core/paper/paper-runtime-channels.js +21 -66
  154. package/packages/core/paper/paper-scaffold-content.js +1 -1
  155. package/packages/core/paper/paper.js +9 -5
  156. package/packages/core/paper/publication/candidate.js +0 -9
  157. package/packages/core/paper/publication-controller.js +2 -4
  158. package/packages/core/providers/github/artifact-attestation.js +1 -1
  159. package/packages/core/publication/authority/actions.js +9 -8
  160. package/packages/core/publication/authority/admission.js +0 -11
  161. package/packages/core/publication/authority/assembly.js +2 -7
  162. package/packages/core/publication/authority/control-plane.js +2 -2
  163. package/packages/core/publication/authority/governance.js +2 -9
  164. package/packages/core/publication/authority/request.js +7 -2
  165. package/packages/core/publication/authority/verification.js +3 -18
  166. package/packages/core/publication/binary/action.js +5 -7
  167. package/packages/core/publication/candidate/qualification-action.js +1 -6
  168. package/packages/core/publication/candidate/stage-capsules.js +1 -1
  169. package/packages/core/publication/npm/preview-action.js +9 -15
  170. package/packages/core/publication/oci/preview-actions.js +1 -10
  171. package/packages/core/publication/publication-artifact-candidate.js +2 -2
  172. package/packages/core/publication/publication-authority.js +2 -2
  173. package/packages/core/publication/publication-rehearsal-projection.js +3 -3
  174. package/packages/core/publication/settlement/actions.js +2 -11
  175. package/packages/core/release/binary/coordinates-action.js +0 -13
  176. package/packages/core/release/binary/coordinates.js +2 -19
  177. package/packages/core/release/commands/promotion-channel-router.mjs +12 -56
  178. package/packages/core/release/commands/resume-from-candidate-run.mjs +2 -3
  179. package/packages/core/release/dev-alpha-active-release-train.js +0 -5
  180. package/packages/core/release/line/action.js +2 -13
  181. package/packages/core/release/next-development/actions.js +2 -5
  182. package/packages/core/release/passport/consumer-validation.js +1 -28
  183. package/packages/core/release/promote-candidate/development-source.js +7 -8
  184. package/packages/core/release/promotion/actions.js +7 -38
  185. package/packages/core/release/promotion/admission.js +3 -50
  186. package/packages/core/release/promotion/candidate.js +2 -4
  187. package/packages/core/release/promotion/channel.js +13 -101
  188. package/packages/core/release/promotion/qualification-action.js +2 -13
  189. package/packages/core/release/promotion/routing.js +16 -81
  190. package/packages/core/release/promotion/selection.js +1 -9
  191. package/packages/core/release/promotion-request.js +1 -40
  192. package/packages/core/release/qualification/actions.js +0 -8
  193. package/packages/core/release/qualification/public-build.js +1 -1
  194. package/packages/core/release/recovery/candidate.js +15 -21
  195. package/packages/core/release/recovery/capsules.js +2 -10
  196. package/packages/core/release/recovery/lineage.js +305 -0
  197. package/packages/core/release/recovery/provenance.js +1 -2
  198. package/packages/core/release/recovery/publication.js +4 -14
  199. package/packages/core/release/recovery/readback.js +19 -32
  200. package/packages/core/release/recovery/runtime.js +4 -95
  201. package/packages/core/release/release-candidate-recovery.js +4 -9
  202. package/packages/core/release/release-candidate.js +2 -5
  203. package/packages/core/release/reseal/actions.js +3 -22
  204. package/packages/core/release/reseal/admission.js +0 -2
  205. package/packages/core/release/reseal/finalize-platform.js +0 -2
  206. package/packages/core/release/tail-reseal-github.js +1 -2
  207. package/packages/core/release/tail-reseal-receipt.js +0 -1
  208. package/packages/core/release/tail-reseal.js +2 -20
  209. package/packages/core/release/version-state.js +16 -13
  210. package/packages/core/runtime/buildchain-domain.wasm +0 -0
  211. package/packages/core/runtime/checkout-identity.js +0 -13
  212. package/packages/core/runtime/domain-wasm-artifact.js +2 -2
  213. package/packages/core/runtime/entry/actions.js +121 -0
  214. package/packages/core/runtime/entry/activation.js +86 -0
  215. package/packages/core/runtime/entry/github.js +55 -0
  216. package/packages/core/runtime/entry/recovery.js +37 -0
  217. package/packages/core/runtime/entry/selection.js +110 -0
  218. package/packages/core/web/controller.js +1 -1
  219. package/packages/core/web/publication-admission-action.js +1 -8
  220. package/packages/core/web/web-surface-publication-candidate.js +2 -5
  221. package/packages/core/workflow/admission/actions.js +6 -26
  222. package/packages/core/workflow/admission/recovery.js +3 -43
  223. package/packages/core/workflow/admission/transactions.js +8 -24
  224. package/packages/core/workflow/commands/buildchain-cli-help.mjs +1 -1
  225. package/packages/core/workflow/commands/universal-workflow-engine.mjs +2 -7
  226. package/packages/core/workflow/dogfood/actions.js +0 -17
  227. package/packages/core/workflow/engine/action.js +0 -5
  228. package/packages/core/workflow/engine/conformance.js +1 -1
  229. package/packages/core/workflow/engine/execution.js +2 -6
  230. package/packages/core/workflow/engine/identity.js +1 -6
  231. package/packages/core/workflow/engine/release-environment.js +11 -35
  232. package/packages/core/workflow/engine/release-promotion.js +2 -2
  233. package/packages/core/workflow/settlement/actions.js +0 -12
  234. package/packages/core/workflow/universal-self-dogfood.js +2 -16
  235. package/packages/core/workflow/universal-workflow-bootstrap.js +16 -241
  236. package/packages/core/workflow/workflow-taxonomy.mjs +2 -2
  237. package/scripts/check-dev-delivery-actions.mjs +17 -8
  238. package/scripts/check-floating-consumer-policy-contract.mjs +6 -6
  239. package/scripts/check-inventory.mjs +1 -10
  240. package/scripts/check-public-dogfood-contract.mjs +34 -21
  241. package/scripts/check-release-topology.mjs +2 -6
  242. package/scripts/check-runtime-entry.mjs +133 -0
  243. package/scripts/check-universal-workflow-bootstrap.mjs +45 -281
  244. package/scripts/check-workflows.sh +0 -7
  245. package/scripts/generate-bootstrap-admission.mjs +1 -1
  246. package/scripts/generate-channel-promotion-workflow.mjs +4 -4
  247. package/scripts/inventory/binary.mjs +4 -4
  248. package/scripts/inventory/promotion.mjs +5 -3
  249. package/scripts/runtime-source-boundaries.mjs +70 -0
  250. package/scripts/site-capability-metadata.mjs +2 -2
  251. package/scripts/workflow-action-graph.mjs +5 -18
  252. package/scripts/workflow-self-reference.mjs +20 -0
  253. package/templates/native-dev-delivery.yml +4 -4
  254. package/templates/universal-buildchain-bootstrap.yml +12 -2
  255. package/architecture/runtime-ref-resume-authority.json +0 -64
  256. package/architecture/universal-workflow-train-admission.json +0 -76
  257. package/contracts/v4-runtime-ref-resume-authority-v1.schema.json +0 -235
  258. package/docs/v4-runtime-ref-resume-authority.md +0 -69
  259. package/packages/core/consumer/channel-selection.js +0 -211
  260. package/packages/core/consumer/commands/buildchain-channel-router.mjs +0 -81
  261. package/packages/core/consumer/invocation-selector.js +0 -4
  262. package/packages/core/consumer/runtime-ref-resume-authority.js +0 -621
  263. package/packages/core/consumer/workflow-definition-authority.js +0 -64
  264. package/packages/core/contracts/runtime-contract-action.js +0 -48
  265. package/packages/core/release/commands/promotion-identity-resolver.mjs +0 -77
  266. package/packages/core/release/commands/verify-promotion-router-binding.sh +0 -36
  267. package/packages/core/release/promotion/identities.js +0 -56
  268. package/packages/core/release/runtime-override-authorization.js +0 -242
  269. package/packages/core/runtime/commands/runtime-ref-core.mjs +0 -171
  270. package/packages/core/runtime/provider-closure.js +0 -60
  271. package/packages/core/runtime/runtime-selection-action.js +0 -34
  272. package/packages/core/runtime/runtime-selection.js +0 -136
  273. package/packages/core/runtime/workflow-runtime.js +0 -11
  274. package/packages/core/workflow/admission/review.js +0 -188
  275. package/packages/core/workflow/commands/universal-workflow-backflow.mjs +0 -26
  276. package/packages/core/workflow/installation.js +0 -33
  277. package/packages/core/workflow/settlement/backflow.js +0 -187
  278. package/scripts/generate-bootstrap-recovery.mjs +0 -94
  279. package/templates/bootstrap-recovery/actions/build/source/admit/action.yml +0 -17
  280. package/templates/bootstrap-recovery/actions/build/source/admit/dist/index.js +0 -63
  281. package/templates/bootstrap-recovery/actions/runtime/dependencies/install/action.yml +0 -18
  282. package/templates/bootstrap-recovery/actions/runtime/dependencies/install/dist/index.js +0 -63
  283. package/templates/bootstrap-recovery/actions/runtime/environment/prepare/action.yml +0 -21
  284. package/templates/bootstrap-recovery/actions/workflow/admission/inspect/action.yml +0 -27
  285. package/templates/bootstrap-recovery/actions/workflow/admission/inspect/dist/index.js +0 -64
  286. package/templates/bootstrap-recovery/actions/workflow/admission/review/action.yml +0 -15
  287. package/templates/bootstrap-recovery/actions/workflow/admission/review/dist/index.js +0 -65
  288. package/templates/bootstrap-recovery/actions/workflow/recovery/admit/action.yml +0 -47
  289. package/templates/bootstrap-recovery/actions/workflow/recovery/execute/action.yml +0 -48
  290. package/templates/bootstrap-recovery/actions/workflow/recovery/settle/action.yml +0 -54
  291. package/templates/bootstrap-recovery/actions/workflow/settlement/seal/action.yml +0 -17
  292. package/templates/bootstrap-recovery/actions/workflow/settlement/seal/dist/index.js +0 -65
  293. package/templates/bootstrap-recovery/manifest.json +0 -68
  294. package/templates/bootstrap-recovery/package.json +0 -9
  295. package/templates/universal-buildchain-bootstrap-recovery.yml +0 -115
@@ -14,44 +14,12 @@ function repository(value, label) {
14
14
  return normalized;
15
15
  }
16
16
 
17
- const DEFAULT_ARTIFACT_SIGNING_AUTHORITY_REF =
18
- "authority/v4/v4.1/artifact-signing";
19
17
  const AUTHORITY_WORKFLOW = "public-release-signing-authority.yml";
20
18
 
21
- export function resolveAuthorityDispatchRef(value) {
22
- const ref = required(value, "authority ref");
23
- if (/^[0-9a-f]{40}$/u.test(ref) || /^v4(?:-alpha)?$/u.test(ref))
24
- return DEFAULT_ARTIFACT_SIGNING_AUTHORITY_REF;
25
- if (ref !== DEFAULT_ARTIFACT_SIGNING_AUTHORITY_REF)
26
- throw new Error(
27
- "Artifact signing requires the current protected authority",
28
- );
29
- return ref;
30
- }
31
-
32
- export async function resolveArtifactSigningAuthorityRuntime({
33
- authorityRepository,
34
- authorityRef,
35
- token,
36
- requestImpl = githubRequest,
37
- }) {
38
- const authorityRepo = repository(authorityRepository, "authority repository");
39
- const ref = resolveAuthorityDispatchRef(authorityRef);
40
- const encodedRef = ref.split("/").map(encodeURIComponent).join("/");
41
- const response = await requestImpl(
42
- `/repos/${authorityRepo}/git/ref/heads/${encodedRef}`,
43
- { token: required(token, "Buildchain authority dispatch token") },
44
- );
45
- if (response?.object?.type !== "commit") {
46
- throw new Error(
47
- "Buildchain signing authority ref does not resolve to a commit",
48
- );
49
- }
50
- const sha = String(response.object.sha || "");
51
- if (!/^[0-9a-f]{40}$/u.test(sha)) {
52
- throw new Error("Buildchain signing authority runtime SHA must be exact");
53
- }
54
- return { ref, sha };
19
+ export function resolveAuthorityDispatchRef(value = "v4") {
20
+ if (!["v4", "v4-alpha"].includes(value))
21
+ throw new Error("Signing entry must use a public floating channel");
22
+ return value;
55
23
  }
56
24
 
57
25
  function authorityError(message, outputs = {}) {
@@ -62,7 +30,7 @@ function authorityError(message, outputs = {}) {
62
30
 
63
31
  export function validateArtifactSigningAuthorityRun(
64
32
  run,
65
- { authorityRepository, authorityRuntimeSha, expectedTitle },
33
+ { authorityRepository, expectedTitle },
66
34
  ) {
67
35
  if (!run || typeof run !== "object") {
68
36
  throw new Error("Buildchain signing authority run is missing");
@@ -73,9 +41,6 @@ export function validateArtifactSigningAuthorityRun(
73
41
  if (String(run.event || "") !== "workflow_dispatch") {
74
42
  throw new Error("Buildchain signing authority event mismatch");
75
43
  }
76
- if (String(run.head_sha || "") !== authorityRuntimeSha) {
77
- throw new Error("Buildchain signing authority runtime SHA mismatch");
78
- }
79
44
  if (
80
45
  run.repository?.full_name &&
81
46
  String(run.repository.full_name) !== authorityRepository
@@ -92,7 +57,6 @@ export function validateArtifactSigningAuthorityRun(
92
57
  async function pollArtifactSigningAuthorityRun({
93
58
  authorityRepository,
94
59
  token,
95
- authorityRuntimeSha,
96
60
  expectedTitle,
97
61
  startedAtMs,
98
62
  deadline,
@@ -122,8 +86,7 @@ async function pollArtifactSigningAuthorityRun({
122
86
  try {
123
87
  run = validateArtifactSigningAuthorityRun(matches[0], {
124
88
  authorityRepository,
125
- authorityRuntimeSha,
126
- expectedTitle,
89
+ expectedTitle,
127
90
  });
128
91
  } catch (error) {
129
92
  throw authorityError(error.message, {
@@ -194,7 +157,7 @@ function successfulAuthorityResult({
194
157
  export async function dispatchArtifactSigningAuthority({
195
158
  token,
196
159
  authorityRepository = "kungfu-systems/buildchain",
197
- authorityRef,
160
+ authorityRef = "v4",
198
161
  sourceRepository,
199
162
  sourceRunId,
200
163
  sourceRunAttempt = "1",
@@ -213,8 +176,6 @@ export async function dispatchArtifactSigningAuthority({
213
176
  const sourceRepo = repository(sourceRepository, "source repository");
214
177
  const ref = resolveAuthorityDispatchRef(authorityRef);
215
178
  const runtime = required(runtimeSha, "Buildchain runtime SHA");
216
- if (!/^[0-9a-f]{40}$/u.test(runtime))
217
- throw new Error("Buildchain runtime SHA must be exact");
218
179
  const runId = required(sourceRunId, "source run ID");
219
180
  const runAttempt = required(sourceRunAttempt, "source run attempt");
220
181
  if (!/^[1-9][0-9]*$/u.test(runAttempt)) {
@@ -243,20 +204,14 @@ export async function dispatchArtifactSigningAuthority({
243
204
  "controller-started-at": controllerStartedAt,
244
205
  };
245
206
  try {
246
- const authorityRuntime = await resolveArtifactSigningAuthorityRuntime({
247
- authorityRepository: authorityRepo,
248
- authorityRef: ref,
249
- token: authToken,
250
- requestImpl,
251
- });
252
- baseOutputs["authority-runtime-sha"] = authorityRuntime.sha;
207
+ baseOutputs["authority-runtime-sha"] = runtime;
253
208
  await requestImpl(
254
209
  `/repos/${authorityRepo}/actions/workflows/${AUTHORITY_WORKFLOW}/dispatches`,
255
210
  {
256
211
  token: authToken,
257
212
  method: "POST",
258
213
  body: {
259
- ref: authorityRuntime.ref,
214
+ ref,
260
215
  inputs: {
261
216
  "source-repository": sourceRepo,
262
217
  "source-run-id": runId,
@@ -265,7 +220,7 @@ export async function dispatchArtifactSigningAuthority({
265
220
  "expected-request-root": requestRootDigest,
266
221
  "result-artifact-name": resultName,
267
222
  "correlation-id": correlation,
268
- "expected-runtime-sha": runtime,
223
+ "runtime-ref": runtime,
269
224
  },
270
225
  },
271
226
  },
@@ -274,7 +229,6 @@ export async function dispatchArtifactSigningAuthority({
274
229
  const run = await pollArtifactSigningAuthorityRun({
275
230
  authorityRepository: authorityRepo,
276
231
  token: authToken,
277
- authorityRuntimeSha: authorityRuntime.sha,
278
232
  expectedTitle,
279
233
  startedAtMs: controllerStartedAtMs,
280
234
  deadline: controllerStartedAtMs + timeout * 1000,
@@ -15,7 +15,6 @@ import { artifactSigningRequestRoot } from "../signing/request.js";
15
15
  export function inspectArtifactSigningRequests({
16
16
  inputRoot,
17
17
  expectedRepository,
18
- expectedRuntimeSha,
19
18
  expectedRequestRoot,
20
19
  } = {}) {
21
20
  const root = path.resolve(required(inputRoot, "signing request root"));
@@ -53,9 +52,6 @@ export function inspectArtifactSigningRequests({
53
52
  ) {
54
53
  throw new Error("signing request source repository mismatch");
55
54
  }
56
- if (expectedRuntimeSha && request.runtime.sha !== expectedRuntimeSha) {
57
- throw new Error("signing request runtime SHA mismatch");
58
- }
59
55
  const key = `${request.source.sha}:${request.artifact.id}:${request.artifact.platform}`;
60
56
  if (seen.has(key))
61
57
  throw new Error(`duplicate artifact signing request: ${key}`);
@@ -27,7 +27,7 @@ export async function sealSigning(plan, platform, sourceRoot) {
27
27
  sourceSha: plan.source.sha,
28
28
  sourceTreeSha: plan.source.tree_sha,
29
29
  runtimeRepository: plan.identity.repository,
30
- runtimeRef: plan.identity.ref,
30
+ runtimeRef: plan.runtime?.ref || plan.identity.ref,
31
31
  runtimeSha: plan.identity.sha,
32
32
  platformId: platform.id,
33
33
  platformName: platform.name,
@@ -139,7 +139,6 @@ export function artifactSigningCorrelation({
139
139
  return [
140
140
  required(sourceRunId, "source run ID"),
141
141
  positiveInteger(sourceRunAttempt, "source run attempt"),
142
- exactSha(runtimeSha, "runtime SHA").slice(0, 12),
143
142
  required(platformId, "platform ID").replace(/[^A-Za-z0-9._-]+/gu, "-"),
144
143
  sha256Root(requestRoot, "request root").slice("sha256:".length, 19),
145
144
  ].join("-");
@@ -171,7 +170,7 @@ export function validateArtifactSigningControlRequest(value) {
171
170
  runtime: {
172
171
  repository: repository(value.runtime?.repository, "runtime.repository"),
173
172
  ref: required(value.runtime?.ref, "runtime.ref"),
174
- sha: exactSha(value.runtime?.sha, "runtime.sha"),
173
+ sha: value.runtime?.sha,
175
174
  },
176
175
  platform: {
177
176
  id: required(value.platform?.id, "platform.id"),
@@ -356,8 +355,6 @@ export function assertArtifactSigningControlRequestContext(
356
355
  [sourceRunAttempt, String(value.source.runAttempt), "source run attempt"],
357
356
  [sourceSha, value.source.sha, "source SHA"],
358
357
  [sourceTreeSha, value.source.treeSha, "source tree SHA"],
359
- [runtimeRepository, value.runtime.repository, "runtime repository"],
360
- [runtimeSha, value.runtime.sha, "runtime SHA"],
361
358
  [platformId, value.platform.id, "platform ID"],
362
359
  ];
363
360
  for (const [expected, actual, label] of expectations) {
@@ -378,7 +375,6 @@ export function artifactSigningControlRequestOutputs(request) {
378
375
  "result-artifact": value.authority.resultArtifact,
379
376
  "correlation-id": value.authority.correlationId,
380
377
  "authority-repository": value.authority.repository,
381
- "authority-ref": value.runtime.ref,
382
378
  "runtime-sha": value.runtime.sha,
383
379
  };
384
380
  }
@@ -417,7 +413,7 @@ export function validateArtifactSigningControllerReceipt(value) {
417
413
  },
418
414
  runtime: {
419
415
  repository: repository(value.runtime?.repository, "runtime.repository"),
420
- sha: exactSha(value.runtime?.sha, "runtime.sha"),
416
+ sha: value.runtime?.sha,
421
417
  },
422
418
  platform: {
423
419
  id: required(value.platform?.id, "platform.id"),
@@ -436,7 +432,7 @@ export function validateArtifactSigningControllerReceipt(value) {
436
432
  "authority.repository",
437
433
  ),
438
434
  runtimeSha: value.authority?.runtimeSha
439
- ? exactSha(value.authority.runtimeSha, "authority.runtimeSha")
435
+ ? value.authority.runtimeSha
440
436
  : "",
441
437
  runId: optional(value.authority?.runId, "authority.runId"),
442
438
  runUrl: optional(value.authority?.runUrl, "authority.runUrl"),
@@ -501,7 +497,6 @@ export function validateArtifactSigningControllerReceipt(value) {
501
497
  required(receipt.authority.runId, "authority.runId");
502
498
  required(receipt.authority.runUrl, "authority.runUrl");
503
499
  required(receipt.authority.resultArtifact, "authority.resultArtifact");
504
- exactSha(receipt.authority.runtimeSha, "authority.runtimeSha");
505
500
  }
506
501
  if (
507
502
  receipt.request.count === 0 &&
@@ -1,16 +1,12 @@
1
1
  import path from "node:path";
2
- import { verifySourceRuntimeCheckouts } from "../../runtime/checkout-identity.js";
3
- export function verifySourceRuntimeAction(core, env) {
4
- verifySourceRuntimeCheckouts({
5
- sourceDirectory: path.resolve(
2
+ import { verifyCheckoutIdentity } from "../../runtime/checkout-identity.js";
3
+ export function verifySourceCheckoutAction(core, env) {
4
+ verifyCheckoutIdentity({
5
+ directory: path.resolve(
6
6
  env.GITHUB_WORKSPACE,
7
7
  core.getInput("source-directory"),
8
8
  ),
9
- sourceSha: core.getInput("source-sha", { required: true }),
10
- runtimeDirectory: path.resolve(
11
- env.GITHUB_WORKSPACE,
12
- core.getInput("runtime-directory"),
13
- ),
14
- runtimeSha: core.getInput("runtime-sha", { required: true }),
9
+ sha: core.getInput("source-sha", { required: true }),
10
+ label: "Consumer source",
15
11
  });
16
12
  }
@@ -64,10 +64,7 @@ export function sourceQualificationStages({
64
64
  return [
65
65
  {
66
66
  id: "resolve-runtime",
67
- status: aggregate([
68
- observations.runtime?.outcome,
69
- observations["core-runtime"]?.outcome,
70
- ]),
67
+ status: "success",
71
68
  },
72
69
  { id: "checkout-source", status: sourceOutcome },
73
70
  {
@@ -5,14 +5,13 @@ import {
5
5
  loadBuildchainConfig,
6
6
  validateBuildchainConfig,
7
7
  } from "../../consumer/buildchain-config.js";
8
- import { collectPaperPreflight } from "../../paper/paper.js";
9
- import { resolvePaperBuildchainSha } from "../../paper/paper-agent-entry.js";
8
+ import { collectPaperSourcePolicy } from "../../paper/paper.js";
10
9
  import { runLifecycle } from "../lifecycle/transaction.js";
11
10
  import { consumerCommandSession } from "../../runtime/consumer-shell.js";
12
11
 
13
12
  export function admitSourcePaper(
14
13
  { cwd, runtimeRoot, runtimeRef },
15
- inspect = collectPaperPreflight,
14
+ inspect = collectPaperSourcePolicy,
16
15
  ) {
17
16
  const config = loadBuildchainConfig(cwd)?.config;
18
17
  const applicable =
@@ -21,16 +20,7 @@ export function admitSourcePaper(
21
20
  (config?.project?.type === "publication-artifact" &&
22
21
  (!config.publication || config.publication.kind === "paper"));
23
22
  if (!applicable) return { applicable: false };
24
- if (!runtimeRef)
25
- throw new Error("Paper policy requires the selected runtime coordinate");
26
- const result = inspect({
27
- cwd,
28
- buildchainRoot: runtimeRoot,
29
- buildchainRef: runtimeRef,
30
- buildchainSha: resolvePaperBuildchainSha(runtimeRoot),
31
- offline: true,
32
- agentEntryMode: "ci",
33
- });
23
+ const result = inspect({ cwd });
34
24
  console.log(JSON.stringify(result));
35
25
  if (!result.ok)
36
26
  throw new Error("Paper agent-entry and acceptance policy did not qualify");
@@ -1,24 +1,15 @@
1
1
  import path from "node:path";
2
2
  import { command } from "../../runtime/action-process.mjs";
3
3
  import { installationRoot } from "../../runtime/installation-root.js";
4
- import { exactWorkflowRuntime } from "../../runtime/workflow-runtime.js";
5
4
  import { qualifyStageCapsuleConsumer } from "./canary.js";
6
5
  import { aggregateStageCapsuleCampaign } from "./campaign/aggregate.js";
7
- function runtime(core) {
6
+ function runtime(env) {
8
7
  const runtimeRoot = installationRoot(import.meta.url);
9
- const runtimeSha = exactWorkflowRuntime(
10
- core.getInput("workflow-sha", { required: true }),
11
- );
12
- if (
13
- command("git", ["-C", runtimeRoot, "rev-parse", "HEAD"], {
14
- stdio: "pipe",
15
- }).trim() !== runtimeSha
16
- )
17
- throw new Error("Stage Capsule runtime differs from called workflow");
8
+ const runtimeSha = env.BUILDCHAIN_RUNTIME_SHA;
18
9
  return { runtimeRoot, runtimeSha };
19
10
  }
20
11
  export async function qualifyStageCapsuleConsumerAction(core, env) {
21
- const binding = runtime(core);
12
+ const binding = runtime(env);
22
13
  const workspace = path.resolve(env.GITHUB_WORKSPACE);
23
14
  if (
24
15
  command("git", ["-C", workspace, "rev-parse", "HEAD"], {
@@ -38,7 +29,6 @@ export async function qualifyStageCapsuleConsumerAction(core, env) {
38
29
  });
39
30
  }
40
31
  export function aggregateStageCapsuleConsumerAction(core, env) {
41
- runtime(core);
42
32
  return aggregateStageCapsuleCampaign({
43
33
  directory: path.join(
44
34
  env.GITHUB_WORKSPACE,
@@ -60,13 +60,19 @@ function resumeRequest(state, store) {
60
60
  };
61
61
  }
62
62
 
63
+ function checkpointResult(entry) {
64
+ const { runtimeRoot: _runtimeProvenance, ...identity } =
65
+ entry.capsule.identity;
66
+ return domainCanonicalBytes({
67
+ identity,
68
+ manifestRoot: entry.manifest.manifestRoot,
69
+ }).toString("utf8");
70
+ }
71
+
63
72
  function emitMissing(context, state, store, stageId) {
64
73
  const emitted = emitStageCapsuleCampaignCheckpoint(context, stageId, store);
65
74
  const expected = state.reference.find(({ stage }) => stage === stageId);
66
- if (
67
- emitted.capsule.capsuleRoot !== expected.capsule.capsuleRoot ||
68
- emitted.manifest.manifestRoot !== expected.manifest.manifestRoot
69
- )
75
+ if (checkpointResult(emitted) !== checkpointResult(expected))
70
76
  throw new Error(`resumed ${stageId} differs from the fresh build`);
71
77
  return {
72
78
  stage: stageId,
@@ -81,7 +87,6 @@ export function resumeStageCapsuleCampaign(context) {
81
87
  for (const [name, code] of [
82
88
  ["consumer", "stage-capsule-campaign-consumer-drift"],
83
89
  ["platform", "stage-capsule-campaign-platform-drift"],
84
- ["runtimeRef", "stage-capsule-campaign-runtime-ref-drift"],
85
90
  ["consumerSourceRevision", "stage-capsule-campaign-source-revision-drift"],
86
91
  ])
87
92
  if (state[name] !== context[name])
@@ -1,6 +1,5 @@
1
1
  import path from "node:path";
2
2
  import { command } from "../../../runtime/action-process.mjs";
3
- import { installationRoot } from "../../../runtime/installation-root.js";
4
3
  import { rehearseStageCheckpoint } from "./run.js";
5
4
  import { rehearseStageResume } from "./resume.js";
6
5
  import { rehearseTailResealMacos } from "./macos-tail.js";
@@ -38,9 +37,9 @@ export function verifyStageCapsuleCheckpoints({
38
37
  return { checkpoint, resume, tail };
39
38
  }
40
39
  export function verifyStageCapsuleCheckpointsAction(core, env) {
41
- const runtimeRoot = installationRoot(import.meta.url);
40
+ const sourceRoot = path.resolve(env.GITHUB_WORKSPACE);
42
41
  if (
43
- command("git", ["-C", runtimeRoot, "rev-parse", "HEAD"], {
42
+ command("git", ["-C", sourceRoot, "rev-parse", "HEAD"], {
44
43
  stdio: "pipe",
45
44
  }).trim() !== env.GITHUB_SHA
46
45
  )
@@ -48,7 +47,7 @@ export function verifyStageCapsuleCheckpointsAction(core, env) {
48
47
  "Checkpoint verification must execute exact candidate source",
49
48
  );
50
49
  return verifyStageCapsuleCheckpoints({
51
- runtimeRoot,
50
+ runtimeRoot: sourceRoot,
52
51
  workspace: path.resolve(env.GITHUB_WORKSPACE),
53
52
  platform: core.getInput("platform", { required: true }),
54
53
  environment: env,
@@ -237,7 +237,6 @@ function changedDecision(node, candidate, availabilityRoot) {
237
237
  "toolchain-changed",
238
238
  false,
239
239
  ],
240
- ["runtimeRoot", "runtime-root", "rebuild", "runtime-changed", true],
241
240
  ["policyRoot", "policy-root", "rebuild", "policy-changed", true],
242
241
  ["declaredInputs", "declared-inputs", "rebuild", "input-changed", false],
243
242
  [
@@ -76,12 +76,12 @@ export async function aggregate(context, plan, jobs, executions) {
76
76
  },
77
77
  runtime: {
78
78
  workflowShellRef: plan.identity.ref,
79
- requestedRef: plan.identity.ref,
80
- ref: plan.identity.ref,
79
+ requestedRef: plan.runtime?.ref || plan.identity.ref,
80
+ ref: plan.runtime?.ref || plan.identity.ref,
81
81
  sha: plan.identity.sha,
82
- class: plan.identity.channel,
83
- override: false,
84
- trustDecision: "workflow-identity",
82
+ class: plan.runtime?.class || plan.identity.channel,
83
+ override: plan.runtime?.origin === "runtime-parameter",
84
+ trustDecision: "entry-selection",
85
85
  rollbackRef: plan.identity.ref,
86
86
  },
87
87
  });
@@ -49,7 +49,7 @@ async function finalizeBuild(context, jobs) {
49
49
  sourceTreeHash: plan.source.tree_sha,
50
50
  buildSummary: aggregated.summary,
51
51
  buildchain: {
52
- ref: plan.identity.ref,
52
+ ref: plan.runtime?.ref || plan.identity.ref,
53
53
  sha: plan.identity.sha,
54
54
  workflowShellRef: plan.identity.ref,
55
55
  },
@@ -1,5 +1,4 @@
1
1
  import path from "node:path";
2
- import { installationRoot } from "../../runtime/installation-root.js";
3
2
  import { command } from "../../runtime/action-process.mjs";
4
3
  import { qualifyRepositorySource, verificationProvider } from "./source.js";
5
4
 
@@ -8,13 +7,9 @@ export async function qualifyRepositorySourceAction(core, env) {
8
7
  runtimeRoot = path.join(workspace, ".buildchain/runtime");
9
8
  const sha = (cwd) =>
10
9
  command("git", ["rev-parse", "HEAD"], { cwd, stdio: "pipe" }).trim();
11
- if (
12
- sha(workspace) !== env.GITHUB_SHA ||
13
- sha(runtimeRoot) !== env.GITHUB_SHA ||
14
- path.resolve(installationRoot(import.meta.url)) !== path.resolve(workspace)
15
- )
10
+ if (sha(workspace) !== env.GITHUB_SHA)
16
11
  throw new Error(
17
- "Repository verification requires exact source-owned code and matching runtime checkout",
12
+ "Repository verification requires the invoked source checkout",
18
13
  );
19
14
  return qualifyRepositorySource(
20
15
  {
@@ -37,11 +32,7 @@ export async function qualifyRepositorySourceAction(core, env) {
37
32
  );
38
33
  }
39
34
  export function qualifyBuildBackboneAction(_core, env) {
40
- const root = installationRoot(import.meta.url);
41
- if (path.resolve(root) !== path.resolve(env.GITHUB_WORKSPACE))
42
- throw new Error(
43
- "Build backbone tests must execute from the admitted source checkout",
44
- );
35
+ const root = path.resolve(env.GITHUB_WORKSPACE);
45
36
  command(
46
37
  "node",
47
38
  [
@@ -2,7 +2,6 @@ import { verifyRepository } from "./repository.js";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { command } from "../../runtime/action-process.mjs";
5
- import { installationRoot } from "../../runtime/installation-root.js";
6
5
  import { collectGitHubReleasePassport } from "../../release/passport/collection.js";
7
6
  import { verifyReleasePassport } from "../../release/release-passport.js";
8
7
 
@@ -44,26 +43,29 @@ export async function qualifyRunnerCompatibility(
44
43
  throw new Error("Runner compatibility passport verification failed");
45
44
  return report;
46
45
  }
47
- export async function qualifyRunnerCompatibilityAction(core, env) {
46
+ export async function qualifyRunnerCompatibilityAction(
47
+ core,
48
+ env,
49
+ dependencies,
50
+ ) {
48
51
  const workspace = env.GITHUB_WORKSPACE;
49
- if (
50
- path.resolve(installationRoot(import.meta.url)) !== path.resolve(workspace)
51
- )
52
- throw new Error("Runner compatibility requires source-owned code");
53
52
  core.info(`Runner ${env.RUNNER_NAME}: ${env.RUNNER_OS}/${env.RUNNER_ARCH}`);
54
- return qualifyRunnerCompatibility({
55
- workspace,
56
- repository: env.GITHUB_REPOSITORY,
57
- sourceSha: env.GITHUB_SHA,
58
- env,
59
- workflow: {
60
- name: env.GITHUB_WORKFLOW || "",
61
- runId: env.GITHUB_RUN_ID || "",
62
- runAttempt: env.GITHUB_RUN_ATTEMPT || "",
63
- url: `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}`,
64
- runnerOs: env.RUNNER_OS || process.platform,
65
- runnerArch: env.RUNNER_ARCH || process.arch,
66
- runnerImage: env.ImageOS || "",
53
+ return qualifyRunnerCompatibility(
54
+ {
55
+ workspace,
56
+ repository: env.GITHUB_REPOSITORY,
57
+ sourceSha: env.GITHUB_SHA,
58
+ env,
59
+ workflow: {
60
+ name: env.GITHUB_WORKFLOW || "",
61
+ runId: env.GITHUB_RUN_ID || "",
62
+ runAttempt: env.GITHUB_RUN_ATTEMPT || "",
63
+ url: `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}`,
64
+ runnerOs: env.RUNNER_OS || process.platform,
65
+ runnerArch: env.RUNNER_ARCH || process.arch,
66
+ runnerImage: env.ImageOS || "",
67
+ },
67
68
  },
68
- });
69
+ dependencies,
70
+ );
69
71
  }
@@ -1,5 +1,4 @@
1
1
  import crypto from "node:crypto";
2
- import { SOURCE_OWNED_PROMOTION } from "./invocation-selector.js";
3
2
 
4
3
  export const FLOATING_CONSUMER_POLICY =
5
4
  "kungfu-buildchain-v4-floating-consumer-policy/v1";
@@ -61,13 +60,6 @@ function verifyIdentity(value, expected, check, label) {
61
60
  "invoked-workflow-mismatch",
62
61
  `${label} workflow mismatch`,
63
62
  );
64
- if (expected.resolvedRuntimeSha)
65
- check(
66
- value?.invocation?.resolvedRuntimeSha ===
67
- expected.resolvedRuntimeSha.toLowerCase(),
68
- "runtime-sha-mismatch",
69
- `${label} runtime SHA mismatch`,
70
- );
71
63
  }
72
64
 
73
65
  function verifyAuthorityFields(value, expected, check, label) {
@@ -111,28 +103,18 @@ function verifyAuthorityFields(value, expected, check, label) {
111
103
 
112
104
  function verifyFloatingSelector(value, check, label) {
113
105
  const invocation = value?.invocation;
114
- const local =
115
- value?.caller?.repository === SOURCE_OWNED_PROMOTION.repository &&
116
- invocation?.workflow === SOURCE_OWNED_PROMOTION.workflow &&
117
- invocation?.visibleSelector === `./${SOURCE_OWNED_PROMOTION.workflow}` &&
118
- invocation?.selectorClass === "repository-local" &&
119
- invocation?.definition?.repository === value.caller.repository &&
120
- /^[0-9a-f]{40}$/.test(invocation?.definition?.commitSha || "") &&
121
- invocation.definition.commitSha === invocation.resolvedWorkflowSha &&
122
- SHA256_ROOT.test(invocation?.definition?.filesRoot || "") &&
123
- ["stable", "alpha"].includes(invocation?.channel);
124
106
  const floating =
125
107
  invocation?.selectorClass === "floating" &&
126
108
  { v4: "stable", "v4-alpha": "alpha" }[invocation?.visibleSelector] ===
127
109
  invocation?.channel &&
128
110
  invocation?.definition === undefined;
129
111
  check(
130
- floating || local,
112
+ floating,
131
113
  "selector-class-invalid",
132
- `${label} must bind a floating channel or an authenticated source-owned public invocation`,
114
+ `${label} must bind a floating channel`,
133
115
  );
134
116
  check(
135
- ["v4", "v4-alpha"].includes(invocation?.visibleSelector) || local,
117
+ ["v4", "v4-alpha"].includes(invocation?.visibleSelector),
136
118
  "selector-invalid",
137
119
  `${label} selector is outside the current invocation contract`,
138
120
  );