@kungfu-tech/buildchain 4.0.1-alpha.4 → 4.0.1-alpha.40
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/ci-lane-change-budget.json +187 -0
- package/architecture/decisions/0002-next-development-transition.md +101 -0
- package/architecture/internal-capabilities.json +117 -8
- package/architecture/maintainability-policy.json +43 -25
- 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-floating-consumer-policy.json +6 -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-floating-consumer-policy-receipt-v1.schema.json +4 -2
- 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 +477 -32
- package/dist/site/capability-registry.json +17 -14
- package/dist/site/cli-registry.json +159 -1
- package/dist/site/kfd-claims.json +455 -15
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +53 -7
- package/dist/site/node-api-registry.json +14008 -9602
- package/dist/site/page-registry.json +442 -21
- package/dist/site/public-surface-audit.json +440 -11
- package/dist/site/publication-authority-registry.json +44 -8
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +22 -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 +35 -11
- package/dist/site/workflow-registry.json +142 -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/dev-delivery-warrant.md +22 -1
- package/docs/next-development-transition.md +118 -0
- package/docs/node-api-reference.md +583 -288
- package/docs/release-candidate.md +7 -0
- 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 +30 -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/buildchain-publication-authority.js +1 -0
- package/packages/core/channel-candidate.js +8 -0
- package/packages/core/channel-promotion-baseline.js +55 -0
- package/packages/core/ci-lane-change-budget.js +247 -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-native-proof.js +43 -27
- package/packages/core/dev-delivery-process-boundary.js +19 -6
- package/packages/core/dev-delivery-provider-heartbeat.js +18 -6
- package/packages/core/dev-delivery-warrant-settlement.js +234 -2
- package/packages/core/dev-delivery-warrant-state.js +46 -10
- package/packages/core/dev-delivery-warrant.js +16 -3
- package/packages/core/github-governance-authority.js +1 -0
- package/packages/core/index.js +5 -0
- 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-candidate-recovery.js +70 -15
- package/packages/core/release-candidate.js +2 -2
- package/packages/core/release-passport.js +36 -9
- 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-delivery-warrant-read-candidate.js +10 -3
- package/packages/core/v4-floating-consumer-evidence.js +18 -4
- package/packages/core/v4-floating-consumer-policy.js +143 -20
- package/packages/core/v4-floating-consumer-release-passport.js +35 -8
- 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/packages/core/workflow-yaml-contract.js +24 -2
- package/scripts/artifact-signing-controller-core.mjs +1 -1
- package/scripts/buildchain-cli-help.mjs +30 -0
- package/scripts/check-ci-lane-change-budget.mjs +100 -0
- package/scripts/check-inventory.mjs +14 -3
- package/scripts/check-project-cut-merge-queue-admission.mjs +87 -0
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +23 -4
- 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/dev-delivery-warrant-options.mjs +27 -11
- package/scripts/dev-delivery-warrant-store.mjs +10 -6
- package/scripts/dev-delivery-warrant.mjs +50 -6
- package/scripts/dev-pr-auto-merge.mjs +25 -11
- package/scripts/dev-pr-delivery-warrant.mjs +45 -0
- package/scripts/dev-pr-prequeue-guard.mjs +0 -18
- package/scripts/dev-qualification-patrol.mjs +9 -9
- package/scripts/dispatch-artifact-signing-authority.mjs +1 -1
- package/scripts/generate-channel-promotion-workflow.mjs +2 -2
- 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/project-cut-merge-queue-admission.mjs +394 -0
- package/scripts/promotion-channel-router.mjs +4 -4
- package/scripts/release-candidate-anchor-provenance.mjs +99 -0
- package/scripts/release-tail.mjs +51 -3
- package/scripts/resume-from-candidate-run.mjs +595 -65
- package/scripts/site-capability-metadata.mjs +29 -0
- package/scripts/stable-candidate-qualification.mjs +9 -10
- package/scripts/v4-consumer-policy.mjs +5 -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
|
@@ -8,6 +8,11 @@ export const BUILDCHAIN_USAGE = `Usage:
|
|
|
8
8
|
buildchain architecture qualify --authority-revision <git-revision>
|
|
9
9
|
[--candidate-revision <git-revision>]
|
|
10
10
|
[--cwd <dir>] [--json]
|
|
11
|
+
buildchain adopter-delivery run --input <json-or-path> [--output <path>]
|
|
12
|
+
buildchain adopter-delivery verify --input <json-or-path>
|
|
13
|
+
--readback <json-or-path> [--output <path>]
|
|
14
|
+
buildchain adopter-delivery bootstrap --input <json-or-path> [--output <path>]
|
|
15
|
+
buildchain adopter-delivery archive --input <json-or-path> [--output <path>]
|
|
11
16
|
buildchain portable-cache plan --manifest <file-or-json> [--output <file>]
|
|
12
17
|
[--github-output <file>] [--json]
|
|
13
18
|
buildchain portable-cache receipt --plan <file-or-json> [--matched-key <key>]
|
|
@@ -44,6 +49,23 @@ export const BUILDCHAIN_USAGE = `Usage:
|
|
|
44
49
|
buildchain release-tail init --declaration <json-or-path> [--state <path>]
|
|
45
50
|
buildchain release-tail <status|verify> [--state <path>] [--output <path>]
|
|
46
51
|
buildchain release-tail compat --hooks-json <json-or-path> [--output <path>]
|
|
52
|
+
buildchain release-tail rehearse --capsule <absolute-path>
|
|
53
|
+
--candidate-root <absolute-path>
|
|
54
|
+
--mode <simulate|replay>
|
|
55
|
+
--state <absolute-path>
|
|
56
|
+
--evidence <absolute-path>
|
|
57
|
+
buildchain tail-reseal plan --request <request.json> [--output <plan.json>]
|
|
58
|
+
buildchain tail-reseal admit --request <request.json> [--output <admission.json>]
|
|
59
|
+
buildchain tail-reseal verify-platform --request <request.json> --platform <id>
|
|
60
|
+
[--artifact-root <dir>] [--mode retained|resealed]
|
|
61
|
+
[--provider-readback-root <sha256:...>]
|
|
62
|
+
[--output <readback.json>]
|
|
63
|
+
buildchain tail-reseal seal --request <request.json> --plan <plan.json>
|
|
64
|
+
--readbacks <dir> --passport <passport.json>
|
|
65
|
+
--protected-readback-root <sha256:...>
|
|
66
|
+
[--output <receipt.json>]
|
|
67
|
+
buildchain next-development materialize --input <request.json> [--cwd <dir>]
|
|
68
|
+
[--write] [--output <path>] [--json]
|
|
47
69
|
buildchain github-governance <plan|apply|rollback|protection-policy-plan|ruleset-policy-plan> ...
|
|
48
70
|
buildchain release <inspect|recover|finalize|abort> ...
|
|
49
71
|
buildchain transaction inspect ...
|
|
@@ -154,6 +176,14 @@ export const BUILDCHAIN_USAGE = `Usage:
|
|
|
154
176
|
[--module-fact <file>]... [--artifact <path>]...
|
|
155
177
|
[--output <file>] [--json]
|
|
156
178
|
buildchain facts verify [--cwd <dir>] --fact <file> [--json]
|
|
179
|
+
buildchain facts compatibility project [--cwd <dir>] [--registry <json-or-path>]
|
|
180
|
+
[--output <file>] [--json]
|
|
181
|
+
buildchain facts compatibility verify [--cwd <dir>] [--registry <json-or-path>] [--json]
|
|
182
|
+
buildchain facts compatibility query --query <json-or-path>
|
|
183
|
+
[--registry <json-or-path>] [--cwd <dir>] [--json]
|
|
184
|
+
buildchain facts compatibility query-template --fact-root <sha256:...>
|
|
185
|
+
[--query-id <id>] [--registry <json-or-path>]
|
|
186
|
+
[--cwd <dir>] [--json]
|
|
157
187
|
buildchain kfd ...
|
|
158
188
|
buildchain kfd hub <init|inspect|test|explain> [--cwd <dir>]
|
|
159
189
|
[--declaration <path>] [--output-dir <path>]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import crypto from "node:crypto";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { evaluateCiLaneChangeBudget } from "../packages/core/ci-lane-change-budget.js";
|
|
8
|
+
|
|
9
|
+
const root = process.cwd();
|
|
10
|
+
const workflowRoot = path.join(root, ".github", "workflows");
|
|
11
|
+
const policyPath = path.join(
|
|
12
|
+
root,
|
|
13
|
+
"architecture",
|
|
14
|
+
"ci-lane-change-budget.json",
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const workflows = fs
|
|
18
|
+
.readdirSync(workflowRoot, { withFileTypes: true })
|
|
19
|
+
.filter((entry) => entry.isFile() && /\.(?:yaml|yml)$/u.test(entry.name))
|
|
20
|
+
.map((entry) => {
|
|
21
|
+
const workflowPath = path.posix.join(".github/workflows", entry.name);
|
|
22
|
+
return {
|
|
23
|
+
path: workflowPath,
|
|
24
|
+
text: fs.readFileSync(path.join(workflowRoot, entry.name), "utf8"),
|
|
25
|
+
};
|
|
26
|
+
})
|
|
27
|
+
.sort((left, right) => left.path.localeCompare(right.path));
|
|
28
|
+
|
|
29
|
+
const policy = JSON.parse(fs.readFileSync(policyPath, "utf8"));
|
|
30
|
+
const baselineRevision = String(policy.baseline?.gitRevision || "").trim();
|
|
31
|
+
if (!/^[0-9a-f]{40}$/u.test(baselineRevision)) {
|
|
32
|
+
throw new Error("baseline.gitRevision must be an exact Git commit");
|
|
33
|
+
}
|
|
34
|
+
const embeddedBaselineLanes = policy.baseline?.lanes;
|
|
35
|
+
if (
|
|
36
|
+
!Array.isArray(embeddedBaselineLanes) ||
|
|
37
|
+
embeddedBaselineLanes.length === 0
|
|
38
|
+
) {
|
|
39
|
+
throw new Error("baseline.lanes must contain the exact offline lane set");
|
|
40
|
+
}
|
|
41
|
+
const embeddedLaneSetRoot = `sha256:${crypto
|
|
42
|
+
.createHash("sha256")
|
|
43
|
+
.update(`${JSON.stringify(embeddedBaselineLanes)}\n`)
|
|
44
|
+
.digest("hex")}`;
|
|
45
|
+
if (embeddedLaneSetRoot !== policy.baseline?.laneSetRoot) {
|
|
46
|
+
throw new Error("baseline laneSetRoot does not match baseline.lanes");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let baselineWorkflows = null;
|
|
50
|
+
try {
|
|
51
|
+
execFileSync("git", ["cat-file", "-e", `${baselineRevision}^{commit}`], {
|
|
52
|
+
cwd: root,
|
|
53
|
+
stdio: "ignore",
|
|
54
|
+
});
|
|
55
|
+
const baselinePaths = execFileSync(
|
|
56
|
+
"git",
|
|
57
|
+
[
|
|
58
|
+
"ls-tree",
|
|
59
|
+
"-r",
|
|
60
|
+
"--name-only",
|
|
61
|
+
baselineRevision,
|
|
62
|
+
"--",
|
|
63
|
+
".github/workflows",
|
|
64
|
+
],
|
|
65
|
+
{ cwd: root, encoding: "utf8" },
|
|
66
|
+
)
|
|
67
|
+
.split(/\r?\n/u)
|
|
68
|
+
.filter((value) => /\.(?:yaml|yml)$/u.test(value))
|
|
69
|
+
.sort();
|
|
70
|
+
baselineWorkflows = baselinePaths.map((workflowPath) => ({
|
|
71
|
+
path: workflowPath,
|
|
72
|
+
text: execFileSync("git", ["show", `${baselineRevision}:${workflowPath}`], {
|
|
73
|
+
cwd: root,
|
|
74
|
+
encoding: "utf8",
|
|
75
|
+
}),
|
|
76
|
+
}));
|
|
77
|
+
} catch {
|
|
78
|
+
// Shallow and exported source cuts may not contain the pinned commit object.
|
|
79
|
+
// The content-rooted embedded lane set remains the exact offline authority.
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const embeddedEvaluation = evaluateCiLaneChangeBudget({
|
|
83
|
+
policy,
|
|
84
|
+
workflows,
|
|
85
|
+
});
|
|
86
|
+
const evaluation = baselineWorkflows
|
|
87
|
+
? evaluateCiLaneChangeBudget({ policy, workflows, baselineWorkflows })
|
|
88
|
+
: embeddedEvaluation;
|
|
89
|
+
if (
|
|
90
|
+
baselineWorkflows &&
|
|
91
|
+
(evaluation.baselineLaneCount !== embeddedEvaluation.baselineLaneCount ||
|
|
92
|
+
JSON.stringify(evaluation.newLanes) !==
|
|
93
|
+
JSON.stringify(embeddedEvaluation.newLanes))
|
|
94
|
+
) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
"embedded baseline lanes do not match the pinned baseline revision",
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
process.stdout.write(`${JSON.stringify(evaluation, null, 2)}\n`);
|
|
100
|
+
if (!evaluation.ok) process.exitCode = 1;
|
|
@@ -54,6 +54,10 @@ const requiredPaths = [
|
|
|
54
54
|
"packages/core/homebrew.js",
|
|
55
55
|
"packages/core/artifact-verification-envelope.js",
|
|
56
56
|
"packages/core/anchored-version-material.js",
|
|
57
|
+
"packages/core/next-development-transition.js",
|
|
58
|
+
"packages/core/next-development-controller.js",
|
|
59
|
+
"packages/core/next-development-candidate-reservation.js",
|
|
60
|
+
"packages/core/next-development-projection.js",
|
|
57
61
|
"packages/core/build-facts.js",
|
|
58
62
|
"packages/core/publication-package.js",
|
|
59
63
|
"packages/core/publication-reproducibility.js",
|
|
@@ -76,6 +80,8 @@ const requiredPaths = [
|
|
|
76
80
|
"docs/auditable-demo.md",
|
|
77
81
|
"contracts/auditable-demo-scenario-v1.schema.json",
|
|
78
82
|
"contracts/release-candidate-recovery-v1.schema.json",
|
|
83
|
+
"contracts/next-development-request-v1.schema.json",
|
|
84
|
+
"contracts/next-development-transition-v1.schema.json",
|
|
79
85
|
"contracts/auditable-demo-media-profiles-v1.json",
|
|
80
86
|
"contracts/evidence/auditable-demo-web-delivery-v1.json",
|
|
81
87
|
"contracts/evidence/auditable-demo-responsive-web-delivery-v1.json",
|
|
@@ -87,10 +93,15 @@ const requiredPaths = [
|
|
|
87
93
|
"contracts/fixtures/auditable-demo-responsive-web-delivery-v1/public-projection.json",
|
|
88
94
|
"contracts/fixtures/auditable-demo-responsive-web-delivery-v1/scene.json",
|
|
89
95
|
"docs/release-propagation.md",
|
|
96
|
+
"docs/next-development-transition.md",
|
|
90
97
|
"docs/site-bundle-contract.md",
|
|
91
98
|
"docs/toolkit-observability.md",
|
|
92
99
|
"docs/versioning.md",
|
|
93
100
|
"scripts/release-line-dry-run.mjs",
|
|
101
|
+
"scripts/next-development-transition.mjs",
|
|
102
|
+
"scripts/next-development-self-dogfood.mjs",
|
|
103
|
+
"scripts/next-development-self-dogfood-harness.mjs",
|
|
104
|
+
"scripts/generate-next-development-guidance.mjs",
|
|
94
105
|
"scripts/reconcile-release-governance.mjs",
|
|
95
106
|
"scripts/buildchain-channel-router.mjs",
|
|
96
107
|
"scripts/generate-channel-build-workflow.mjs",
|
|
@@ -1010,16 +1021,16 @@ for (const forbiddenSnippet of [
|
|
|
1010
1021
|
for (const requiredSnippet of [
|
|
1011
1022
|
"id-token: write",
|
|
1012
1023
|
"actions: write",
|
|
1013
|
-
"uses:
|
|
1024
|
+
"uses: kungfu-systems/buildchain/.github/workflows/release-candidate-promote.yml@v4-alpha",
|
|
1014
1025
|
"github.event.workflow_run.event == 'push'",
|
|
1015
1026
|
"!startsWith(github.event.workflow_run.display_title, 'chore(release): prepare v')",
|
|
1016
1027
|
"!startsWith(github.event.workflow_run.display_title, 'chore(release): release v')",
|
|
1017
1028
|
"resume-candidate-run-id:",
|
|
1018
1029
|
"resume-expected-source-tree:",
|
|
1019
1030
|
"resume-buildchain-runtime-sha:",
|
|
1020
|
-
"github-
|
|
1031
|
+
"uses: kungfu-systems/buildchain/.github/workflows/release-candidate-promote.yml@v4",
|
|
1021
1032
|
"release-passport-buildchain-self-kfd: true",
|
|
1022
|
-
"
|
|
1033
|
+
"buildchain-channel: alpha",
|
|
1023
1034
|
"release-passport-impact-json: .buildchain/release-impact.json",
|
|
1024
1035
|
]) {
|
|
1025
1036
|
if (!buildchainRefPromotionWorkflow.includes(requiredSnippet)) {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import {
|
|
4
|
+
ProjectCutAdmissionError,
|
|
5
|
+
qualifyProjectCut,
|
|
6
|
+
releaseFamilyQueueLease,
|
|
7
|
+
} from "./project-cut-merge-queue-admission.mjs";
|
|
8
|
+
|
|
9
|
+
function parseArguments(argv) {
|
|
10
|
+
const options = {};
|
|
11
|
+
const names = new Map([
|
|
12
|
+
["--base", "base"],
|
|
13
|
+
["--head", "head"],
|
|
14
|
+
["--initiative-id", "initiativeId"],
|
|
15
|
+
["--assignment-id", "assignmentId"],
|
|
16
|
+
["--delivery-class", "deliveryClass"],
|
|
17
|
+
["--queue-attempt", "queueAttempt"],
|
|
18
|
+
["--admission-proof-root", "admissionProofRoot"],
|
|
19
|
+
["--release-family-marker", "releaseFamilyMarker"],
|
|
20
|
+
["--expected-pr-head", "expectedPullRequestHead"],
|
|
21
|
+
["--terminal-reason", "terminalReason"],
|
|
22
|
+
["--evidence-root", "evidenceRoot"],
|
|
23
|
+
]);
|
|
24
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
25
|
+
const name = argv[index];
|
|
26
|
+
const key = names.get(name);
|
|
27
|
+
if (!key) throw new Error(`unknown argument: ${name}`);
|
|
28
|
+
const value = argv[index + 1];
|
|
29
|
+
if (value === undefined || value.startsWith("--"))
|
|
30
|
+
throw new Error(`${name} requires a value`);
|
|
31
|
+
if (Object.hasOwn(options, key))
|
|
32
|
+
throw new Error(`${name} was provided more than once`);
|
|
33
|
+
options[key] = value;
|
|
34
|
+
index += 1;
|
|
35
|
+
}
|
|
36
|
+
return options;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function markerText(path) {
|
|
40
|
+
return path === "-"
|
|
41
|
+
? fs.readFileSync(0, "utf8")
|
|
42
|
+
: fs.readFileSync(path, "utf8");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function repairReceipt(error) {
|
|
46
|
+
return {
|
|
47
|
+
schema: "project.cut.merge-queue-admission/v1",
|
|
48
|
+
ok: false,
|
|
49
|
+
decision: "repair-required",
|
|
50
|
+
retryable: false,
|
|
51
|
+
compositionChanged: false,
|
|
52
|
+
reasonCodes: [error.reasonCode],
|
|
53
|
+
error: error.message,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function main(argv = process.argv.slice(2)) {
|
|
58
|
+
try {
|
|
59
|
+
const options = parseArguments(argv);
|
|
60
|
+
if (options.releaseFamilyMarker) {
|
|
61
|
+
console.log(
|
|
62
|
+
JSON.stringify(
|
|
63
|
+
releaseFamilyQueueLease(
|
|
64
|
+
markerText(options.releaseFamilyMarker),
|
|
65
|
+
options,
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
if (!options.base || !options.head)
|
|
72
|
+
throw new Error("--base and --head are required");
|
|
73
|
+
console.log(
|
|
74
|
+
JSON.stringify(qualifyProjectCut({ cwd: process.cwd(), ...options })),
|
|
75
|
+
);
|
|
76
|
+
return 0;
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (error instanceof ProjectCutAdmissionError) {
|
|
79
|
+
console.log(JSON.stringify(repairReceipt(error)));
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
console.error(`project-cut admission error: ${error.message}`);
|
|
83
|
+
return 2;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (import.meta.url === `file://${process.argv[1]}`) process.exitCode = main();
|
|
@@ -52,8 +52,13 @@ function assertOrdered(relative, markers) {
|
|
|
52
52
|
|
|
53
53
|
export function assertPromotionCertificationWiring(source) {
|
|
54
54
|
for (const marker of [
|
|
55
|
-
".buildchain/runtime/
|
|
56
|
-
|
|
55
|
+
"path: .buildchain/runtime/candidate-policy-runtime",
|
|
56
|
+
"BUILDCHAIN_EXPECTED_RUNTIME_SHA: ${{ steps.v4-policy-caller.outputs.runtime-sha }}",
|
|
57
|
+
"policy_runtime=.buildchain/runtime",
|
|
58
|
+
'node "${policy_runtime}/scripts/v4-consumer-policy.mjs" certify',
|
|
59
|
+
"passport.consumerPolicy?.receipt?.caller?.sourceSha",
|
|
60
|
+
"path: .buildchain/runtime/policy-caller",
|
|
61
|
+
'--caller-root "${{ github.workspace }}/.buildchain/runtime/policy-caller"',
|
|
57
62
|
'--stable-lock "${{ inputs.buildchain-stable-contract-lock-path }}"',
|
|
58
63
|
'--alpha-lock "${{ inputs.buildchain-alpha-contract-lock-path }}"',
|
|
59
64
|
"release-passport-v4-consumer-policy-certification-root: ${{ steps.v4-policy-certification.outputs.v4-consumer-policy-certification-root }}",
|
|
@@ -78,13 +83,22 @@ function assertPersistedSelectors() {
|
|
|
78
83
|
);
|
|
79
84
|
if (!match) continue;
|
|
80
85
|
const selector = match[2];
|
|
86
|
+
const protectedBootstrap =
|
|
87
|
+
relative ===
|
|
88
|
+
".github/workflows/buildchain-ref-promotion-recovery.yml" &&
|
|
89
|
+
match[1] === ".github/workflows/.release-candidate-promote.yml" &&
|
|
90
|
+
selector === "alpha/v4/v4.0";
|
|
81
91
|
const isV4 =
|
|
82
92
|
selector === "v4" ||
|
|
83
93
|
selector === "v4-alpha" ||
|
|
84
94
|
/^v4(?:[./-]|$)/u.test(selector) ||
|
|
85
95
|
/^[0-9a-f]{40}$/iu.test(selector) ||
|
|
86
96
|
selector.includes("${{");
|
|
87
|
-
if (
|
|
97
|
+
if (
|
|
98
|
+
(isV4 || protectedBootstrap) &&
|
|
99
|
+
!["v4", "v4-alpha"].includes(selector) &&
|
|
100
|
+
!protectedBootstrap
|
|
101
|
+
) {
|
|
88
102
|
offenders.push(`${relative}:${node.line} @${selector}`);
|
|
89
103
|
}
|
|
90
104
|
}
|
|
@@ -112,7 +126,12 @@ export function checkV4FloatingConsumerPolicyContract() {
|
|
|
112
126
|
"Enforce v4 floating consumer policy",
|
|
113
127
|
"Validate consumer package manager contract",
|
|
114
128
|
]);
|
|
115
|
-
if (
|
|
129
|
+
if (
|
|
130
|
+
!read(".github/workflows/.build.yml").includes(
|
|
131
|
+
"BUILDCHAIN_EXPECTED_INVOCATION_CHANNEL: ${{ inputs.buildchain-expected-channel }}",
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
fail("channel builds must disambiguate dual-channel caller invocations");
|
|
116
135
|
assertTrustGatedJobs(read(".github/workflows/.build.yml"), [
|
|
117
136
|
"resolve-source",
|
|
118
137
|
"resolve-contract",
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
candidateFromDecision,
|
|
21
21
|
selectLatestQualifiedSource,
|
|
22
22
|
} from "../packages/core/dev-alpha-candidate-selection.js";
|
|
23
|
+
import { readGitHubNextDevelopmentVersionReservation } from "../packages/core/next-development-candidate-reservation.js";
|
|
23
24
|
|
|
24
25
|
export { reconcileActiveReleaseTrain, selectLatestQualifiedSource };
|
|
25
26
|
|
|
@@ -617,6 +618,7 @@ export async function runDevAlphaCandidatePatrol(
|
|
|
617
618
|
comparison,
|
|
618
619
|
workflowEvidence,
|
|
619
620
|
skippedNewerCommitCount,
|
|
621
|
+
versionReservation,
|
|
620
622
|
qualificationError,
|
|
621
623
|
} = await resolvePatrolSourceInputs({
|
|
622
624
|
client,
|
|
@@ -646,6 +648,7 @@ export async function runDevAlphaCandidatePatrol(
|
|
|
646
648
|
observedSourceHeadSha,
|
|
647
649
|
skippedNewerCommitCount,
|
|
648
650
|
...(targetBaseline ? { targetBaseline } : {}),
|
|
651
|
+
...(versionReservation ? { versionReservation } : {}),
|
|
649
652
|
},
|
|
650
653
|
workflowEvidence,
|
|
651
654
|
requiredWorkflowPaths,
|
|
@@ -992,6 +995,20 @@ export function createGitHubChannelCandidateClient({
|
|
|
992
995
|
targetBranch,
|
|
993
996
|
parseCandidate: managedCandidateFromPullRequest,
|
|
994
997
|
}),
|
|
998
|
+
async readNextDevelopmentVersionReservation({
|
|
999
|
+
reservationSha,
|
|
1000
|
+
candidateSha,
|
|
1001
|
+
targetVersion,
|
|
1002
|
+
}) {
|
|
1003
|
+
return readGitHubNextDevelopmentVersionReservation({
|
|
1004
|
+
api,
|
|
1005
|
+
owner,
|
|
1006
|
+
repo,
|
|
1007
|
+
reservationSha,
|
|
1008
|
+
candidateSha,
|
|
1009
|
+
targetVersion,
|
|
1010
|
+
});
|
|
1011
|
+
},
|
|
995
1012
|
async listCompletedWorkflowRuns(workflowPathValue, sourceBranch) {
|
|
996
1013
|
const runs = [];
|
|
997
1014
|
for (let page = 1; page <= 10; page += 1) {
|
|
@@ -1015,7 +1032,11 @@ export function createGitHubChannelCandidateClient({
|
|
|
1015
1032
|
for (const commit of rows) {
|
|
1016
1033
|
const commitSha = text(commit.sha);
|
|
1017
1034
|
if (commitSha === targetSha) return commits;
|
|
1018
|
-
commits.push(
|
|
1035
|
+
commits.push({
|
|
1036
|
+
sha: commitSha,
|
|
1037
|
+
message: text(commit.commit?.message),
|
|
1038
|
+
parents: (commit.parents || []).map((parent) => text(parent.sha)),
|
|
1039
|
+
});
|
|
1019
1040
|
}
|
|
1020
1041
|
if (rows.length < 100) return commits;
|
|
1021
1042
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
|
|
5
|
+
const SHA = /^[0-9a-f]{40}$/u;
|
|
6
|
+
|
|
7
|
+
function exactSha(value, label) {
|
|
8
|
+
const normalized = String(value || "")
|
|
9
|
+
.trim()
|
|
10
|
+
.toLowerCase();
|
|
11
|
+
if (!SHA.test(normalized))
|
|
12
|
+
throw new Error(`${label} must be an exact 40-hex Git SHA`);
|
|
13
|
+
return normalized;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function git(args, { cwd, encoding = "utf8" }) {
|
|
17
|
+
const result = spawnSync("git", args, {
|
|
18
|
+
cwd,
|
|
19
|
+
encoding,
|
|
20
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
21
|
+
});
|
|
22
|
+
if (result.status !== 0)
|
|
23
|
+
throw new Error(
|
|
24
|
+
`git ${args.join(" ")} failed: ${String(result.stderr || "").trim()}`,
|
|
25
|
+
);
|
|
26
|
+
return encoding === null ? result.stdout : String(result.stdout || "").trim();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function patchRoot(base, head, cwd) {
|
|
30
|
+
const patch = git(
|
|
31
|
+
[
|
|
32
|
+
"diff",
|
|
33
|
+
"--binary",
|
|
34
|
+
"--full-index",
|
|
35
|
+
"--no-ext-diff",
|
|
36
|
+
`${base}..${head}`,
|
|
37
|
+
],
|
|
38
|
+
{ cwd, encoding: null },
|
|
39
|
+
);
|
|
40
|
+
return `sha256:${crypto.createHash("sha256").update(patch).digest("hex")}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function linearRange(base, head, cwd) {
|
|
44
|
+
try {
|
|
45
|
+
git(["merge-base", "--is-ancestor", base, head], { cwd });
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const commits = git(
|
|
50
|
+
["rev-list", "--reverse", "--topo-order", `${base}..${head}`],
|
|
51
|
+
{ cwd },
|
|
52
|
+
)
|
|
53
|
+
.split(/\s+/u)
|
|
54
|
+
.filter(Boolean);
|
|
55
|
+
if (commits.length === 0) return null;
|
|
56
|
+
let expectedParent = base;
|
|
57
|
+
const trees = [];
|
|
58
|
+
const patchRoots = [];
|
|
59
|
+
for (const rangeCommit of commits) {
|
|
60
|
+
const [observedCommit, ...parents] = git(
|
|
61
|
+
["rev-list", "--parents", "-n", "1", rangeCommit],
|
|
62
|
+
{ cwd },
|
|
63
|
+
).split(/\s+/u);
|
|
64
|
+
if (
|
|
65
|
+
observedCommit !== rangeCommit ||
|
|
66
|
+
parents.length !== 1 ||
|
|
67
|
+
parents[0] !== expectedParent
|
|
68
|
+
) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
trees.push(
|
|
72
|
+
exactSha(
|
|
73
|
+
git(["rev-parse", `${rangeCommit}^{tree}`], { cwd }),
|
|
74
|
+
"replayedCommitTree",
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
patchRoots.push(patchRoot(expectedParent, rangeCommit, cwd));
|
|
78
|
+
expectedParent = rangeCommit;
|
|
79
|
+
}
|
|
80
|
+
return { commits, trees, patchRoots };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function exactMergeGroupBinding(input = {}) {
|
|
84
|
+
const cwd = path.resolve(input.cwd || process.cwd());
|
|
85
|
+
const mergeGroupHead = exactSha(input.mergeGroupHead, "mergeGroupHead");
|
|
86
|
+
const expectedTree = exactSha(input.mergeGroupTree, "mergeGroupTree");
|
|
87
|
+
const qualifiedBase = exactSha(input.qualifiedBase, "qualifiedBase");
|
|
88
|
+
const currentBase = exactSha(input.currentBase, "currentBase");
|
|
89
|
+
const sourceHead = exactSha(input.sourceHead, "sourceHead");
|
|
90
|
+
const sourcePatchRoot = String(input.sourcePatchRoot || "").trim();
|
|
91
|
+
const actualTree = exactSha(
|
|
92
|
+
git(["rev-parse", `${mergeGroupHead}^{tree}`], { cwd }),
|
|
93
|
+
"mergeGroupTree",
|
|
94
|
+
);
|
|
95
|
+
if (actualTree !== expectedTree)
|
|
96
|
+
return { ok: false, reason: "merge-group-tree-mismatch" };
|
|
97
|
+
try {
|
|
98
|
+
git(["merge-base", "--is-ancestor", qualifiedBase, currentBase], { cwd });
|
|
99
|
+
} catch {
|
|
100
|
+
return {
|
|
101
|
+
ok: false,
|
|
102
|
+
reason: "current-base-not-descendant-of-qualified-base",
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (!/^sha256:[0-9a-f]{64}$/u.test(sourcePatchRoot))
|
|
106
|
+
throw new Error("sourcePatchRoot must be an exact SHA-256 root");
|
|
107
|
+
if (patchRoot(currentBase, mergeGroupHead, cwd) !== sourcePatchRoot)
|
|
108
|
+
return { ok: false, reason: "merge-group-source-patch-mismatch" };
|
|
109
|
+
|
|
110
|
+
const [commit, ...parents] = git(
|
|
111
|
+
["rev-list", "--parents", "-n", "1", mergeGroupHead],
|
|
112
|
+
{ cwd },
|
|
113
|
+
).split(/\s+/u);
|
|
114
|
+
if (commit !== mergeGroupHead)
|
|
115
|
+
return { ok: false, reason: "merge-group-parent-mismatch" };
|
|
116
|
+
if (
|
|
117
|
+
parents.length === 2 &&
|
|
118
|
+
parents[0] === currentBase &&
|
|
119
|
+
parents[1] === sourceHead
|
|
120
|
+
) {
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
mergeGroupHead,
|
|
124
|
+
mergeGroupTree: actualTree,
|
|
125
|
+
parents,
|
|
126
|
+
compositionMode: "two-parent-merge",
|
|
127
|
+
replayedCommitTrees: [],
|
|
128
|
+
replayedCommitPatchRoots: [],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const sourceRange = linearRange(qualifiedBase, sourceHead, cwd);
|
|
133
|
+
const mergeGroupRange = linearRange(currentBase, mergeGroupHead, cwd);
|
|
134
|
+
if (
|
|
135
|
+
!sourceRange ||
|
|
136
|
+
!mergeGroupRange ||
|
|
137
|
+
sourceRange.commits.length !== mergeGroupRange.commits.length ||
|
|
138
|
+
sourceRange.patchRoots.some(
|
|
139
|
+
(root, index) => root !== mergeGroupRange.patchRoots[index],
|
|
140
|
+
)
|
|
141
|
+
) {
|
|
142
|
+
return { ok: false, reason: "merge-group-parent-mismatch" };
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
ok: true,
|
|
146
|
+
mergeGroupHead,
|
|
147
|
+
mergeGroupTree: actualTree,
|
|
148
|
+
parents,
|
|
149
|
+
compositionMode: "linear-replay",
|
|
150
|
+
replayedCommitTrees: mergeGroupRange.trees,
|
|
151
|
+
replayedCommitPatchRoots: mergeGroupRange.patchRoots,
|
|
152
|
+
};
|
|
153
|
+
}
|