@kungfu-tech/buildchain 4.0.1-alpha.0 → 4.0.1-alpha.3
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/AGENTS.md +13 -5
- package/actions/promote-buildchain-ref/README.md +11 -6
- package/architecture/decisions/0003-two-phase-delivery-warrant.md +152 -0
- package/architecture/internal-capabilities.json +105 -2
- package/architecture/maintainability-policy.json +218 -19
- package/architecture/v3-core-mechanism-inventory.json +2 -0
- package/architecture/v4-delivery-authority-parity.json +250 -0
- package/architecture/v4-delivery-warrant-shadow-fixtures.json +29 -6
- package/architecture/v4-floating-consumer-policy.json +75 -0
- package/architecture/v4-floating-consumer-policy.md +32 -0
- package/architecture/v4-runtime-ref-resume-authority.json +64 -0
- package/architecture/v4-stage-capsule-qualification.json +2 -2
- package/bin/buildchain.mjs +9 -1
- package/bin/internal/trust-release-release-handlers.mjs +5 -0
- package/contracts/dev-delivery-authority-v2.schema.json +662 -0
- package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +53 -0
- package/contracts/fixtures/v4-runtime-ref-resume-authority-v1/scenario.json +15 -0
- package/contracts/v4-floating-consumer-policy-receipt-v1.schema.json +105 -0
- package/contracts/v4-runtime-ref-resume-authority-v1.schema.json +235 -0
- package/dist/site/agent-index.json +1 -0
- package/dist/site/artifact-schemas.json +2 -0
- package/dist/site/buildchain-contract.json +186 -33
- package/dist/site/buildchain-site.json +229 -32
- package/dist/site/capability-registry.json +3 -3
- package/dist/site/cli-registry.json +46 -2
- package/dist/site/controller-registry.json +62 -6
- package/dist/site/kfd-claims.json +105 -16
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +7 -7
- package/dist/site/node-api-registry.json +7491 -5290
- package/dist/site/page-registry.json +218 -21
- package/dist/site/public-surface-audit.json +412 -20
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +4 -0
- package/dist/site/schemas/dev-delivery-authority-v2.schema.json +662 -0
- package/dist/site/site-manifest.json +11 -11
- package/dist/site/workflow-registry.json +63 -19
- package/docs/MAP.md +3 -0
- package/docs/cli-reference.md +211 -13
- package/docs/dev-delivery-qualification-landing-adr.md +251 -0
- package/docs/dev-delivery-warrant.md +336 -30
- package/docs/lifecycle-protocol.md +41 -0
- package/docs/node-api-reference.md +319 -186
- package/docs/reusable-build-surface.md +41 -0
- package/docs/runtime-train-validation.md +10 -0
- package/docs/v4-runtime-ref-resume-authority.md +69 -0
- package/docs/versioning.md +1 -0
- package/package.json +10 -4
- package/packages/core/artifact-signing.js +61 -0
- package/packages/core/buildchain-config.js +66 -1
- package/packages/core/buildchain-contract.js +3 -2
- package/packages/core/dev-delivery-authority-candidate.js +270 -0
- package/packages/core/dev-delivery-authority-evidence.js +146 -0
- package/packages/core/dev-delivery-authority-landing.js +461 -0
- package/packages/core/dev-delivery-authority-observation.js +48 -0
- package/packages/core/dev-delivery-authority-qualification.js +591 -0
- package/packages/core/dev-delivery-authority-settlement.js +213 -0
- package/packages/core/dev-delivery-authority-state.js +583 -0
- package/packages/core/dev-delivery-candidate-identity.js +13 -0
- package/packages/core/dev-delivery-contract-surface.js +76 -0
- package/packages/core/dev-delivery-execution-failure.js +133 -0
- package/packages/core/dev-delivery-execution-transfer.js +572 -0
- package/packages/core/dev-delivery-landing-admission-core.js +119 -0
- package/packages/core/dev-delivery-landing-readback.js +598 -0
- package/packages/core/dev-delivery-landing-terminal-evidence.js +271 -0
- package/packages/core/dev-delivery-landing-testing-port.js +6 -0
- package/packages/core/dev-delivery-native-execution.js +110 -0
- package/packages/core/dev-delivery-native-proof.js +546 -0
- package/packages/core/dev-delivery-process-boundary.js +551 -0
- package/packages/core/dev-delivery-proof.js +37 -3
- package/packages/core/dev-delivery-provider-attempt.js +127 -0
- package/packages/core/dev-delivery-provider-heartbeat.js +370 -0
- package/packages/core/dev-delivery-warrant-cancellation.js +1 -0
- package/packages/core/dev-delivery-warrant-qualification.js +145 -0
- package/packages/core/dev-delivery-warrant-settlement.js +237 -36
- package/packages/core/dev-delivery-warrant-state.js +565 -0
- package/packages/core/dev-delivery-warrant.js +320 -368
- package/packages/core/index.js +2 -0
- package/packages/core/publication-authority.js +5 -5
- package/packages/core/release-candidate.js +79 -19
- package/packages/core/release-passport.js +239 -33
- package/packages/core/v4-floating-consumer-evidence.js +324 -0
- package/packages/core/v4-floating-consumer-policy.js +446 -0
- package/packages/core/v4-floating-consumer-release-passport.js +126 -0
- package/packages/core/v4-runtime-ref-resume-authority.js +625 -0
- package/packages/core/v4-runtime-selector-persistence.js +228 -0
- package/packages/core/workflow-yaml-contract.js +48 -0
- package/scripts/audit-publication-control-plane.mjs +31 -31
- package/scripts/buildchain-cli-help.mjs +11 -2
- package/scripts/check-inventory.mjs +1 -1
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +198 -0
- package/scripts/check-v4-public-dogfood-contract.mjs +6 -11
- package/scripts/dev-delivery-authority-command-adapters.mjs +206 -0
- package/scripts/dev-delivery-authority-provider.mjs +28 -0
- package/scripts/dev-delivery-authority.mjs +490 -0
- package/scripts/dev-delivery-native-run.mjs +177 -0
- package/scripts/dev-delivery-process-boundary.mjs +260 -0
- package/scripts/dev-delivery-proof.mjs +67 -2
- package/scripts/dev-delivery-provider-heartbeat.mjs +215 -0
- package/scripts/dev-delivery-source-proof-reuse.mjs +631 -0
- package/scripts/dev-delivery-two-phase-resume.mjs +345 -0
- package/scripts/dev-delivery-two-phase.mjs +573 -0
- package/scripts/dev-delivery-warrant-options.mjs +266 -0
- package/scripts/dev-delivery-warrant-store.mjs +227 -0
- package/scripts/dev-delivery-warrant.mjs +227 -193
- package/scripts/dev-pr-auto-merge.mjs +37 -48
- package/scripts/dev-pr-delivery-warrant.mjs +215 -2
- package/scripts/dev-pr-prequeue-guard.mjs +399 -0
- package/scripts/ensure-github-release.mjs +3 -3
- package/scripts/generate-channel-build-workflow.mjs +3 -0
- package/scripts/generate-channel-promotion-workflow.mjs +112 -12
- package/scripts/generate-release-candidate-passport.mjs +41 -33
- package/scripts/generate-site-bundle.mjs +26 -4
- package/scripts/init-repo.mjs +5 -1
- package/scripts/inspect-artifact-signing-requests.mjs +6 -0
- package/scripts/npm-publish-transaction.mjs +103 -91
- package/scripts/resume-from-candidate-run.mjs +11 -14
- package/scripts/seal-artifact-signing-requests.mjs +6 -0
- package/scripts/site-capability-metadata.mjs +14 -0
- package/scripts/v4-consumer-policy.mjs +231 -0
- package/templates/native-dev-delivery.yml +141 -0
|
@@ -10,9 +10,7 @@ const DEFAULT_ROOT = path.resolve(
|
|
|
10
10
|
);
|
|
11
11
|
const CALLER_PATH = ".github/workflows/v4-public-consumer-dogfood.yml";
|
|
12
12
|
const REUSABLE_PATH = ".github/workflows/v4-stage-capsule-canary.yml";
|
|
13
|
-
export const
|
|
14
|
-
"train/v4/v4.0/public-consumer-self-dogfood";
|
|
15
|
-
const EXACT_SHA = /^[0-9a-f]{40}$/u;
|
|
13
|
+
export const V4_PUBLIC_DOGFOOD_ALPHA_REF = "v4-alpha";
|
|
16
14
|
const PRIVATE_CONSUMER = ["buildchain", "self", "dogfood"].join("-");
|
|
17
15
|
const PRIVATE_SHADOW = ["kungfu", "shadow"].join("-");
|
|
18
16
|
|
|
@@ -139,13 +137,8 @@ function assertArchitecture(root) {
|
|
|
139
137
|
);
|
|
140
138
|
const dogfood = architecture.publicConsumerDogfood;
|
|
141
139
|
const validationRef = dogfood?.validationRef;
|
|
142
|
-
if (
|
|
143
|
-
validationRef
|
|
144
|
-
!EXACT_SHA.test(String(validationRef))
|
|
145
|
-
)
|
|
146
|
-
fail(
|
|
147
|
-
"architecture validationRef must be the exact public train or a protected commit SHA",
|
|
148
|
-
);
|
|
140
|
+
if (validationRef !== V4_PUBLIC_DOGFOOD_ALPHA_REF)
|
|
141
|
+
fail("architecture validationRef must use the floating v4-alpha channel");
|
|
149
142
|
const caller = read(root, CALLER_PATH);
|
|
150
143
|
if (caller !== expectedV4PublicDogfoodWorkflow(validationRef))
|
|
151
144
|
fail(`${CALLER_PATH} must remain the exact thin public consumer caller`);
|
|
@@ -168,7 +161,7 @@ function assertArchitecture(root) {
|
|
|
168
161
|
dogfood.relativeOrSelfInvocationAllowed !== false ||
|
|
169
162
|
dogfood.directQualificationInvocationAllowed !== false ||
|
|
170
163
|
dogfood.candidateBranchOverrideAllowed !== false ||
|
|
171
|
-
dogfood.recursionRecovery !== "
|
|
164
|
+
dogfood.recursionRecovery !== "floating-selector-with-trusted-runtime-input"
|
|
172
165
|
)
|
|
173
166
|
fail(
|
|
174
167
|
"architecture publicConsumerDogfood contract is incomplete or widened",
|
|
@@ -226,6 +219,8 @@ function assertPolicySources(root) {
|
|
|
226
219
|
"No agent may add or restore a relative/self reusable-workflow call",
|
|
227
220
|
"never solve recursion with an internal exception",
|
|
228
221
|
"scripts/check-v4-public-dogfood-contract.mjs",
|
|
222
|
+
"source-persisted exact commit SHA",
|
|
223
|
+
"v4-alpha",
|
|
229
224
|
])
|
|
230
225
|
if (!agents.includes(invariant))
|
|
231
226
|
fail(`AGENTS.md is missing invariant: ${invariant}`);
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
acquireDevDeliveryLandingWarrant,
|
|
5
|
+
acquireDevDeliveryQualificationLease,
|
|
6
|
+
admitDevDeliveryMergeGroup,
|
|
7
|
+
completeDevDeliveryQualification,
|
|
8
|
+
heartbeatDevDeliveryLandingWarrantWithGitHubProvider,
|
|
9
|
+
heartbeatDevDeliveryQualificationLease,
|
|
10
|
+
migrateDevDeliveryAuthorityState,
|
|
11
|
+
observeDevDeliveryAuthorityState,
|
|
12
|
+
recoverDevDeliveryAuthority,
|
|
13
|
+
submitDevDeliveryAuthorityCandidate,
|
|
14
|
+
} from "../packages/core/dev-delivery-authority-landing.js";
|
|
15
|
+
import { createNativeCommandContract } from "../packages/core/dev-delivery-warrant.js";
|
|
16
|
+
import { settleDevDeliveryAuthorityWithProvider } from "./dev-delivery-authority-provider.mjs";
|
|
17
|
+
|
|
18
|
+
function identity(options) {
|
|
19
|
+
return {
|
|
20
|
+
candidateId: options.candidateId,
|
|
21
|
+
token: options.authorityToken,
|
|
22
|
+
generation: options.authorityGeneration,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function rootedList(value) {
|
|
27
|
+
if (Array.isArray(value)) return value;
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = JSON.parse(value || "[]");
|
|
31
|
+
} catch (cause) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`qualification domains must be a JSON array: ${cause.message}`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
if (!Array.isArray(parsed))
|
|
37
|
+
throw new Error("qualification domains must be a JSON array");
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function migrateAuthority(state, options) {
|
|
42
|
+
if (!options.migrationSource?.exists) {
|
|
43
|
+
throw new Error("migrate requires the live v1 authority state ref");
|
|
44
|
+
}
|
|
45
|
+
return migrateDevDeliveryAuthorityState(options.migrationSource.queue, {
|
|
46
|
+
now: options.now,
|
|
47
|
+
policy: options.authorityPolicy,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function submitCandidate(state, options) {
|
|
52
|
+
const nativeCommandContract = options.environmentRoot
|
|
53
|
+
? options.nativeCommandContract ||
|
|
54
|
+
createNativeCommandContract(options.nativeCommand)
|
|
55
|
+
: undefined;
|
|
56
|
+
if (
|
|
57
|
+
options.nativeCommandRoot &&
|
|
58
|
+
nativeCommandContract?.commandRoot !== options.nativeCommandRoot
|
|
59
|
+
) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
"native command contract root does not match native-command",
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return submitDevDeliveryAuthorityCandidate(
|
|
65
|
+
state,
|
|
66
|
+
{
|
|
67
|
+
pullRequestNumber: options.pullRequestNumber,
|
|
68
|
+
sourceHead: options.sourceHead,
|
|
69
|
+
assignmentRoot: options.assignmentRoot,
|
|
70
|
+
initiativeRoot: options.initiativeRoot,
|
|
71
|
+
sourceIdentityRoot: options.sourceIdentityRoot,
|
|
72
|
+
sourcePatchRoot: options.sourcePatchRoot,
|
|
73
|
+
sourceProofRoot: options.sourceProofRoot,
|
|
74
|
+
planRoot: options.planRoot,
|
|
75
|
+
closureRoot: options.closureRoot,
|
|
76
|
+
dependencyRoot: options.dependencyRoot,
|
|
77
|
+
toolchainRoot: options.toolchainRoot,
|
|
78
|
+
environmentRoot: options.environmentRoot,
|
|
79
|
+
nativeCommandContract,
|
|
80
|
+
affectedPaths: rootedList(options.affectedPaths),
|
|
81
|
+
shardEvidenceRoots: rootedList(options.shardEvidenceRoots),
|
|
82
|
+
deliveryClass: options.deliveryClass,
|
|
83
|
+
qualificationDomains: rootedList(options.qualificationDomains),
|
|
84
|
+
},
|
|
85
|
+
{ now: options.now },
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const commandAdapters = {
|
|
90
|
+
migrate: migrateAuthority,
|
|
91
|
+
submit: submitCandidate,
|
|
92
|
+
"lease-qualification": (state, options) =>
|
|
93
|
+
acquireDevDeliveryQualificationLease(state, {
|
|
94
|
+
now: options.now,
|
|
95
|
+
leaseSeconds: options.leaseSeconds,
|
|
96
|
+
}),
|
|
97
|
+
"complete-qualification": (state, options) =>
|
|
98
|
+
completeDevDeliveryQualification(state, identity(options), {
|
|
99
|
+
sourceProof: options.sourceProof,
|
|
100
|
+
nativeProof: options.nativeProof,
|
|
101
|
+
qualificationContract: options.qualificationContract,
|
|
102
|
+
now: options.now,
|
|
103
|
+
}),
|
|
104
|
+
"heartbeat-qualification": (state, options) =>
|
|
105
|
+
heartbeatDevDeliveryQualificationLease(state, identity(options), {
|
|
106
|
+
now: options.now,
|
|
107
|
+
leaseSeconds: options.leaseSeconds,
|
|
108
|
+
}),
|
|
109
|
+
"lease-landing": (state, options) =>
|
|
110
|
+
acquireDevDeliveryLandingWarrant(state, {
|
|
111
|
+
now: options.now,
|
|
112
|
+
leaseSeconds: options.leaseSeconds,
|
|
113
|
+
}),
|
|
114
|
+
"heartbeat-landing": (state, options) =>
|
|
115
|
+
heartbeatDevDeliveryLandingWarrantWithGitHubProvider(
|
|
116
|
+
state,
|
|
117
|
+
identity(options),
|
|
118
|
+
{
|
|
119
|
+
providerAttempt: options.providerAttempt,
|
|
120
|
+
token: options.token || process.env.GITHUB_TOKEN,
|
|
121
|
+
apiUrl:
|
|
122
|
+
options.apiUrl ||
|
|
123
|
+
process.env.GITHUB_API_URL ||
|
|
124
|
+
"https://api.github.com",
|
|
125
|
+
now: options.now,
|
|
126
|
+
leaseSeconds: options.leaseSeconds,
|
|
127
|
+
},
|
|
128
|
+
),
|
|
129
|
+
recover: (state, options) =>
|
|
130
|
+
recoverDevDeliveryAuthority(state, { now: options.now }),
|
|
131
|
+
"admit-merge-group": (state, options) =>
|
|
132
|
+
admitDevDeliveryMergeGroup(state, identity(options), {
|
|
133
|
+
mergeGroupHead: options.mergeGroupHead,
|
|
134
|
+
providerRunId: options.providerRunId,
|
|
135
|
+
providerRunAttempt: options.providerRunAttempt,
|
|
136
|
+
token: options.token || process.env.GITHUB_TOKEN,
|
|
137
|
+
apiUrl:
|
|
138
|
+
options.apiUrl ||
|
|
139
|
+
process.env.GITHUB_API_URL ||
|
|
140
|
+
"https://api.github.com",
|
|
141
|
+
now: options.now,
|
|
142
|
+
}),
|
|
143
|
+
settle: settleDevDeliveryAuthorityWithProvider,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
function readCommandDocuments(options) {
|
|
147
|
+
for (const [field, file] of [
|
|
148
|
+
["sourceProof", options.sourceProofPath],
|
|
149
|
+
["nativeProof", options.nativeProofPath],
|
|
150
|
+
["qualificationContract", options.qualificationContractPath],
|
|
151
|
+
["providerAttempt", options.providerAttemptPath],
|
|
152
|
+
]) {
|
|
153
|
+
if (file)
|
|
154
|
+
options[field] = JSON.parse(fs.readFileSync(path.resolve(file), "utf8"));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export async function runDevDeliveryAuthorityCommandAdapter(loaded, options) {
|
|
159
|
+
const loadedV2 =
|
|
160
|
+
loaded.exists &&
|
|
161
|
+
loaded.queue?.contract === "kungfu-buildchain-dev-delivery-authority" &&
|
|
162
|
+
Number(loaded.queue?.schemaVersion) === 2;
|
|
163
|
+
if (options.command === "migrate" && loadedV2) {
|
|
164
|
+
throw new Error("migration target state ref already exists");
|
|
165
|
+
}
|
|
166
|
+
if (options.command !== "migrate" && !loadedV2) {
|
|
167
|
+
throw new Error(
|
|
168
|
+
"v2 authority state is missing; explicitly migrate the exact current v1 state before mutation",
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
if (
|
|
172
|
+
options.expectedOldStateRoot &&
|
|
173
|
+
loaded.queue.stateRoot !== options.expectedOldStateRoot
|
|
174
|
+
) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`expected-old state drift: ${loaded.queue.stateRoot} != ${options.expectedOldStateRoot}`,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
if (options.command === "observe") {
|
|
180
|
+
return {
|
|
181
|
+
result: {
|
|
182
|
+
schema: "kungfu.buildchain.dev-delivery-authority-command-result/v1",
|
|
183
|
+
ok: true,
|
|
184
|
+
mode: "observe",
|
|
185
|
+
stateRef: options.stateRef,
|
|
186
|
+
stateCommit: loaded.commitSha,
|
|
187
|
+
observation: observeDevDeliveryAuthorityState(loaded.queue, {
|
|
188
|
+
now: options.now,
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
readCommandDocuments(options);
|
|
194
|
+
if (options.command === "heartbeat-landing" && !options.providerAttempt) {
|
|
195
|
+
throw new Error(
|
|
196
|
+
"heartbeat-landing requires --provider-attempt with the exact persisted admitted attempt",
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
const adapter = commandAdapters[options.command];
|
|
200
|
+
if (!adapter) {
|
|
201
|
+
throw new Error(
|
|
202
|
+
`unsupported dev authority command ${options.command || "<empty>"}`,
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
return { changed: await adapter(loaded.queue, options) };
|
|
206
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { settleDevDeliveryAuthorityCandidateWithGitHubProvider } from "../packages/core/dev-delivery-authority-landing.js";
|
|
2
|
+
|
|
3
|
+
export function settleDevDeliveryAuthorityWithProvider(state, options) {
|
|
4
|
+
return settleDevDeliveryAuthorityCandidateWithGitHubProvider(
|
|
5
|
+
state,
|
|
6
|
+
{
|
|
7
|
+
pullRequestNumber: options.pullRequestNumber,
|
|
8
|
+
sourceHead: options.sourceHead,
|
|
9
|
+
outcome: options.outcome,
|
|
10
|
+
evidenceRoot: options.evidenceRoot,
|
|
11
|
+
reason: options.reason,
|
|
12
|
+
authorityToken: options.authorityToken,
|
|
13
|
+
authorityGeneration: options.authorityGeneration,
|
|
14
|
+
transferRoot: options.transferRoot,
|
|
15
|
+
finalizerBoundaryRoot: options.finalizerBoundaryRoot,
|
|
16
|
+
nativeJobId: options.nativeJobId,
|
|
17
|
+
sealJobId: options.sealJobId,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
now: options.now,
|
|
21
|
+
token: options.token || process.env.GITHUB_TOKEN,
|
|
22
|
+
apiUrl:
|
|
23
|
+
options.apiUrl ||
|
|
24
|
+
process.env.GITHUB_API_URL ||
|
|
25
|
+
"https://api.github.com",
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
}
|