@kungfu-tech/buildchain 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -4
- package/CONTRIBUTING.md +34 -0
- package/README.md +1 -1
- package/architecture/agent-change-map.md +154 -147
- package/architecture/{v4-architecture-constitution.md → architecture-constitution.md} +11 -11
- package/architecture/{v3-core-mechanism-inventory.md → baseline-core-mechanism-inventory.md} +1 -1
- package/architecture/{v4-bootstrap-authority.json → bootstrap-authority.json} +3 -3
- package/architecture/{v3-v4-capability-closure.md → capability-parity-closure.md} +3 -3
- package/architecture/{v3-v4-live-capability-inventory.json → capability-parity-live-capability-inventory.json} +4 -4
- package/architecture/{v4-capability-state-machine-manifest.json → capability-state-machine-manifest.json} +2 -2
- package/architecture/{v4-capability-state-machine-manifest.schema.json → capability-state-machine-manifest.schema.json} +2 -2
- package/architecture/ci-lane-change-budget.json +18 -0
- package/architecture/{v4-cross-platform-adopter-qualification.json → cross-platform-adopter-qualification.json} +3 -3
- package/architecture/{v4-delivery-authority-parity.json → delivery-authority-parity.json} +16 -16
- package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.json → delivery-warrant-shadow-bootstrap-plan.json} +3 -3
- package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.md → delivery-warrant-shadow-bootstrap-plan.md} +7 -7
- package/architecture/{v4-floating-consumer-policy.md → floating-consumer-policy.md} +1 -1
- package/architecture/implementation-naming.json +1273 -0
- package/architecture/internal-capabilities.json +171 -169
- package/architecture/maintainability-debt.json +87 -82
- package/architecture/maintainability-policy.json +15 -15
- package/architecture/{v4-next-development-parity.json → next-development-parity.json} +8 -8
- package/architecture/{v4-partial-mutation-recovery-qualification.json → partial-mutation-recovery-qualification.json} +8 -8
- package/architecture/{v4-platform-stage-checkpoints.json → platform-stage-checkpoints.json} +2 -2
- package/architecture/{v4-provider-operation-journal-contract.json → provider-operation-journal-contract.json} +9 -9
- package/architecture/{v4-publication-rehearsal-parity.json → publication-rehearsal-parity.json} +4 -4
- package/architecture/{v4-release-activation-shadow-domain.json → release-activation-shadow-domain.json} +8 -8
- package/architecture/{v4-release-topology.json → release-topology.json} +112 -56
- package/architecture/{v4-release-train-parity.json → release-train-parity.json} +2 -2
- package/architecture/{v4-runtime-ref-resume-authority.json → runtime-ref-resume-authority.json} +1 -1
- package/architecture/{v4-runtime-semantic-closure.json → runtime-semantic-closure.json} +2 -2
- package/architecture/{v4-rust-libnode-bridge-evaluation.json → rust-libnode-bridge-evaluation.json} +3 -3
- package/architecture/{v4-rust-libnode-bridge-spike.md → rust-libnode-bridge-spike.md} +6 -6
- package/architecture/{v4-rust-wasm-production-authority.json → rust-wasm-production-authority.json} +11 -11
- package/architecture/{v4-stable-publication-fence.json → stable-publication-fence.json} +6 -6
- package/architecture/{v4-stage-capsule-contract.json → stage-capsule-contract.json} +1 -1
- package/architecture/{v4-stage-capsule-qualification.json → stage-capsule-qualification.json} +6 -6
- package/architecture/{v4-stage-capsule-resume-planner.json → stage-capsule-resume-planner.json} +2 -2
- package/architecture/{v4-stage-capsule-store-contract.json → stage-capsule-store-contract.json} +4 -4
- package/architecture/{v4-tail-reseal-parity.json → tail-reseal-parity.json} +28 -28
- package/architecture/{v4-universal-workflow-bootstrap.json → universal-workflow-bootstrap.json} +9 -4
- package/architecture/{v4-universal-workflow-fault-campaign.json → universal-workflow-fault-campaign.json} +8 -8
- package/architecture/{v4-universal-workflow-train-admission.json → universal-workflow-train-admission.json} +8 -8
- package/architecture/workflow-taxonomy.json +11 -0
- package/bin/buildchain.mjs +3 -3
- package/bin/internal/adopter-delivery-cli.mjs +9 -9
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/Cargo.lock +1 -1
- package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/Cargo.toml +1 -1
- package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/src/main.rs +3 -3
- package/dist/site/buildchain-contract.json +18 -18
- package/dist/site/buildchain-site.json +167 -71
- package/dist/site/capability-registry.json +5 -5
- package/dist/site/kfd-claims.json +226 -90
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +7 -7
- package/dist/site/node-api-registry.json +12929 -10491
- package/dist/site/page-registry.json +155 -59
- package/dist/site/public-surface-audit.json +65 -46
- package/dist/site/publication-authority-registry.json +27 -17
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +18 -9
- package/dist/site/site-manifest.json +11 -11
- package/dist/site/workflow-registry.json +86 -52
- package/docs/MAP.md +4 -3
- package/docs/next-development-transition.md +24 -1
- package/docs/node-api-reference.md +435 -175
- package/docs/oci-publication.md +173 -0
- package/docs/publish-transaction.md +36 -3
- package/docs/release-flow.md +1 -1
- package/docs/reusable-build-surface.md +1 -1
- package/docs/v4-adopter-delivery.md +2 -2
- package/docs/v4-canonical-contracts.md +7 -7
- package/docs/v4-delivery-warrant-read-candidate.md +3 -3
- package/docs/v4-delivery-warrant-semantic-diff.md +3 -3
- package/docs/v4-production-release.md +8 -2
- package/docs/v4-publication-rehearsal.md +3 -3
- package/docs/v4-runtime-ref-resume-authority.md +2 -2
- package/docs/v4-rust-wasm-production-authority.md +6 -6
- package/docs/v4-stage-capsule.md +7 -7
- package/docs/v4-tail-reseal.md +1 -1
- package/docs/workflow-catalog.md +1 -0
- package/package.json +37 -26
- package/packages/compatibility/adopter-delivery.js +16 -0
- package/packages/compatibility/cross-platform-adopter-qualification.js +12 -0
- package/packages/compatibility/floating-consumer-policy.js +14 -0
- package/packages/compatibility/publication-qualification.js +11 -0
- package/packages/compatibility/publication-rehearsal.js +18 -0
- package/packages/compatibility/runtime-ref-resume-authority.js +13 -0
- package/packages/compatibility/tail-reseal-receipt.js +7 -0
- package/packages/compatibility/tail-reseal.js +11 -0
- package/packages/core/{v4-adopter-delivery-parity.js → adopter-delivery-parity.js} +12 -12
- package/packages/core/{v4-adopter-delivery.js → adopter-delivery.js} +24 -24
- package/packages/core/buildchain-contract.js +5 -5
- package/packages/core/buildchain-domain.wasm +0 -0
- package/packages/core/buildchain-publication-authority.js +1 -0
- package/packages/core/{v4-canonical-contracts.js → canonical-contracts.js} +32 -31
- package/packages/core/{v4-cross-platform-adopter-qualification.js → cross-platform-adopter-qualification.js} +19 -19
- package/packages/core/{v4-delivery-warrant-fixture-runner.js → delivery-warrant-fixture-runner.js} +36 -32
- package/packages/core/{v4-delivery-warrant-read-candidate.js → delivery-warrant-read-candidate.js} +40 -40
- package/packages/core/{v4-delivery-warrant-semantic-diff-gate.js → delivery-warrant-semantic-diff-gate.js} +58 -59
- package/packages/core/{v4-delivery-warrant-shadow-adapter.js → delivery-warrant-shadow-adapter.js} +15 -15
- package/packages/core/dev-delivery-execution-transfer.js +6 -6
- package/packages/core/dev-delivery-native-proof.js +12 -8
- package/packages/core/dev-delivery-warrant-legacy-recovery.js +1 -1
- package/packages/core/dev-delivery-warrant-native-compatibility.js +4 -4
- package/packages/core/dev-delivery-warrant-state.js +11 -11
- package/packages/core/dev-delivery-warrant.js +3 -3
- package/packages/core/domain-wasm-artifact.js +7 -0
- package/packages/core/{v4-domain-wasm.js → domain-wasm.js} +31 -31
- package/packages/core/{v4-floating-consumer-evidence.js → floating-consumer-evidence.js} +13 -13
- package/packages/core/{v4-floating-consumer-policy.js → floating-consumer-policy.js} +27 -29
- package/packages/core/{v4-floating-consumer-release-passport.js → floating-consumer-release-passport.js} +25 -25
- package/packages/core/index.js +4 -8
- package/packages/core/next-development-projection.js +24 -1
- package/packages/core/next-development-transition.js +5 -6
- package/packages/core/oci-compose-qualification.js +143 -0
- package/packages/core/oci-publication-bundle.js +281 -0
- package/packages/core/oci-publication-graph.js +206 -0
- package/packages/core/paper-runtime-channels.js +2 -2
- package/packages/core/paper.js +3 -3
- package/packages/core/partial-mutation-recovery-qualification.js +18 -0
- package/packages/core/{v4-platform-stage-checkpoints.js → platform-stage-checkpoints.js} +37 -37
- package/packages/core/{v4-product-publication.js → product-publication.js} +11 -9
- package/packages/core/{v4-protected-publication-source.js → protected-publication-source.js} +3 -3
- package/packages/core/provider-operation-journal.js +62 -0
- package/packages/core/{v4-provider-readback-idempotency.js → provider-readback-idempotency.js} +33 -33
- package/packages/core/public-export-compatibility.js +33 -0
- package/packages/core/publication-development.js +72 -0
- package/packages/core/{v4-publication-qualification.js → publication-qualification.js} +17 -17
- package/packages/core/{v4-publication-rehearsal-capsule.js → publication-rehearsal-capsule.js} +23 -23
- package/packages/core/publication-rehearsal-projection.js +2 -2
- package/packages/core/{v4-publication-rehearsal-provider-bindings.js → publication-rehearsal-provider-bindings.js} +4 -4
- package/packages/core/publication-rehearsal-runtime.js +21 -21
- package/packages/core/{v4-publication-rehearsal.js → publication-rehearsal.js} +33 -33
- package/packages/core/publication-sealed-bundle.js +78 -13
- package/packages/core/release-activation-shadow.js +32 -0
- package/packages/core/release-candidate.js +6 -6
- package/packages/core/{v4-release-invocation.js → release-invocation.js} +15 -15
- package/packages/core/release-passport.js +36 -36
- package/packages/core/release-tail-product-capabilities.js +9 -0
- package/packages/core/release-tail-provider-plane.js +10 -10
- package/packages/core/{v4-runtime-ref-resume-authority.js → runtime-ref-resume-authority.js} +36 -40
- package/packages/core/{v4-runtime-selector-persistence.js → runtime-selector-persistence.js} +7 -7
- package/packages/core/stable-publication-fence.js +28 -0
- package/packages/core/{v4-stage-capsule-local-store.js → stage-capsule-local-store.js} +56 -54
- package/packages/core/{v4-stage-capsule-qualification-campaign.js → stage-capsule-qualification-campaign.js} +37 -38
- package/packages/core/{v4-stage-capsule-qualification.js → stage-capsule-qualification.js} +28 -29
- package/packages/core/{v4-stage-capsule-resume-planner.js → stage-capsule-resume-planner.js} +29 -29
- package/packages/core/{v4-stage-capsule-store.js → stage-capsule-store.js} +59 -56
- package/packages/core/{v4-stage-capsule.js → stage-capsule.js} +45 -45
- package/packages/core/{v4-tail-reseal-contract.js → tail-reseal-contract.js} +6 -6
- package/packages/core/{v4-tail-reseal-github.js → tail-reseal-github.js} +12 -12
- package/packages/core/{v4-tail-reseal-receipt.js → tail-reseal-receipt.js} +22 -22
- package/packages/core/{v4-tail-reseal.js → tail-reseal.js} +29 -29
- package/packages/core/{v4-universal-workflow-bootstrap.js → universal-workflow-bootstrap.js} +23 -23
- package/scripts/{v4-architecture.mjs → architecture.mjs} +6 -6
- package/scripts/binary-publication-evidence.mjs +1 -1
- package/scripts/{v4-bridge-bootstrap.mjs → bridge-bootstrap.mjs} +14 -18
- package/scripts/{v4-bridge-evidence.mjs → bridge-evidence.mjs} +8 -8
- package/scripts/{build-v4-domain-wasm.mjs → build-domain-wasm.mjs} +6 -18
- package/scripts/{v3-v4-capability-catalog.mjs → capability-parity-catalog.mjs} +19 -19
- package/scripts/check-action-bundles.mjs +2 -2
- package/scripts/{check-v3-v4-capability-inventory.mjs → check-capability-parity-inventory.mjs} +42 -42
- package/scripts/check-core-mechanism-inventory.mjs +4 -1
- package/scripts/{check-v4-floating-consumer-policy-contract.mjs → check-floating-consumer-policy-contract.mjs} +8 -8
- package/scripts/check-implementation-naming.mjs +135 -0
- package/scripts/check-inventory.mjs +6 -5
- package/scripts/check-maintainability.mjs +9 -2
- package/scripts/{check-v4-public-dogfood-contract.mjs → check-public-dogfood-contract.mjs} +15 -15
- package/scripts/{check-v4-release-topology.mjs → check-release-topology.mjs} +53 -31
- package/scripts/{check-v4-runtime-semantic-closure.mjs → check-runtime-semantic-closure.mjs} +19 -16
- package/scripts/{check-v4-universal-workflow-bootstrap.mjs → check-universal-workflow-bootstrap.mjs} +14 -14
- package/scripts/{v4-consumer-policy.mjs → consumer-policy.mjs} +15 -15
- package/scripts/{copy-v4-domain-wasm.mjs → copy-domain-wasm.mjs} +3 -3
- package/scripts/{v4-cross-platform-adopter-qualification.mjs → cross-platform-adopter-qualification.mjs} +9 -9
- package/scripts/{v4-declarative-promotion-admission.mjs → declarative-promotion-admission.mjs} +4 -4
- package/scripts/dev-delivery-warrant-options.mjs +1 -1
- package/scripts/dev-delivery-warrant-store.mjs +29 -10
- package/scripts/dev-delivery-warrant.mjs +4 -4
- package/scripts/dev-pr-delivery-warrant.mjs +1 -1
- package/scripts/generate-channel-build-workflow.mjs +2 -2
- package/scripts/generate-channel-promotion-workflow.mjs +14 -31
- package/scripts/generate-release-candidate-passport.mjs +23 -23
- package/scripts/generate-site-bundle.mjs +17 -17
- package/scripts/{generate-v4-universal-workflow-facades.mjs → generate-universal-workflow-facades.mjs} +61 -21
- package/scripts/{v4-host-adapter.mjs → host-adapter.mjs} +1 -1
- package/scripts/implementation-references.mjs +25 -0
- package/scripts/init-repo.mjs +1 -1
- package/scripts/next-development-review.mjs +17 -11
- package/scripts/oci-compose-preview.mjs +261 -0
- package/scripts/{v4-platform-stage-checkpoint-rehearsal.mjs → platform-stage-checkpoint-rehearsal.mjs} +17 -17
- package/scripts/{v4-product-publication-intent.mjs → product-publication-intent.mjs} +16 -8
- package/scripts/publication-candidate-kind.mjs +93 -0
- package/scripts/publication-candidate-sealer.mjs +16 -1
- package/scripts/{v4-publication-rehearsal-fixture.mjs → publication-rehearsal-fixture.mjs} +5 -5
- package/scripts/{v4-publication-settlement.mjs → publication-settlement.mjs} +8 -8
- package/scripts/{v4-release-candidate-adapter.mjs → release-candidate-adapter.mjs} +4 -4
- package/scripts/release-candidate-resolver.mjs +15 -26
- package/scripts/release-tail.mjs +5 -5
- package/scripts/resume-from-candidate-run.mjs +35 -42
- package/scripts/site-capability-metadata.mjs +9 -0
- package/scripts/source-verification-evidence.mjs +7 -7
- package/scripts/{v4-stage-capsule-qualification.mjs → stage-capsule-qualification.mjs} +62 -62
- package/scripts/{v4-stage-capsule-resume-rehearsal.mjs → stage-capsule-resume-rehearsal.mjs} +6 -6
- package/scripts/{v4-tail-reseal-macos-rehearsal.mjs → tail-reseal-macos-rehearsal.mjs} +9 -9
- package/scripts/{v4-tail-reseal.mjs → tail-reseal.mjs} +19 -19
- package/scripts/universal-facade-maintainability.mjs +12 -3
- package/scripts/{v4-universal-workflow-backflow.mjs → universal-workflow-backflow.mjs} +10 -10
- package/scripts/{v4-universal-workflow-engine.mjs → universal-workflow-engine.mjs} +40 -38
- package/scripts/{v4-universal-workflow-self-dogfood.mjs → universal-workflow-self-dogfood.mjs} +12 -12
- package/scripts/verify-version-state-delta.mjs +4 -2
- package/scripts/{v4-warrant-shadow-plan.mjs → warrant-shadow-plan.mjs} +6 -6
- package/templates/universal-buildchain-bootstrap-recovery.yml +4 -4
- package/packages/core/buildchain-v4-domain.wasm +0 -0
- package/packages/core/v4-domain-wasm-artifact.js +0 -7
- package/packages/core/v4-partial-mutation-recovery-qualification.js +0 -18
- package/packages/core/v4-provider-operation-journal.js +0 -62
- package/packages/core/v4-release-activation-shadow.js +0 -32
- package/packages/core/v4-stable-publication-fence.js +0 -28
- /package/actions/{v4-release-candidate-promote → release-candidate-promote}/README.md +0 -0
- /package/architecture/{v4-adopter-delivery-parity.json → adopter-delivery-parity.json} +0 -0
- /package/architecture/{v3-core-mechanism-inventory.json → baseline-core-mechanism-inventory.json} +0 -0
- /package/architecture/{v4-canonical-contract-fixtures.json → canonical-contract-fixtures.json} +0 -0
- /package/architecture/{v4-compatibility-facts-parity.json → compatibility-facts-parity.json} +0 -0
- /package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.schema.json → delivery-warrant-shadow-bootstrap-plan.schema.json} +0 -0
- /package/architecture/{v4-delivery-warrant-shadow-fixtures.json → delivery-warrant-shadow-fixtures.json} +0 -0
- /package/architecture/{v4-delivery-warrant-shadow-fixtures.schema.json → delivery-warrant-shadow-fixtures.schema.json} +0 -0
- /package/architecture/{v4-exception-ledger.json → exception-ledger.json} +0 -0
- /package/architecture/{v4-exception-ledger.schema.json → exception-ledger.schema.json} +0 -0
- /package/architecture/{v4-floating-consumer-policy.json → floating-consumer-policy.json} +0 -0
- /package/architecture/{v4-publication-facade-patches.json → publication-facade-patches.json} +0 -0
- /package/architecture/{v4-release-invocation-fixtures.json → release-invocation-fixtures.json} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./
|
|
9
|
-
import {
|
|
4
|
+
ContractFault,
|
|
5
|
+
domainContentRoot,
|
|
6
|
+
validateClock,
|
|
7
|
+
validateRoot,
|
|
8
|
+
} from "./canonical-contracts.js";
|
|
9
|
+
import { validateStageCapsule } from "./stage-capsule.js";
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const STAGE_CAPSULE_OUTPUT_MANIFEST_CONTRACT =
|
|
12
12
|
"buildchain-v4-stage-capsule-output-manifest/v1";
|
|
13
|
-
export const
|
|
13
|
+
export const STAGE_CAPSULE_RETENTION_STATE_CONTRACT =
|
|
14
14
|
"buildchain-v4-stage-capsule-retention-state/v1";
|
|
15
|
-
export const
|
|
15
|
+
export const STAGE_CAPSULE_TRANSPORT_CONTRACT =
|
|
16
16
|
"buildchain-v4-stage-capsule-transport/v1";
|
|
17
|
-
export const
|
|
17
|
+
export const STAGE_CAPSULE_STORE_RECEIPT_CONTRACT =
|
|
18
18
|
"buildchain-v4-stage-capsule-store-receipt/v1";
|
|
19
19
|
|
|
20
20
|
const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
@@ -38,7 +38,7 @@ const OUTCOMES = new Set([
|
|
|
38
38
|
]);
|
|
39
39
|
|
|
40
40
|
function fault(code, path, message) {
|
|
41
|
-
throw new
|
|
41
|
+
throw new ContractFault(code, path, message);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function exactKeys(value, keys, path) {
|
|
@@ -71,7 +71,7 @@ function token(value, path) {
|
|
|
71
71
|
return value;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export function
|
|
74
|
+
export function stageCapsuleBlobRoot(bytes) {
|
|
75
75
|
const value = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes);
|
|
76
76
|
return `sha256:${crypto.createHash("sha256").update(value).digest("hex")}`;
|
|
77
77
|
}
|
|
@@ -80,17 +80,20 @@ function manifestPayload(value) {
|
|
|
80
80
|
return { schema: value.schema, entries: value.entries };
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
export function
|
|
84
|
-
|
|
85
|
-
return
|
|
83
|
+
export function stageCapsuleOutputManifestRoot(value) {
|
|
84
|
+
validateStageCapsuleOutputManifest(value, { verifyRoot: false });
|
|
85
|
+
return domainContentRoot(
|
|
86
|
+
"stage-capsule-output-manifest",
|
|
87
|
+
manifestPayload(value),
|
|
88
|
+
);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
export function
|
|
91
|
+
export function validateStageCapsuleOutputManifest(
|
|
89
92
|
value,
|
|
90
93
|
{ verifyRoot = true } = {},
|
|
91
94
|
) {
|
|
92
95
|
exactKeys(value, ["schema", "entries", "manifestRoot"], "$/manifest");
|
|
93
|
-
if (value.schema !==
|
|
96
|
+
if (value.schema !== STAGE_CAPSULE_OUTPUT_MANIFEST_CONTRACT)
|
|
94
97
|
fault(
|
|
95
98
|
"unsupported-stage-capsule-store-version",
|
|
96
99
|
"$/manifest/schema",
|
|
@@ -107,7 +110,7 @@ export function validateV4StageCapsuleOutputManifest(
|
|
|
107
110
|
const entryPath = `$/manifest/entries/${index}`;
|
|
108
111
|
exactKeys(entry, ["name", "root", "size"], entryPath);
|
|
109
112
|
token(entry.name, `${entryPath}/name`);
|
|
110
|
-
|
|
113
|
+
validateRoot(entry.root, `${entryPath}/root`);
|
|
111
114
|
if (!Number.isSafeInteger(entry.size) || entry.size < 0)
|
|
112
115
|
fault(
|
|
113
116
|
"invalid-stage-capsule-content-size",
|
|
@@ -122,11 +125,11 @@ export function validateV4StageCapsuleOutputManifest(
|
|
|
122
125
|
);
|
|
123
126
|
prior = entry.name;
|
|
124
127
|
}
|
|
125
|
-
|
|
128
|
+
validateRoot(value.manifestRoot, "$/manifest/manifestRoot");
|
|
126
129
|
if (
|
|
127
130
|
verifyRoot &&
|
|
128
131
|
value.manifestRoot !==
|
|
129
|
-
|
|
132
|
+
domainContentRoot("stage-capsule-output-manifest", manifestPayload(value))
|
|
130
133
|
)
|
|
131
134
|
fault(
|
|
132
135
|
"stage-capsule-manifest-root-mismatch",
|
|
@@ -136,20 +139,20 @@ export function validateV4StageCapsuleOutputManifest(
|
|
|
136
139
|
return value;
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
export function
|
|
142
|
+
export function stageCapsuleRetentionPromiseRoot(promise) {
|
|
140
143
|
exactKeys(promise, ["class", "retainUntil"], "$/retentionPromise");
|
|
141
144
|
token(promise.class, "$/retentionPromise/class");
|
|
142
|
-
|
|
143
|
-
return
|
|
145
|
+
validateClock(promise.retainUntil, "$/retentionPromise/retainUntil");
|
|
146
|
+
return domainContentRoot("stage-capsule-retention-promise", promise);
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
export function
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
export function createStageCapsuleRetentionState({ capsule, evaluatedAt }) {
|
|
150
|
+
validateStageCapsule(capsule);
|
|
151
|
+
validateClock(evaluatedAt, "$/evaluatedAt");
|
|
149
152
|
const value = {
|
|
150
|
-
schema:
|
|
153
|
+
schema: STAGE_CAPSULE_RETENTION_STATE_CONTRACT,
|
|
151
154
|
capsuleRoot: capsule.capsuleRoot,
|
|
152
|
-
promiseRoot:
|
|
155
|
+
promiseRoot: stageCapsuleRetentionPromiseRoot(capsule.retentionPromise),
|
|
153
156
|
evaluatedAt,
|
|
154
157
|
status:
|
|
155
158
|
evaluatedAt <= capsule.retentionPromise.retainUntil
|
|
@@ -158,11 +161,11 @@ export function createV4StageCapsuleRetentionState({ capsule, evaluatedAt }) {
|
|
|
158
161
|
};
|
|
159
162
|
return {
|
|
160
163
|
...value,
|
|
161
|
-
stateRoot:
|
|
164
|
+
stateRoot: domainContentRoot("stage-capsule-retention-state", value),
|
|
162
165
|
};
|
|
163
166
|
}
|
|
164
167
|
|
|
165
|
-
export function
|
|
168
|
+
export function validateStageCapsuleRetentionState(value) {
|
|
166
169
|
exactKeys(
|
|
167
170
|
value,
|
|
168
171
|
[
|
|
@@ -175,24 +178,24 @@ export function validateV4StageCapsuleRetentionState(value) {
|
|
|
175
178
|
],
|
|
176
179
|
"$/retentionState",
|
|
177
180
|
);
|
|
178
|
-
if (value.schema !==
|
|
181
|
+
if (value.schema !== STAGE_CAPSULE_RETENTION_STATE_CONTRACT)
|
|
179
182
|
fault(
|
|
180
183
|
"unsupported-stage-capsule-store-version",
|
|
181
184
|
"$/retentionState/schema",
|
|
182
185
|
"unsupported retention-state schema",
|
|
183
186
|
);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
validateRoot(value.capsuleRoot, "$/retentionState/capsuleRoot");
|
|
188
|
+
validateRoot(value.promiseRoot, "$/retentionState/promiseRoot");
|
|
189
|
+
validateClock(value.evaluatedAt, "$/retentionState/evaluatedAt");
|
|
187
190
|
if (!new Set(["retained", "expired"]).has(value.status))
|
|
188
191
|
fault(
|
|
189
192
|
"invalid-stage-capsule-retention-state",
|
|
190
193
|
"$/retentionState/status",
|
|
191
194
|
"retention status must be retained or expired",
|
|
192
195
|
);
|
|
193
|
-
|
|
196
|
+
validateRoot(value.stateRoot, "$/retentionState/stateRoot");
|
|
194
197
|
const { stateRoot, ...body } = value;
|
|
195
|
-
if (stateRoot !==
|
|
198
|
+
if (stateRoot !== domainContentRoot("stage-capsule-retention-state", body))
|
|
196
199
|
fault(
|
|
197
200
|
"stage-capsule-retention-root-mismatch",
|
|
198
201
|
"$/retentionState/stateRoot",
|
|
@@ -201,7 +204,7 @@ export function validateV4StageCapsuleRetentionState(value) {
|
|
|
201
204
|
return value;
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
export function
|
|
207
|
+
export function createStageCapsuleTransport({
|
|
205
208
|
provider,
|
|
206
209
|
mode,
|
|
207
210
|
locatorRoot,
|
|
@@ -214,10 +217,10 @@ export function createV4StageCapsuleTransport({
|
|
|
214
217
|
"$/transport",
|
|
215
218
|
"unsupported transport provider or mode",
|
|
216
219
|
);
|
|
217
|
-
|
|
218
|
-
|
|
220
|
+
validateRoot(locatorRoot, "$/transport/locatorRoot");
|
|
221
|
+
validateClock(observedAt, "$/transport/observedAt");
|
|
219
222
|
const value = {
|
|
220
|
-
schema:
|
|
223
|
+
schema: STAGE_CAPSULE_TRANSPORT_CONTRACT,
|
|
221
224
|
provider,
|
|
222
225
|
mode,
|
|
223
226
|
locatorRoot,
|
|
@@ -225,11 +228,11 @@ export function createV4StageCapsuleTransport({
|
|
|
225
228
|
};
|
|
226
229
|
return {
|
|
227
230
|
...value,
|
|
228
|
-
transportRoot:
|
|
231
|
+
transportRoot: domainContentRoot("stage-capsule-transport", value),
|
|
229
232
|
};
|
|
230
233
|
}
|
|
231
234
|
|
|
232
|
-
export function
|
|
235
|
+
export function validateStageCapsuleTransport(value) {
|
|
233
236
|
exactKeys(
|
|
234
237
|
value,
|
|
235
238
|
[
|
|
@@ -242,7 +245,7 @@ export function validateV4StageCapsuleTransport(value) {
|
|
|
242
245
|
],
|
|
243
246
|
"$/transport",
|
|
244
247
|
);
|
|
245
|
-
const rebuilt =
|
|
248
|
+
const rebuilt = createStageCapsuleTransport(value);
|
|
246
249
|
if (
|
|
247
250
|
rebuilt.schema !== value.schema ||
|
|
248
251
|
rebuilt.transportRoot !== value.transportRoot
|
|
@@ -255,9 +258,9 @@ export function validateV4StageCapsuleTransport(value) {
|
|
|
255
258
|
return value;
|
|
256
259
|
}
|
|
257
260
|
|
|
258
|
-
export function
|
|
261
|
+
export function createStageCapsuleStoreReceipt(value) {
|
|
259
262
|
const body = {
|
|
260
|
-
schema:
|
|
263
|
+
schema: STAGE_CAPSULE_STORE_RECEIPT_CONTRACT,
|
|
261
264
|
operation: value.operation,
|
|
262
265
|
recordedAt: value.recordedAt,
|
|
263
266
|
capsuleRoot: value.capsuleRoot,
|
|
@@ -271,12 +274,12 @@ export function createV4StageCapsuleStoreReceipt(value) {
|
|
|
271
274
|
};
|
|
272
275
|
const receipt = {
|
|
273
276
|
...body,
|
|
274
|
-
receiptRoot:
|
|
277
|
+
receiptRoot: domainContentRoot("stage-capsule-store-receipt", body),
|
|
275
278
|
};
|
|
276
|
-
return
|
|
279
|
+
return validateStageCapsuleStoreReceipt(receipt);
|
|
277
280
|
}
|
|
278
281
|
|
|
279
|
-
export function
|
|
282
|
+
export function validateStageCapsuleStoreReceipt(value) {
|
|
280
283
|
exactKeys(
|
|
281
284
|
value,
|
|
282
285
|
[
|
|
@@ -295,7 +298,7 @@ export function validateV4StageCapsuleStoreReceipt(value) {
|
|
|
295
298
|
],
|
|
296
299
|
"$/receipt",
|
|
297
300
|
);
|
|
298
|
-
if (value.schema !==
|
|
301
|
+
if (value.schema !== STAGE_CAPSULE_STORE_RECEIPT_CONTRACT)
|
|
299
302
|
fault(
|
|
300
303
|
"unsupported-stage-capsule-store-version",
|
|
301
304
|
"$/receipt/schema",
|
|
@@ -307,7 +310,7 @@ export function validateV4StageCapsuleStoreReceipt(value) {
|
|
|
307
310
|
"$/receipt",
|
|
308
311
|
"unsupported store operation or outcome",
|
|
309
312
|
);
|
|
310
|
-
|
|
313
|
+
validateClock(value.recordedAt, "$/receipt/recordedAt");
|
|
311
314
|
for (const name of [
|
|
312
315
|
"capsuleRoot",
|
|
313
316
|
"manifestRoot",
|
|
@@ -317,7 +320,7 @@ export function validateV4StageCapsuleStoreReceipt(value) {
|
|
|
317
320
|
"qualificationRoot",
|
|
318
321
|
"receiptRoot",
|
|
319
322
|
])
|
|
320
|
-
|
|
323
|
+
validateRoot(value[name], `$/receipt/${name}`);
|
|
321
324
|
if (value.faultCode !== null)
|
|
322
325
|
fault(
|
|
323
326
|
"invalid-stage-capsule-store-receipt",
|
|
@@ -325,7 +328,7 @@ export function validateV4StageCapsuleStoreReceipt(value) {
|
|
|
325
328
|
"successful store receipts cannot carry a fault",
|
|
326
329
|
);
|
|
327
330
|
const { receiptRoot, ...body } = value;
|
|
328
|
-
if (receiptRoot !==
|
|
331
|
+
if (receiptRoot !== domainContentRoot("stage-capsule-store-receipt", body))
|
|
329
332
|
fault(
|
|
330
333
|
"stage-capsule-store-receipt-root-mismatch",
|
|
331
334
|
"$/receipt/receiptRoot",
|
|
@@ -341,12 +344,12 @@ function validateProviderRequest(operation, request) {
|
|
|
341
344
|
: ["capsuleRoot", "locatorRoot", "recordedAt"];
|
|
342
345
|
exactKeys(request, keys, "$/adapter/request");
|
|
343
346
|
for (const name of keys.filter((name) => name.endsWith("Root")))
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
validateRoot(request[name], `$/adapter/request/${name}`);
|
|
348
|
+
validateClock(request.recordedAt, "$/adapter/request/recordedAt");
|
|
346
349
|
return request;
|
|
347
350
|
}
|
|
348
351
|
|
|
349
|
-
export function
|
|
352
|
+
export function createStageCapsuleProviderAdapter({
|
|
350
353
|
provider,
|
|
351
354
|
mode = "effect-disabled",
|
|
352
355
|
fixture = null,
|
|
@@ -388,7 +391,7 @@ export function createV4StageCapsuleProviderAdapter({
|
|
|
388
391
|
mode,
|
|
389
392
|
observe: (request) => {
|
|
390
393
|
exactKeys(request, ["locatorRoot", "observedAt"], "$/adapter/request");
|
|
391
|
-
return
|
|
394
|
+
return createStageCapsuleTransport({
|
|
392
395
|
provider,
|
|
393
396
|
mode,
|
|
394
397
|
locatorRoot: request.locatorRoot,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "./
|
|
2
|
+
ContractFault,
|
|
3
|
+
domainContentRoot,
|
|
4
|
+
validateClock,
|
|
5
|
+
validateRoot,
|
|
6
|
+
} from "./canonical-contracts.js";
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
8
|
+
export const STAGE_CAPSULE_CONTRACT = "buildchain-v4-stage-capsule/v1";
|
|
9
|
+
export const STAGE_CAPSULE_IDENTITY_CONTRACT =
|
|
10
10
|
"buildchain-v4-stage-capsule-identity/v1";
|
|
11
|
-
export const
|
|
11
|
+
export const STAGE_CAPSULE_AVAILABILITY_CONTRACT =
|
|
12
12
|
"buildchain-v4-stage-capsule-availability/v1";
|
|
13
|
-
export const
|
|
13
|
+
export const STAGE_CAPSULE_REUSE_CONTRACT =
|
|
14
14
|
"buildchain-v4-stage-capsule-reuse/v1";
|
|
15
15
|
|
|
16
16
|
const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
@@ -25,7 +25,7 @@ const AVAILABILITY = new Set([
|
|
|
25
25
|
]);
|
|
26
26
|
|
|
27
27
|
function fault(code, path, message) {
|
|
28
|
-
throw new
|
|
28
|
+
throw new ContractFault(code, path, message);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function exactKeys(value, keys, path) {
|
|
@@ -61,7 +61,7 @@ function validateNamedRoots(value, path) {
|
|
|
61
61
|
const entryPath = `${path}/${index}`;
|
|
62
62
|
exactKeys(entry, ["name", "root"], entryPath);
|
|
63
63
|
validateToken(entry.name, `${entryPath}/name`);
|
|
64
|
-
|
|
64
|
+
validateRoot(entry.root, `${entryPath}/root`);
|
|
65
65
|
if (prior !== null && entry.name <= prior)
|
|
66
66
|
fault(
|
|
67
67
|
"unordered-stage-capsule-roots",
|
|
@@ -72,7 +72,7 @@ function validateNamedRoots(value, path) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export function
|
|
75
|
+
export function validateStageCapsuleIdentity(value) {
|
|
76
76
|
exactKeys(
|
|
77
77
|
value,
|
|
78
78
|
[
|
|
@@ -92,7 +92,7 @@ export function validateV4StageCapsuleIdentity(value) {
|
|
|
92
92
|
],
|
|
93
93
|
"$/identity",
|
|
94
94
|
);
|
|
95
|
-
if (value.schema !==
|
|
95
|
+
if (value.schema !== STAGE_CAPSULE_IDENTITY_CONTRACT)
|
|
96
96
|
fault(
|
|
97
97
|
"unsupported-stage-capsule-version",
|
|
98
98
|
"$/identity/schema",
|
|
@@ -109,22 +109,22 @@ export function validateV4StageCapsuleIdentity(value) {
|
|
|
109
109
|
"outputManifestRoot",
|
|
110
110
|
"qualificationRoot",
|
|
111
111
|
])
|
|
112
|
-
|
|
112
|
+
validateRoot(value[name], `$/identity/${name}`);
|
|
113
113
|
validateNamedRoots(value.toolchainRoots, "$/identity/toolchainRoots");
|
|
114
114
|
validateNamedRoots(value.declaredInputs, "$/identity/declaredInputs");
|
|
115
115
|
validateNamedRoots(value.observationRoots, "$/identity/observationRoots");
|
|
116
116
|
return value;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
export function
|
|
120
|
-
|
|
121
|
-
return
|
|
119
|
+
export function stageCapsuleIdentityRoot(identity) {
|
|
120
|
+
validateStageCapsuleIdentity(identity);
|
|
121
|
+
return domainContentRoot("stage-capsule-identity", identity);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
function validateRetentionPromise(value) {
|
|
125
125
|
exactKeys(value, ["class", "retainUntil"], "$/retentionPromise");
|
|
126
126
|
validateToken(value.class, "$/retentionPromise/class");
|
|
127
|
-
|
|
127
|
+
validateClock(value.retainUntil, "$/retentionPromise/retainUntil");
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
function capsulePayload(value) {
|
|
@@ -138,7 +138,7 @@ function capsulePayload(value) {
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
export function
|
|
141
|
+
export function validateStageCapsule(value) {
|
|
142
142
|
exactKeys(
|
|
143
143
|
value,
|
|
144
144
|
[
|
|
@@ -152,7 +152,7 @@ export function validateV4StageCapsule(value) {
|
|
|
152
152
|
],
|
|
153
153
|
"$",
|
|
154
154
|
);
|
|
155
|
-
if (value.schema !==
|
|
155
|
+
if (value.schema !== STAGE_CAPSULE_CONTRACT)
|
|
156
156
|
fault(
|
|
157
157
|
"unsupported-stage-capsule-version",
|
|
158
158
|
"$/schema",
|
|
@@ -167,8 +167,8 @@ export function validateV4StageCapsule(value) {
|
|
|
167
167
|
"$/writerAuthority",
|
|
168
168
|
"Stage Capsule authority must remain TypeScript v3 with validation-only Rust",
|
|
169
169
|
);
|
|
170
|
-
const identityRoot =
|
|
171
|
-
|
|
170
|
+
const identityRoot = stageCapsuleIdentityRoot(value.identity);
|
|
171
|
+
validateRoot(value.identityRoot, "$/identityRoot");
|
|
172
172
|
if (value.identityRoot !== identityRoot)
|
|
173
173
|
fault(
|
|
174
174
|
"stage-capsule-identity-root-mismatch",
|
|
@@ -176,8 +176,8 @@ export function validateV4StageCapsule(value) {
|
|
|
176
176
|
"identityRoot does not bind the canonical Stage Capsule identity",
|
|
177
177
|
);
|
|
178
178
|
validateRetentionPromise(value.retentionPromise);
|
|
179
|
-
|
|
180
|
-
const capsuleRoot =
|
|
179
|
+
validateRoot(value.capsuleRoot, "$/capsuleRoot");
|
|
180
|
+
const capsuleRoot = domainContentRoot("stage-capsule", capsulePayload(value));
|
|
181
181
|
if (value.capsuleRoot !== capsuleRoot)
|
|
182
182
|
fault(
|
|
183
183
|
"stage-capsule-root-mismatch",
|
|
@@ -187,13 +187,13 @@ export function validateV4StageCapsule(value) {
|
|
|
187
187
|
return value;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
export function
|
|
191
|
-
|
|
190
|
+
export function stageCapsuleRoot(value) {
|
|
191
|
+
validateStageCapsuleIdentity(value.identity);
|
|
192
192
|
validateRetentionPromise(value.retentionPromise);
|
|
193
|
-
return
|
|
193
|
+
return domainContentRoot("stage-capsule", capsulePayload(value));
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
export function
|
|
196
|
+
export function validateStageCapsuleAvailability(value) {
|
|
197
197
|
exactKeys(
|
|
198
198
|
value,
|
|
199
199
|
[
|
|
@@ -208,14 +208,14 @@ export function validateV4StageCapsuleAvailability(value) {
|
|
|
208
208
|
],
|
|
209
209
|
"$/availability",
|
|
210
210
|
);
|
|
211
|
-
if (value.schema !==
|
|
211
|
+
if (value.schema !== STAGE_CAPSULE_AVAILABILITY_CONTRACT)
|
|
212
212
|
fault(
|
|
213
213
|
"unsupported-stage-capsule-version",
|
|
214
214
|
"$/availability/schema",
|
|
215
215
|
"unsupported Stage Capsule availability schema",
|
|
216
216
|
);
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
validateRoot(value.capsuleRoot, "$/availability/capsuleRoot");
|
|
218
|
+
validateClock(value.observedAt, "$/availability/observedAt");
|
|
219
219
|
if (!AVAILABILITY.has(value.status))
|
|
220
220
|
fault(
|
|
221
221
|
"invalid-stage-capsule-availability",
|
|
@@ -224,7 +224,7 @@ export function validateV4StageCapsuleAvailability(value) {
|
|
|
224
224
|
);
|
|
225
225
|
for (const name of ["contentRoot", "qualificationRoot"])
|
|
226
226
|
if (value[name] !== null)
|
|
227
|
-
|
|
227
|
+
validateRoot(value[name], `$/availability/${name}`);
|
|
228
228
|
validateNamedRoots(value.transports, "$/availability/transports");
|
|
229
229
|
if (value.faultCode !== null)
|
|
230
230
|
validateToken(value.faultCode, "$/availability/faultCode");
|
|
@@ -248,12 +248,12 @@ export function validateV4StageCapsuleAvailability(value) {
|
|
|
248
248
|
return value;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
export function
|
|
252
|
-
|
|
253
|
-
return
|
|
251
|
+
export function stageCapsuleAvailabilityRoot(value) {
|
|
252
|
+
validateStageCapsuleAvailability(value);
|
|
253
|
+
return domainContentRoot("stage-capsule-availability", value);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
export function
|
|
256
|
+
export function evaluateStageCapsuleReuse(request) {
|
|
257
257
|
exactKeys(
|
|
258
258
|
request,
|
|
259
259
|
[
|
|
@@ -267,26 +267,26 @@ export function evaluateV4StageCapsuleReuse(request) {
|
|
|
267
267
|
],
|
|
268
268
|
"$",
|
|
269
269
|
);
|
|
270
|
-
if (request.schema !==
|
|
270
|
+
if (request.schema !== STAGE_CAPSULE_REUSE_CONTRACT)
|
|
271
271
|
fault(
|
|
272
272
|
"unsupported-stage-capsule-version",
|
|
273
273
|
"$/schema",
|
|
274
274
|
"unsupported Stage Capsule reuse schema",
|
|
275
275
|
);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
validateStageCapsule(request.capsule);
|
|
277
|
+
validateStageCapsuleAvailability(request.availability);
|
|
278
|
+
validateClock(request.evaluatedAt, "$/evaluatedAt");
|
|
279
279
|
for (const name of [
|
|
280
280
|
"expectedCapsuleRoot",
|
|
281
281
|
"expectedOutputManifestRoot",
|
|
282
282
|
"expectedQualificationRoot",
|
|
283
283
|
])
|
|
284
|
-
|
|
284
|
+
validateRoot(request[name], `$/${name}`);
|
|
285
285
|
const fail = (reason) => ({
|
|
286
|
-
schema:
|
|
286
|
+
schema: STAGE_CAPSULE_REUSE_CONTRACT,
|
|
287
287
|
eligible: false,
|
|
288
288
|
capsuleRoot: request.capsule.capsuleRoot,
|
|
289
|
-
availabilityRoot:
|
|
289
|
+
availabilityRoot: stageCapsuleAvailabilityRoot(request.availability),
|
|
290
290
|
reason,
|
|
291
291
|
});
|
|
292
292
|
if (
|
|
@@ -310,10 +310,10 @@ export function evaluateV4StageCapsuleReuse(request) {
|
|
|
310
310
|
)
|
|
311
311
|
return fail("root-mismatch");
|
|
312
312
|
return {
|
|
313
|
-
schema:
|
|
313
|
+
schema: STAGE_CAPSULE_REUSE_CONTRACT,
|
|
314
314
|
eligible: true,
|
|
315
315
|
capsuleRoot: request.capsule.capsuleRoot,
|
|
316
|
-
availabilityRoot:
|
|
316
|
+
availabilityRoot: stageCapsuleAvailabilityRoot(request.availability),
|
|
317
317
|
reason: "eligible",
|
|
318
318
|
};
|
|
319
319
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const TAIL_RESEAL_REQUEST_CONTRACT =
|
|
2
2
|
"kungfu-buildchain-v4-tail-reseal-request/v1";
|
|
3
|
-
export const
|
|
3
|
+
export const TAIL_RESEAL_PLAN_CONTRACT =
|
|
4
4
|
"kungfu-buildchain-v4-tail-reseal-plan/v1";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const TAIL_RESEAL_PLATFORMS = Object.freeze([
|
|
7
7
|
"linux-arm64",
|
|
8
8
|
"linux-x64",
|
|
9
9
|
"macos-arm64",
|
|
10
10
|
"windows-x64",
|
|
11
11
|
]);
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const TAIL_RESEAL_PLATFORM_RUNNERS = Object.freeze({
|
|
14
14
|
"linux-arm64": '["ubuntu-24.04-arm"]',
|
|
15
15
|
"linux-x64": '["ubuntu-24.04"]',
|
|
16
16
|
"macos-arm64": '["macos-15"]',
|
|
17
17
|
"windows-x64": '["windows-2025"]',
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
export const
|
|
21
|
-
|
|
20
|
+
export const TAIL_RESEAL_REUSED_STAGE_KEYS = Object.freeze(
|
|
21
|
+
TAIL_RESEAL_PLATFORMS.flatMap((platformId) =>
|
|
22
22
|
["build", "install", "package", "verify"].map(
|
|
23
23
|
(stage) => `${platformId}:${stage}`,
|
|
24
24
|
),
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
V4TailResealFault,
|
|
4
|
-
normalizeV4TailResealRequest,
|
|
5
|
-
} from "./v4-tail-reseal.js";
|
|
1
|
+
import { domainContentRoot } from "./canonical-contracts.js";
|
|
2
|
+
import { TailResealFault, normalizeTailResealRequest } from "./tail-reseal.js";
|
|
6
3
|
|
|
7
|
-
export const
|
|
4
|
+
export const TAIL_RESEAL_ADMISSION_CONTRACT =
|
|
8
5
|
"kungfu-buildchain-v4-tail-reseal-admission/v1";
|
|
9
6
|
|
|
10
7
|
const REQUIRED_SUCCESS_JOBS = Object.freeze([
|
|
@@ -22,7 +19,7 @@ const REQUIRED_SUCCESS_JOBS = Object.freeze([
|
|
|
22
19
|
]);
|
|
23
20
|
|
|
24
21
|
function fault(code, path, message) {
|
|
25
|
-
throw new
|
|
22
|
+
throw new TailResealFault(code, path, message);
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
function exactArtifact(artifacts, name, digest, path) {
|
|
@@ -141,7 +138,7 @@ function validateSigningAuthority(normalized, signingRun, signingArtifacts) {
|
|
|
141
138
|
);
|
|
142
139
|
}
|
|
143
140
|
|
|
144
|
-
export function
|
|
141
|
+
export function validateTailResealGitHubEvidence({
|
|
145
142
|
request,
|
|
146
143
|
sourceCommit,
|
|
147
144
|
sourceRun,
|
|
@@ -150,13 +147,13 @@ export function validateV4TailResealGitHubEvidence({
|
|
|
150
147
|
signingRun,
|
|
151
148
|
signingArtifacts,
|
|
152
149
|
} = {}) {
|
|
153
|
-
const normalized =
|
|
150
|
+
const normalized = normalizeTailResealRequest(request);
|
|
154
151
|
validateSourceIdentity(normalized, sourceCommit, sourceRun);
|
|
155
152
|
validateSourceJobs(normalized, sourceJobs);
|
|
156
153
|
validateRetainedArtifacts(normalized, sourceArtifacts);
|
|
157
154
|
validateSigningAuthority(normalized, signingRun, signingArtifacts);
|
|
158
155
|
const payload = {
|
|
159
|
-
schema:
|
|
156
|
+
schema: TAIL_RESEAL_ADMISSION_CONTRACT,
|
|
160
157
|
repository: normalized.repository,
|
|
161
158
|
sourceRoot: normalized.source.sourceRoot,
|
|
162
159
|
sourceRunId: normalized.source.runId,
|
|
@@ -171,8 +168,11 @@ export function validateV4TailResealGitHubEvidence({
|
|
|
171
168
|
};
|
|
172
169
|
return {
|
|
173
170
|
...payload,
|
|
174
|
-
admissionRoot:
|
|
171
|
+
admissionRoot: domainContentRoot("tail-reseal-admission", payload),
|
|
175
172
|
};
|
|
176
173
|
}
|
|
177
174
|
|
|
178
|
-
export {
|
|
175
|
+
export {
|
|
176
|
+
REQUIRED_SUCCESS_JOBS as TAIL_RESEAL_REQUIRED_SUCCESS_JOBS,
|
|
177
|
+
REQUIRED_SUCCESS_JOBS as V4_TAIL_RESEAL_REQUIRED_SUCCESS_JOBS,
|
|
178
|
+
};
|