@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
package/packages/core/{v4-runtime-ref-resume-authority.js → runtime-ref-resume-authority.js}
RENAMED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./
|
|
3
|
+
RUNTIME_PERSISTENCE_SCAN_CONTRACT,
|
|
4
|
+
scanRuntimeSelectorPersistence,
|
|
5
|
+
} from "./runtime-selector-persistence.js";
|
|
6
6
|
|
|
7
|
-
export {
|
|
8
|
-
V4_RUNTIME_PERSISTENCE_SCAN_CONTRACT,
|
|
9
|
-
scanV4RuntimeSelectorPersistence,
|
|
10
|
-
};
|
|
7
|
+
export { RUNTIME_PERSISTENCE_SCAN_CONTRACT, scanRuntimeSelectorPersistence };
|
|
11
8
|
|
|
12
|
-
export const
|
|
9
|
+
export const RUNTIME_AUTHORIZATION_CONTRACT =
|
|
13
10
|
"kungfu-buildchain-v4-runtime-authorization/v1";
|
|
14
|
-
export const
|
|
11
|
+
export const RUNTIME_RESUME_LINEAGE_CONTRACT =
|
|
15
12
|
"kungfu-buildchain-v4-runtime-resume-lineage/v1";
|
|
16
13
|
const EXACT_SHA = /^[0-9a-f]{40}$/u;
|
|
17
14
|
const SHA256_ROOT = /^sha256:[0-9a-f]{64}$/u;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
15
|
+
const OFFICIAL_DOMAIN_REF = /^v4(?:-alpha)?$/u;
|
|
16
|
+
const TRAIN_DOMAIN_REF = /^train\/v4\/v4\.\d+\/[A-Za-z0-9._/-]+$/u;
|
|
17
|
+
const AUTHORITY_DOMAIN_REF = /^authority\/v4\/v4\.\d+\/[A-Za-z0-9._/-]+$/u;
|
|
21
18
|
const TOKEN = /^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u;
|
|
22
19
|
|
|
23
20
|
function stableJson(value) {
|
|
@@ -31,7 +28,7 @@ function stableJson(value) {
|
|
|
31
28
|
return JSON.stringify(value);
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
export function
|
|
31
|
+
export function runtimeResumeDocumentRoot(value) {
|
|
35
32
|
return `sha256:${crypto.createHash("sha256").update(stableJson(value)).digest("hex")}`;
|
|
36
33
|
}
|
|
37
34
|
|
|
@@ -108,21 +105,21 @@ function normalizeRef(value) {
|
|
|
108
105
|
.replace(/^refs\/(?:heads|tags)\//u, "");
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
function
|
|
108
|
+
function approvedRef(value) {
|
|
112
109
|
const ref = normalizeRef(value);
|
|
113
110
|
return (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
OFFICIAL_DOMAIN_REF.test(ref) ||
|
|
112
|
+
TRAIN_DOMAIN_REF.test(ref) ||
|
|
113
|
+
AUTHORITY_DOMAIN_REF.test(ref)
|
|
117
114
|
);
|
|
118
115
|
}
|
|
119
116
|
|
|
120
117
|
function runtimeClass(value) {
|
|
121
118
|
const ref = normalizeRef(value);
|
|
122
119
|
if (EXACT_SHA.test(ref.toLowerCase())) return "exact-sha";
|
|
123
|
-
if (
|
|
124
|
-
if (
|
|
125
|
-
if (
|
|
120
|
+
if (OFFICIAL_DOMAIN_REF.test(ref)) return "floating";
|
|
121
|
+
if (TRAIN_DOMAIN_REF.test(ref)) return "train";
|
|
122
|
+
if (AUTHORITY_DOMAIN_REF.test(ref)) return "authority";
|
|
126
123
|
return "rejected";
|
|
127
124
|
}
|
|
128
125
|
|
|
@@ -139,7 +136,7 @@ function normalizeReadbacks(values, runtimeSha) {
|
|
|
139
136
|
`approvedRefReadbacks[${index}]`,
|
|
140
137
|
);
|
|
141
138
|
const ref = normalizeRef(value.ref);
|
|
142
|
-
if (!
|
|
139
|
+
if (!approvedRef(ref)) {
|
|
143
140
|
throw new Error(
|
|
144
141
|
`approvedRefReadbacks[${index}].ref is not an approved v4 ref`,
|
|
145
142
|
);
|
|
@@ -170,7 +167,7 @@ function normalizeReadbacks(values, runtimeSha) {
|
|
|
170
167
|
return normalized;
|
|
171
168
|
}
|
|
172
169
|
|
|
173
|
-
export function
|
|
170
|
+
export function authorizeRuntimeSelection({
|
|
174
171
|
repository,
|
|
175
172
|
eventName,
|
|
176
173
|
mode = "dispatch",
|
|
@@ -210,7 +207,7 @@ export function authorizeV4RuntimeSelection({
|
|
|
210
207
|
}
|
|
211
208
|
if (
|
|
212
209
|
!persistenceScan ||
|
|
213
|
-
persistenceScan.contract !==
|
|
210
|
+
persistenceScan.contract !== RUNTIME_PERSISTENCE_SCAN_CONTRACT
|
|
214
211
|
) {
|
|
215
212
|
throw new Error("a v4 runtime persistence scan is required");
|
|
216
213
|
}
|
|
@@ -221,7 +218,7 @@ export function authorizeV4RuntimeSelection({
|
|
|
221
218
|
}
|
|
222
219
|
const scanPayload = { ...persistenceScan };
|
|
223
220
|
delete scanPayload.root;
|
|
224
|
-
if (persistenceScan.root !==
|
|
221
|
+
if (persistenceScan.root !== runtimeResumeDocumentRoot(scanPayload)) {
|
|
225
222
|
throw new Error("runtime persistence scan root mismatch");
|
|
226
223
|
}
|
|
227
224
|
const readbacks = normalizeReadbacks(approvedRefReadbacks, runtimeSha);
|
|
@@ -238,7 +235,7 @@ export function authorizeV4RuntimeSelection({
|
|
|
238
235
|
throw new Error("authorizedAt must be an ISO-8601 timestamp");
|
|
239
236
|
const receipt = {
|
|
240
237
|
schemaVersion: 1,
|
|
241
|
-
contract:
|
|
238
|
+
contract: RUNTIME_AUTHORIZATION_CONTRACT,
|
|
242
239
|
status: "authorized",
|
|
243
240
|
mode,
|
|
244
241
|
eventName,
|
|
@@ -265,10 +262,10 @@ export function authorizeV4RuntimeSelection({
|
|
|
265
262
|
),
|
|
266
263
|
persistenceScanRoot: root(persistenceScan.root, "persistenceScan.root"),
|
|
267
264
|
};
|
|
268
|
-
return { receipt, receiptRoot:
|
|
265
|
+
return { receipt, receiptRoot: runtimeResumeDocumentRoot(receipt) };
|
|
269
266
|
}
|
|
270
267
|
|
|
271
|
-
export function
|
|
268
|
+
export function verifyRuntimeAuthorizationReceipt({
|
|
272
269
|
receipt,
|
|
273
270
|
receiptRoot,
|
|
274
271
|
repository = "",
|
|
@@ -281,13 +278,13 @@ export function verifyV4RuntimeAuthorizationReceipt({
|
|
|
281
278
|
if (!condition) failures.push(code);
|
|
282
279
|
};
|
|
283
280
|
check(
|
|
284
|
-
receipt?.contract ===
|
|
281
|
+
receipt?.contract === RUNTIME_AUTHORIZATION_CONTRACT,
|
|
285
282
|
"contract-invalid",
|
|
286
283
|
);
|
|
287
284
|
check(receipt?.status === "authorized", "status-not-authorized");
|
|
288
285
|
check(
|
|
289
286
|
SHA256_ROOT.test(String(receiptRoot || "")) &&
|
|
290
|
-
receiptRoot ===
|
|
287
|
+
receiptRoot === runtimeResumeDocumentRoot(receipt),
|
|
291
288
|
"receipt-root-mismatch",
|
|
292
289
|
);
|
|
293
290
|
check(receipt?.eventName === "workflow_dispatch", "event-not-trusted");
|
|
@@ -302,8 +299,7 @@ export function verifyV4RuntimeAuthorizationReceipt({
|
|
|
302
299
|
check(
|
|
303
300
|
Array.isArray(receipt?.runtime?.reachableFrom) &&
|
|
304
301
|
receipt.runtime.reachableFrom.some(
|
|
305
|
-
(entry) =>
|
|
306
|
-
approvedV4Ref(entry.ref) && entry.containsRuntimeSha === true,
|
|
302
|
+
(entry) => approvedRef(entry.ref) && entry.containsRuntimeSha === true,
|
|
307
303
|
),
|
|
308
304
|
"runtime-unreachable",
|
|
309
305
|
);
|
|
@@ -322,7 +318,7 @@ export function verifyV4RuntimeAuthorizationReceipt({
|
|
|
322
318
|
return { ok: failures.length === 0, failures };
|
|
323
319
|
}
|
|
324
320
|
|
|
325
|
-
export function
|
|
321
|
+
export function createRuntimeResumeLineage({
|
|
326
322
|
authorization,
|
|
327
323
|
authorizationRoot,
|
|
328
324
|
buildAttempt,
|
|
@@ -336,7 +332,7 @@ export function createV4RuntimeResumeLineage({
|
|
|
336
332
|
floatingRefBefore,
|
|
337
333
|
floatingRefAfter,
|
|
338
334
|
} = {}) {
|
|
339
|
-
const verification =
|
|
335
|
+
const verification = verifyRuntimeAuthorizationReceipt({
|
|
340
336
|
receipt: authorization,
|
|
341
337
|
receiptRoot: authorizationRoot,
|
|
342
338
|
sourceSha: source?.sha,
|
|
@@ -437,7 +433,7 @@ export function createV4RuntimeResumeLineage({
|
|
|
437
433
|
ref: normalizeRef(floatingRefAfter?.ref),
|
|
438
434
|
sha: exactSha(floatingRefAfter?.sha, "floatingRefAfter.sha"),
|
|
439
435
|
};
|
|
440
|
-
if (!
|
|
436
|
+
if (!OFFICIAL_DOMAIN_REF.test(before.ref) || before.ref !== after.ref) {
|
|
441
437
|
throw new Error(
|
|
442
438
|
"floating ref movement must remain on one official v4 channel",
|
|
443
439
|
);
|
|
@@ -455,7 +451,7 @@ export function createV4RuntimeResumeLineage({
|
|
|
455
451
|
);
|
|
456
452
|
const lineage = {
|
|
457
453
|
schemaVersion: 1,
|
|
458
|
-
contract:
|
|
454
|
+
contract: RUNTIME_RESUME_LINEAGE_CONTRACT,
|
|
459
455
|
status: "qualified",
|
|
460
456
|
authorizationRoot: root(authorizationRoot, "authorizationRoot"),
|
|
461
457
|
source: sourceIdentity,
|
|
@@ -480,7 +476,7 @@ export function createV4RuntimeResumeLineage({
|
|
|
480
476
|
"finalPublicReadbackRoot",
|
|
481
477
|
),
|
|
482
478
|
};
|
|
483
|
-
return { lineage, lineageRoot:
|
|
479
|
+
return { lineage, lineageRoot: runtimeResumeDocumentRoot(lineage) };
|
|
484
480
|
}
|
|
485
481
|
|
|
486
482
|
function validSourceIdentity(source) {
|
|
@@ -500,7 +496,7 @@ function validRuntimeTransition(attempts) {
|
|
|
500
496
|
|
|
501
497
|
function validFloatingRefMovement(movement) {
|
|
502
498
|
return (
|
|
503
|
-
|
|
499
|
+
OFFICIAL_DOMAIN_REF.test(String(movement?.before?.ref || "")) &&
|
|
504
500
|
movement.before.ref === movement?.after?.ref &&
|
|
505
501
|
EXACT_SHA.test(String(movement.before.sha || "")) &&
|
|
506
502
|
EXACT_SHA.test(String(movement.after.sha || "")) &&
|
|
@@ -548,7 +544,7 @@ function platformLineageFailures(stageCapsules) {
|
|
|
548
544
|
return failures;
|
|
549
545
|
}
|
|
550
546
|
|
|
551
|
-
export function
|
|
547
|
+
export function verifyRuntimeResumeLineage({
|
|
552
548
|
lineage,
|
|
553
549
|
lineageRoot,
|
|
554
550
|
repository = "",
|
|
@@ -562,13 +558,13 @@ export function verifyV4RuntimeResumeLineage({
|
|
|
562
558
|
if (!condition) failures.push(code);
|
|
563
559
|
};
|
|
564
560
|
check(
|
|
565
|
-
lineage?.contract ===
|
|
561
|
+
lineage?.contract === RUNTIME_RESUME_LINEAGE_CONTRACT,
|
|
566
562
|
"contract-invalid",
|
|
567
563
|
);
|
|
568
564
|
check(lineage?.status === "qualified", "status-not-qualified");
|
|
569
565
|
check(
|
|
570
566
|
SHA256_ROOT.test(String(lineageRoot || "")) &&
|
|
571
|
-
lineageRoot ===
|
|
567
|
+
lineageRoot === runtimeResumeDocumentRoot(lineage),
|
|
572
568
|
"lineage-root-mismatch",
|
|
573
569
|
);
|
|
574
570
|
check(
|
package/packages/core/{v4-runtime-selector-persistence.js → runtime-selector-persistence.js}
RENAMED
|
@@ -2,12 +2,12 @@ import crypto from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const RUNTIME_PERSISTENCE_SCAN_CONTRACT =
|
|
6
6
|
"kungfu-buildchain-v4-runtime-persistence-scan/v1";
|
|
7
7
|
|
|
8
8
|
const EXACT_SHA = /^[0-9a-f]{40}$/u;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const TRAIN_DOMAIN_REF = /^train\/v4\/v4\.\d+\/[A-Za-z0-9._/-]+$/u;
|
|
10
|
+
const AUTHORITY_DOMAIN_REF = /^authority\/v4\/v4\.\d+\/[A-Za-z0-9._/-]+$/u;
|
|
11
11
|
const RUNTIME_SELECTOR =
|
|
12
12
|
/(?:buildchain[-_. ]?(?:ref|runtime)|runtime[-_. ]?sha|resume[-_. ]?buildchain)/iu;
|
|
13
13
|
const EXACT_SHA_LITERAL = /\b[0-9a-f]{40}\b/giu;
|
|
@@ -44,8 +44,8 @@ function transientSelector(value) {
|
|
|
44
44
|
const normalized = normalizeRef(value);
|
|
45
45
|
return (
|
|
46
46
|
EXACT_SHA.test(normalized.toLowerCase()) ||
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
TRAIN_DOMAIN_REF.test(normalized) ||
|
|
48
|
+
AUTHORITY_DOMAIN_REF.test(normalized) ||
|
|
49
49
|
/\$\{\{\s*(?:vars|secrets|env)\./u.test(value)
|
|
50
50
|
);
|
|
51
51
|
}
|
|
@@ -178,7 +178,7 @@ function inspectSource({
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
export function
|
|
181
|
+
export function scanRuntimeSelectorPersistence({
|
|
182
182
|
root: callerRoot = process.cwd(),
|
|
183
183
|
paths = undefined,
|
|
184
184
|
} = {}) {
|
|
@@ -214,7 +214,7 @@ export function scanV4RuntimeSelectorPersistence({
|
|
|
214
214
|
}
|
|
215
215
|
const payload = {
|
|
216
216
|
schemaVersion: 1,
|
|
217
|
-
contract:
|
|
217
|
+
contract: RUNTIME_PERSISTENCE_SCAN_CONTRACT,
|
|
218
218
|
status: failures.length === 0 ? "passed" : "rejected",
|
|
219
219
|
files,
|
|
220
220
|
authorityUsage: authorityUsage.sort((left, right) =>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ContractFault } from "./canonical-contracts.js";
|
|
2
|
+
import { DomainWasmFault, invokeDomainWasm } from "./domain-wasm.js";
|
|
3
|
+
|
|
4
|
+
export const STABLE_PUBLICATION_REQUEST_CONTRACT =
|
|
5
|
+
"buildchain-v4-stable-publication-request/v1";
|
|
6
|
+
export const STABLE_PUBLICATION_PLAN_CONTRACT =
|
|
7
|
+
"buildchain-v4-stable-publication-plan/v1";
|
|
8
|
+
export const STABLE_PUBLICATION_FENCE_CONTRACT =
|
|
9
|
+
"buildchain-v4-stable-publication-fence/v1";
|
|
10
|
+
|
|
11
|
+
function project(request) {
|
|
12
|
+
try {
|
|
13
|
+
return invokeDomainWasm("stable-publication", request);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
if (error instanceof DomainWasmFault) {
|
|
16
|
+
throw new ContractFault(error.code, error.path, error.message);
|
|
17
|
+
}
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function planStablePublication(request) {
|
|
23
|
+
return project(request).plan;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function projectStablePublication(request) {
|
|
27
|
+
return project(request);
|
|
28
|
+
}
|
|
@@ -2,30 +2,30 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./
|
|
5
|
+
ContractFault,
|
|
6
|
+
domainCanonicalBytes,
|
|
7
|
+
domainContentRoot,
|
|
8
|
+
validateClock,
|
|
9
|
+
validateRoot,
|
|
10
|
+
} from "./canonical-contracts.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "./
|
|
12
|
+
STAGE_CAPSULE_AVAILABILITY_CONTRACT,
|
|
13
|
+
stageCapsuleAvailabilityRoot,
|
|
14
|
+
validateStageCapsule,
|
|
15
|
+
validateStageCapsuleAvailability,
|
|
16
|
+
} from "./stage-capsule.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "./
|
|
18
|
+
createStageCapsuleRetentionState,
|
|
19
|
+
createStageCapsuleStoreReceipt,
|
|
20
|
+
createStageCapsuleTransport,
|
|
21
|
+
stageCapsuleBlobRoot,
|
|
22
|
+
validateStageCapsuleOutputManifest,
|
|
23
|
+
} from "./stage-capsule-store.js";
|
|
24
24
|
|
|
25
25
|
const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
26
26
|
|
|
27
27
|
function fault(code, pathValue, message) {
|
|
28
|
-
throw new
|
|
28
|
+
throw new ContractFault(code, pathValue, message);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function exactKeys(value, keys, pathValue) {
|
|
@@ -55,7 +55,7 @@ function token(value, pathValue) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function rootedPath(rootDirectory, family, root, suffix = "") {
|
|
58
|
-
|
|
58
|
+
validateRoot(root);
|
|
59
59
|
return path.join(
|
|
60
60
|
rootDirectory,
|
|
61
61
|
family,
|
|
@@ -99,7 +99,7 @@ function readCanonicalJson(file, missingCode) {
|
|
|
99
99
|
} catch {
|
|
100
100
|
fault("stage-capsule-corrupt", "$/store", "stored JSON is invalid");
|
|
101
101
|
}
|
|
102
|
-
if (!
|
|
102
|
+
if (!domainCanonicalBytes(value).equals(bytes))
|
|
103
103
|
fault("stage-capsule-corrupt", "$/store", "stored JSON is not canonical");
|
|
104
104
|
return value;
|
|
105
105
|
}
|
|
@@ -126,7 +126,7 @@ function normalizeBlobs(manifest, blobs) {
|
|
|
126
126
|
if (
|
|
127
127
|
!bytes ||
|
|
128
128
|
bytes.length !== entry.size ||
|
|
129
|
-
|
|
129
|
+
stageCapsuleBlobRoot(bytes) !== entry.root
|
|
130
130
|
)
|
|
131
131
|
fault(
|
|
132
132
|
"stage-capsule-root-mismatch",
|
|
@@ -151,7 +151,7 @@ function statusForFault(code) {
|
|
|
151
151
|
: "corrupt";
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export class
|
|
154
|
+
export class StageCapsuleLocalStore {
|
|
155
155
|
constructor(rootDirectory, { locatorRoot } = {}) {
|
|
156
156
|
if (typeof rootDirectory !== "string" || rootDirectory.length === 0)
|
|
157
157
|
fault(
|
|
@@ -162,15 +162,15 @@ export class V4StageCapsuleLocalStore {
|
|
|
162
162
|
this.rootDirectory = path.resolve(rootDirectory);
|
|
163
163
|
this.locatorRoot =
|
|
164
164
|
locatorRoot ??
|
|
165
|
-
|
|
165
|
+
domainContentRoot("stage-capsule-transport", {
|
|
166
166
|
provider: "local-filesystem",
|
|
167
167
|
mode: "local-reference",
|
|
168
168
|
});
|
|
169
|
-
|
|
169
|
+
validateRoot(this.locatorRoot, "$/locatorRoot");
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
transport(observedAt) {
|
|
173
|
-
return
|
|
173
|
+
return createStageCapsuleTransport({
|
|
174
174
|
provider: "local-filesystem",
|
|
175
175
|
mode: "local-reference",
|
|
176
176
|
locatorRoot: this.locatorRoot,
|
|
@@ -195,9 +195,9 @@ export class V4StageCapsuleLocalStore {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
put({ capsule, manifest, blobs, recordedAt }) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
validateStageCapsule(capsule);
|
|
199
|
+
validateStageCapsuleOutputManifest(manifest);
|
|
200
|
+
validateClock(recordedAt, "$/recordedAt");
|
|
201
201
|
if (manifest.manifestRoot !== capsule.identity.outputManifestRoot)
|
|
202
202
|
fault(
|
|
203
203
|
"stage-capsule-root-mismatch",
|
|
@@ -205,7 +205,7 @@ export class V4StageCapsuleLocalStore {
|
|
|
205
205
|
"capsule does not bind the stored manifest",
|
|
206
206
|
);
|
|
207
207
|
const content = normalizeBlobs(manifest, blobs);
|
|
208
|
-
const retention =
|
|
208
|
+
const retention = createStageCapsuleRetentionState({
|
|
209
209
|
capsule,
|
|
210
210
|
evaluatedAt: recordedAt,
|
|
211
211
|
});
|
|
@@ -219,19 +219,21 @@ export class V4StageCapsuleLocalStore {
|
|
|
219
219
|
entry.bytes,
|
|
220
220
|
) || wrote;
|
|
221
221
|
const files = this.paths(capsule.capsuleRoot, manifest.manifestRoot);
|
|
222
|
-
wrote =
|
|
223
|
-
|
|
222
|
+
wrote =
|
|
223
|
+
immutableWrite(files.manifest, domainCanonicalBytes(manifest)) || wrote;
|
|
224
|
+
wrote =
|
|
225
|
+
immutableWrite(files.capsule, domainCanonicalBytes(capsule)) || wrote;
|
|
224
226
|
const record = {
|
|
225
227
|
schema: "buildchain-v4-stage-capsule-store-record/v1",
|
|
226
228
|
capsuleRoot: capsule.capsuleRoot,
|
|
227
229
|
manifestRoot: manifest.manifestRoot,
|
|
228
230
|
};
|
|
229
|
-
wrote = immutableWrite(files.record,
|
|
231
|
+
wrote = immutableWrite(files.record, domainCanonicalBytes(record)) || wrote;
|
|
230
232
|
const located = this.locate({
|
|
231
233
|
capsuleRoot: capsule.capsuleRoot,
|
|
232
234
|
recordedAt,
|
|
233
235
|
});
|
|
234
|
-
return
|
|
236
|
+
return createStageCapsuleStoreReceipt({
|
|
235
237
|
...located.receipt,
|
|
236
238
|
operation: "put",
|
|
237
239
|
outcome: wrote ? "stored" : "already-stored",
|
|
@@ -240,8 +242,8 @@ export class V4StageCapsuleLocalStore {
|
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
verifyStored(capsuleRoot, evaluatedAt, { skipQuarantine = false } = {}) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
validateRoot(capsuleRoot, "$/capsuleRoot");
|
|
246
|
+
validateClock(evaluatedAt, "$/evaluatedAt");
|
|
245
247
|
const base = this.paths(capsuleRoot);
|
|
246
248
|
if (!skipQuarantine && fs.existsSync(base.quarantine))
|
|
247
249
|
fault("stage-capsule-quarantined", "$/store", "capsule is quarantined");
|
|
@@ -252,10 +254,10 @@ export class V4StageCapsuleLocalStore {
|
|
|
252
254
|
record.capsuleRoot !== capsuleRoot
|
|
253
255
|
)
|
|
254
256
|
fault("stage-capsule-root-mismatch", "$/record", "record root mismatch");
|
|
255
|
-
|
|
257
|
+
validateRoot(record.manifestRoot, "$/record/manifestRoot");
|
|
256
258
|
const files = this.paths(capsuleRoot, record.manifestRoot);
|
|
257
259
|
const capsule = readCanonicalJson(files.capsule, "stage-capsule-partial");
|
|
258
|
-
|
|
260
|
+
validateStageCapsule(capsule);
|
|
259
261
|
if (capsule.capsuleRoot !== capsuleRoot)
|
|
260
262
|
fault(
|
|
261
263
|
"stage-capsule-root-mismatch",
|
|
@@ -263,7 +265,7 @@ export class V4StageCapsuleLocalStore {
|
|
|
263
265
|
"stored capsule root mismatch",
|
|
264
266
|
);
|
|
265
267
|
const manifest = readCanonicalJson(files.manifest, "stage-capsule-partial");
|
|
266
|
-
|
|
268
|
+
validateStageCapsuleOutputManifest(manifest);
|
|
267
269
|
if (
|
|
268
270
|
manifest.manifestRoot !== record.manifestRoot ||
|
|
269
271
|
manifest.manifestRoot !== capsule.identity.outputManifestRoot
|
|
@@ -273,7 +275,7 @@ export class V4StageCapsuleLocalStore {
|
|
|
273
275
|
"$/manifest/manifestRoot",
|
|
274
276
|
"stored manifest root mismatch",
|
|
275
277
|
);
|
|
276
|
-
const retention =
|
|
278
|
+
const retention = createStageCapsuleRetentionState({
|
|
277
279
|
capsule,
|
|
278
280
|
evaluatedAt,
|
|
279
281
|
});
|
|
@@ -286,7 +288,7 @@ export class V4StageCapsuleLocalStore {
|
|
|
286
288
|
);
|
|
287
289
|
if (
|
|
288
290
|
bytes.length !== entry.size ||
|
|
289
|
-
|
|
291
|
+
stageCapsuleBlobRoot(bytes) !== entry.root
|
|
290
292
|
)
|
|
291
293
|
fault(
|
|
292
294
|
"stage-capsule-corrupt",
|
|
@@ -305,8 +307,8 @@ export class V4StageCapsuleLocalStore {
|
|
|
305
307
|
return {
|
|
306
308
|
stored,
|
|
307
309
|
transport,
|
|
308
|
-
availability:
|
|
309
|
-
schema:
|
|
310
|
+
availability: validateStageCapsuleAvailability({
|
|
311
|
+
schema: STAGE_CAPSULE_AVAILABILITY_CONTRACT,
|
|
310
312
|
capsuleRoot,
|
|
311
313
|
observedAt,
|
|
312
314
|
status: "available",
|
|
@@ -319,12 +321,12 @@ export class V4StageCapsuleLocalStore {
|
|
|
319
321
|
}),
|
|
320
322
|
};
|
|
321
323
|
} catch (error) {
|
|
322
|
-
if (!(error instanceof
|
|
324
|
+
if (!(error instanceof ContractFault)) throw error;
|
|
323
325
|
return {
|
|
324
326
|
stored: null,
|
|
325
327
|
transport,
|
|
326
|
-
availability:
|
|
327
|
-
schema:
|
|
328
|
+
availability: validateStageCapsuleAvailability({
|
|
329
|
+
schema: STAGE_CAPSULE_AVAILABILITY_CONTRACT,
|
|
328
330
|
capsuleRoot,
|
|
329
331
|
observedAt,
|
|
330
332
|
status: statusForFault(error.code),
|
|
@@ -350,13 +352,13 @@ export class V4StageCapsuleLocalStore {
|
|
|
350
352
|
const { stored, transport, availability } = observation;
|
|
351
353
|
return {
|
|
352
354
|
...observation,
|
|
353
|
-
receipt:
|
|
355
|
+
receipt: createStageCapsuleStoreReceipt({
|
|
354
356
|
operation: "locate",
|
|
355
357
|
recordedAt,
|
|
356
358
|
capsuleRoot,
|
|
357
359
|
manifestRoot: stored.manifest.manifestRoot,
|
|
358
360
|
retentionStateRoot: stored.retention.stateRoot,
|
|
359
|
-
availabilityRoot:
|
|
361
|
+
availabilityRoot: stageCapsuleAvailabilityRoot(availability),
|
|
360
362
|
transportRoot: transport.transportRoot,
|
|
361
363
|
qualificationRoot: stored.capsule.identity.qualificationRoot,
|
|
362
364
|
outcome: "located",
|
|
@@ -372,7 +374,7 @@ export class V4StageCapsuleLocalStore {
|
|
|
372
374
|
manifest: located.stored.manifest,
|
|
373
375
|
blobs: located.stored.blobs,
|
|
374
376
|
availability: located.availability,
|
|
375
|
-
receipt:
|
|
377
|
+
receipt: createStageCapsuleStoreReceipt({
|
|
376
378
|
...located.receipt,
|
|
377
379
|
operation: "restore",
|
|
378
380
|
outcome: "restored",
|
|
@@ -394,14 +396,14 @@ export class V4StageCapsuleLocalStore {
|
|
|
394
396
|
};
|
|
395
397
|
immutableWrite(
|
|
396
398
|
this.paths(capsuleRoot).quarantine,
|
|
397
|
-
|
|
399
|
+
domainCanonicalBytes({
|
|
398
400
|
...markerBody,
|
|
399
|
-
markerRoot:
|
|
401
|
+
markerRoot: domainContentRoot("stage-capsule-quarantine", markerBody),
|
|
400
402
|
}),
|
|
401
403
|
);
|
|
402
404
|
const transport = this.transport(recordedAt);
|
|
403
|
-
const availability =
|
|
404
|
-
schema:
|
|
405
|
+
const availability = validateStageCapsuleAvailability({
|
|
406
|
+
schema: STAGE_CAPSULE_AVAILABILITY_CONTRACT,
|
|
405
407
|
capsuleRoot,
|
|
406
408
|
observedAt: recordedAt,
|
|
407
409
|
status: "quarantined",
|
|
@@ -410,13 +412,13 @@ export class V4StageCapsuleLocalStore {
|
|
|
410
412
|
transports: [{ name: "local-reference", root: transport.transportRoot }],
|
|
411
413
|
faultCode: "stage-capsule-quarantined",
|
|
412
414
|
});
|
|
413
|
-
return
|
|
415
|
+
return createStageCapsuleStoreReceipt({
|
|
414
416
|
operation: "quarantine",
|
|
415
417
|
recordedAt,
|
|
416
418
|
capsuleRoot,
|
|
417
419
|
manifestRoot: stored.manifest.manifestRoot,
|
|
418
420
|
retentionStateRoot: stored.retention.stateRoot,
|
|
419
|
-
availabilityRoot:
|
|
421
|
+
availabilityRoot: stageCapsuleAvailabilityRoot(availability),
|
|
420
422
|
transportRoot: transport.transportRoot,
|
|
421
423
|
qualificationRoot: stored.capsule.identity.qualificationRoot,
|
|
422
424
|
outcome: "quarantined",
|