@kungfu-tech/buildchain 4.0.1-alpha.2 → 4.0.1-alpha.21
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/decisions/0003-two-phase-delivery-warrant.md +152 -0
- package/architecture/internal-capabilities.json +211 -8
- package/architecture/maintainability-policy.json +113 -28
- package/architecture/release-tail-contract-inventory.json +5 -2
- package/architecture/v3-core-mechanism-inventory.json +91 -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-delivery-authority-parity.json +250 -0
- package/architecture/v4-delivery-warrant-shadow-fixtures.json +41 -9
- 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 +32 -3
- 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/dev-delivery-authority-v2.schema.json +662 -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 +5 -0
- package/dist/site/artifact-schemas.json +10 -0
- package/dist/site/buildchain-contract.json +1475 -27
- package/dist/site/buildchain-site.json +627 -31
- package/dist/site/capability-registry.json +17 -14
- package/dist/site/cli-registry.json +205 -3
- package/dist/site/kfd-claims.json +490 -16
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +52 -6
- package/dist/site/node-api-registry.json +14736 -8851
- package/dist/site/page-registry.json +593 -21
- package/dist/site/public-surface-audit.json +837 -48
- package/dist/site/publication-authority-registry.json +44 -8
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +24 -0
- package/dist/site/schemas/dev-delivery-authority-v2.schema.json +662 -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 +160 -10
- package/docs/MAP.md +8 -2
- package/docs/cli-reference.md +404 -13
- package/docs/cli.md +8 -0
- package/docs/dev-alpha-candidate-patrol.md +8 -0
- package/docs/dev-delivery-qualification-landing-adr.md +251 -0
- package/docs/dev-delivery-warrant.md +351 -38
- package/docs/next-development-transition.md +118 -0
- package/docs/node-api-reference.md +646 -293
- 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 +34 -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 +96 -143
- 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-authority-candidate.js +270 -0
- package/packages/core/dev-delivery-authority-evidence.js +146 -0
- package/packages/core/dev-delivery-authority-landing.js +461 -0
- package/packages/core/dev-delivery-authority-observation.js +48 -0
- package/packages/core/dev-delivery-authority-qualification.js +591 -0
- package/packages/core/dev-delivery-authority-settlement.js +213 -0
- package/packages/core/dev-delivery-authority-state.js +583 -0
- package/packages/core/dev-delivery-candidate-identity.js +13 -0
- package/packages/core/dev-delivery-contract-surface.js +76 -0
- package/packages/core/dev-delivery-execution-failure.js +133 -0
- package/packages/core/dev-delivery-execution-transfer.js +592 -0
- package/packages/core/dev-delivery-landing-admission-core.js +119 -0
- package/packages/core/dev-delivery-landing-readback.js +598 -0
- package/packages/core/dev-delivery-landing-terminal-evidence.js +271 -0
- package/packages/core/dev-delivery-landing-testing-port.js +6 -0
- package/packages/core/dev-delivery-native-execution.js +110 -0
- package/packages/core/dev-delivery-native-proof.js +562 -0
- package/packages/core/dev-delivery-process-boundary.js +563 -0
- package/packages/core/dev-delivery-provider-attempt.js +127 -0
- package/packages/core/dev-delivery-provider-heartbeat.js +382 -0
- package/packages/core/dev-delivery-warrant-cancellation.js +1 -0
- package/packages/core/dev-delivery-warrant-qualification.js +145 -0
- package/packages/core/dev-delivery-warrant-settlement.js +237 -36
- package/packages/core/dev-delivery-warrant-state.js +587 -0
- package/packages/core/dev-delivery-warrant.js +328 -370
- 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 +32 -5
- 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/buildchain-cli-help.mjs +41 -2
- package/scripts/check-ci-lane-change-budget.mjs +100 -0
- package/scripts/check-inventory.mjs +14 -3
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +23 -4
- package/scripts/dev-alpha-candidate-patrol.mjs +22 -1
- package/scripts/dev-delivery-authority-command-adapters.mjs +206 -0
- package/scripts/dev-delivery-authority-provider.mjs +28 -0
- package/scripts/dev-delivery-authority.mjs +490 -0
- package/scripts/dev-delivery-native-run.mjs +177 -0
- package/scripts/dev-delivery-process-boundary.mjs +260 -0
- package/scripts/dev-delivery-proof.mjs +67 -2
- package/scripts/dev-delivery-provider-heartbeat.mjs +215 -0
- package/scripts/dev-delivery-source-proof-replay.mjs +153 -0
- package/scripts/dev-delivery-source-proof-reuse.mjs +13 -97
- package/scripts/dev-delivery-two-phase-resume.mjs +345 -0
- package/scripts/dev-delivery-two-phase.mjs +573 -0
- package/scripts/dev-delivery-warrant-options.mjs +266 -0
- package/scripts/dev-delivery-warrant-store.mjs +231 -0
- package/scripts/dev-delivery-warrant.mjs +232 -194
- package/scripts/dev-pr-auto-merge.mjs +1 -1
- package/scripts/dev-pr-delivery-warrant.mjs +11 -0
- 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 +69 -4
- 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/npm-publish-transaction.mjs +2 -2
- 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/release-train-self-dogfood.mjs +94 -92
- package/scripts/resume-from-candidate-run.mjs +557 -30
- package/scripts/site-capability-metadata.mjs +41 -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
- package/templates/native-dev-delivery.yml +143 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { semanticRoot } from "@kungfu-tech/kfd/scripts/self-conformance-contract.mjs";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
resolvePublishedKfdAdopterCategoryProfiles,
|
|
5
|
+
verifyPublishedKfdAdopterCategoryInstance,
|
|
6
|
+
} from "./kfd-adopter-category-driver.js";
|
|
7
|
+
|
|
8
|
+
export const BUILDCHAIN_DELIVERY_INFRASTRUCTURE_ADOPTER_ID =
|
|
9
|
+
"kungfu-systems/buildchain";
|
|
10
|
+
export const BUILDCHAIN_DELIVERY_INFRASTRUCTURE_PROFILE = Object.freeze({
|
|
11
|
+
id: "kfd.adopter-category/delivery-infrastructure",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const CATEGORY_INSTANCE_SCHEMA =
|
|
16
|
+
"https://kfd.libkungfu.dev/schemas/kfd-adopter-conformance/category-instance-manifest.schema.json";
|
|
17
|
+
const CATEGORY_INSTANCE_CONTRACT = "kfd.adopter-category-instance-manifest/v1";
|
|
18
|
+
const ROOT_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
19
|
+
const CLAIM_BOUNDARY = Object.freeze({
|
|
20
|
+
categoryConformanceIsDeclarationOnly: true,
|
|
21
|
+
evidenceTransfer: false,
|
|
22
|
+
runtimePermission: false,
|
|
23
|
+
releaseAuthorization: false,
|
|
24
|
+
independentCertification: false,
|
|
25
|
+
semanticAuthorityTransfer: false,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function exactEvidenceReference(value, index) {
|
|
29
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
30
|
+
throw new TypeError(`evidence[${index}] must be an object`);
|
|
31
|
+
}
|
|
32
|
+
const fields = ["requirementId", "kind", "coordinate", "root", "observedAt"];
|
|
33
|
+
const actual = Object.keys(value).sort();
|
|
34
|
+
const expected = [...fields].sort();
|
|
35
|
+
if (
|
|
36
|
+
actual.length !== expected.length ||
|
|
37
|
+
actual.some((field, fieldIndex) => field !== expected[fieldIndex])
|
|
38
|
+
) {
|
|
39
|
+
throw new TypeError(`evidence[${index}] has an invalid field set`);
|
|
40
|
+
}
|
|
41
|
+
for (const field of ["requirementId", "kind", "coordinate", "observedAt"]) {
|
|
42
|
+
if (typeof value[field] !== "string" || value[field].length === 0) {
|
|
43
|
+
throw new TypeError(`evidence[${index}].${field} must be non-empty`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!ROOT_PATTERN.test(value.root ?? "")) {
|
|
47
|
+
throw new TypeError(`evidence[${index}].root must be a sha256 root`);
|
|
48
|
+
}
|
|
49
|
+
return structuredClone(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function releaseBound(adopterManifest, artifact, release) {
|
|
53
|
+
return (adopterManifest?.releaseBindings ?? []).some(
|
|
54
|
+
(binding) =>
|
|
55
|
+
semanticRoot(binding.artifact) === semanticRoot(artifact) &&
|
|
56
|
+
semanticRoot(binding.releasePassport) === semanticRoot(release) &&
|
|
57
|
+
binding.kfdPackageRoot === adopterManifest.kfdCut.package.artifactRoot,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createBuildchainDeliveryInfrastructureInstanceManifest({
|
|
62
|
+
instanceId,
|
|
63
|
+
adopterManifest,
|
|
64
|
+
source,
|
|
65
|
+
artifact,
|
|
66
|
+
release,
|
|
67
|
+
evidence = [],
|
|
68
|
+
} = {}) {
|
|
69
|
+
if (typeof instanceId !== "string" || instanceId.length === 0) {
|
|
70
|
+
throw new TypeError("instanceId must be non-empty");
|
|
71
|
+
}
|
|
72
|
+
if (
|
|
73
|
+
adopterManifest?.adopter?.id !==
|
|
74
|
+
BUILDCHAIN_DELIVERY_INFRASTRUCTURE_ADOPTER_ID
|
|
75
|
+
) {
|
|
76
|
+
throw new TypeError(
|
|
77
|
+
`adopterManifest must identify ${BUILDCHAIN_DELIVERY_INFRASTRUCTURE_ADOPTER_ID}`,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
if (!releaseBound(adopterManifest, artifact, release)) {
|
|
81
|
+
throw new TypeError(
|
|
82
|
+
"adopterManifest must bind the exact Buildchain artifact and release",
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const selection = {
|
|
87
|
+
schemaVersion: 1,
|
|
88
|
+
contract: "kfd.adopter-category-profile-selection/v1",
|
|
89
|
+
profiles: [structuredClone(BUILDCHAIN_DELIVERY_INFRASTRUCTURE_PROFILE)],
|
|
90
|
+
};
|
|
91
|
+
const resolution = resolvePublishedKfdAdopterCategoryProfiles(selection);
|
|
92
|
+
if (!resolution.valid) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`published delivery-infrastructure profile did not resolve: ${JSON.stringify(resolution.issues)}`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const project = {
|
|
99
|
+
adopterId: BUILDCHAIN_DELIVERY_INFRASTRUCTURE_ADOPTER_ID,
|
|
100
|
+
source: structuredClone(source),
|
|
101
|
+
artifact: structuredClone(artifact),
|
|
102
|
+
release: structuredClone(release),
|
|
103
|
+
};
|
|
104
|
+
const projectRoot = semanticRoot(project);
|
|
105
|
+
const adopterManifestRoot = semanticRoot(adopterManifest);
|
|
106
|
+
const packageRoot = adopterManifest.kfdCut.package.artifactRoot;
|
|
107
|
+
const requirementIds = new Set(
|
|
108
|
+
resolution.requirements.map((requirement) => requirement.id),
|
|
109
|
+
);
|
|
110
|
+
const suppliedEvidence = evidence.map(exactEvidenceReference);
|
|
111
|
+
for (const [index, entry] of suppliedEvidence.entries()) {
|
|
112
|
+
if (!requirementIds.has(entry.requirementId)) {
|
|
113
|
+
throw new TypeError(
|
|
114
|
+
`evidence[${index}].requirementId is not selected by the published profile`,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
$schema: CATEGORY_INSTANCE_SCHEMA,
|
|
121
|
+
schemaVersion: 1,
|
|
122
|
+
contract: CATEGORY_INSTANCE_CONTRACT,
|
|
123
|
+
instanceId,
|
|
124
|
+
rootAlgorithm: "sha256-kfd-canonical-json-v1",
|
|
125
|
+
project,
|
|
126
|
+
adopterManifest: {
|
|
127
|
+
contract: adopterManifest.contract,
|
|
128
|
+
manifestId: adopterManifest.manifestId,
|
|
129
|
+
root: adopterManifestRoot,
|
|
130
|
+
},
|
|
131
|
+
kfdCut: {
|
|
132
|
+
packageVersion: adopterManifest.kfdCut.package.version,
|
|
133
|
+
packageRoot,
|
|
134
|
+
categoryCatalogRoot: resolution.catalogRoot,
|
|
135
|
+
},
|
|
136
|
+
selection,
|
|
137
|
+
selectionRoot: resolution.selectionRoot,
|
|
138
|
+
requirements: resolution.requirements.map((requirement) => ({
|
|
139
|
+
id: requirement.id,
|
|
140
|
+
evidence: suppliedEvidence
|
|
141
|
+
.filter((entry) => entry.requirementId === requirement.id)
|
|
142
|
+
.map(({ requirementId: _requirementId, ...entry }) => ({
|
|
143
|
+
...entry,
|
|
144
|
+
projectInstanceId: instanceId,
|
|
145
|
+
projectRoot,
|
|
146
|
+
adopterManifestRoot,
|
|
147
|
+
kfdPackageRoot: packageRoot,
|
|
148
|
+
categorySelectionRoot: resolution.selectionRoot,
|
|
149
|
+
})),
|
|
150
|
+
})),
|
|
151
|
+
claimBoundary: structuredClone(CLAIM_BOUNDARY),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function verifyBuildchainDeliveryInfrastructureInstance(
|
|
156
|
+
manifest,
|
|
157
|
+
{ adopterManifest, verifiedAt, maxAgeSeconds } = {},
|
|
158
|
+
) {
|
|
159
|
+
return verifyPublishedKfdAdopterCategoryInstance(manifest, {
|
|
160
|
+
adopterManifest,
|
|
161
|
+
verifiedAt,
|
|
162
|
+
maxAgeSeconds,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { initAdopterManifest } from "@kungfu-tech/kfd/adopter-conformance/toolchain";
|
|
2
|
+
|
|
3
|
+
import { adopterDeliveryGateDigest } from "./adopter-delivery-gate.js";
|
|
4
|
+
import { withPublishedBuildchainDeliveryAuthority } from "./published-delivery-authority.js";
|
|
5
|
+
|
|
6
|
+
export const BUILDCHAIN_DELIVERY_SELF_DOGFOOD_CONTRACT =
|
|
7
|
+
"kungfu-buildchain-delivery-infrastructure-self-dogfood/v1";
|
|
8
|
+
|
|
9
|
+
const ROOT_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
10
|
+
const SHA_PATTERN = /^[0-9a-f]{40}$/;
|
|
11
|
+
const BUILDCHAIN_PACKAGE = "@kungfu-tech/buildchain";
|
|
12
|
+
const KFD_PACKAGE = "@kungfu-tech/kfd";
|
|
13
|
+
const PROFILE_REQUIREMENTS = Object.freeze([
|
|
14
|
+
["adopter-identity", ["declaration"]],
|
|
15
|
+
["artifact-readback", ["verification"]],
|
|
16
|
+
["claim-boundary", ["declaration"]],
|
|
17
|
+
["delivery-policy-cut", ["declaration", "verification"]],
|
|
18
|
+
["kfd-cut", ["verification"]],
|
|
19
|
+
["protected-delivery", ["implementation", "review", "verification"]],
|
|
20
|
+
["source-artifact", ["implementation"]],
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
function exactPackage(value, { name, version = "", root = "", label }) {
|
|
24
|
+
if (
|
|
25
|
+
value?.name !== name ||
|
|
26
|
+
typeof value.version !== "string" ||
|
|
27
|
+
value.version.length === 0 ||
|
|
28
|
+
!ROOT_PATTERN.test(value.artifactRoot ?? "")
|
|
29
|
+
) {
|
|
30
|
+
throw new TypeError(`${label} package identity is incomplete`);
|
|
31
|
+
}
|
|
32
|
+
if (version && value.version !== version) {
|
|
33
|
+
throw new TypeError(`${label} package version does not match its binding`);
|
|
34
|
+
}
|
|
35
|
+
if (root && value.artifactRoot !== root) {
|
|
36
|
+
throw new TypeError(`${label} package root does not match its binding`);
|
|
37
|
+
}
|
|
38
|
+
return structuredClone(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function authorityFunctions(authorityRuntime) {
|
|
42
|
+
const names = [
|
|
43
|
+
"createBuildchainDeliveryInfrastructureInstanceManifest",
|
|
44
|
+
"verifyBuildchainDeliveryInfrastructureInstance",
|
|
45
|
+
"createAdopterDeliveryGate",
|
|
46
|
+
"createPackageArtifactProfile",
|
|
47
|
+
"createKfdAdopterCategoryProtocolDriver",
|
|
48
|
+
"qualifyBuildchainDeliveryInfrastructureBootstrap",
|
|
49
|
+
];
|
|
50
|
+
for (const name of names) {
|
|
51
|
+
if (typeof authorityRuntime?.[name] !== "function") {
|
|
52
|
+
throw new TypeError(`authority runtime is missing ${name}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return authorityRuntime;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function passed(value, label) {
|
|
59
|
+
if (value?.status !== "passed") {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`${label} failed closed: ${JSON.stringify(value?.issues ?? [])}`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function candidateWarrant(candidate) {
|
|
68
|
+
const terminal = candidate?.terminal;
|
|
69
|
+
if (
|
|
70
|
+
candidate?.status !== "merged" ||
|
|
71
|
+
!SHA_PATTERN.test(candidate?.sourceHead ?? "") ||
|
|
72
|
+
!ROOT_PATTERN.test(candidate?.sourceProofRoot ?? "") ||
|
|
73
|
+
terminal?.outcome !== "merged" ||
|
|
74
|
+
!ROOT_PATTERN.test(terminal?.nativeProofRoot ?? "") ||
|
|
75
|
+
!ROOT_PATTERN.test(terminal?.evidenceRoot ?? "")
|
|
76
|
+
) {
|
|
77
|
+
throw new TypeError("candidate Warrant settlement is incomplete");
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
outcome: "merged",
|
|
81
|
+
sourceHead: candidate.sourceHead,
|
|
82
|
+
sourceProofRoot: candidate.sourceProofRoot,
|
|
83
|
+
nativeProofRoot: terminal.nativeProofRoot,
|
|
84
|
+
integrationProofRoot: terminal.evidenceRoot,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function deliveryCut() {
|
|
89
|
+
const protocol = {
|
|
90
|
+
id: "kfd.adopter-category/instance-manifest",
|
|
91
|
+
version: "1.0.0",
|
|
92
|
+
};
|
|
93
|
+
protocol.root = adopterDeliveryGateDigest(protocol);
|
|
94
|
+
const profile = {
|
|
95
|
+
id: "kfd.adopter-category/delivery-infrastructure",
|
|
96
|
+
version: "1.0.0",
|
|
97
|
+
};
|
|
98
|
+
profile.root = adopterDeliveryGateDigest({
|
|
99
|
+
...profile,
|
|
100
|
+
requirements: PROFILE_REQUIREMENTS,
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
gateRoot: adopterDeliveryGateDigest({
|
|
104
|
+
protocol,
|
|
105
|
+
profile,
|
|
106
|
+
artifactProfile: {
|
|
107
|
+
id: "buildchain.artifact/package",
|
|
108
|
+
version: "1.0.0",
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
111
|
+
protocol,
|
|
112
|
+
profile,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function candidateEvidence({
|
|
117
|
+
source,
|
|
118
|
+
artifact,
|
|
119
|
+
authority,
|
|
120
|
+
warrant,
|
|
121
|
+
kfdRoot,
|
|
122
|
+
observedAt,
|
|
123
|
+
}) {
|
|
124
|
+
const roots = {
|
|
125
|
+
"adopter-identity:declaration": source.root,
|
|
126
|
+
"artifact-readback:verification": artifact.root,
|
|
127
|
+
"claim-boundary:declaration": adopterDeliveryGateDigest({
|
|
128
|
+
qualifying: false,
|
|
129
|
+
selfCertified: false,
|
|
130
|
+
releaseAuthorized: false,
|
|
131
|
+
}),
|
|
132
|
+
"delivery-policy-cut:declaration": authority.gateRoot,
|
|
133
|
+
"delivery-policy-cut:verification": warrant.integrationProofRoot,
|
|
134
|
+
"kfd-cut:verification": kfdRoot,
|
|
135
|
+
"protected-delivery:implementation": artifact.root,
|
|
136
|
+
"protected-delivery:review": warrant.sourceProofRoot,
|
|
137
|
+
"protected-delivery:verification": warrant.nativeProofRoot,
|
|
138
|
+
"source-artifact:implementation": source.root,
|
|
139
|
+
};
|
|
140
|
+
return PROFILE_REQUIREMENTS.flatMap(([requirementId, kinds]) =>
|
|
141
|
+
kinds.map((kind) => ({
|
|
142
|
+
requirementId,
|
|
143
|
+
kind,
|
|
144
|
+
coordinate: `evidence://kungfu-systems/buildchain/${requirementId}/${kind}`,
|
|
145
|
+
root: roots[`${requirementId}:${kind}`],
|
|
146
|
+
observedAt,
|
|
147
|
+
})),
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function createBuildchainDeliveryInfrastructureSelfDogfood(
|
|
152
|
+
{
|
|
153
|
+
authorityPackage,
|
|
154
|
+
kfdPackage,
|
|
155
|
+
authority,
|
|
156
|
+
candidate,
|
|
157
|
+
instanceId,
|
|
158
|
+
adopterManifest,
|
|
159
|
+
source,
|
|
160
|
+
artifact,
|
|
161
|
+
release,
|
|
162
|
+
evidence = [],
|
|
163
|
+
warrant,
|
|
164
|
+
transitionEvidence,
|
|
165
|
+
verifiedAt,
|
|
166
|
+
maxAgeSeconds,
|
|
167
|
+
} = {},
|
|
168
|
+
authorityRuntime,
|
|
169
|
+
) {
|
|
170
|
+
const runtime = authorityFunctions(authorityRuntime);
|
|
171
|
+
const boundAuthorityPackage = exactPackage(authorityPackage, {
|
|
172
|
+
name: BUILDCHAIN_PACKAGE,
|
|
173
|
+
version: authority?.version,
|
|
174
|
+
root: authority?.packageRoot,
|
|
175
|
+
label: "Buildchain authority",
|
|
176
|
+
});
|
|
177
|
+
const boundKfdPackage = exactPackage(kfdPackage, {
|
|
178
|
+
name: KFD_PACKAGE,
|
|
179
|
+
version: adopterManifest?.kfdCut?.package?.version,
|
|
180
|
+
root: adopterManifest?.kfdCut?.package?.artifactRoot,
|
|
181
|
+
label: "KFD authority",
|
|
182
|
+
});
|
|
183
|
+
if (candidate?.authorityVersion !== boundAuthorityPackage.version) {
|
|
184
|
+
throw new TypeError(
|
|
185
|
+
"candidate does not name the exact Buildchain N-1 authority",
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const instanceManifest =
|
|
190
|
+
runtime.createBuildchainDeliveryInfrastructureInstanceManifest({
|
|
191
|
+
instanceId,
|
|
192
|
+
adopterManifest,
|
|
193
|
+
source,
|
|
194
|
+
artifact,
|
|
195
|
+
release,
|
|
196
|
+
evidence,
|
|
197
|
+
});
|
|
198
|
+
const instanceReport = runtime.verifyBuildchainDeliveryInfrastructureInstance(
|
|
199
|
+
instanceManifest,
|
|
200
|
+
{
|
|
201
|
+
adopterManifest,
|
|
202
|
+
verifiedAt,
|
|
203
|
+
maxAgeSeconds,
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
if (instanceReport?.valid !== true) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
`delivery-infrastructure instance failed closed: ${JSON.stringify(instanceReport?.issues ?? [])}`,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const gateResult = passed(
|
|
213
|
+
runtime
|
|
214
|
+
.createAdopterDeliveryGate({
|
|
215
|
+
drivers: [runtime.createKfdAdopterCategoryProtocolDriver()],
|
|
216
|
+
artifactProfiles: [runtime.createPackageArtifactProfile()],
|
|
217
|
+
})
|
|
218
|
+
.evaluate(
|
|
219
|
+
{
|
|
220
|
+
schemaVersion: 1,
|
|
221
|
+
contract: "kungfu-buildchain-adopter-delivery-request",
|
|
222
|
+
protocol: {
|
|
223
|
+
id: "kfd.adopter-category/instance-manifest",
|
|
224
|
+
version: "1.0.0",
|
|
225
|
+
},
|
|
226
|
+
artifactProfile: {
|
|
227
|
+
id: "buildchain.artifact/package",
|
|
228
|
+
version: "1.0.0",
|
|
229
|
+
},
|
|
230
|
+
project: {
|
|
231
|
+
instanceId,
|
|
232
|
+
adopterId: "kungfu-systems/buildchain",
|
|
233
|
+
},
|
|
234
|
+
artifact: structuredClone(artifact),
|
|
235
|
+
declaration: instanceManifest,
|
|
236
|
+
},
|
|
237
|
+
{ adopterManifest, verifiedAt, maxAgeSeconds },
|
|
238
|
+
),
|
|
239
|
+
"adopter delivery gate",
|
|
240
|
+
);
|
|
241
|
+
const bootstrap = passed(
|
|
242
|
+
runtime.qualifyBuildchainDeliveryInfrastructureBootstrap({
|
|
243
|
+
authority,
|
|
244
|
+
candidate,
|
|
245
|
+
gateResult,
|
|
246
|
+
warrant,
|
|
247
|
+
transitionEvidence,
|
|
248
|
+
}),
|
|
249
|
+
"delivery-infrastructure bootstrap",
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
const result = {
|
|
253
|
+
schemaVersion: 1,
|
|
254
|
+
contract: BUILDCHAIN_DELIVERY_SELF_DOGFOOD_CONTRACT,
|
|
255
|
+
status: "passed",
|
|
256
|
+
authorityRuntime: {
|
|
257
|
+
buildchainPackage: boundAuthorityPackage,
|
|
258
|
+
kfdPackage: boundKfdPackage,
|
|
259
|
+
},
|
|
260
|
+
candidate: structuredClone(candidate),
|
|
261
|
+
roots: {
|
|
262
|
+
adopterManifest: adopterDeliveryGateDigest(adopterManifest),
|
|
263
|
+
instanceManifest: adopterDeliveryGateDigest(instanceManifest),
|
|
264
|
+
instanceReport: adopterDeliveryGateDigest(instanceReport),
|
|
265
|
+
gateResult: gateResult.gateRoot,
|
|
266
|
+
bootstrap: bootstrap.bootstrapRoot,
|
|
267
|
+
warrant: adopterDeliveryGateDigest(warrant),
|
|
268
|
+
},
|
|
269
|
+
instanceManifest,
|
|
270
|
+
instanceReport,
|
|
271
|
+
gateResult,
|
|
272
|
+
bootstrap,
|
|
273
|
+
qualifying: false,
|
|
274
|
+
selfCertified: false,
|
|
275
|
+
releaseAuthorized: false,
|
|
276
|
+
finalAuthority:
|
|
277
|
+
"protected-n-minus-one-runtime-plus-exact-delivery-evidence",
|
|
278
|
+
};
|
|
279
|
+
result.selfDogfoodRoot = adopterDeliveryGateDigest(result);
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export async function createPublishedBuildchainDeliveryInfrastructureSelfDogfood({
|
|
284
|
+
authorityPackages,
|
|
285
|
+
selfDogfood,
|
|
286
|
+
} = {}) {
|
|
287
|
+
return withPublishedBuildchainDeliveryAuthority(
|
|
288
|
+
authorityPackages,
|
|
289
|
+
async ({ packages, authorityRuntime, authorityRoot }) => {
|
|
290
|
+
const result = createBuildchainDeliveryInfrastructureSelfDogfood(
|
|
291
|
+
{
|
|
292
|
+
...structuredClone(selfDogfood ?? {}),
|
|
293
|
+
authorityPackage: packages.buildchain,
|
|
294
|
+
kfdPackage: packages.kfd,
|
|
295
|
+
},
|
|
296
|
+
authorityRuntime,
|
|
297
|
+
);
|
|
298
|
+
return {
|
|
299
|
+
...result,
|
|
300
|
+
publishedAuthorityRoot: authorityRoot,
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export async function createPublishedBuildchainDeliveryInfrastructureCandidateSelfDogfood({
|
|
307
|
+
authorityPackages,
|
|
308
|
+
authoritySourceCommit,
|
|
309
|
+
candidatePackage,
|
|
310
|
+
warrantCandidate,
|
|
311
|
+
source,
|
|
312
|
+
release,
|
|
313
|
+
verifiedAt,
|
|
314
|
+
maxAgeSeconds = 86400,
|
|
315
|
+
} = {}) {
|
|
316
|
+
if (!SHA_PATTERN.test(authoritySourceCommit ?? "")) {
|
|
317
|
+
throw new TypeError("authority source commit is invalid");
|
|
318
|
+
}
|
|
319
|
+
const artifact = exactPackage(candidatePackage, {
|
|
320
|
+
name: BUILDCHAIN_PACKAGE,
|
|
321
|
+
label: "Buildchain candidate",
|
|
322
|
+
});
|
|
323
|
+
if (
|
|
324
|
+
source?.coordinate !==
|
|
325
|
+
`kungfu-systems/buildchain@${warrantCandidate?.sourceHead ?? ""}` ||
|
|
326
|
+
!ROOT_PATTERN.test(source?.root ?? "") ||
|
|
327
|
+
!ROOT_PATTERN.test(release?.root ?? "")
|
|
328
|
+
) {
|
|
329
|
+
throw new TypeError("candidate source or release binding is incomplete");
|
|
330
|
+
}
|
|
331
|
+
const warrant = candidateWarrant(warrantCandidate);
|
|
332
|
+
const cut = deliveryCut();
|
|
333
|
+
const authority = {
|
|
334
|
+
version: authorityPackages?.buildchain?.version,
|
|
335
|
+
sourceCommit: authoritySourceCommit,
|
|
336
|
+
packageRoot: authorityPackages?.buildchain?.artifactRoot,
|
|
337
|
+
...cut,
|
|
338
|
+
protected: true,
|
|
339
|
+
published: true,
|
|
340
|
+
};
|
|
341
|
+
const candidate = {
|
|
342
|
+
version: artifact.version,
|
|
343
|
+
sourceCommit: warrant.sourceHead,
|
|
344
|
+
packageRoot: artifact.artifactRoot,
|
|
345
|
+
...cut,
|
|
346
|
+
authorityVersion: authority.version,
|
|
347
|
+
};
|
|
348
|
+
const adopterManifest = initAdopterManifest({
|
|
349
|
+
manifestId: `buildchain-delivery-infrastructure-${artifact.version}`,
|
|
350
|
+
adopterId: "kungfu-systems/buildchain",
|
|
351
|
+
artifactKind: "package",
|
|
352
|
+
artifactCoordinate: `${artifact.name}@${artifact.version}`,
|
|
353
|
+
artifactRoot: artifact.artifactRoot,
|
|
354
|
+
scope: "Buildchain delivery infrastructure release candidate self-dogfood",
|
|
355
|
+
packageArtifactRoot: authorityPackages?.kfd?.artifactRoot,
|
|
356
|
+
verifiedAt,
|
|
357
|
+
maxAgeSeconds,
|
|
358
|
+
});
|
|
359
|
+
adopterManifest.releaseBindings.push({
|
|
360
|
+
id: `buildchain-${artifact.version}`,
|
|
361
|
+
artifact: {
|
|
362
|
+
kind: "package",
|
|
363
|
+
coordinate: `${artifact.name}@${artifact.version}`,
|
|
364
|
+
root: artifact.artifactRoot,
|
|
365
|
+
},
|
|
366
|
+
releasePassport: structuredClone(release),
|
|
367
|
+
kfdPackageRoot: authorityPackages.kfd.artifactRoot,
|
|
368
|
+
});
|
|
369
|
+
const evidence = candidateEvidence({
|
|
370
|
+
source,
|
|
371
|
+
artifact: adopterManifest.releaseBindings[0].artifact,
|
|
372
|
+
authority,
|
|
373
|
+
warrant,
|
|
374
|
+
kfdRoot: authorityPackages.kfd.artifactRoot,
|
|
375
|
+
observedAt: verifiedAt,
|
|
376
|
+
});
|
|
377
|
+
const result =
|
|
378
|
+
await createPublishedBuildchainDeliveryInfrastructureSelfDogfood({
|
|
379
|
+
authorityPackages,
|
|
380
|
+
selfDogfood: {
|
|
381
|
+
authority,
|
|
382
|
+
candidate,
|
|
383
|
+
instanceId: `kungfu-systems/buildchain@${artifact.version}`,
|
|
384
|
+
adopterManifest,
|
|
385
|
+
source,
|
|
386
|
+
artifact: adopterManifest.releaseBindings[0].artifact,
|
|
387
|
+
release,
|
|
388
|
+
evidence,
|
|
389
|
+
warrant,
|
|
390
|
+
verifiedAt,
|
|
391
|
+
maxAgeSeconds,
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
return { ...result, adopterManifest, deliveryEvidence: evidence };
|
|
395
|
+
}
|
|
@@ -29,6 +29,7 @@ const DESCRIPTORS = Object.freeze([
|
|
|
29
29
|
[".github/workflows/buildchain-patrol-monthly.yml", "governance-write"],
|
|
30
30
|
[".github/workflows/buildchain-patrol-weekly.yml", "governance-write"],
|
|
31
31
|
[".github/workflows/buildchain-patrol.yml", "governance-write"],
|
|
32
|
+
[".github/workflows/buildchain-ref-promotion-recovery.yml", "governance-write"],
|
|
32
33
|
[".github/workflows/buildchain-ref-promotion.yml", "governance-write"],
|
|
33
34
|
[".github/workflows/buildchain-stable-candidate-patrol.yml", "governance-write"],
|
|
34
35
|
[".github/workflows/dev-qualification-patrol.yml", "governance-write"],
|
|
@@ -97,6 +97,14 @@ export function decideChannelCandidate(input) {
|
|
|
97
97
|
const sourceSha = sha(input.sourceSha, "sourceSha");
|
|
98
98
|
const targetSha = sha(input.targetSha, "targetSha");
|
|
99
99
|
const selection = normalizeChannelCandidateSelection(input.selection);
|
|
100
|
+
if (
|
|
101
|
+
selection?.versionReservation &&
|
|
102
|
+
selection.versionReservation.candidateSha !== sourceSha
|
|
103
|
+
) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
"selection version reservation must bind the selected source SHA",
|
|
106
|
+
);
|
|
107
|
+
}
|
|
100
108
|
const now = required(input.now || new Date().toISOString(), "now");
|
|
101
109
|
const maxAgeSeconds = Number(input.maxAgeSeconds ?? 7 * 24 * 60 * 60);
|
|
102
110
|
if (!Number.isSafeInteger(maxAgeSeconds) || maxAgeSeconds <= 0) {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
nextDevelopmentPatrolContext,
|
|
5
|
+
normalizeNextDevelopmentVersionReservation,
|
|
6
|
+
} from "./next-development-candidate-reservation.js";
|
|
7
|
+
|
|
3
8
|
const SHA = /^[0-9a-f]{40}$/;
|
|
4
9
|
|
|
5
10
|
function text(value = "") {
|
|
@@ -59,6 +64,18 @@ export function normalizeChannelCandidateSelection(input) {
|
|
|
59
64
|
),
|
|
60
65
|
}
|
|
61
66
|
: {}),
|
|
67
|
+
...(input.versionReservation
|
|
68
|
+
? {
|
|
69
|
+
versionReservation: normalizeNextDevelopmentVersionReservation(
|
|
70
|
+
input.versionReservation,
|
|
71
|
+
{
|
|
72
|
+
reservationSha: input.versionReservation.reservationSha,
|
|
73
|
+
candidateSha: input.versionReservation.candidateSha,
|
|
74
|
+
targetVersion: input.versionReservation.targetVersion,
|
|
75
|
+
},
|
|
76
|
+
),
|
|
77
|
+
}
|
|
78
|
+
: {}),
|
|
62
79
|
};
|
|
63
80
|
}
|
|
64
81
|
|
|
@@ -117,6 +134,7 @@ export async function resolvePatrolSourceInputs({
|
|
|
117
134
|
let comparison = headComparison;
|
|
118
135
|
let workflowEvidence = [];
|
|
119
136
|
let skippedNewerCommitCount = 0;
|
|
137
|
+
let versionReservation;
|
|
120
138
|
let qualificationError;
|
|
121
139
|
if (
|
|
122
140
|
headComparison.status === "ahead" &&
|
|
@@ -130,6 +148,8 @@ export async function resolvePatrolSourceInputs({
|
|
|
130
148
|
),
|
|
131
149
|
]);
|
|
132
150
|
try {
|
|
151
|
+
const { preparations, ignoredSourceShas } =
|
|
152
|
+
nextDevelopmentPatrolContext(sourceHistory);
|
|
133
153
|
const selected = selectQualifiedSource({
|
|
134
154
|
sourceHistory,
|
|
135
155
|
workflowRunsByPath: new Map(
|
|
@@ -141,8 +161,42 @@ export async function resolvePatrolSourceInputs({
|
|
|
141
161
|
requiredWorkflowPaths,
|
|
142
162
|
now: options.now,
|
|
143
163
|
maxAgeSeconds: options.maxAgeSeconds,
|
|
164
|
+
ignoredSourceShas,
|
|
144
165
|
});
|
|
145
166
|
({ sourceSha, skippedNewerCommitCount, workflowEvidence } = selected);
|
|
167
|
+
const selectedIndex = sourceHistory.findIndex(
|
|
168
|
+
(entry) =>
|
|
169
|
+
(typeof entry === "string" ? entry : entry?.sha) === sourceSha,
|
|
170
|
+
);
|
|
171
|
+
const reservation = preparations.find(
|
|
172
|
+
({ index }) => index > selectedIndex,
|
|
173
|
+
)?.preparation;
|
|
174
|
+
if (reservation) {
|
|
175
|
+
if (
|
|
176
|
+
typeof client.readNextDevelopmentVersionReservation !== "function"
|
|
177
|
+
) {
|
|
178
|
+
throw new Error(
|
|
179
|
+
"candidate follows next-development preparation but reservation readback is unavailable",
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
versionReservation = normalizeNextDevelopmentVersionReservation(
|
|
183
|
+
await client.readNextDevelopmentVersionReservation({
|
|
184
|
+
reservationSha: reservation.sha,
|
|
185
|
+
candidateSha: sourceSha,
|
|
186
|
+
targetVersion: reservation.targetVersion,
|
|
187
|
+
}),
|
|
188
|
+
{
|
|
189
|
+
reservationSha: reservation.sha,
|
|
190
|
+
candidateSha: sourceSha,
|
|
191
|
+
targetVersion: reservation.targetVersion,
|
|
192
|
+
},
|
|
193
|
+
);
|
|
194
|
+
if (versionReservation.status !== "current") {
|
|
195
|
+
throw new Error(
|
|
196
|
+
`next-development version reservation is ${versionReservation.status} for candidate ${sourceSha}`,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
146
200
|
if (sourceSha !== observedSourceHeadSha)
|
|
147
201
|
comparison = await client.compare(boundarySha, sourceSha);
|
|
148
202
|
} catch (error) {
|
|
@@ -158,6 +212,7 @@ export async function resolvePatrolSourceInputs({
|
|
|
158
212
|
comparison,
|
|
159
213
|
workflowEvidence,
|
|
160
214
|
skippedNewerCommitCount,
|
|
215
|
+
versionReservation,
|
|
161
216
|
qualificationError,
|
|
162
217
|
};
|
|
163
218
|
}
|