@kungfu-tech/buildchain 4.0.0 → 4.0.1-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 (69) hide show
  1. package/AGENTS.md +13 -5
  2. package/actions/promote-buildchain-ref/README.md +11 -6
  3. package/architecture/internal-capabilities.json +11 -2
  4. package/architecture/maintainability-policy.json +149 -17
  5. package/architecture/v4-floating-consumer-policy.json +75 -0
  6. package/architecture/v4-floating-consumer-policy.md +32 -0
  7. package/architecture/v4-runtime-ref-resume-authority.json +64 -0
  8. package/architecture/v4-stage-capsule-qualification.json +2 -2
  9. package/bin/internal/trust-release-release-handlers.mjs +5 -0
  10. package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +53 -0
  11. package/contracts/fixtures/v4-runtime-ref-resume-authority-v1/scenario.json +15 -0
  12. package/contracts/v4-floating-consumer-policy-receipt-v1.schema.json +105 -0
  13. package/contracts/v4-runtime-ref-resume-authority-v1.schema.json +235 -0
  14. package/dist/site/buildchain-contract.json +101 -31
  15. package/dist/site/buildchain-site.json +73 -27
  16. package/dist/site/capability-registry.json +3 -3
  17. package/dist/site/controller-registry.json +62 -6
  18. package/dist/site/kfd-claims.json +68 -13
  19. package/dist/site/kfd-upstream-aggregate.json +1 -1
  20. package/dist/site/manual-registry.json +6 -6
  21. package/dist/site/node-api-registry.json +799 -127
  22. package/dist/site/page-registry.json +63 -17
  23. package/dist/site/public-surface-audit.json +49 -17
  24. package/dist/site/publication-registry.json +4 -4
  25. package/dist/site/release-provenance.json +2 -0
  26. package/dist/site/site-manifest.json +10 -10
  27. package/dist/site/workflow-registry.json +46 -18
  28. package/docs/MAP.md +2 -0
  29. package/docs/dev-delivery-warrant.md +19 -1
  30. package/docs/lifecycle-protocol.md +41 -0
  31. package/docs/node-api-reference.md +207 -134
  32. package/docs/reusable-build-surface.md +41 -0
  33. package/docs/runtime-train-validation.md +10 -0
  34. package/docs/v4-runtime-ref-resume-authority.md +69 -0
  35. package/docs/versioning.md +1 -0
  36. package/package.json +6 -4
  37. package/packages/core/artifact-signing.js +61 -0
  38. package/packages/core/buildchain-config.js +66 -1
  39. package/packages/core/dev-delivery-proof.js +37 -3
  40. package/packages/core/dev-delivery-warrant.js +3 -3
  41. package/packages/core/index.js +2 -0
  42. package/packages/core/publication-authority.js +5 -5
  43. package/packages/core/release-candidate.js +79 -19
  44. package/packages/core/release-passport.js +239 -33
  45. package/packages/core/v4-floating-consumer-evidence.js +324 -0
  46. package/packages/core/v4-floating-consumer-policy.js +446 -0
  47. package/packages/core/v4-floating-consumer-release-passport.js +126 -0
  48. package/packages/core/v4-runtime-ref-resume-authority.js +625 -0
  49. package/packages/core/v4-runtime-selector-persistence.js +228 -0
  50. package/packages/core/workflow-yaml-contract.js +48 -0
  51. package/scripts/audit-publication-control-plane.mjs +31 -31
  52. package/scripts/check-inventory.mjs +1 -1
  53. package/scripts/check-v4-floating-consumer-policy-contract.mjs +198 -0
  54. package/scripts/check-v4-public-dogfood-contract.mjs +6 -11
  55. package/scripts/dev-delivery-source-proof-reuse.mjs +631 -0
  56. package/scripts/dev-pr-auto-merge.mjs +37 -48
  57. package/scripts/dev-pr-delivery-warrant.mjs +205 -2
  58. package/scripts/dev-pr-prequeue-guard.mjs +399 -0
  59. package/scripts/ensure-github-release.mjs +3 -3
  60. package/scripts/generate-channel-build-workflow.mjs +3 -0
  61. package/scripts/generate-channel-promotion-workflow.mjs +112 -12
  62. package/scripts/generate-release-candidate-passport.mjs +41 -33
  63. package/scripts/init-repo.mjs +5 -1
  64. package/scripts/inspect-artifact-signing-requests.mjs +6 -0
  65. package/scripts/npm-publish-transaction.mjs +101 -89
  66. package/scripts/resume-from-candidate-run.mjs +11 -14
  67. package/scripts/seal-artifact-signing-requests.mjs +6 -0
  68. package/scripts/site-capability-metadata.mjs +2 -0
  69. package/scripts/v4-consumer-policy.mjs +231 -0
@@ -0,0 +1,53 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "contract": "kungfu-buildchain-v4-floating-consumer-policy-fixtures/v1",
4
+ "cases": [
5
+ {
6
+ "id": "stable-floating-dual-lock",
7
+ "selector": "v4",
8
+ "expected": "passed"
9
+ },
10
+ {
11
+ "id": "alpha-floating-dual-lock",
12
+ "selector": "v4-alpha",
13
+ "expected": "passed"
14
+ },
15
+ {
16
+ "id": "persistent-exact-sha",
17
+ "selector": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
18
+ "expectedCode": "persistent-exact-sha-selector"
19
+ },
20
+ {
21
+ "id": "repository-variable-indirection",
22
+ "selector": "${{ vars.BUILDCHAIN_REF }}",
23
+ "expectedCode": "persistent-selector-indirection"
24
+ },
25
+ {
26
+ "id": "input-default-indirection",
27
+ "selector": "${{ inputs.buildchain-ref }}",
28
+ "expectedCode": "persistent-selector-indirection"
29
+ },
30
+ {
31
+ "id": "wrong-channel",
32
+ "selector": "v4.0",
33
+ "expectedCode": "unapproved-v4-selector"
34
+ },
35
+ {
36
+ "id": "missing-alpha-lock",
37
+ "selector": "v4",
38
+ "remove": ".buildchain/alpha-contract-lock.json",
39
+ "expectedCode": "alpha-lock-missing"
40
+ },
41
+ {
42
+ "id": "stale-selected-lock",
43
+ "selector": "v4-alpha",
44
+ "stale": "alpha",
45
+ "expectedCode": "selected-lock-runtime-mismatch"
46
+ },
47
+ {
48
+ "id": "nested-composite-exact-sha",
49
+ "selector": "local-composite",
50
+ "expectedCode": "persistent-exact-sha-selector"
51
+ }
52
+ ]
53
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "scenario": "floating-ref-moves-after-late-platform-failure",
4
+ "sourceSha": "cccccccccccccccccccccccccccccccccccccccc",
5
+ "sourceTreeSha": "dddddddddddddddddddddddddddddddddddddddd",
6
+ "buildAttempt": "attempt-build-17",
7
+ "resumeAttempt": "attempt-resume-18",
8
+ "buildRuntimeSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
9
+ "resumeRuntimeSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
10
+ "floatingRef": "v4-alpha",
11
+ "requiredPlatforms": ["linux-x64", "macos-arm64", "windows-x64"],
12
+ "reusedPlatforms": ["linux-x64", "macos-arm64"],
13
+ "rebuildPlatforms": ["windows-x64"],
14
+ "rerunFailedJobs": false
15
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://buildchain.kungfu-tech.com/schemas/v4-floating-consumer-policy-receipt-v1.schema.json",
4
+ "title": "Buildchain v4 floating consumer policy receipt",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema",
9
+ "status",
10
+ "caller",
11
+ "invocation",
12
+ "contractLocks",
13
+ "policy",
14
+ "failures"
15
+ ],
16
+ "properties": {
17
+ "schema": {
18
+ "const": "kungfu-buildchain-v4-floating-consumer-policy-receipt/v1"
19
+ },
20
+ "status": { "enum": ["passed", "failed"] },
21
+ "caller": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["repository", "sourceSha"],
25
+ "properties": {
26
+ "repository": { "type": "string", "pattern": "^[^/]+/[^/]+$" },
27
+ "sourceSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
28
+ }
29
+ },
30
+ "invocation": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "required": [
34
+ "workflow",
35
+ "sourcePath",
36
+ "sourceLine",
37
+ "visibleSelector",
38
+ "selectorClass",
39
+ "channel",
40
+ "resolvedWorkflowSha",
41
+ "resolvedRuntimeSha"
42
+ ],
43
+ "properties": {
44
+ "workflow": {
45
+ "type": "string",
46
+ "pattern": "^\\.github/workflows/.+\\.ya?ml$"
47
+ },
48
+ "sourcePath": { "type": "string" },
49
+ "sourceLine": { "type": "integer", "minimum": 0 },
50
+ "visibleSelector": { "enum": ["", "v4", "v4-alpha"] },
51
+ "selectorClass": { "enum": ["", "floating", "rejected"] },
52
+ "channel": { "enum": ["", "stable", "alpha"] },
53
+ "resolvedWorkflowSha": {
54
+ "type": "string",
55
+ "pattern": "^[0-9a-f]{40}$"
56
+ },
57
+ "resolvedRuntimeSha": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
58
+ }
59
+ },
60
+ "contractLocks": {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "required": ["stable", "alpha"],
64
+ "properties": {
65
+ "stable": { "$ref": "#/$defs/lock" },
66
+ "alpha": { "$ref": "#/$defs/lock" }
67
+ }
68
+ },
69
+ "policy": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": ["version", "root", "scannerRoot", "sourceScanRoot"],
73
+ "properties": {
74
+ "version": { "type": "string", "minLength": 1 },
75
+ "root": { "$ref": "#/$defs/root" },
76
+ "scannerRoot": { "$ref": "#/$defs/root" },
77
+ "sourceScanRoot": { "$ref": "#/$defs/root" }
78
+ }
79
+ },
80
+ "failures": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["code", "message"],
86
+ "properties": {
87
+ "code": { "type": "string", "minLength": 1 },
88
+ "message": { "type": "string", "minLength": 1 }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "$defs": {
94
+ "root": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
95
+ "lock": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": ["path", "root"],
99
+ "properties": {
100
+ "path": { "type": "string", "minLength": 1 },
101
+ "root": { "anyOf": [{ "$ref": "#/$defs/root" }, { "const": "" }] }
102
+ }
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,235 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://buildchain.libkungfu.dev/schema/v4-runtime-ref-resume-authority-v1.schema.json",
4
+ "title": "Buildchain v4 transient runtime authorization and resume lineage evidence",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["authorizationRoot", "authorization", "lineageRoot", "lineage"],
8
+ "properties": {
9
+ "authorizationRoot": { "$ref": "#/$defs/root" },
10
+ "authorization": { "$ref": "#/$defs/authorization" },
11
+ "lineageRoot": { "$ref": "#/$defs/root" },
12
+ "lineage": { "$ref": "#/$defs/lineage" }
13
+ },
14
+ "$defs": {
15
+ "root": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
16
+ "sha": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
17
+ "token": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]*$" },
18
+ "authorization": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": [
22
+ "schemaVersion",
23
+ "contract",
24
+ "status",
25
+ "mode",
26
+ "eventName",
27
+ "repository",
28
+ "actor",
29
+ "reason",
30
+ "authorizedAt",
31
+ "source",
32
+ "request",
33
+ "runtime",
34
+ "contractLocks",
35
+ "consumerPolicyReceiptRoot",
36
+ "persistenceScanRoot"
37
+ ],
38
+ "properties": {
39
+ "schemaVersion": { "const": 1 },
40
+ "contract": {
41
+ "const": "kungfu-buildchain-v4-runtime-authorization/v1"
42
+ },
43
+ "status": { "const": "authorized" },
44
+ "mode": { "enum": ["dispatch", "resume", "rescue"] },
45
+ "eventName": { "const": "workflow_dispatch" },
46
+ "repository": { "type": "string", "minLength": 3 },
47
+ "actor": { "$ref": "#/$defs/actor" },
48
+ "reason": { "type": "string", "minLength": 1 },
49
+ "authorizedAt": {
50
+ "type": "string",
51
+ "pattern": "^(?!0000)\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$"
52
+ },
53
+ "source": { "$ref": "#/$defs/source" },
54
+ "request": { "$ref": "#/$defs/request" },
55
+ "runtime": { "$ref": "#/$defs/runtime" },
56
+ "contractLocks": { "$ref": "#/$defs/contractLocks" },
57
+ "consumerPolicyReceiptRoot": { "$ref": "#/$defs/root" },
58
+ "persistenceScanRoot": { "$ref": "#/$defs/root" }
59
+ }
60
+ },
61
+ "lineage": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": [
65
+ "schemaVersion",
66
+ "contract",
67
+ "status",
68
+ "authorizationRoot",
69
+ "source",
70
+ "consumerPolicyReceiptRoot",
71
+ "attempts",
72
+ "floatingRefMovement",
73
+ "continuation",
74
+ "stageCapsules",
75
+ "finalPublicReadbackRoot"
76
+ ],
77
+ "properties": {
78
+ "schemaVersion": { "const": 1 },
79
+ "contract": {
80
+ "const": "kungfu-buildchain-v4-runtime-resume-lineage/v1"
81
+ },
82
+ "status": { "const": "qualified" },
83
+ "authorizationRoot": { "$ref": "#/$defs/root" },
84
+ "source": { "$ref": "#/$defs/source" },
85
+ "consumerPolicyReceiptRoot": { "$ref": "#/$defs/root" },
86
+ "attempts": { "$ref": "#/$defs/attempts" },
87
+ "floatingRefMovement": { "$ref": "#/$defs/floatingRefMovement" },
88
+ "continuation": { "$ref": "#/$defs/continuation" },
89
+ "stageCapsules": { "$ref": "#/$defs/stageCapsules" },
90
+ "finalPublicReadbackRoot": { "$ref": "#/$defs/root" }
91
+ }
92
+ },
93
+ "actor": {
94
+ "type": "object",
95
+ "additionalProperties": false,
96
+ "required": ["login", "permission"],
97
+ "properties": {
98
+ "login": { "type": "string", "minLength": 1 },
99
+ "permission": { "enum": ["write", "maintain", "admin"] }
100
+ }
101
+ },
102
+ "source": {
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "required": ["sha", "treeSha"],
106
+ "properties": {
107
+ "sha": { "$ref": "#/$defs/sha" },
108
+ "treeSha": { "$ref": "#/$defs/sha" }
109
+ }
110
+ },
111
+ "request": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": ["ref", "class"],
115
+ "properties": {
116
+ "ref": { "type": "string", "minLength": 1 },
117
+ "class": { "enum": ["exact-sha", "floating", "train", "authority"] }
118
+ }
119
+ },
120
+ "readback": {
121
+ "type": "object",
122
+ "additionalProperties": false,
123
+ "required": ["ref", "sha", "containsRuntimeSha", "readbackRoot"],
124
+ "properties": {
125
+ "ref": { "type": "string", "minLength": 1 },
126
+ "sha": { "$ref": "#/$defs/sha" },
127
+ "containsRuntimeSha": { "type": "boolean" },
128
+ "readbackRoot": { "$ref": "#/$defs/root" }
129
+ }
130
+ },
131
+ "runtime": {
132
+ "type": "object",
133
+ "additionalProperties": false,
134
+ "required": ["sha", "reachableFrom"],
135
+ "properties": {
136
+ "sha": { "$ref": "#/$defs/sha" },
137
+ "reachableFrom": {
138
+ "type": "array",
139
+ "minItems": 1,
140
+ "uniqueItems": true,
141
+ "items": { "$ref": "#/$defs/readback" }
142
+ }
143
+ }
144
+ },
145
+ "contractLocks": {
146
+ "type": "object",
147
+ "additionalProperties": false,
148
+ "required": ["stableRoot", "alphaRoot"],
149
+ "properties": {
150
+ "stableRoot": { "$ref": "#/$defs/root" },
151
+ "alphaRoot": { "$ref": "#/$defs/root" }
152
+ }
153
+ },
154
+ "attempt": {
155
+ "type": "object",
156
+ "additionalProperties": false,
157
+ "required": ["id", "runtimeSha"],
158
+ "properties": {
159
+ "id": { "$ref": "#/$defs/token" },
160
+ "runtimeSha": { "$ref": "#/$defs/sha" }
161
+ }
162
+ },
163
+ "attempts": {
164
+ "type": "object",
165
+ "additionalProperties": false,
166
+ "required": ["build", "resume"],
167
+ "properties": {
168
+ "build": { "$ref": "#/$defs/attempt" },
169
+ "resume": { "$ref": "#/$defs/attempt" }
170
+ }
171
+ },
172
+ "refReadback": {
173
+ "type": "object",
174
+ "additionalProperties": false,
175
+ "required": ["ref", "sha"],
176
+ "properties": {
177
+ "ref": { "enum": ["v4", "v4-alpha"] },
178
+ "sha": { "$ref": "#/$defs/sha" }
179
+ }
180
+ },
181
+ "floatingRefMovement": {
182
+ "type": "object",
183
+ "additionalProperties": false,
184
+ "required": ["before", "after"],
185
+ "properties": {
186
+ "before": { "$ref": "#/$defs/refReadback" },
187
+ "after": { "$ref": "#/$defs/refReadback" }
188
+ }
189
+ },
190
+ "continuation": {
191
+ "type": "object",
192
+ "additionalProperties": false,
193
+ "required": ["mechanism", "rerunFailedJobs", "resumePlanRoot"],
194
+ "properties": {
195
+ "mechanism": { "const": "new-governed-attempt" },
196
+ "rerunFailedJobs": { "const": false },
197
+ "resumePlanRoot": { "$ref": "#/$defs/root" }
198
+ }
199
+ },
200
+ "capsule": {
201
+ "type": "object",
202
+ "additionalProperties": false,
203
+ "required": ["platform", "capsuleRoot", "identityRoot", "artifactDigest"],
204
+ "properties": {
205
+ "platform": { "$ref": "#/$defs/token" },
206
+ "capsuleRoot": { "$ref": "#/$defs/root" },
207
+ "identityRoot": { "$ref": "#/$defs/root" },
208
+ "artifactDigest": { "$ref": "#/$defs/root" }
209
+ }
210
+ },
211
+ "stageCapsules": {
212
+ "type": "object",
213
+ "additionalProperties": false,
214
+ "required": ["requiredPlatforms", "reused", "rebuildPlatforms"],
215
+ "properties": {
216
+ "requiredPlatforms": {
217
+ "type": "array",
218
+ "minItems": 1,
219
+ "uniqueItems": true,
220
+ "items": { "$ref": "#/$defs/token" }
221
+ },
222
+ "reused": {
223
+ "type": "array",
224
+ "uniqueItems": true,
225
+ "items": { "$ref": "#/$defs/capsule" }
226
+ },
227
+ "rebuildPlatforms": {
228
+ "type": "array",
229
+ "uniqueItems": true,
230
+ "items": { "$ref": "#/$defs/token" }
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }