@kungfu-tech/buildchain 4.0.1-alpha.4 → 4.0.1-alpha.6
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/actions/release-tail/README.md +8 -0
- package/architecture/decisions/0002-next-development-transition.md +101 -0
- package/architecture/internal-capabilities.json +117 -8
- package/architecture/maintainability-policy.json +38 -20
- package/architecture/release-tail-contract-inventory.json +5 -2
- package/architecture/v3-core-mechanism-inventory.json +89 -0
- package/architecture/v4-adopter-delivery-parity.json +32 -5
- package/architecture/v4-capability-state-machine-manifest.json +73 -0
- package/architecture/v4-compatibility-facts-parity.json +77 -0
- package/architecture/v4-next-development-parity.json +192 -0
- package/architecture/v4-publication-rehearsal-parity.json +84 -0
- package/architecture/v4-release-train-parity.json +1 -0
- package/architecture/v4-tail-reseal-parity.json +150 -0
- package/bin/buildchain.mjs +23 -2
- package/bin/internal/adopter-delivery-cli.mjs +70 -0
- package/bin/internal/command-registry.mjs +3 -0
- package/bin/internal/compatibility-facts-cli.mjs +101 -0
- package/contracts/fixtures/next-development-transition-v1/anchored-manual-waiting.json +47 -0
- package/contracts/fixtures/next-development-transition-v1/semver-auto-planned.json +47 -0
- package/contracts/fixtures/next-development-transition-v1/version-model-cases.json +40 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/archive-template.json +19 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/bootstrap-positive.json +93 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/gate-positive.json +29 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/gate-unknown-selector.json +26 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/offline-vectors.json +50 -0
- package/contracts/fixtures/v4-compatibility-facts-v1/shared.json +1129 -0
- package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +7 -1
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/artifacts/product.bin +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/config/buildchain.toml +5 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/release-activation.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/signed-channel.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/evidence/qualification.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/candidate.json +5 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/release-passport.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/capsule.json +707 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/offline-vectors.json +27 -0
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +229 -0
- package/contracts/next-development-request-v1.schema.json +66 -0
- package/contracts/next-development-transition-v1.schema.json +292 -0
- package/contracts/v4-adopter-delivery-v1.schema.json +81 -0
- package/contracts/v4-compatibility-facts-v1.schema.json +230 -0
- package/contracts/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/contracts/v4-tail-reseal-v1.schema.json +276 -0
- package/dist/site/agent-index.json +4 -0
- package/dist/site/artifact-schemas.json +8 -0
- package/dist/site/buildchain-contract.json +1393 -28
- package/dist/site/buildchain-site.json +462 -27
- package/dist/site/capability-registry.json +17 -14
- package/dist/site/cli-registry.json +159 -1
- package/dist/site/kfd-claims.json +429 -15
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +52 -6
- package/dist/site/node-api-registry.json +13972 -9697
- package/dist/site/page-registry.json +428 -17
- package/dist/site/public-surface-audit.json +429 -11
- package/dist/site/publication-authority-registry.json +22 -4
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +21 -0
- package/dist/site/schemas/release-tail-capabilities-v1.schema.json +199 -0
- package/dist/site/schemas/v4-adopter-delivery-v1.schema.json +81 -0
- package/dist/site/schemas/v4-compatibility-facts-v1.schema.json +230 -0
- package/dist/site/schemas/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/dist/site/site-manifest.json +34 -10
- package/dist/site/workflow-registry.json +121 -8
- package/docs/MAP.md +7 -2
- package/docs/cli-reference.md +193 -0
- package/docs/cli.md +8 -0
- package/docs/dev-alpha-candidate-patrol.md +8 -0
- package/docs/next-development-transition.md +118 -0
- package/docs/node-api-reference.md +448 -168
- package/docs/release-tail-provider-plane.md +30 -0
- package/docs/v4-adopter-delivery.md +133 -0
- package/docs/v4-compatibility-facts.md +91 -0
- package/docs/v4-publication-rehearsal.md +130 -0
- package/docs/v4-tail-reseal.md +73 -0
- package/docs/versioning.md +4 -3
- package/package.json +29 -6
- package/packages/core/adopter-delivery-passport.js +259 -0
- package/packages/core/adopter-delivery-vectors.js +158 -0
- package/packages/core/adopter-delivery-vectors.json +77 -0
- package/packages/core/buildchain-agent-manuals.js +3 -0
- package/packages/core/buildchain-compatibility-authority.js +336 -0
- package/packages/core/buildchain-compatibility-fact.js +394 -0
- package/packages/core/buildchain-compatibility-facts.json +217 -0
- package/packages/core/buildchain-compatibility-proof.js +566 -0
- package/packages/core/buildchain-config.js +84 -0
- package/packages/core/buildchain-contract.js +93 -141
- package/packages/core/buildchain-delivery-bootstrap.js +240 -0
- package/packages/core/buildchain-delivery-infrastructure.js +164 -0
- package/packages/core/buildchain-delivery-self-dogfood.js +395 -0
- package/packages/core/channel-candidate.js +8 -0
- package/packages/core/channel-promotion-baseline.js +55 -0
- package/packages/core/dev-alpha-candidate-selection.js +10 -2
- package/packages/core/dev-delivery-execution-transfer.js +21 -1
- package/packages/core/dev-delivery-process-boundary.js +19 -6
- package/packages/core/dev-delivery-provider-heartbeat.js +18 -6
- package/packages/core/kungfu-temporal-fact.js +557 -0
- package/packages/core/legacy-kfd-adopter-driver.js +167 -0
- package/packages/core/next-development-candidate-reservation.js +186 -0
- package/packages/core/next-development-controller.js +728 -0
- package/packages/core/next-development-projection.js +287 -0
- package/packages/core/next-development-transition.js +738 -0
- package/packages/core/paper-agent-entry.js +11 -5
- package/packages/core/paper.js +16 -5
- package/packages/core/published-delivery-authority.js +266 -0
- package/packages/core/release-passport.js +26 -8
- package/packages/core/v4-adopter-delivery-parity.js +3 -3
- package/packages/core/v4-adopter-delivery.js +359 -0
- package/packages/core/v4-canonical-contracts.js +5 -0
- package/packages/core/v4-floating-consumer-policy.js +29 -9
- package/packages/core/v4-publication-rehearsal-capsule.js +468 -0
- package/packages/core/v4-publication-rehearsal-provider-bindings.js +212 -0
- package/packages/core/v4-publication-rehearsal.js +481 -0
- package/packages/core/v4-tail-reseal-contract.js +26 -0
- package/packages/core/v4-tail-reseal-github.js +178 -0
- package/packages/core/v4-tail-reseal-receipt.js +225 -0
- package/packages/core/v4-tail-reseal.js +594 -0
- package/scripts/buildchain-cli-help.mjs +30 -0
- package/scripts/check-inventory.mjs +14 -3
- package/scripts/dev-alpha-candidate-patrol.mjs +22 -1
- package/scripts/dev-delivery-source-proof-replay.mjs +153 -0
- package/scripts/dev-delivery-source-proof-reuse.mjs +13 -97
- package/scripts/generate-next-development-guidance.mjs +49 -0
- package/scripts/generate-release-candidate-passport.mjs +152 -0
- package/scripts/generate-site-bundle.mjs +46 -3
- package/scripts/init-repo.mjs +22 -4
- package/scripts/next-development-self-dogfood-harness.mjs +460 -0
- package/scripts/next-development-self-dogfood.mjs +597 -0
- package/scripts/next-development-transition.mjs +47 -0
- package/scripts/release-tail.mjs +51 -3
- package/scripts/resume-from-candidate-run.mjs +545 -15
- package/scripts/site-capability-metadata.mjs +28 -0
- package/scripts/v4-consumer-policy.mjs +1 -5
- package/scripts/v4-publication-rehearsal-fixture.mjs +144 -0
- package/scripts/v4-tail-reseal-macos-rehearsal.mjs +134 -0
- package/scripts/v4-tail-reseal.mjs +416 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adopterDeliveryGateDigest,
|
|
3
|
+
createAdopterDeliveryGate,
|
|
4
|
+
createGitCommitArtifactProfile,
|
|
5
|
+
createPackageArtifactProfile,
|
|
6
|
+
defineAdopterProtocolDriver,
|
|
7
|
+
ADOPTER_PROTOCOL_DRIVER_INTERFACE,
|
|
8
|
+
} from "./adopter-delivery-gate.js";
|
|
9
|
+
import { qualifyBuildchainDeliveryInfrastructureBootstrap } from "./buildchain-delivery-bootstrap.js";
|
|
10
|
+
import { createKfdAdopterCategoryProtocolDriver } from "./kfd-adopter-category-driver.js";
|
|
11
|
+
import { createLegacyKfdAdopterProtocolDriver } from "./legacy-kfd-adopter-driver.js";
|
|
12
|
+
import { loadPublishedBuildchainDeliveryAuthority } from "./published-delivery-authority.js";
|
|
13
|
+
|
|
14
|
+
export const V4_ADOPTER_DELIVERY_CONTRACT =
|
|
15
|
+
"kungfu-buildchain-v4-adopter-delivery/v1";
|
|
16
|
+
export const V4_ADOPTER_DELIVERY_READBACK_CONTRACT =
|
|
17
|
+
"kungfu-buildchain-v4-adopter-delivery-readback/v1";
|
|
18
|
+
export const V4_ADOPTER_DELIVERY_BOOTSTRAP_LINEAGE_CONTRACT =
|
|
19
|
+
"kungfu-buildchain-v4-adopter-delivery-bootstrap-lineage/v1";
|
|
20
|
+
export const V4_ADOPTER_DELIVERY_SOURCE = Object.freeze({
|
|
21
|
+
branch: "dev/v3/v3.0",
|
|
22
|
+
commit: "6b96bdad8d9f8ccf9275f27d9370a226a9c78465",
|
|
23
|
+
vectorSuiteRoot:
|
|
24
|
+
"sha256:c978707556406ffda4ef4192032332c01c2da1cebb6ad8c4f0edfc65d5cef0c7",
|
|
25
|
+
kfdPackage: "@kungfu-tech/kfd@1.0.0-alpha.65",
|
|
26
|
+
targetBranch: "dev/v4/v4.0",
|
|
27
|
+
initialTargetBase: "e5611377efc03178f8687d99968cfdfa3ce2825b",
|
|
28
|
+
targetBase: "e0342713c7447960c13bd73377282b2e93f4853d",
|
|
29
|
+
});
|
|
30
|
+
export const V4_ADOPTER_DELIVERY_ARCHIVE_AUTHORITY = Object.freeze({
|
|
31
|
+
buildchain: Object.freeze({
|
|
32
|
+
name: "@kungfu-tech/buildchain",
|
|
33
|
+
version: "3.0.9-alpha.16",
|
|
34
|
+
archiveRoot:
|
|
35
|
+
"sha256:3f425e2c77d11f0bee8eb9aa2448566bca7a9d14672a7e528ced3e505b3f14a3",
|
|
36
|
+
artifactRoot:
|
|
37
|
+
"sha256:3f425e2c77d11f0bee8eb9aa2448566bca7a9d14672a7e528ced3e505b3f14a3",
|
|
38
|
+
}),
|
|
39
|
+
kfd: Object.freeze({
|
|
40
|
+
name: "@kungfu-tech/kfd",
|
|
41
|
+
version: "1.0.0-alpha.65",
|
|
42
|
+
archiveRoot:
|
|
43
|
+
"sha256:c4dbd3f954910236d7f0823ea6887f4151e43b871df526ccdd599123421bced2",
|
|
44
|
+
artifactRoot:
|
|
45
|
+
"sha256:c0781bcaf191a58561ae32ee2fbedabbb48ed50b5725c356fbd83704089637f8",
|
|
46
|
+
}),
|
|
47
|
+
authorityRoot:
|
|
48
|
+
"sha256:9ba0cc6042b189ce749d01003617b57bcd03ea6ecf40e96d19e8ecbbfa347134",
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const ROOT = /^sha256:[0-9a-f]{64}$/u;
|
|
52
|
+
const SHA = /^[0-9a-f]{40}$/u;
|
|
53
|
+
const BUILTIN_DRIVER_SELECTORS = Object.freeze({
|
|
54
|
+
"json-assertion": "buildchain.adopter/json-assertion@1.0.0",
|
|
55
|
+
"kfd-category": "kfd.adopter-category/instance-manifest@1.0.0",
|
|
56
|
+
"legacy-kfd": "buildchain.kfd-adopter/legacy-support-matrix@1.0.0",
|
|
57
|
+
});
|
|
58
|
+
const BUILTIN_PROFILE_SELECTORS = Object.freeze({
|
|
59
|
+
"git-commit": "buildchain.artifact/git-commit@1.0.0",
|
|
60
|
+
package: "buildchain.artifact/package@1.0.0",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
function exactKeys(value, keys, label) {
|
|
64
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
65
|
+
throw new TypeError(`${label} must be an object`);
|
|
66
|
+
}
|
|
67
|
+
const actual = Object.keys(value).sort();
|
|
68
|
+
const expected = [...keys].sort();
|
|
69
|
+
if (
|
|
70
|
+
actual.length !== expected.length ||
|
|
71
|
+
actual.some((entry, index) => entry !== expected[index])
|
|
72
|
+
) {
|
|
73
|
+
throw new TypeError(`${label} has an unsupported field set`);
|
|
74
|
+
}
|
|
75
|
+
return structuredClone(value);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function definitionKey(value) {
|
|
79
|
+
return `${value.id}@${value.version}`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function resolveSelector(selector, table, definitions, label) {
|
|
83
|
+
const expected = table[selector];
|
|
84
|
+
if (!expected) throw new RangeError(`unknown ${label} selector: ${selector}`);
|
|
85
|
+
const selected = definitions.find(
|
|
86
|
+
(entry) => definitionKey(entry) === expected,
|
|
87
|
+
);
|
|
88
|
+
if (!selected)
|
|
89
|
+
throw new Error(
|
|
90
|
+
`${label} selector is not backed by an exact implementation`,
|
|
91
|
+
);
|
|
92
|
+
return selected;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function createJsonAssertionAdopterProtocolDriver() {
|
|
96
|
+
return defineAdopterProtocolDriver({
|
|
97
|
+
interface: ADOPTER_PROTOCOL_DRIVER_INTERFACE,
|
|
98
|
+
id: "buildchain.adopter/json-assertion",
|
|
99
|
+
version: "1.0.0",
|
|
100
|
+
verify({ request }) {
|
|
101
|
+
const declaration = request.declaration;
|
|
102
|
+
const exact =
|
|
103
|
+
declaration &&
|
|
104
|
+
typeof declaration === "object" &&
|
|
105
|
+
!Array.isArray(declaration) &&
|
|
106
|
+
Object.keys(declaration).length === 1 &&
|
|
107
|
+
typeof declaration.valid === "boolean";
|
|
108
|
+
const valid = exact && declaration.valid === true;
|
|
109
|
+
const issues = valid
|
|
110
|
+
? []
|
|
111
|
+
: [
|
|
112
|
+
{
|
|
113
|
+
code: "delivery-json-assertion-rejected",
|
|
114
|
+
path: "/declaration",
|
|
115
|
+
message:
|
|
116
|
+
"JSON assertion declarations must contain only valid: true.",
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
const report = {
|
|
120
|
+
schemaVersion: 1,
|
|
121
|
+
contract: "kungfu-buildchain-json-assertion-driver-report/v1",
|
|
122
|
+
valid,
|
|
123
|
+
declaration: structuredClone(declaration),
|
|
124
|
+
qualifying: false,
|
|
125
|
+
selfCertified: false,
|
|
126
|
+
releaseAuthorized: false,
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
valid,
|
|
130
|
+
report,
|
|
131
|
+
reportRoot: adopterDeliveryGateDigest(report),
|
|
132
|
+
issues,
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function createV4AdopterDeliveryRuntime({
|
|
139
|
+
drivers = [],
|
|
140
|
+
artifactProfiles = [],
|
|
141
|
+
} = {}) {
|
|
142
|
+
const allDrivers = [
|
|
143
|
+
createJsonAssertionAdopterProtocolDriver(),
|
|
144
|
+
createKfdAdopterCategoryProtocolDriver(),
|
|
145
|
+
createLegacyKfdAdopterProtocolDriver(),
|
|
146
|
+
...drivers,
|
|
147
|
+
];
|
|
148
|
+
const allProfiles = [
|
|
149
|
+
createGitCommitArtifactProfile(),
|
|
150
|
+
createPackageArtifactProfile(),
|
|
151
|
+
...artifactProfiles,
|
|
152
|
+
];
|
|
153
|
+
return Object.freeze({
|
|
154
|
+
drivers: Object.freeze(allDrivers),
|
|
155
|
+
artifactProfiles: Object.freeze(allProfiles),
|
|
156
|
+
evaluate({
|
|
157
|
+
request,
|
|
158
|
+
context = {},
|
|
159
|
+
driverSelector,
|
|
160
|
+
artifactProfileSelector,
|
|
161
|
+
} = {}) {
|
|
162
|
+
const driver = resolveSelector(
|
|
163
|
+
driverSelector,
|
|
164
|
+
BUILTIN_DRIVER_SELECTORS,
|
|
165
|
+
allDrivers,
|
|
166
|
+
"driver",
|
|
167
|
+
);
|
|
168
|
+
const profile = resolveSelector(
|
|
169
|
+
artifactProfileSelector,
|
|
170
|
+
BUILTIN_PROFILE_SELECTORS,
|
|
171
|
+
allProfiles,
|
|
172
|
+
"artifact profile",
|
|
173
|
+
);
|
|
174
|
+
if (definitionKey(driver) !== definitionKey(request?.protocol ?? {})) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
"driver selector does not match the exact request protocol",
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
if (
|
|
180
|
+
definitionKey(profile) !== definitionKey(request?.artifactProfile ?? {})
|
|
181
|
+
) {
|
|
182
|
+
throw new Error(
|
|
183
|
+
"artifact profile selector does not match the exact request profile",
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
return createAdopterDeliveryGate({
|
|
187
|
+
drivers: [driver],
|
|
188
|
+
artifactProfiles: [profile],
|
|
189
|
+
}).evaluate(structuredClone(request), structuredClone(context));
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function runV4AdopterDeliveryGate(input, options = {}) {
|
|
195
|
+
const normalized = exactKeys(
|
|
196
|
+
input,
|
|
197
|
+
[
|
|
198
|
+
"schemaVersion",
|
|
199
|
+
"contract",
|
|
200
|
+
"driverSelector",
|
|
201
|
+
"artifactProfileSelector",
|
|
202
|
+
"request",
|
|
203
|
+
"context",
|
|
204
|
+
],
|
|
205
|
+
"v4 adopter delivery input",
|
|
206
|
+
);
|
|
207
|
+
if (
|
|
208
|
+
normalized.schemaVersion !== 1 ||
|
|
209
|
+
normalized.contract !== V4_ADOPTER_DELIVERY_CONTRACT
|
|
210
|
+
) {
|
|
211
|
+
throw new Error("v4 adopter delivery contract or version is unsupported");
|
|
212
|
+
}
|
|
213
|
+
const gateResult =
|
|
214
|
+
createV4AdopterDeliveryRuntime(options).evaluate(normalized);
|
|
215
|
+
const result = {
|
|
216
|
+
schemaVersion: 1,
|
|
217
|
+
contract: V4_ADOPTER_DELIVERY_READBACK_CONTRACT,
|
|
218
|
+
sourceAuthority: structuredClone(V4_ADOPTER_DELIVERY_SOURCE),
|
|
219
|
+
selection: {
|
|
220
|
+
driver: normalized.driverSelector,
|
|
221
|
+
artifactProfile: normalized.artifactProfileSelector,
|
|
222
|
+
},
|
|
223
|
+
gateResult,
|
|
224
|
+
qualifying: false,
|
|
225
|
+
selfCertified: false,
|
|
226
|
+
releaseAuthorized: false,
|
|
227
|
+
finalAuthority: "selected-public-driver-plus-exact-consumer-readback",
|
|
228
|
+
};
|
|
229
|
+
result.deliveryRoot = adopterDeliveryGateDigest(result);
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function verifyV4AdopterDeliveryReadback(
|
|
234
|
+
{ input, readback } = {},
|
|
235
|
+
options = {},
|
|
236
|
+
) {
|
|
237
|
+
if (!readback || !ROOT.test(readback.deliveryRoot ?? "")) {
|
|
238
|
+
throw new Error("exact adopter delivery readback is required");
|
|
239
|
+
}
|
|
240
|
+
const observed = runV4AdopterDeliveryGate(input, options);
|
|
241
|
+
if (
|
|
242
|
+
observed.deliveryRoot !== readback.deliveryRoot ||
|
|
243
|
+
adopterDeliveryGateDigest(observed) !== adopterDeliveryGateDigest(readback)
|
|
244
|
+
) {
|
|
245
|
+
throw new Error(
|
|
246
|
+
"adopter delivery readback does not match exact recomputation",
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
return observed;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function qualifyV4AdopterDeliveryBootstrap({ input, lineage } = {}) {
|
|
253
|
+
const normalizedLineage = exactKeys(
|
|
254
|
+
lineage,
|
|
255
|
+
[
|
|
256
|
+
"schemaVersion",
|
|
257
|
+
"contract",
|
|
258
|
+
"sourceAuthorityCommit",
|
|
259
|
+
"targetBaseCommit",
|
|
260
|
+
"authorityArchiveRoot",
|
|
261
|
+
],
|
|
262
|
+
"bootstrap lineage",
|
|
263
|
+
);
|
|
264
|
+
if (
|
|
265
|
+
normalizedLineage.schemaVersion !== 1 ||
|
|
266
|
+
normalizedLineage.contract !==
|
|
267
|
+
V4_ADOPTER_DELIVERY_BOOTSTRAP_LINEAGE_CONTRACT ||
|
|
268
|
+
normalizedLineage.sourceAuthorityCommit !==
|
|
269
|
+
V4_ADOPTER_DELIVERY_SOURCE.commit ||
|
|
270
|
+
normalizedLineage.targetBaseCommit !==
|
|
271
|
+
V4_ADOPTER_DELIVERY_SOURCE.targetBase ||
|
|
272
|
+
!SHA.test(normalizedLineage.sourceAuthorityCommit) ||
|
|
273
|
+
!SHA.test(normalizedLineage.targetBaseCommit) ||
|
|
274
|
+
!ROOT.test(normalizedLineage.authorityArchiveRoot ?? "") ||
|
|
275
|
+
normalizedLineage.authorityArchiveRoot !== input?.authority?.packageRoot
|
|
276
|
+
) {
|
|
277
|
+
throw new Error(
|
|
278
|
+
"bootstrap lineage does not bind the exact v3 authority and v4 base",
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
const bootstrap = qualifyBuildchainDeliveryInfrastructureBootstrap(input);
|
|
282
|
+
const result = {
|
|
283
|
+
schemaVersion: 1,
|
|
284
|
+
contract: "kungfu-buildchain-v4-adopter-delivery-bootstrap/v1",
|
|
285
|
+
sourceAuthority: structuredClone(V4_ADOPTER_DELIVERY_SOURCE),
|
|
286
|
+
lineage: normalizedLineage,
|
|
287
|
+
bootstrap,
|
|
288
|
+
qualifying: false,
|
|
289
|
+
selfCertified: false,
|
|
290
|
+
releaseAuthorized: false,
|
|
291
|
+
};
|
|
292
|
+
result.resultRoot = adopterDeliveryGateDigest(result);
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export async function loadV4PublishedAdopterDeliveryAuthority({
|
|
297
|
+
packages,
|
|
298
|
+
expectedAuthorityRoot,
|
|
299
|
+
} = {}) {
|
|
300
|
+
const request = assertV4PublishedAdopterDeliveryRequest({
|
|
301
|
+
packages,
|
|
302
|
+
expectedAuthorityRoot,
|
|
303
|
+
});
|
|
304
|
+
const authority = await loadPublishedBuildchainDeliveryAuthority(
|
|
305
|
+
request.packages,
|
|
306
|
+
);
|
|
307
|
+
if (authority.authorityRoot !== expectedAuthorityRoot) {
|
|
308
|
+
await authority.dispose();
|
|
309
|
+
throw new Error("published archive authority readback root does not match");
|
|
310
|
+
}
|
|
311
|
+
return authority;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export function assertV4PublishedAdopterDeliveryRequest({
|
|
315
|
+
packages,
|
|
316
|
+
expectedAuthorityRoot,
|
|
317
|
+
} = {}) {
|
|
318
|
+
if (
|
|
319
|
+
!ROOT.test(expectedAuthorityRoot ?? "") ||
|
|
320
|
+
expectedAuthorityRoot !==
|
|
321
|
+
V4_ADOPTER_DELIVERY_ARCHIVE_AUTHORITY.authorityRoot
|
|
322
|
+
) {
|
|
323
|
+
throw new Error(
|
|
324
|
+
"exact published archive authority readback root is required",
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
const normalizedPackages = exactKeys(
|
|
328
|
+
packages,
|
|
329
|
+
["buildchain", "kfd"],
|
|
330
|
+
"published archive packages",
|
|
331
|
+
);
|
|
332
|
+
for (const key of ["buildchain", "kfd"]) {
|
|
333
|
+
const declaration = exactKeys(
|
|
334
|
+
normalizedPackages[key],
|
|
335
|
+
["name", "version", "archivePath", "archiveRoot", "artifactRoot"],
|
|
336
|
+
`${key} archive identity`,
|
|
337
|
+
);
|
|
338
|
+
const expected = V4_ADOPTER_DELIVERY_ARCHIVE_AUTHORITY[key];
|
|
339
|
+
if (
|
|
340
|
+
typeof declaration.archivePath !== "string" ||
|
|
341
|
+
declaration.archivePath.length === 0 ||
|
|
342
|
+
declaration.name !== expected.name ||
|
|
343
|
+
declaration.version !== expected.version ||
|
|
344
|
+
declaration.archiveRoot !== expected.archiveRoot ||
|
|
345
|
+
declaration.artifactRoot !== expected.artifactRoot
|
|
346
|
+
) {
|
|
347
|
+
throw new Error(`${key} archive identity is not the exact v3 authority`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
packages: normalizedPackages,
|
|
352
|
+
expectedAuthorityRoot,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export const V4_ADOPTER_DELIVERY_SELECTORS = Object.freeze({
|
|
357
|
+
drivers: BUILTIN_DRIVER_SELECTORS,
|
|
358
|
+
artifactProfiles: BUILTIN_PROFILE_SELECTORS,
|
|
359
|
+
});
|
|
@@ -56,6 +56,11 @@ const ROOT_DOMAINS = new Set([
|
|
|
56
56
|
"stable-publication-fence",
|
|
57
57
|
"partial-mutation-recovery-checkpoint",
|
|
58
58
|
"partial-mutation-recovery-plan",
|
|
59
|
+
"tail-reseal-plan",
|
|
60
|
+
"tail-reseal-admission",
|
|
61
|
+
"tail-reseal-artifact-files",
|
|
62
|
+
"tail-reseal-receipt",
|
|
63
|
+
"release-candidate-passport",
|
|
59
64
|
]);
|
|
60
65
|
const FAULT_CLASSES = new Set([
|
|
61
66
|
"validation",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
createBuildchainContractWorld,
|
|
6
|
+
evaluateBuildchainContractLock,
|
|
7
|
+
} from "./buildchain-contract.js";
|
|
4
8
|
import { parseYamlUses } from "./workflow-yaml-contract.js";
|
|
5
9
|
import {
|
|
6
10
|
V4_FLOATING_CONSUMER_POLICY,
|
|
@@ -29,6 +33,7 @@ const TRANSIENT_ACTION =
|
|
|
29
33
|
const SCANNER_PATHS = Object.freeze([
|
|
30
34
|
"architecture/v4-floating-consumer-policy.json",
|
|
31
35
|
"contracts/v4-floating-consumer-policy-receipt-v1.schema.json",
|
|
36
|
+
"packages/core/buildchain-contract.js",
|
|
32
37
|
"packages/core/v4-floating-consumer-policy.js",
|
|
33
38
|
"packages/core/workflow-yaml-contract.js",
|
|
34
39
|
"scripts/v4-consumer-policy.mjs",
|
|
@@ -381,15 +386,30 @@ export function scanV4FloatingConsumerPolicy({
|
|
|
381
386
|
expectedInvocationChannel,
|
|
382
387
|
);
|
|
383
388
|
const selectedLock = selected?.channel === "alpha" ? alpha : stable;
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
389
|
+
if (selected?.channel && selectedLock) {
|
|
390
|
+
try {
|
|
391
|
+
const compatibility = evaluateBuildchainContractLock({
|
|
392
|
+
lock: selectedLock,
|
|
393
|
+
current: createBuildchainContractWorld({ root: defaultRuntimeRoot() }),
|
|
394
|
+
runtimeRef: selected.selector,
|
|
395
|
+
runtimeSha: normalizedWorkflowSha,
|
|
396
|
+
runtimeClass: selected.channel,
|
|
397
|
+
workflowShellRef: selected.selector,
|
|
398
|
+
expectedChannel: selected.channel,
|
|
399
|
+
expectedMajor: "v4",
|
|
400
|
+
});
|
|
401
|
+
if (!compatibility.ok) {
|
|
402
|
+
failures.push({
|
|
403
|
+
code: "selected-lock-runtime-incompatible",
|
|
404
|
+
message: `${selected.channel} contract lock rejects resolved workflow shell ${normalizedWorkflowSha}: ${compatibility.reasons?.join("; ") || compatibility.status}`,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
} catch (error) {
|
|
408
|
+
failures.push({
|
|
409
|
+
code: "selected-lock-contract-world-invalid",
|
|
410
|
+
message: `cannot evaluate ${selected.channel} contract lock against the resolved workflow shell: ${error.message}`,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
393
413
|
}
|
|
394
414
|
|
|
395
415
|
const policyRoot = sha256(stableJson(policy));
|