@kungfu-tech/buildchain 4.0.1-alpha.42 → 4.0.1-alpha.54
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/architecture/agent-change-map.md +1015 -0
- package/architecture/ci-lane-change-budget.json +17 -0
- package/architecture/internal-capabilities.json +156 -11
- package/architecture/maintainability-debt.json +3229 -0
- package/architecture/maintainability-policy.json +474 -125
- package/architecture/v3-core-mechanism-inventory.json +4 -3
- package/architecture/v3-v4-capability-closure.md +59 -0
- package/architecture/v3-v4-live-capability-inventory.json +102404 -0
- package/architecture/v4-cross-platform-adopter-qualification.json +52 -0
- package/architecture/v4-delivery-warrant-shadow-fixtures.json +3 -3
- package/architecture/v4-runtime-semantic-closure.json +710 -0
- package/bin/internal/trust-release-release-handlers.mjs +5 -0
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/dist/site/buildchain-contract.json +71 -31
- package/dist/site/buildchain-site.json +38 -18
- package/dist/site/capability-registry.json +2 -2
- package/dist/site/cli-registry.json +5 -2
- package/dist/site/controller-registry.json +37 -5
- package/dist/site/kfd-claims.json +76 -14
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +4 -4
- package/dist/site/node-api-registry.json +1168 -203
- package/dist/site/page-registry.json +30 -10
- package/dist/site/public-surface-audit.json +46 -17
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +3 -0
- package/dist/site/site-manifest.json +8 -8
- package/dist/site/workflow-registry.json +47 -18
- package/docs/cli-reference.md +4 -4
- package/docs/dev-delivery-warrant.md +12 -9
- package/docs/node-api-reference.md +224 -169
- package/docs/publish-transaction.md +11 -4
- package/docs/v4-adopter-delivery.md +23 -4
- package/package.json +6 -3
- package/packages/core/adopter-delivery-passport.js +36 -0
- package/packages/core/dev-delivery-warrant-settlement.js +5 -1
- package/packages/core/dev-delivery-warrant.js +13 -4
- package/packages/core/github-governance-authority.js +4 -4
- package/packages/core/paper-scaffold-content.js +401 -0
- package/packages/core/paper.js +12 -378
- package/packages/core/publication-control-plane-audit.js +135 -111
- package/packages/core/publication-rehearsal-projection.js +104 -0
- package/packages/core/publication-rehearsal-runtime.js +190 -0
- package/packages/core/release-candidate-recovery.js +1 -0
- package/packages/core/release-passport.js +82 -184
- package/packages/core/v4-cross-platform-adopter-qualification.js +343 -0
- package/packages/core/v4-floating-consumer-policy.js +3 -2
- package/packages/core/v4-floating-consumer-release-passport.js +119 -0
- package/scripts/audit-publication-control-plane.mjs +17 -17
- package/scripts/buildchain-cli-help.mjs +3 -0
- package/scripts/check-internal-architecture.mjs +23 -3
- package/scripts/check-inventory.mjs +21 -3
- package/scripts/check-maintainability.mjs +145 -4
- package/scripts/check-v3-v4-capability-inventory.mjs +574 -0
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +10 -3
- package/scripts/check-v4-runtime-semantic-closure.mjs +266 -0
- package/scripts/generate-agent-change-map.mjs +118 -0
- package/scripts/maintainability-domain-metrics.mjs +237 -0
- package/scripts/maintainability-governance.mjs +473 -0
- package/scripts/maintainability-metrics.mjs +28 -6
- package/scripts/promotion-routing-evidence.mjs +35 -6
- package/scripts/release-line-policy.mjs +25 -15
- package/scripts/release-tail.mjs +19 -2
- package/scripts/resume-from-candidate-run.mjs +1 -1
- package/scripts/run-lifecycle-core.mjs +341 -376
- package/scripts/site-capability-metadata.mjs +3 -0
- package/scripts/v3-v4-capability-catalog.mjs +439 -0
- package/scripts/v4-cross-platform-adopter-qualification.mjs +228 -0
|
@@ -230,6 +230,8 @@ export function nodeApiMeta(exportName) {
|
|
|
230
230
|
"./v4-tail-reseal": { group: "release-passport-trust", summary: "Effect-pure retained Stage Capsule validation and explicit Warrant-, credential-, and release-tail-fenced macOS reseal planning APIs." },
|
|
231
231
|
"./v4-tail-reseal-receipt": { group: "release-passport-trust", summary: "Four-platform byte readback, standard candidate Passport binding, and terminal v4 tail-reseal receipt APIs." },
|
|
232
232
|
"./v4-publication-rehearsal": { group: "release-passport-trust", summary: "Content-addressed v4 publication rehearsal capsules, shared production release-tail execution, replay, provider observation, and fail-closed verification APIs." },
|
|
233
|
+
"./publication-rehearsal-runtime": { group: "release-passport-trust", summary: "Compatibility names for the source-bound v4 publication rehearsal runtime and explicit rooted migration diagnostics." },
|
|
234
|
+
"./publication-rehearsal-projection": { group: "release-passport-trust", summary: "Compatibility projection helpers that emit only the current source-bound v4 publication rehearsal configuration and workflow." },
|
|
233
235
|
"./v4-publication-qualification": { group: "release-passport-trust", summary: "Sealed v4 candidate, source, artifact, policy, freshness, and command-free promotion admission APIs." },
|
|
234
236
|
"./adopter-delivery-gate": { group: "reusable-build", summary: "Protocol-neutral adopter delivery gate, driver interface, artifact profiles, and canonical result APIs." },
|
|
235
237
|
"./kfd-adopter-category-driver": { group: "kfd-trust", summary: "Published KFD adopter-category driver and exact package-cut verification APIs." },
|
|
@@ -241,6 +243,7 @@ export function nodeApiMeta(exportName) {
|
|
|
241
243
|
"./adopter-delivery-passport": { group: "release-passport-trust", summary: "Non-authoritative adopter delivery Release Passport binding and substitution checks." },
|
|
242
244
|
"./adopter-delivery-vectors": { group: "reusable-build", summary: "Rooted public adopter delivery conformance vector suite APIs." },
|
|
243
245
|
"./v4-adopter-delivery": { group: "reusable-build", summary: "Public v4 adopter delivery runtime, exact readback, N-1 lineage, and published archive verification APIs." },
|
|
246
|
+
"./v4-cross-platform-adopter-qualification": { group: "reusable-build", summary: "Exact-source v3 capability matrix reports, executed failure and recovery evidence, and cross-platform public adopter qualification APIs." },
|
|
244
247
|
"./release-candidate-recovery": { group: "release-passport-trust", summary: "Fail-closed verification and immutable receipts for reusing a successful sealed candidate run without rebuilding product payloads." },
|
|
245
248
|
"./release-train": { group: "governance-versioning", summary: "Frozen Release Cut identity, rooted Release Train transitions, Dev observations, supersession, replay, and legacy read compatibility APIs." },
|
|
246
249
|
"./next-development-transition": { group: "governance-versioning", summary: "Provider-neutral completed-Alpha preservation and rooted next-development state, version-model, idempotency, and local materialization APIs." },
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
const FIXED_GENERATED_CONTRACTS = Object.freeze([
|
|
5
|
+
"dist/site/buildchain-contract.json",
|
|
6
|
+
"dist/site/capability-registry.json",
|
|
7
|
+
"dist/site/cli-registry.json",
|
|
8
|
+
"dist/site/controller-registry.json",
|
|
9
|
+
"dist/site/kfd-claims.json",
|
|
10
|
+
"dist/site/manual-registry.json",
|
|
11
|
+
"dist/site/node-api-registry.json",
|
|
12
|
+
"dist/site/page-registry.json",
|
|
13
|
+
"dist/site/public-surface-audit.json",
|
|
14
|
+
"dist/site/release-model.json",
|
|
15
|
+
"dist/site/release-passport-check-manifest.json",
|
|
16
|
+
"dist/site/site-manifest.json",
|
|
17
|
+
"dist/site/workflow-registry.json",
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
const PLATFORM_MARKERS = Object.freeze({
|
|
21
|
+
linux: /\b(?:ubuntu|linux)\b/iu,
|
|
22
|
+
macos: /\bmacos\b/iu,
|
|
23
|
+
"self-hosted": /\bself-hosted\b/iu,
|
|
24
|
+
windows: /\bwindows\b/iu,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function sha256(value) {
|
|
28
|
+
return `sha256:${crypto.createHash("sha256").update(value).digest("hex")}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function stableJson(value) {
|
|
32
|
+
if (Array.isArray(value)) return value.map(stableJson);
|
|
33
|
+
if (!value || typeof value !== "object") return value;
|
|
34
|
+
return Object.fromEntries(
|
|
35
|
+
Object.entries(value)
|
|
36
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
37
|
+
.map(([key, entry]) => [key, stableJson(entry)]),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function git(root, args, { trim = true } = {}) {
|
|
42
|
+
const output = execFileSync("git", args, {
|
|
43
|
+
cwd: root,
|
|
44
|
+
encoding: "utf8",
|
|
45
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
46
|
+
});
|
|
47
|
+
return trim ? output.trim() : output;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function gitJson(root, revision, relPath) {
|
|
51
|
+
return JSON.parse(
|
|
52
|
+
git(root, ["show", `${revision}:${relPath}`], { trim: false }),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function gitText(root, revision, relPath) {
|
|
57
|
+
return git(root, ["show", `${revision}:${relPath}`], { trim: false });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function gitPaths(root, revision) {
|
|
61
|
+
return git(root, ["ls-tree", "-r", "--name-only", revision])
|
|
62
|
+
.split("\n")
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.sort();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function catalogEntry({ category, identity, path: relPath, selector, value }) {
|
|
68
|
+
return {
|
|
69
|
+
id: `${category}:${identity}`,
|
|
70
|
+
category,
|
|
71
|
+
identity,
|
|
72
|
+
evidence: {
|
|
73
|
+
path: relPath,
|
|
74
|
+
selector,
|
|
75
|
+
valueRoot: sha256(JSON.stringify(stableJson(value))),
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function add(catalog, entry) {
|
|
81
|
+
if (catalog.has(entry.id))
|
|
82
|
+
throw new Error(`duplicate capability identity: ${entry.id}`);
|
|
83
|
+
catalog.set(entry.id, entry);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function values(entries) {
|
|
87
|
+
return (entries || [])
|
|
88
|
+
.map((entry) => (typeof entry === "string" ? entry : entry?.name))
|
|
89
|
+
.filter(Boolean);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function addNodeCatalog(catalog, packageJson, nodeRegistry) {
|
|
93
|
+
for (const [exportName, target] of Object.entries(
|
|
94
|
+
packageJson.exports || {},
|
|
95
|
+
)) {
|
|
96
|
+
add(
|
|
97
|
+
catalog,
|
|
98
|
+
catalogEntry({
|
|
99
|
+
category: "node-export",
|
|
100
|
+
identity: exportName,
|
|
101
|
+
path: "package.json",
|
|
102
|
+
selector: `exports[${JSON.stringify(exportName)}]`,
|
|
103
|
+
value: target,
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
const symbolNames = new Map(
|
|
108
|
+
(nodeRegistry.symbols || []).map((symbol) => [symbol.id, symbol.name]),
|
|
109
|
+
);
|
|
110
|
+
for (const entry of nodeRegistry.exports || []) {
|
|
111
|
+
add(
|
|
112
|
+
catalog,
|
|
113
|
+
catalogEntry({
|
|
114
|
+
category: "documented-module",
|
|
115
|
+
identity: entry.export,
|
|
116
|
+
path: "dist/site/node-api-registry.json",
|
|
117
|
+
selector: `exports[export=${JSON.stringify(entry.export)}]`,
|
|
118
|
+
value: {
|
|
119
|
+
target: entry.target,
|
|
120
|
+
summary: entry.summary,
|
|
121
|
+
digest: entry.digest,
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
for (const symbolId of entry.symbolIds || []) {
|
|
126
|
+
const name = symbolNames.get(symbolId);
|
|
127
|
+
if (!name)
|
|
128
|
+
throw new Error(
|
|
129
|
+
`node registry export ${entry.export} references unknown symbol ${symbolId}`,
|
|
130
|
+
);
|
|
131
|
+
add(
|
|
132
|
+
catalog,
|
|
133
|
+
catalogEntry({
|
|
134
|
+
category: "node-symbol",
|
|
135
|
+
identity: `${entry.export}#${name}`,
|
|
136
|
+
path: "dist/site/node-api-registry.json",
|
|
137
|
+
selector: `exports[export=${JSON.stringify(entry.export)}].symbolIds[name=${JSON.stringify(name)}]`,
|
|
138
|
+
value: name,
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function addCliCatalog(catalog, cliRegistry) {
|
|
146
|
+
for (const command of cliRegistry.commands || []) {
|
|
147
|
+
add(
|
|
148
|
+
catalog,
|
|
149
|
+
catalogEntry({
|
|
150
|
+
category: "cli-command",
|
|
151
|
+
identity: command.id,
|
|
152
|
+
path: "dist/site/cli-registry.json",
|
|
153
|
+
selector: `commands[id=${JSON.stringify(command.id)}]`,
|
|
154
|
+
value: { paths: command.paths, usage: command.usage },
|
|
155
|
+
}),
|
|
156
|
+
);
|
|
157
|
+
for (const option of command.options || []) {
|
|
158
|
+
add(
|
|
159
|
+
catalog,
|
|
160
|
+
catalogEntry({
|
|
161
|
+
category: "cli-option",
|
|
162
|
+
identity: `${command.id}#${option}`,
|
|
163
|
+
path: "dist/site/cli-registry.json",
|
|
164
|
+
selector: `commands[id=${JSON.stringify(command.id)}].options[${JSON.stringify(option)}]`,
|
|
165
|
+
value: option,
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function addWorkflowInterface(catalog, workflow, category, field) {
|
|
173
|
+
for (const name of values(workflow[field])) {
|
|
174
|
+
add(
|
|
175
|
+
catalog,
|
|
176
|
+
catalogEntry({
|
|
177
|
+
category,
|
|
178
|
+
identity: `${workflow.id}#${name}`,
|
|
179
|
+
path: "dist/site/workflow-registry.json",
|
|
180
|
+
selector: `workflows[id=${JSON.stringify(workflow.id)}].${field}[${JSON.stringify(name)}]`,
|
|
181
|
+
value: name,
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function addWorkflowCatalog(catalog, workflowRegistry) {
|
|
188
|
+
for (const workflow of workflowRegistry.workflows || []) {
|
|
189
|
+
add(
|
|
190
|
+
catalog,
|
|
191
|
+
catalogEntry({
|
|
192
|
+
category: "workflow",
|
|
193
|
+
identity: workflow.id,
|
|
194
|
+
path: "dist/site/workflow-registry.json",
|
|
195
|
+
selector: `workflows[id=${JSON.stringify(workflow.id)}]`,
|
|
196
|
+
value: { path: workflow.path, reusable: workflow.reusable },
|
|
197
|
+
}),
|
|
198
|
+
);
|
|
199
|
+
for (const [category, field] of [
|
|
200
|
+
["workflow-input", "inputs"],
|
|
201
|
+
["workflow-output", "outputs"],
|
|
202
|
+
["workflow-secret", "secrets"],
|
|
203
|
+
]) {
|
|
204
|
+
addWorkflowInterface(catalog, workflow, category, field);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
for (const action of workflowRegistry.actions || []) {
|
|
208
|
+
add(
|
|
209
|
+
catalog,
|
|
210
|
+
catalogEntry({
|
|
211
|
+
category: "action",
|
|
212
|
+
identity: action.id,
|
|
213
|
+
path: "dist/site/workflow-registry.json",
|
|
214
|
+
selector: `actions[id=${JSON.stringify(action.id)}]`,
|
|
215
|
+
value: action.path,
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
218
|
+
for (const name of values(action.inputs)) {
|
|
219
|
+
add(
|
|
220
|
+
catalog,
|
|
221
|
+
catalogEntry({
|
|
222
|
+
category: "action-input",
|
|
223
|
+
identity: `${action.id}#${name}`,
|
|
224
|
+
path: "dist/site/workflow-registry.json",
|
|
225
|
+
selector: `actions[id=${JSON.stringify(action.id)}].inputs[${JSON.stringify(name)}]`,
|
|
226
|
+
value: name,
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function addFileEntry(catalog, root, revision, category, relPath) {
|
|
234
|
+
add(
|
|
235
|
+
catalog,
|
|
236
|
+
catalogEntry({
|
|
237
|
+
category,
|
|
238
|
+
identity: relPath,
|
|
239
|
+
path: relPath,
|
|
240
|
+
selector: "$",
|
|
241
|
+
value: sha256(gitText(root, revision, relPath)),
|
|
242
|
+
}),
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function addFileCatalog(catalog, root, revision, paths, pathSet) {
|
|
247
|
+
const schemas = paths.filter(
|
|
248
|
+
(entry) =>
|
|
249
|
+
entry.startsWith("contracts/") &&
|
|
250
|
+
entry.endsWith(".schema.json") &&
|
|
251
|
+
!entry.includes("/fixtures/"),
|
|
252
|
+
);
|
|
253
|
+
const configs = paths.filter((entry) =>
|
|
254
|
+
/^\.buildchain\/.*\.(?:json|toml)$/u.test(entry),
|
|
255
|
+
);
|
|
256
|
+
const generated = new Set([
|
|
257
|
+
...FIXED_GENERATED_CONTRACTS.filter((entry) => pathSet.has(entry)),
|
|
258
|
+
...paths.filter(
|
|
259
|
+
(entry) =>
|
|
260
|
+
entry.startsWith("dist/site/schemas/") &&
|
|
261
|
+
entry.endsWith(".schema.json"),
|
|
262
|
+
),
|
|
263
|
+
]);
|
|
264
|
+
const evidence = paths.filter(
|
|
265
|
+
(entry) =>
|
|
266
|
+
entry.startsWith("contracts/") &&
|
|
267
|
+
!entry.includes("/fixtures/") &&
|
|
268
|
+
/(?:evidence|passport|receipt|attestation|witness)/u.test(entry),
|
|
269
|
+
);
|
|
270
|
+
for (const relPath of schemas)
|
|
271
|
+
addFileEntry(catalog, root, revision, "source-schema", relPath);
|
|
272
|
+
for (const relPath of configs)
|
|
273
|
+
addFileEntry(catalog, root, revision, "config-contract", relPath);
|
|
274
|
+
for (const relPath of [...generated].sort())
|
|
275
|
+
addFileEntry(catalog, root, revision, "generated-contract", relPath);
|
|
276
|
+
for (const relPath of evidence)
|
|
277
|
+
addFileEntry(
|
|
278
|
+
catalog,
|
|
279
|
+
root,
|
|
280
|
+
revision,
|
|
281
|
+
"observable-evidence-contract",
|
|
282
|
+
relPath,
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function addMechanismCatalog(
|
|
287
|
+
catalog,
|
|
288
|
+
mechanismInventory,
|
|
289
|
+
runtimeSemanticClosure,
|
|
290
|
+
isLiveV3,
|
|
291
|
+
) {
|
|
292
|
+
const mechanisms = isLiveV3
|
|
293
|
+
? mechanismInventory.mechanisms || []
|
|
294
|
+
: runtimeSemanticClosure.capabilities || [];
|
|
295
|
+
const relPath = isLiveV3
|
|
296
|
+
? "architecture/v3-core-mechanism-inventory.json"
|
|
297
|
+
: "architecture/v4-runtime-semantic-closure.json";
|
|
298
|
+
for (const mechanism of mechanisms) {
|
|
299
|
+
add(
|
|
300
|
+
catalog,
|
|
301
|
+
catalogEntry({
|
|
302
|
+
category: "release-delivery-recovery",
|
|
303
|
+
identity: mechanism.id,
|
|
304
|
+
path: relPath,
|
|
305
|
+
selector: `capability[id=${JSON.stringify(mechanism.id)}]`,
|
|
306
|
+
value: mechanism,
|
|
307
|
+
}),
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function addPlatformCatalog(catalog, root, revision, paths) {
|
|
313
|
+
const workflowText = paths
|
|
314
|
+
.filter(
|
|
315
|
+
(entry) =>
|
|
316
|
+
entry.startsWith(".github/workflows/") && /\.ya?ml$/u.test(entry),
|
|
317
|
+
)
|
|
318
|
+
.map((entry) => gitText(root, revision, entry))
|
|
319
|
+
.join("\n");
|
|
320
|
+
for (const [platform, pattern] of Object.entries(PLATFORM_MARKERS)) {
|
|
321
|
+
if (!pattern.test(workflowText)) continue;
|
|
322
|
+
add(
|
|
323
|
+
catalog,
|
|
324
|
+
catalogEntry({
|
|
325
|
+
category: "platform-branch",
|
|
326
|
+
identity: platform,
|
|
327
|
+
path: ".github/workflows",
|
|
328
|
+
selector: `runner-marker:${platform}`,
|
|
329
|
+
value: platform,
|
|
330
|
+
}),
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export function collectRevisionCatalog({ root, revision, liveV3Revision }) {
|
|
336
|
+
const catalog = new Map();
|
|
337
|
+
const paths = gitPaths(root, revision);
|
|
338
|
+
const pathSet = new Set(paths);
|
|
339
|
+
const packageJson = gitJson(root, revision, "package.json");
|
|
340
|
+
const nodeRegistry = gitJson(
|
|
341
|
+
root,
|
|
342
|
+
revision,
|
|
343
|
+
"dist/site/node-api-registry.json",
|
|
344
|
+
);
|
|
345
|
+
const cliRegistry = gitJson(root, revision, "dist/site/cli-registry.json");
|
|
346
|
+
const workflowRegistry = gitJson(
|
|
347
|
+
root,
|
|
348
|
+
revision,
|
|
349
|
+
"dist/site/workflow-registry.json",
|
|
350
|
+
);
|
|
351
|
+
const mechanismInventory = gitJson(
|
|
352
|
+
root,
|
|
353
|
+
revision,
|
|
354
|
+
"architecture/v3-core-mechanism-inventory.json",
|
|
355
|
+
);
|
|
356
|
+
const runtimeSemanticClosure =
|
|
357
|
+
revision === liveV3Revision
|
|
358
|
+
? null
|
|
359
|
+
: gitJson(
|
|
360
|
+
root,
|
|
361
|
+
revision,
|
|
362
|
+
"architecture/v4-runtime-semantic-closure.json",
|
|
363
|
+
);
|
|
364
|
+
addNodeCatalog(catalog, packageJson, nodeRegistry);
|
|
365
|
+
addCliCatalog(catalog, cliRegistry);
|
|
366
|
+
addWorkflowCatalog(catalog, workflowRegistry);
|
|
367
|
+
addFileCatalog(catalog, root, revision, paths, pathSet);
|
|
368
|
+
addMechanismCatalog(
|
|
369
|
+
catalog,
|
|
370
|
+
mechanismInventory,
|
|
371
|
+
runtimeSemanticClosure,
|
|
372
|
+
revision === liveV3Revision,
|
|
373
|
+
);
|
|
374
|
+
addPlatformCatalog(catalog, root, revision, paths);
|
|
375
|
+
return { catalog, paths: pathSet };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export function collectHistoryRows({
|
|
379
|
+
root,
|
|
380
|
+
priorRevision,
|
|
381
|
+
liveV3Revision,
|
|
382
|
+
v4Paths,
|
|
383
|
+
migrationPaths,
|
|
384
|
+
ownerAssignment,
|
|
385
|
+
}) {
|
|
386
|
+
const output = git(root, [
|
|
387
|
+
"diff",
|
|
388
|
+
"--name-status",
|
|
389
|
+
priorRevision,
|
|
390
|
+
liveV3Revision,
|
|
391
|
+
]);
|
|
392
|
+
return output
|
|
393
|
+
.split("\n")
|
|
394
|
+
.filter(Boolean)
|
|
395
|
+
.map((line) => {
|
|
396
|
+
const fields = line.split("\t");
|
|
397
|
+
const sourcePath = fields.at(-1);
|
|
398
|
+
const migrationPath = migrationPaths.get(sourcePath);
|
|
399
|
+
if (!v4Paths.has(sourcePath) && !migrationPath)
|
|
400
|
+
throw new Error(
|
|
401
|
+
`unclassified post-family v3 history path: ${sourcePath}`,
|
|
402
|
+
);
|
|
403
|
+
if (migrationPath && !v4Paths.has(migrationPath))
|
|
404
|
+
throw new Error(
|
|
405
|
+
`history migration route is absent from the exact v4 cut: ${migrationPath}`,
|
|
406
|
+
);
|
|
407
|
+
return {
|
|
408
|
+
id: `history-change:${sourcePath}`,
|
|
409
|
+
category: "history-change",
|
|
410
|
+
disposition: migrationPath ? "executable-migration" : "v4-native",
|
|
411
|
+
ownerAssignment,
|
|
412
|
+
sourceEvidence: {
|
|
413
|
+
path: sourcePath,
|
|
414
|
+
selector: `git-diff-status:${fields[0]}`,
|
|
415
|
+
valueRoot: sha256(line),
|
|
416
|
+
},
|
|
417
|
+
v4Route: {
|
|
418
|
+
capabilityId: `path:${migrationPath || sourcePath}`,
|
|
419
|
+
evidence: { path: migrationPath || sourcePath, selector: "$" },
|
|
420
|
+
},
|
|
421
|
+
residual: null,
|
|
422
|
+
positiveProbe:
|
|
423
|
+
"the exact v3 history range includes the path and the exact v4 cut contains its route",
|
|
424
|
+
negativeProbe:
|
|
425
|
+
"an absent or unclassified changed path fails validation",
|
|
426
|
+
};
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export function countsBy(rows, field) {
|
|
431
|
+
return Object.fromEntries(
|
|
432
|
+
[...new Set(rows.map((row) => row[field]))]
|
|
433
|
+
.sort()
|
|
434
|
+
.map((value) => [
|
|
435
|
+
value,
|
|
436
|
+
rows.filter((row) => row[field] === value).length,
|
|
437
|
+
]),
|
|
438
|
+
);
|
|
439
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
createV4CrossPlatformAdopterReport,
|
|
9
|
+
qualifyV4CrossPlatformAdopters,
|
|
10
|
+
summarizeV3V4CapabilityInventory,
|
|
11
|
+
} from "../packages/core/v4-cross-platform-adopter-qualification.js";
|
|
12
|
+
|
|
13
|
+
function flag(name, fallback = "") {
|
|
14
|
+
const index = process.argv.indexOf(`--${name}`);
|
|
15
|
+
return index === -1 ? fallback : process.argv[index + 1] || fallback;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function required(name) {
|
|
19
|
+
const value = flag(name);
|
|
20
|
+
if (!value) throw new Error(`--${name} is required`);
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function repeated(name) {
|
|
25
|
+
const values = [];
|
|
26
|
+
for (let index = 0; index < process.argv.length; index += 1) {
|
|
27
|
+
if (process.argv[index] === `--${name}` && process.argv[index + 1])
|
|
28
|
+
values.push(process.argv[++index]);
|
|
29
|
+
}
|
|
30
|
+
return values;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function readJson(file) {
|
|
34
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function writeJson(file, value) {
|
|
38
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
39
|
+
fs.writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function run(command, args, options = {}) {
|
|
43
|
+
const completed = spawnSync(command, args, {
|
|
44
|
+
encoding: "utf8",
|
|
45
|
+
...options,
|
|
46
|
+
});
|
|
47
|
+
if (completed.error) throw completed.error;
|
|
48
|
+
return completed;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function expectPass(result, label) {
|
|
52
|
+
if (result.status !== 0)
|
|
53
|
+
throw new Error(
|
|
54
|
+
`${label} failed with ${result.status}: ${(result.stderr || "").trim()}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function resolveInput(consumerRoot, value) {
|
|
59
|
+
return path.isAbsolute(value) ? value : path.join(consumerRoot, value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function runPlatform() {
|
|
63
|
+
const runtimeRoot = path.resolve(required("runtime-root"));
|
|
64
|
+
const consumerRoot = path.resolve(flag("consumer-root", process.cwd()));
|
|
65
|
+
const output = path.resolve(required("output"));
|
|
66
|
+
const workRoot = path.dirname(output);
|
|
67
|
+
const input = resolveInput(consumerRoot, required("input"));
|
|
68
|
+
const bootstrap = resolveInput(consumerRoot, required("bootstrap"));
|
|
69
|
+
const cli = path.join(runtimeRoot, "bin/buildchain.mjs");
|
|
70
|
+
const command = (subcommand, args) =>
|
|
71
|
+
run(process.execPath, [cli, "adopter-delivery", subcommand, ...args], {
|
|
72
|
+
cwd: consumerRoot,
|
|
73
|
+
env: process.env,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const inventory = readJson(
|
|
77
|
+
path.join(runtimeRoot, "architecture/v3-v4-live-capability-inventory.json"),
|
|
78
|
+
);
|
|
79
|
+
const inventoryEvidence = summarizeV3V4CapabilityInventory(inventory);
|
|
80
|
+
fs.mkdirSync(workRoot, { recursive: true });
|
|
81
|
+
const initialPath = path.join(workRoot, "initial-readback.json");
|
|
82
|
+
const retryPath = path.join(workRoot, "retry-readback.json");
|
|
83
|
+
const terminalPath = path.join(workRoot, "terminal-readback.json");
|
|
84
|
+
const tamperedPath = path.join(workRoot, "tampered-readback.json");
|
|
85
|
+
const bootstrapPath = path.join(workRoot, "bootstrap.json");
|
|
86
|
+
|
|
87
|
+
expectPass(
|
|
88
|
+
command("run", ["--input", input, "--output", initialPath]),
|
|
89
|
+
"initial public adopter delivery",
|
|
90
|
+
);
|
|
91
|
+
const initial = readJson(initialPath);
|
|
92
|
+
const tampered = structuredClone(initial);
|
|
93
|
+
tampered.gateResult.artifact.root = `sha256:${"f".repeat(64)}`;
|
|
94
|
+
writeJson(tamperedPath, tampered);
|
|
95
|
+
const rejected = command("verify", [
|
|
96
|
+
"--input",
|
|
97
|
+
input,
|
|
98
|
+
"--readback",
|
|
99
|
+
tamperedPath,
|
|
100
|
+
]);
|
|
101
|
+
if (rejected.status === 0)
|
|
102
|
+
throw new Error("tampered public readback was not rejected");
|
|
103
|
+
expectPass(
|
|
104
|
+
command("run", ["--input", input, "--output", retryPath]),
|
|
105
|
+
"retry public adopter delivery",
|
|
106
|
+
);
|
|
107
|
+
const retry = readJson(retryPath);
|
|
108
|
+
expectPass(
|
|
109
|
+
command("verify", [
|
|
110
|
+
"--input",
|
|
111
|
+
input,
|
|
112
|
+
"--readback",
|
|
113
|
+
retryPath,
|
|
114
|
+
"--output",
|
|
115
|
+
terminalPath,
|
|
116
|
+
]),
|
|
117
|
+
"terminal public adopter delivery readback",
|
|
118
|
+
);
|
|
119
|
+
const terminal = readJson(terminalPath);
|
|
120
|
+
expectPass(
|
|
121
|
+
command("bootstrap", ["--input", bootstrap, "--output", bootstrapPath]),
|
|
122
|
+
"public N-1 bootstrap",
|
|
123
|
+
);
|
|
124
|
+
const bootstrapEvidence = readJson(bootstrapPath);
|
|
125
|
+
const neutralDriver = run(
|
|
126
|
+
process.execPath,
|
|
127
|
+
[
|
|
128
|
+
"--test",
|
|
129
|
+
path.join(
|
|
130
|
+
runtimeRoot,
|
|
131
|
+
"tests/non-kfd-specification-driver-clean-room.test.mjs",
|
|
132
|
+
),
|
|
133
|
+
],
|
|
134
|
+
{ cwd: runtimeRoot, env: process.env },
|
|
135
|
+
);
|
|
136
|
+
expectPass(neutralDriver, "independent protocol-neutral driver");
|
|
137
|
+
|
|
138
|
+
const report = createV4CrossPlatformAdopterReport({
|
|
139
|
+
platform: required("platform"),
|
|
140
|
+
consumer: required("consumer"),
|
|
141
|
+
sourceBinding: {
|
|
142
|
+
runtimeSha: required("runtime-sha"),
|
|
143
|
+
consumerSha: required("consumer-sha"),
|
|
144
|
+
inventoryRoot: inventoryEvidence.inventoryRoot,
|
|
145
|
+
sourceCuts: inventoryEvidence.sourceCuts,
|
|
146
|
+
},
|
|
147
|
+
capabilityMatrix: {
|
|
148
|
+
capabilityCount: inventoryEvidence.summary.capabilityCount,
|
|
149
|
+
categoryCounts: inventoryEvidence.summary.categoryCounts,
|
|
150
|
+
dispositionCounts: inventoryEvidence.summary.dispositionCounts,
|
|
151
|
+
categories: inventoryEvidence.categories,
|
|
152
|
+
},
|
|
153
|
+
execution: {
|
|
154
|
+
initialRun: {
|
|
155
|
+
status: "passed",
|
|
156
|
+
readbackRoot: initial.deliveryRoot,
|
|
157
|
+
},
|
|
158
|
+
tamperFailure: {
|
|
159
|
+
status: "failed-as-required",
|
|
160
|
+
exitCode: rejected.status ?? 1,
|
|
161
|
+
},
|
|
162
|
+
retryRun: {
|
|
163
|
+
status: "passed",
|
|
164
|
+
readbackRoot: retry.deliveryRoot,
|
|
165
|
+
},
|
|
166
|
+
terminalVerify: {
|
|
167
|
+
status: "passed",
|
|
168
|
+
readbackRoot: terminal.deliveryRoot,
|
|
169
|
+
},
|
|
170
|
+
bootstrap: {
|
|
171
|
+
status: "passed",
|
|
172
|
+
resultRoot: bootstrapEvidence.resultRoot,
|
|
173
|
+
},
|
|
174
|
+
neutralDriver: {
|
|
175
|
+
id: "ledger-specification-driver",
|
|
176
|
+
status: "passed",
|
|
177
|
+
kfdDependencyPresent: false,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
authority: {
|
|
181
|
+
productionWrites: false,
|
|
182
|
+
providerEffects: false,
|
|
183
|
+
releaseEffects: false,
|
|
184
|
+
stablePublication: false,
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
writeJson(output, report);
|
|
188
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function collectReports(root) {
|
|
192
|
+
const reports = [];
|
|
193
|
+
const visit = (directory) => {
|
|
194
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
195
|
+
const target = path.join(directory, entry.name);
|
|
196
|
+
if (entry.isDirectory()) visit(target);
|
|
197
|
+
else if (entry.isFile() && entry.name.endsWith(".json")) {
|
|
198
|
+
const candidate = readJson(target);
|
|
199
|
+
if (
|
|
200
|
+
candidate?.contract ===
|
|
201
|
+
"kungfu-buildchain-v4-cross-platform-adopter-report/v1"
|
|
202
|
+
)
|
|
203
|
+
reports.push(candidate);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
visit(root);
|
|
208
|
+
return reports;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function aggregate() {
|
|
212
|
+
const reportsRoot = path.resolve(required("reports-root"));
|
|
213
|
+
const qualification = qualifyV4CrossPlatformAdopters({
|
|
214
|
+
reports: collectReports(reportsRoot),
|
|
215
|
+
consumers: repeated("consumer"),
|
|
216
|
+
});
|
|
217
|
+
const output = flag("output");
|
|
218
|
+
if (output) writeJson(path.resolve(output), qualification);
|
|
219
|
+
process.stdout.write(`${JSON.stringify(qualification, null, 2)}\n`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const mode = process.argv[2] || "";
|
|
223
|
+
if (mode === "run") runPlatform();
|
|
224
|
+
else if (mode === "aggregate") aggregate();
|
|
225
|
+
else
|
|
226
|
+
throw new Error(
|
|
227
|
+
"usage: v4-cross-platform-adopter-qualification.mjs <run|aggregate> ...",
|
|
228
|
+
);
|