@kungfu-tech/buildchain 4.0.2 → 4.0.3-alpha.0
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
|
@@ -2,23 +2,23 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
ContractFault,
|
|
6
|
+
domainCanonicalBytes,
|
|
7
|
+
domainContentRoot,
|
|
8
|
+
} from "./canonical-contracts.js";
|
|
9
|
+
import { emitPlatformStageCheckpoint } from "./platform-stage-checkpoints.js";
|
|
10
|
+
import { STAGE_CAPSULE_QUALIFICATION_FAULTS } from "./stage-capsule-qualification.js";
|
|
11
|
+
import { planStageCapsuleResume } from "./stage-capsule-resume-planner.js";
|
|
12
|
+
import { stageCapsuleBlobRoot } from "./stage-capsule-store.js";
|
|
13
13
|
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
14
|
+
export const STAGE_CAPSULE_CAMPAIGN_RECORDED_AT = "2026-08-08T00:00:00.000Z";
|
|
15
|
+
export const STAGE_CAPSULE_CAMPAIGN_STAGES = Object.freeze([
|
|
16
16
|
"install",
|
|
17
17
|
"build",
|
|
18
18
|
"verify",
|
|
19
19
|
"package",
|
|
20
20
|
]);
|
|
21
|
-
export const
|
|
21
|
+
export const STAGE_CAPSULE_CAMPAIGN_DEPENDENCIES = Object.freeze({
|
|
22
22
|
install: [],
|
|
23
23
|
build: ["install"],
|
|
24
24
|
verify: ["build"],
|
|
@@ -39,18 +39,18 @@ const EXTERNAL_CONSUMER_EXCLUSIONS = Object.freeze({
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
function rootOf(label) {
|
|
42
|
-
return
|
|
42
|
+
return stageCapsuleBlobRoot(
|
|
43
43
|
Buffer.isBuffer(label)
|
|
44
44
|
? label
|
|
45
45
|
: typeof label === "string"
|
|
46
46
|
? Buffer.from(`${label}\n`, "utf8")
|
|
47
|
-
:
|
|
47
|
+
: domainCanonicalBytes(label),
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function outputBytes(context, stageId, outputName) {
|
|
52
52
|
const evidence = context.campaignProfile?.stageEvidence?.[stageId];
|
|
53
|
-
if (evidence) return
|
|
53
|
+
if (evidence) return domainCanonicalBytes(evidence);
|
|
54
54
|
return Buffer.from(
|
|
55
55
|
`${context.consumer}:${context.consumerSourceRevision}:${context.platform}:${stageId}:${outputName}:qualified-bytes\n`,
|
|
56
56
|
"utf8",
|
|
@@ -66,15 +66,14 @@ function inputRoot(context, stageId, name) {
|
|
|
66
66
|
"verification-report": ["verify", "verification-report"],
|
|
67
67
|
"package-archive": ["package", "package-archive"],
|
|
68
68
|
}[name];
|
|
69
|
-
if (producer)
|
|
70
|
-
return v4StageCapsuleBlobRoot(outputBytes(context, ...producer));
|
|
69
|
+
if (producer) return stageCapsuleBlobRoot(outputBytes(context, ...producer));
|
|
71
70
|
return rootOf(
|
|
72
71
|
`${context.consumer}:${context.consumerSourceRevision}:${context.platform}:input:${name}`,
|
|
73
72
|
);
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
function campaignFault(code, location, message) {
|
|
77
|
-
throw new
|
|
76
|
+
throw new ContractFault(code, location, message);
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
function readJson(file, label) {
|
|
@@ -157,7 +156,7 @@ function lifecycleStageEvidence({ stageId, manifest, summary, command }) {
|
|
|
157
156
|
};
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
export function
|
|
159
|
+
export function createStageCapsuleCampaignProfile(context) {
|
|
161
160
|
const loaded = context.lifecycleConfig;
|
|
162
161
|
if (!loaded?.filePath || !loaded?.config)
|
|
163
162
|
campaignFault(
|
|
@@ -226,11 +225,11 @@ export function createV4StageCapsuleCampaignProfile(context) {
|
|
|
226
225
|
configRoot: rootOf(configBytes),
|
|
227
226
|
sourceRevision: context.consumerSourceRevision,
|
|
228
227
|
});
|
|
229
|
-
const installOutputRoot =
|
|
230
|
-
|
|
228
|
+
const installOutputRoot = stageCapsuleBlobRoot(
|
|
229
|
+
domainCanonicalBytes(stageEvidence.install),
|
|
231
230
|
);
|
|
232
231
|
const buildOutputRoot = stageEvidence.build
|
|
233
|
-
?
|
|
232
|
+
? stageCapsuleBlobRoot(domainCanonicalBytes(stageEvidence.build))
|
|
234
233
|
: installOutputRoot;
|
|
235
234
|
const lifecycleDeclarations = stageNames.map((name) => ({
|
|
236
235
|
name,
|
|
@@ -275,18 +274,18 @@ export function createV4StageCapsuleCampaignProfile(context) {
|
|
|
275
274
|
};
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
export function
|
|
279
|
-
return context.campaignProfile?.stages ||
|
|
277
|
+
export function stageCapsuleCampaignStages(context) {
|
|
278
|
+
return context.campaignProfile?.stages || STAGE_CAPSULE_CAMPAIGN_STAGES;
|
|
280
279
|
}
|
|
281
280
|
|
|
282
|
-
export function
|
|
281
|
+
export function stageCapsuleCampaignDependencies(context, stageId) {
|
|
283
282
|
return (
|
|
284
283
|
context.campaignProfile?.dependencies?.[stageId] ||
|
|
285
|
-
|
|
284
|
+
STAGE_CAPSULE_CAMPAIGN_DEPENDENCIES[stageId]
|
|
286
285
|
);
|
|
287
286
|
}
|
|
288
287
|
|
|
289
|
-
export function
|
|
288
|
+
export function createStageCapsuleCampaignCheckpointRequest(
|
|
290
289
|
context,
|
|
291
290
|
stageId,
|
|
292
291
|
store,
|
|
@@ -305,7 +304,7 @@ export function createV4StageCapsuleCampaignCheckpointRequest(
|
|
|
305
304
|
platformId: context.platform,
|
|
306
305
|
stageId,
|
|
307
306
|
stageOutcome,
|
|
308
|
-
recordedAt:
|
|
307
|
+
recordedAt: STAGE_CAPSULE_CAMPAIGN_RECORDED_AT,
|
|
309
308
|
overheadMs: 0,
|
|
310
309
|
inputs: Object.fromEntries(
|
|
311
310
|
stage.inputs.map((name) => [name, inputRoot(context, stageId, name)]),
|
|
@@ -314,7 +313,7 @@ export function createV4StageCapsuleCampaignCheckpointRequest(
|
|
|
314
313
|
productionOutputRoots: Object.fromEntries(
|
|
315
314
|
Object.entries(outputs).map(([name, bytes]) => [
|
|
316
315
|
name,
|
|
317
|
-
|
|
316
|
+
stageCapsuleBlobRoot(bytes),
|
|
318
317
|
]),
|
|
319
318
|
),
|
|
320
319
|
productionLifecycleResult: { outcome: stageOutcome, stage: stageId },
|
|
@@ -357,14 +356,14 @@ export function createV4StageCapsuleCampaignCheckpointRequest(
|
|
|
357
356
|
};
|
|
358
357
|
}
|
|
359
358
|
|
|
360
|
-
export function
|
|
359
|
+
export function emitStageCapsuleCampaignCheckpoint(
|
|
361
360
|
context,
|
|
362
361
|
stageId,
|
|
363
362
|
store,
|
|
364
363
|
stageOutcome = "success",
|
|
365
364
|
) {
|
|
366
|
-
return
|
|
367
|
-
|
|
365
|
+
return emitPlatformStageCheckpoint(
|
|
366
|
+
createStageCapsuleCampaignCheckpointRequest(
|
|
368
367
|
context,
|
|
369
368
|
stageId,
|
|
370
369
|
store,
|
|
@@ -373,7 +372,7 @@ export function emitV4StageCapsuleCampaignCheckpoint(
|
|
|
373
372
|
);
|
|
374
373
|
}
|
|
375
374
|
|
|
376
|
-
export function
|
|
375
|
+
export function stageCapsuleCampaignAggregateRoots(entries) {
|
|
377
376
|
const manifests = entries.map(({ stage, manifest }) => ({
|
|
378
377
|
stage,
|
|
379
378
|
manifestRoot: manifest.manifestRoot,
|
|
@@ -387,11 +386,11 @@ export function v4StageCapsuleCampaignAggregateRoots(entries) {
|
|
|
387
386
|
})),
|
|
388
387
|
);
|
|
389
388
|
return {
|
|
390
|
-
artifactManifestRoot:
|
|
389
|
+
artifactManifestRoot: domainContentRoot(
|
|
391
390
|
"stage-capsule-artifact-manifest",
|
|
392
391
|
manifests,
|
|
393
392
|
),
|
|
394
|
-
contentRoot:
|
|
393
|
+
contentRoot: domainContentRoot("stage-capsule-artifact-content", content),
|
|
395
394
|
};
|
|
396
395
|
}
|
|
397
396
|
|
|
@@ -479,9 +478,9 @@ function faultDefinitions() {
|
|
|
479
478
|
};
|
|
480
479
|
}
|
|
481
480
|
|
|
482
|
-
export function
|
|
481
|
+
export function runStageCapsuleFaultCampaign(baseRequest) {
|
|
483
482
|
const definitions = faultDefinitions();
|
|
484
|
-
return
|
|
483
|
+
return STAGE_CAPSULE_QUALIFICATION_FAULTS.map((id) => {
|
|
485
484
|
const request = structuredClone(baseRequest);
|
|
486
485
|
const faultNode =
|
|
487
486
|
request.nodes.find(({ key }) => key === "build") ||
|
|
@@ -494,11 +493,11 @@ export function runV4StageCapsuleFaultCampaign(baseRequest) {
|
|
|
494
493
|
let actual = "contract-fault";
|
|
495
494
|
let reasonCode = "unknown-fault";
|
|
496
495
|
try {
|
|
497
|
-
const decision =
|
|
496
|
+
const decision = planStageCapsuleResume(request).decisions[0];
|
|
498
497
|
actual = decision.decision;
|
|
499
498
|
reasonCode = decision.reasonCode;
|
|
500
499
|
} catch (error) {
|
|
501
|
-
if (!(error instanceof
|
|
500
|
+
if (!(error instanceof ContractFault)) throw error;
|
|
502
501
|
reasonCode = error.code;
|
|
503
502
|
}
|
|
504
503
|
return {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./
|
|
2
|
+
ContractFault,
|
|
3
|
+
domainContentRoot,
|
|
4
|
+
validateRoot,
|
|
5
|
+
} from "./canonical-contracts.js";
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const STAGE_CAPSULE_PLATFORM_QUALIFICATION_CONTRACT =
|
|
8
8
|
"buildchain-v4-stage-capsule-platform-qualification/v1";
|
|
9
|
-
export const
|
|
9
|
+
export const STAGE_CAPSULE_QUALIFICATION_CONTRACT =
|
|
10
10
|
"buildchain-v4-stage-capsule-qualification/v1";
|
|
11
|
-
export const
|
|
11
|
+
export const STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT =
|
|
12
12
|
"buildchain-v4-stage-capsule-wave-reconciliation/v1";
|
|
13
13
|
|
|
14
14
|
const PLATFORMS = ["linux-x64", "macos-arm64", "windows-x64"];
|
|
@@ -37,7 +37,7 @@ const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
|
37
37
|
const REVISION = /^[0-9a-f]{40}$/u;
|
|
38
38
|
|
|
39
39
|
function fault(code, location, message) {
|
|
40
|
-
throw new
|
|
40
|
+
throw new ContractFault(code, location, message);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function object(value, location) {
|
|
@@ -94,7 +94,7 @@ function string(value, location) {
|
|
|
94
94
|
|
|
95
95
|
function roots(value, names, location) {
|
|
96
96
|
exactKeys(value, names, location);
|
|
97
|
-
for (const name of names)
|
|
97
|
+
for (const name of names) validateRoot(value[name], `${location}/${name}`);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
function validateFaults(entries, location) {
|
|
@@ -123,7 +123,7 @@ function validateFaults(entries, location) {
|
|
|
123
123
|
|
|
124
124
|
function validateAuthorityAndRuns(value) {
|
|
125
125
|
if (
|
|
126
|
-
value.schema !==
|
|
126
|
+
value.schema !== STAGE_CAPSULE_PLATFORM_QUALIFICATION_CONTRACT ||
|
|
127
127
|
value.mode !== "shadow-only" ||
|
|
128
128
|
value.productionAuthority !== "v3" ||
|
|
129
129
|
value.providerEffects !== false ||
|
|
@@ -163,7 +163,7 @@ function validateAuthorityAndRuns(value) {
|
|
|
163
163
|
`$/processRuns/${index}`,
|
|
164
164
|
"run order or outcome differs",
|
|
165
165
|
);
|
|
166
|
-
|
|
166
|
+
validateRoot(run.evidenceRoot, `$/processRuns/${index}/evidenceRoot`);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -188,7 +188,7 @@ function validateBuildAndPlan(value) {
|
|
|
188
188
|
["planRoot", "requiredRestores", "requiredStages"],
|
|
189
189
|
"$/resumePlan",
|
|
190
190
|
);
|
|
191
|
-
|
|
191
|
+
validateRoot(value.resumePlan.planRoot, "$/resumePlan/planRoot");
|
|
192
192
|
for (const name of ["requiredRestores", "requiredStages"])
|
|
193
193
|
if (
|
|
194
194
|
!Array.isArray(value.resumePlan[name]) ||
|
|
@@ -252,7 +252,7 @@ function validateMetricsAndRollback(value) {
|
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
export function
|
|
255
|
+
export function validateStageCapsulePlatformQualification(value) {
|
|
256
256
|
exactKeys(
|
|
257
257
|
value,
|
|
258
258
|
[
|
|
@@ -277,13 +277,13 @@ export function validateV4StageCapsulePlatformQualification(value) {
|
|
|
277
277
|
"$",
|
|
278
278
|
);
|
|
279
279
|
validateAuthorityAndRuns(value);
|
|
280
|
-
|
|
280
|
+
validateRoot(value.campaignProfileRoot, "$/campaignProfileRoot");
|
|
281
281
|
validateBuildAndPlan(value);
|
|
282
282
|
validateFaults(value.faultCampaign, "$/faultCampaign");
|
|
283
283
|
validateMetricsAndRollback(value);
|
|
284
284
|
const payload = structuredClone(value);
|
|
285
285
|
delete payload.reportRoot;
|
|
286
|
-
const expectedRoot =
|
|
286
|
+
const expectedRoot = domainContentRoot(
|
|
287
287
|
"stage-capsule-platform-qualification",
|
|
288
288
|
payload,
|
|
289
289
|
);
|
|
@@ -296,7 +296,7 @@ export function validateV4StageCapsulePlatformQualification(value) {
|
|
|
296
296
|
return value;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
export function
|
|
299
|
+
export function qualifyStageCapsuleCampaign(
|
|
300
300
|
platformEvidence,
|
|
301
301
|
expectedConsumers = CONSUMERS,
|
|
302
302
|
) {
|
|
@@ -323,7 +323,7 @@ export function qualifyV4StageCapsuleCampaign(
|
|
|
323
323
|
"every expected consumer must qualify on all three platforms",
|
|
324
324
|
);
|
|
325
325
|
const evidence = platformEvidence.map((entry) =>
|
|
326
|
-
structuredClone(
|
|
326
|
+
structuredClone(validateStageCapsulePlatformQualification(entry)),
|
|
327
327
|
);
|
|
328
328
|
const expectedPairs = requiredConsumers.flatMap((consumer) =>
|
|
329
329
|
PLATFORMS.map((platform) => `${consumer}/${platform}`),
|
|
@@ -349,7 +349,7 @@ export function qualifyV4StageCapsuleCampaign(
|
|
|
349
349
|
"the exact expected consumer set is required",
|
|
350
350
|
);
|
|
351
351
|
const body = {
|
|
352
|
-
schema:
|
|
352
|
+
schema: STAGE_CAPSULE_QUALIFICATION_CONTRACT,
|
|
353
353
|
mode: "shadow-only",
|
|
354
354
|
productionAuthority: "v3",
|
|
355
355
|
platforms: evidence.map(({ platform, reportRoot }) => ({
|
|
@@ -370,23 +370,23 @@ export function qualifyV4StageCapsuleCampaign(
|
|
|
370
370
|
};
|
|
371
371
|
return {
|
|
372
372
|
...body,
|
|
373
|
-
qualificationRoot:
|
|
373
|
+
qualificationRoot: domainContentRoot("stage-capsule-qualification", body),
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
export function
|
|
377
|
+
export function reconcileStageCapsuleWave(request) {
|
|
378
378
|
exactKeys(
|
|
379
379
|
request,
|
|
380
380
|
["schema", "qualificationRoot", "protectedDeliveryDrained", "children"],
|
|
381
381
|
"$",
|
|
382
382
|
);
|
|
383
|
-
if (request.schema !==
|
|
383
|
+
if (request.schema !== STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT)
|
|
384
384
|
fault(
|
|
385
385
|
"unsupported-stage-capsule-wave-reconciliation",
|
|
386
386
|
"$/schema",
|
|
387
387
|
"unsupported reconciliation contract",
|
|
388
388
|
);
|
|
389
|
-
|
|
389
|
+
validateRoot(request.qualificationRoot, "$/qualificationRoot");
|
|
390
390
|
if (request.protectedDeliveryDrained !== true)
|
|
391
391
|
fault(
|
|
392
392
|
"stage-capsule-protected-delivery-not-drained",
|
|
@@ -428,10 +428,10 @@ export function reconcileV4StageCapsuleWave(request) {
|
|
|
428
428
|
"child identity or terminal delivery is incomplete",
|
|
429
429
|
);
|
|
430
430
|
for (const name of ["nativeGateRoot", "reviewRoot", "warrantRoot"])
|
|
431
|
-
|
|
431
|
+
validateRoot(child[name], `$/children/${index}/${name}`);
|
|
432
432
|
}
|
|
433
433
|
const body = {
|
|
434
|
-
schema:
|
|
434
|
+
schema: STAGE_CAPSULE_WAVE_RECONCILIATION_CONTRACT,
|
|
435
435
|
wave: 2,
|
|
436
436
|
qualificationRoot: request.qualificationRoot,
|
|
437
437
|
protectedDeliveryDrained: true,
|
|
@@ -443,14 +443,13 @@ export function reconcileV4StageCapsuleWave(request) {
|
|
|
443
443
|
};
|
|
444
444
|
return {
|
|
445
445
|
...body,
|
|
446
|
-
reconciliationRoot:
|
|
446
|
+
reconciliationRoot: domainContentRoot(
|
|
447
447
|
"stage-capsule-wave-reconciliation",
|
|
448
448
|
body,
|
|
449
449
|
),
|
|
450
450
|
};
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
export const
|
|
454
|
-
|
|
455
|
-
export const
|
|
456
|
-
export const V4_STAGE_CAPSULE_WAVE_CHILDREN = Object.freeze(CHILDREN);
|
|
453
|
+
export const STAGE_CAPSULE_QUALIFICATION_PLATFORMS = Object.freeze(PLATFORMS);
|
|
454
|
+
export const STAGE_CAPSULE_QUALIFICATION_FAULTS = Object.freeze(FAULTS);
|
|
455
|
+
export const STAGE_CAPSULE_WAVE_CHILDREN = Object.freeze(CHILDREN);
|
package/packages/core/{v4-stage-capsule-resume-planner.js → stage-capsule-resume-planner.js}
RENAMED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "./
|
|
2
|
+
ContractFault,
|
|
3
|
+
domainContentRoot,
|
|
4
|
+
validateClock,
|
|
5
|
+
validateRoot,
|
|
6
|
+
} from "./canonical-contracts.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./
|
|
8
|
+
STAGE_CAPSULE_REUSE_CONTRACT,
|
|
9
|
+
evaluateStageCapsuleReuse,
|
|
10
|
+
stageCapsuleAvailabilityRoot,
|
|
11
|
+
validateStageCapsule,
|
|
12
|
+
validateStageCapsuleAvailability,
|
|
13
|
+
validateStageCapsuleIdentity,
|
|
14
|
+
} from "./stage-capsule.js";
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const STAGE_CAPSULE_RESUME_REQUEST_CONTRACT =
|
|
17
17
|
"buildchain-v4-stage-capsule-resume-request/v1";
|
|
18
|
-
export const
|
|
18
|
+
export const STAGE_CAPSULE_RESUME_PLAN_CONTRACT =
|
|
19
19
|
"buildchain-v4-stage-capsule-resume-plan/v1";
|
|
20
20
|
|
|
21
21
|
const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
22
22
|
|
|
23
23
|
function fault(code, path, message) {
|
|
24
|
-
throw new
|
|
24
|
+
throw new ContractFault(code, path, message);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function exactKeys(value, expected, location) {
|
|
@@ -68,16 +68,16 @@ function orderedTokens(values, location) {
|
|
|
68
68
|
function validateRetentionPromise(value, location) {
|
|
69
69
|
exactKeys(value, ["class", "retainUntil"], location);
|
|
70
70
|
token(value.class, `${location}/class`);
|
|
71
|
-
|
|
71
|
+
validateClock(value.retainUntil, `${location}/retainUntil`);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function observationRoot(value) {
|
|
75
|
-
return
|
|
75
|
+
return domainContentRoot("stage-capsule-resume-observation", value);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
function rootOrObservationRoot(value) {
|
|
79
79
|
try {
|
|
80
|
-
|
|
80
|
+
validateRoot(value, "$/resumeObservation");
|
|
81
81
|
return value;
|
|
82
82
|
} catch {
|
|
83
83
|
return observationRoot(value);
|
|
@@ -103,7 +103,7 @@ function validateRequest(request) {
|
|
|
103
103
|
"$",
|
|
104
104
|
);
|
|
105
105
|
if (
|
|
106
|
-
request.schema !==
|
|
106
|
+
request.schema !== STAGE_CAPSULE_RESUME_REQUEST_CONTRACT ||
|
|
107
107
|
!Array.isArray(request.nodes) ||
|
|
108
108
|
request.nodes.length === 0
|
|
109
109
|
)
|
|
@@ -112,7 +112,7 @@ function validateRequest(request) {
|
|
|
112
112
|
"$/schema",
|
|
113
113
|
"unsupported or empty Stage Capsule resume request",
|
|
114
114
|
);
|
|
115
|
-
|
|
115
|
+
validateClock(request.evaluatedAt, "$/evaluatedAt");
|
|
116
116
|
const positions = new Map();
|
|
117
117
|
for (const [index, node] of request.nodes.entries()) {
|
|
118
118
|
const location = `$/nodes/${index}`;
|
|
@@ -147,7 +147,7 @@ function validateRequest(request) {
|
|
|
147
147
|
`${location}/dependencies`,
|
|
148
148
|
"dependencies must name an earlier node in topological order",
|
|
149
149
|
);
|
|
150
|
-
|
|
150
|
+
validateStageCapsuleIdentity(node.expectedIdentity);
|
|
151
151
|
validateRetentionPromise(
|
|
152
152
|
node.expectedRetentionPromise,
|
|
153
153
|
`${location}/expectedRetentionPromise`,
|
|
@@ -158,8 +158,8 @@ function validateRequest(request) {
|
|
|
158
158
|
["capsule", "availability"],
|
|
159
159
|
`${location}/candidate`,
|
|
160
160
|
);
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
validateStageCapsule(node.candidate.capsule);
|
|
162
|
+
validateStageCapsuleAvailability(node.candidate.availability);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
orderedTokens(request.targets, "$/targets");
|
|
@@ -299,11 +299,11 @@ function changedDecision(node, candidate, availabilityRoot) {
|
|
|
299
299
|
function candidateDecision(node, evaluatedAt) {
|
|
300
300
|
if (node.candidate === null) return decision(node, "rebuild", "unavailable");
|
|
301
301
|
const { capsule, availability } = node.candidate;
|
|
302
|
-
const availabilityRoot =
|
|
302
|
+
const availabilityRoot = stageCapsuleAvailabilityRoot(availability);
|
|
303
303
|
const changed = changedDecision(node, node.candidate, availabilityRoot);
|
|
304
304
|
if (changed) return changed;
|
|
305
|
-
const reuse =
|
|
306
|
-
schema:
|
|
305
|
+
const reuse = evaluateStageCapsuleReuse({
|
|
306
|
+
schema: STAGE_CAPSULE_REUSE_CONTRACT,
|
|
307
307
|
capsule,
|
|
308
308
|
availability,
|
|
309
309
|
evaluatedAt,
|
|
@@ -355,7 +355,7 @@ function candidateDecision(node, evaluatedAt) {
|
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
export function
|
|
358
|
+
export function planStageCapsuleResume(request) {
|
|
359
359
|
const positions = validateRequest(request);
|
|
360
360
|
const decisions = request.nodes.map((node) =>
|
|
361
361
|
candidateDecision(node, request.evaluatedAt),
|
|
@@ -381,7 +381,7 @@ export function planV4StageCapsuleResume(request) {
|
|
|
381
381
|
)
|
|
382
382
|
.map(({ key }) => key);
|
|
383
383
|
const payload = {
|
|
384
|
-
schema:
|
|
384
|
+
schema: STAGE_CAPSULE_RESUME_PLAN_CONTRACT,
|
|
385
385
|
mode: "shadow-only",
|
|
386
386
|
productionAuthority: "v3",
|
|
387
387
|
evaluatedAt: request.evaluatedAt,
|
|
@@ -392,6 +392,6 @@ export function planV4StageCapsuleResume(request) {
|
|
|
392
392
|
};
|
|
393
393
|
return {
|
|
394
394
|
...payload,
|
|
395
|
-
planRoot:
|
|
395
|
+
planRoot: domainContentRoot("stage-capsule-resume-plan", payload),
|
|
396
396
|
};
|
|
397
397
|
}
|