@kungfu-tech/buildchain 3.0.6 → 3.0.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/actions/promote-buildchain-ref/README.md +10 -0
- package/actions/release-tail/README.md +17 -0
- package/bin/buildchain.mjs +11 -0
- package/bin/internal/command-registry.mjs +2 -0
- package/contracts/auditable-demo-scenario-v1.schema.json +1 -1
- package/contracts/engineering-housekeeper-v1.schema.json +143 -0
- package/contracts/fixtures/engineering-housekeeper-v1/cases.json +68 -0
- package/contracts/fixtures/release-tail-capabilities-v1/kungfu-alpha.json +273 -0
- package/contracts/publication-rehearsal-capsule-v1.schema.json +173 -0
- package/contracts/release-tail-capabilities-v1.schema.json +199 -0
- package/contracts/release-tail-provider-bindings-v1.schema.json +56 -0
- package/dist/site/agent-index.json +3 -0
- package/dist/site/artifact-schemas.json +6 -0
- package/dist/site/buildchain-contract.json +42 -27
- package/dist/site/buildchain-site.json +384 -33
- package/dist/site/capability-registry.json +15 -12
- package/dist/site/cli-registry.json +102 -0
- package/dist/site/controller-registry.json +19 -3
- package/dist/site/kfd-claims.json +359 -17
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +53 -7
- package/dist/site/node-api-registry.json +5882 -3605
- package/dist/site/page-registry.json +348 -21
- package/dist/site/public-surface-audit.json +396 -16
- package/dist/site/publication-authority-registry.json +106 -1
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +7 -0
- package/dist/site/schemas/publication-rehearsal-capsule-v1.schema.json +269 -0
- package/dist/site/schemas/release-tail-capabilities-v1.schema.json +353 -0
- package/dist/site/schemas/release-tail-provider-bindings-v1.schema.json +94 -0
- package/dist/site/site-manifest.json +35 -11
- package/dist/site/workflow-registry.json +204 -10
- package/docs/MAP.md +6 -2
- package/docs/auditable-demo.md +2 -2
- package/docs/cli-reference.md +136 -0
- package/docs/dev-delivery-warrant.md +49 -4
- package/docs/engineering-housekeeper.md +138 -0
- package/docs/lifecycle-protocol.md +4 -2
- package/docs/node-api-reference.md +495 -281
- package/docs/publication-rehearsal.md +94 -0
- package/docs/release-governance.md +17 -2
- package/docs/release-tail-contract.md +160 -0
- package/docs/release-tail-provider-plane.md +120 -0
- package/docs/reusable-build-surface.md +11 -0
- package/package.json +11 -3
- package/packages/core/artifact-signing.js +61 -0
- package/packages/core/buildchain-agent-manuals.js +3 -0
- package/packages/core/buildchain-config.js +66 -6
- package/packages/core/buildchain-kfd-claims.js +1 -1
- package/packages/core/buildchain-publication-authority.js +5 -0
- package/packages/core/controller-evidence.js +2 -1
- package/packages/core/dev-delivery-warrant-cancellation.js +1 -0
- package/packages/core/dev-delivery-warrant-shadow.js +502 -0
- package/packages/core/dev-delivery-warrant.js +15 -6
- package/packages/core/diagnostics.js +8 -3
- package/packages/core/engineering-housekeeper-github-client.js +222 -0
- package/packages/core/engineering-housekeeper-github.js +501 -0
- package/packages/core/engineering-housekeeper.js +259 -0
- package/packages/core/index.js +42 -0
- package/packages/core/kfd-gate.js +45 -15
- package/packages/core/paper-agent-entry.js +11 -5
- package/packages/core/paper-repository.js +1 -0
- package/packages/core/paper-scaffold-content.js +21 -0
- package/packages/core/paper.js +28 -2
- package/packages/core/publication-rehearsal-projection.js +173 -0
- package/packages/core/publication-rehearsal-runtime.js +921 -0
- package/packages/core/release-passport.js +130 -20
- package/packages/core/release-tail-compatibility.js +60 -0
- package/packages/core/release-tail-provider-adapters.js +461 -0
- package/packages/core/release-tail-provider-plane.js +1228 -0
- package/scripts/assemble-publication-artifact-admission.mjs +1 -1
- package/scripts/assemble-self-publication-admission.mjs +2 -2
- package/scripts/audit-publication-control-plane.mjs +1 -1
- package/scripts/auditable-demo-bundle-verification.mjs +2 -3
- package/scripts/auditable-demo-platform.mjs +2 -2
- package/scripts/auditable-demo-renditions.mjs +1 -1
- package/scripts/auditable-demo.mjs +2 -2
- package/scripts/build-contract-core.mjs +8 -3
- package/scripts/build-standalone-binary.mjs +14 -3
- package/scripts/buildchain-cli-help.mjs +13 -0
- package/scripts/check-core-mechanism-inventory.mjs +347 -0
- package/scripts/check-inventory.mjs +10 -8
- package/scripts/check-maintainability.mjs +9 -2
- package/scripts/check-release-tail-contract.mjs +435 -0
- package/scripts/dev-delivery-warrant.mjs +31 -4
- package/scripts/dev-pr-auto-merge.mjs +30 -4
- package/scripts/dev-pr-delivery-warrant.mjs +50 -0
- package/scripts/engineering-housekeeper-workflow.mjs +394 -0
- package/scripts/generate-channel-promotion-workflow.mjs +10 -8
- package/scripts/generate-site-bundle.mjs +47 -4
- package/scripts/init-repo.mjs +26 -2
- package/scripts/inspect-artifact-signing-requests.mjs +6 -0
- package/scripts/materialize-self-release-candidate-version.mjs +137 -0
- package/scripts/publication-commit-evidence.mjs +69 -23
- package/scripts/release-candidate-resolver.mjs +16 -10
- package/scripts/release-tail.mjs +159 -0
- package/scripts/resume-from-candidate-run.mjs +123 -9
- package/scripts/seal-artifact-signing-requests.mjs +6 -0
- package/scripts/site-capability-metadata.mjs +13 -0
- package/scripts/v4-architecture.mjs +600 -0
- package/scripts/web-surface-core.mjs +8 -2
- package/scripts/workflow-call-contract.mjs +184 -5
|
@@ -4,13 +4,170 @@ import path from "node:path";
|
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import { evaluateWorkflowCallContract } from "../packages/core/workflow-call-contract.js";
|
|
7
|
+
import { parseWorkflowDocument } from "../packages/core/workflow-yaml-contract.js";
|
|
8
|
+
|
|
9
|
+
export const SELF_RELEASE_REF = "769b221bad7a6b9104afad4c2628d9dca396ab0f";
|
|
10
|
+
export const SELF_RELEASE_PUBLIC_WORKFLOW = `kungfu-systems/buildchain/.github/workflows/release-candidate-promote.yml@${SELF_RELEASE_REF}`;
|
|
11
|
+
|
|
12
|
+
function parityFailure(message) {
|
|
13
|
+
throw new Error(`self-release route parity: ${message}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function literal(job, name) {
|
|
17
|
+
const value = job?.with?.[name];
|
|
18
|
+
if (!value || value.kind === "expression") {
|
|
19
|
+
parityFailure(`${job?.id || "<missing>"}.${name} must be a literal`);
|
|
20
|
+
}
|
|
21
|
+
return value.value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function selfReleaseRouteIdentity(workflowText, jobId = "promote") {
|
|
25
|
+
const job = parseWorkflowDocument(workflowText).callJobs.find(
|
|
26
|
+
(entry) => entry.id === jobId,
|
|
27
|
+
);
|
|
28
|
+
if (!job) parityFailure(`reusable workflow job is missing: ${jobId}`);
|
|
29
|
+
if (
|
|
30
|
+
job.uses.startsWith("./") ||
|
|
31
|
+
job.uses.includes("/.release-candidate-promote.yml@")
|
|
32
|
+
) {
|
|
33
|
+
parityFailure(
|
|
34
|
+
`authoritative caller uses an internal or checkout-relative route: ${job.uses}`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if (job.uses !== SELF_RELEASE_PUBLIC_WORKFLOW) {
|
|
38
|
+
parityFailure(
|
|
39
|
+
`caller uses ${job.uses}, expected ${SELF_RELEASE_PUBLIC_WORKFLOW}`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
if (literal(job, "buildchain-ref") !== SELF_RELEASE_REF) {
|
|
43
|
+
parityFailure("caller runtime ref differs from the public workflow ref");
|
|
44
|
+
}
|
|
45
|
+
if (literal(job, "declarative-release-tail") !== true) {
|
|
46
|
+
parityFailure(
|
|
47
|
+
"caller does not require the declarative release-tail provider plane",
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
publicWorkflow: job.uses,
|
|
52
|
+
runtimeRef: SELF_RELEASE_REF,
|
|
53
|
+
declarationContract: "kungfu-buildchain-release-tail-capabilities/v1",
|
|
54
|
+
declarationCompiler:
|
|
55
|
+
"packages/core/release-tail-provider-plane.js#compileReleaseTailDeclaration",
|
|
56
|
+
transaction:
|
|
57
|
+
"packages/core/release-tail-provider-plane.js#executeReleaseTailTransaction",
|
|
58
|
+
providerAdapter:
|
|
59
|
+
"packages/core/release-tail-provider-adapters.js#createGitHubReleaseAssetsAdapter",
|
|
60
|
+
receiptValidator:
|
|
61
|
+
"packages/core/release-tail-provider-plane.js#validateReleaseTailTransaction",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function assertSelfReleaseRouteParity({
|
|
66
|
+
selfWorkflowText,
|
|
67
|
+
consumerWorkflowText,
|
|
68
|
+
routing,
|
|
69
|
+
publicWorkflowText,
|
|
70
|
+
advancedWorkflowText,
|
|
71
|
+
actionText,
|
|
72
|
+
providerPlanText,
|
|
73
|
+
} = {}) {
|
|
74
|
+
const self = selfReleaseRouteIdentity(selfWorkflowText);
|
|
75
|
+
const consumer = selfReleaseRouteIdentity(consumerWorkflowText);
|
|
76
|
+
if (JSON.stringify(self) !== JSON.stringify(consumer)) {
|
|
77
|
+
parityFailure(
|
|
78
|
+
"Buildchain self-release and representative consumer identities differ",
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
const alphaShellRef = routing?.alpha?.callRef;
|
|
82
|
+
if (alphaShellRef !== "train/v3/v3.0/consumer-equivalent-self-dogfood") {
|
|
83
|
+
parityFailure(
|
|
84
|
+
"alpha workflow shell does not resolve through the self-dogfood train",
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
for (const required of [
|
|
88
|
+
"uses: kungfu-systems/buildchain/.github/workflows/.release-candidate-promote.yml@train/v3/v3.0/consumer-equivalent-self-dogfood",
|
|
89
|
+
"declarative-release-tail: ${{ inputs.declarative-release-tail }}",
|
|
90
|
+
]) {
|
|
91
|
+
if (!publicWorkflowText.includes(required)) {
|
|
92
|
+
parityFailure(`public router is missing: ${required}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const required of [
|
|
96
|
+
"declarative-release-tail:",
|
|
97
|
+
"declarative-release-tail: ${{ inputs.declarative-release-tail }}",
|
|
98
|
+
"release-tail-transaction-root:",
|
|
99
|
+
]) {
|
|
100
|
+
if (!advancedWorkflowText.includes(required)) {
|
|
101
|
+
parityFailure(`advanced workflow shell is missing: ${required}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (const required of [
|
|
105
|
+
"executeReleaseTailTransaction",
|
|
106
|
+
"createGitHubReleaseAssetsAdapter",
|
|
107
|
+
"publishDeclarativeGitHubReleaseEvidence",
|
|
108
|
+
]) {
|
|
109
|
+
if (!actionText.includes(required)) {
|
|
110
|
+
parityFailure(
|
|
111
|
+
`promotion action is missing provider-plane identity: ${required}`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const required of [
|
|
116
|
+
"compileReleaseTailDeclaration",
|
|
117
|
+
"githubReleaseAssetsTargetRoot",
|
|
118
|
+
"createDeclarativeGitHubReleasePlan",
|
|
119
|
+
]) {
|
|
120
|
+
if (!providerPlanText.includes(required)) {
|
|
121
|
+
parityFailure(`declarative GitHub Release plan is missing: ${required}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
schema: "kungfu.buildchain.self-release-route-parity/v1",
|
|
126
|
+
ok: true,
|
|
127
|
+
self,
|
|
128
|
+
consumer,
|
|
129
|
+
workflowShellRef: routing.alpha.callRef,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function checkSelfReleaseRouteParity({ root, observed = {} } = {}) {
|
|
134
|
+
const read = (relative) => fs.readFileSync(path.join(root, relative), "utf8");
|
|
135
|
+
const report = assertSelfReleaseRouteParity({
|
|
136
|
+
selfWorkflowText: read(".github/workflows/buildchain-ref-promotion.yml"),
|
|
137
|
+
consumerWorkflowText: read(
|
|
138
|
+
"tests/fixtures/self-release-route/external-consumer.yml",
|
|
139
|
+
),
|
|
140
|
+
routing: JSON.parse(read(".buildchain/promotion-shell-routing.json")),
|
|
141
|
+
publicWorkflowText: read(".github/workflows/release-candidate-promote.yml"),
|
|
142
|
+
advancedWorkflowText: read(
|
|
143
|
+
".github/workflows/.release-candidate-promote.yml",
|
|
144
|
+
),
|
|
145
|
+
actionText: `${read("actions/promote-buildchain-ref/index.js")}\n${read("actions/promote-buildchain-ref/github-release.js")}`,
|
|
146
|
+
providerPlanText: read("actions/promote-buildchain-ref/github-release.js"),
|
|
147
|
+
});
|
|
148
|
+
const rootPattern = /^sha256:[0-9a-f]{64}$/u;
|
|
149
|
+
const shaPattern = /^[0-9a-f]{40}$/u;
|
|
150
|
+
for (const [name, value] of Object.entries(observed)) {
|
|
151
|
+
if (!value) continue;
|
|
152
|
+
const valid =
|
|
153
|
+
name === "runtimeSha" ? shaPattern.test(value) : rootPattern.test(value);
|
|
154
|
+
if (!valid)
|
|
155
|
+
parityFailure(`observed ${name} is not an exact rooted identity`);
|
|
156
|
+
}
|
|
157
|
+
return { ...report, observed };
|
|
158
|
+
}
|
|
7
159
|
|
|
8
160
|
function usage() {
|
|
9
|
-
return `usage:
|
|
161
|
+
return `usage:
|
|
162
|
+
node scripts/workflow-call-contract.mjs check \\
|
|
10
163
|
--caller-workflow <path> --job <id> --caller-repository <owner/repo> \\
|
|
11
164
|
--callee-root <checkout> --callee-workflow <path> --callee-repository <owner/repo> \\
|
|
12
165
|
--trusted-event <event[:type]> [--trusted-event ...] \\
|
|
13
|
-
[--expected-contract-root sha256:...] [--allow-dirty] [--output <path>]
|
|
166
|
+
[--expected-contract-root sha256:...] [--allow-dirty] [--output <path>]
|
|
167
|
+
node scripts/workflow-call-contract.mjs self-release-parity \\
|
|
168
|
+
[--root <checkout>] [--runtime-sha <sha>] [--contract-root <root>] \\
|
|
169
|
+
[--release-tail-declaration-root <root>] [--release-tail-transaction-root <root>] \\
|
|
170
|
+
[--release-tail-state-root <root>] [--output <path>]`;
|
|
14
171
|
}
|
|
15
172
|
|
|
16
173
|
function parseArgs(argv) {
|
|
@@ -21,7 +178,7 @@ function parseArgs(argv) {
|
|
|
21
178
|
options.allowDirty = true;
|
|
22
179
|
continue;
|
|
23
180
|
}
|
|
24
|
-
if (!arg.startsWith("--") ||
|
|
181
|
+
if (!arg.startsWith("--") || index + 1 >= argv.length)
|
|
25
182
|
throw new Error(`invalid argument: ${arg}`);
|
|
26
183
|
const value = argv[index + 1];
|
|
27
184
|
index += 1;
|
|
@@ -67,7 +224,9 @@ export function checkWorkflowCall(options) {
|
|
|
67
224
|
"--untracked-files=no",
|
|
68
225
|
);
|
|
69
226
|
if (calleeStatus) {
|
|
70
|
-
throw new Error(
|
|
227
|
+
throw new Error(
|
|
228
|
+
"callee checkout is dirty; exact pinned-ref bytes are required",
|
|
229
|
+
);
|
|
71
230
|
}
|
|
72
231
|
const callerSha = git(callerRoot, "rev-parse", "HEAD");
|
|
73
232
|
const callerTree = git(callerRoot, "rev-parse", "HEAD^{tree}");
|
|
@@ -103,8 +262,28 @@ export function checkWorkflowCall(options) {
|
|
|
103
262
|
|
|
104
263
|
function main(argv = process.argv.slice(2)) {
|
|
105
264
|
const command = argv.shift();
|
|
106
|
-
if (command !== "check") throw new Error(usage());
|
|
107
265
|
const options = parseArgs(argv);
|
|
266
|
+
if (command === "self-release-parity") {
|
|
267
|
+
const root = options.root ? path.resolve(options.root) : process.cwd();
|
|
268
|
+
const report = checkSelfReleaseRouteParity({
|
|
269
|
+
root,
|
|
270
|
+
observed: {
|
|
271
|
+
runtimeSha: options.runtimeSha || "",
|
|
272
|
+
contractRoot: options.contractRoot || "",
|
|
273
|
+
releaseTailDeclarationRoot: options.releaseTailDeclarationRoot || "",
|
|
274
|
+
releaseTailTransactionRoot: options.releaseTailTransactionRoot || "",
|
|
275
|
+
releaseTailStateRoot: options.releaseTailStateRoot || "",
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
if (options.output) {
|
|
279
|
+
const output = path.resolve(root, options.output);
|
|
280
|
+
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
281
|
+
fs.writeFileSync(output, `${JSON.stringify(report, null, 2)}\n`);
|
|
282
|
+
}
|
|
283
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (command !== "check") throw new Error(usage());
|
|
108
287
|
required(options, [
|
|
109
288
|
"callerWorkflow",
|
|
110
289
|
"job",
|