@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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainWasmFault, invokeDomainWasm } from "./domain-wasm.js";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
3
|
+
export const CANONICAL_JSON_CONTRACT = "buildchain-canonical-json/v1";
|
|
4
|
+
export const EVENT_ENVELOPE_CONTRACT = "buildchain-v4-event-envelope/v1";
|
|
5
|
+
export const RECEIPT_ENVELOPE_CONTRACT = "buildchain-v4-receipt-envelope/v1";
|
|
6
|
+
export const CONTRACT_FAULT_CONTRACT = "buildchain-v4-contract-fault/v1";
|
|
7
7
|
|
|
8
8
|
const ROOT_PATTERN = /^sha256:[0-9a-f]{64}$/u;
|
|
9
9
|
const CLOCK_PATTERN = /^(?!0000)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u;
|
|
@@ -58,6 +58,7 @@ const ROOT_DOMAINS = new Set([
|
|
|
58
58
|
"partial-mutation-recovery-checkpoint",
|
|
59
59
|
"partial-mutation-recovery-plan",
|
|
60
60
|
"v4-product-required-artifacts",
|
|
61
|
+
"oci-publication-family",
|
|
61
62
|
"v4-product-publication-intent",
|
|
62
63
|
"v4-product-publication-operation",
|
|
63
64
|
"v4-product-publication-plan",
|
|
@@ -86,17 +87,17 @@ const FAULT_CLASSES = new Set([
|
|
|
86
87
|
const RETRY_DECISIONS = new Set(["stop", "reread", "redecide", "reselect"]);
|
|
87
88
|
const RECEIPT_OUTCOMES = new Set(["accepted", "rejected", "noop"]);
|
|
88
89
|
|
|
89
|
-
export class
|
|
90
|
+
export class ContractFault extends Error {
|
|
90
91
|
constructor(code, path, message) {
|
|
91
92
|
super(message);
|
|
92
|
-
this.name = "
|
|
93
|
+
this.name = "ContractFault";
|
|
93
94
|
this.code = code;
|
|
94
95
|
this.path = path;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
function fault(code, path, message) {
|
|
99
|
-
throw new
|
|
100
|
+
throw new ContractFault(code, path, message);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
function exactKeys(value, keys, path) {
|
|
@@ -113,30 +114,30 @@ function exactKeys(value, keys, path) {
|
|
|
113
114
|
|
|
114
115
|
function wasm(operation, payload) {
|
|
115
116
|
try {
|
|
116
|
-
return
|
|
117
|
+
return invokeDomainWasm(operation, payload);
|
|
117
118
|
} catch (error) {
|
|
118
|
-
if (error instanceof
|
|
119
|
+
if (error instanceof DomainWasmFault) {
|
|
119
120
|
fault(error.code, error.path, error.message);
|
|
120
121
|
}
|
|
121
122
|
throw error;
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
export function
|
|
126
|
+
export function domainCanonicalBytes(value) {
|
|
126
127
|
return Buffer.from(wasm("canonical-json", value).canonicalUtf8, "utf8");
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
export function
|
|
130
|
+
export function domainContentRoot(domain, value) {
|
|
130
131
|
return wasm("content-root", { domain, value }).root;
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
export function
|
|
134
|
+
export function validateRoot(value, path = "$.root") {
|
|
134
135
|
if (typeof value !== "string" || !ROOT_PATTERN.test(value))
|
|
135
136
|
fault("invalid-root", path, `${path} must be a lowercase sha256 root`);
|
|
136
137
|
return value;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
export function
|
|
140
|
+
export function validateClock(value, path = "$.clock") {
|
|
140
141
|
if (typeof value !== "string" || !CLOCK_PATTERN.test(value))
|
|
141
142
|
fault(
|
|
142
143
|
"invalid-clock",
|
|
@@ -149,13 +150,13 @@ export function validateV4Clock(value, path = "$.clock") {
|
|
|
149
150
|
return value;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
export function
|
|
153
|
+
export function validateContractFault(value, path = "$.fault") {
|
|
153
154
|
exactKeys(
|
|
154
155
|
value,
|
|
155
156
|
["schema", "code", "class", "path", "message", "retry"],
|
|
156
157
|
path,
|
|
157
158
|
);
|
|
158
|
-
if (value.schema !==
|
|
159
|
+
if (value.schema !== CONTRACT_FAULT_CONTRACT)
|
|
159
160
|
fault("invalid-fault", `${path}/schema`, "unsupported fault schema");
|
|
160
161
|
if (!ASCII_TOKEN_PATTERN.test(value.code))
|
|
161
162
|
fault("invalid-fault", `${path}/code`, "fault code must be an ASCII token");
|
|
@@ -171,28 +172,28 @@ export function validateV4ContractFault(value, path = "$.fault") {
|
|
|
171
172
|
`${path}/retry`,
|
|
172
173
|
"fault retry decision is unsupported",
|
|
173
174
|
);
|
|
174
|
-
|
|
175
|
+
domainCanonicalBytes(value);
|
|
175
176
|
return value;
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
export function
|
|
179
|
+
export function validateEventEnvelope(value) {
|
|
179
180
|
exactKeys(
|
|
180
181
|
value,
|
|
181
182
|
["schema", "eventId", "eventType", "occurredAt", "subjectRoot", "payload"],
|
|
182
183
|
"$",
|
|
183
184
|
);
|
|
184
|
-
if (value.schema !==
|
|
185
|
+
if (value.schema !== EVENT_ENVELOPE_CONTRACT)
|
|
185
186
|
fault("invalid-event", "$/schema", "unsupported event schema");
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
validateRoot(value.eventId, "$/eventId");
|
|
188
|
+
validateRoot(value.subjectRoot, "$/subjectRoot");
|
|
189
|
+
validateClock(value.occurredAt, "$/occurredAt");
|
|
189
190
|
if (!ASCII_TOKEN_PATTERN.test(value.eventType))
|
|
190
191
|
fault("invalid-event", "$/eventType", "event type must be an ASCII token");
|
|
191
|
-
|
|
192
|
+
domainCanonicalBytes(value.payload);
|
|
192
193
|
return value;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
export function
|
|
196
|
+
export function validateReceiptEnvelope(value) {
|
|
196
197
|
exactKeys(
|
|
197
198
|
value,
|
|
198
199
|
[
|
|
@@ -207,7 +208,7 @@ export function validateV4ReceiptEnvelope(value) {
|
|
|
207
208
|
],
|
|
208
209
|
"$",
|
|
209
210
|
);
|
|
210
|
-
if (value.schema !==
|
|
211
|
+
if (value.schema !== RECEIPT_ENVELOPE_CONTRACT)
|
|
211
212
|
fault("invalid-receipt", "$/schema", "unsupported receipt schema");
|
|
212
213
|
if (!ASCII_TOKEN_PATTERN.test(value.receiptType))
|
|
213
214
|
fault(
|
|
@@ -215,15 +216,15 @@ export function validateV4ReceiptEnvelope(value) {
|
|
|
215
216
|
"$/receiptType",
|
|
216
217
|
"receipt type must be an ASCII token",
|
|
217
218
|
);
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
validateClock(value.recordedAt, "$/recordedAt");
|
|
220
|
+
validateRoot(value.eventRoot, "$/eventRoot");
|
|
220
221
|
if (value.priorStateRoot !== null)
|
|
221
|
-
|
|
222
|
+
validateRoot(value.priorStateRoot, "$/priorStateRoot");
|
|
222
223
|
if (value.nextStateRoot !== null)
|
|
223
|
-
|
|
224
|
+
validateRoot(value.nextStateRoot, "$/nextStateRoot");
|
|
224
225
|
if (!RECEIPT_OUTCOMES.has(value.outcome))
|
|
225
226
|
fault("invalid-receipt", "$/outcome", "receipt outcome is unsupported");
|
|
226
|
-
if (value.fault !== null)
|
|
227
|
+
if (value.fault !== null) validateContractFault(value.fault);
|
|
227
228
|
if ((value.outcome === "rejected") !== (value.fault !== null))
|
|
228
229
|
fault(
|
|
229
230
|
"invalid-receipt",
|
|
@@ -233,6 +234,6 @@ export function validateV4ReceiptEnvelope(value) {
|
|
|
233
234
|
return value;
|
|
234
235
|
}
|
|
235
236
|
|
|
236
|
-
export function
|
|
237
|
+
export function contractDomains() {
|
|
237
238
|
return [...ROOT_DOMAINS];
|
|
238
239
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { adopterDeliveryGateDigest } from "./adopter-delivery-json.js";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT =
|
|
4
4
|
"kungfu-buildchain-v4-cross-platform-adopter-report/v1";
|
|
5
|
-
export const
|
|
5
|
+
export const CROSS_PLATFORM_ADOPTER_QUALIFICATION_CONTRACT =
|
|
6
6
|
"kungfu-buildchain-v4-cross-platform-adopter-qualification/v1";
|
|
7
|
-
export const
|
|
7
|
+
export const CROSS_PLATFORM_ADOPTER_PLATFORMS = Object.freeze([
|
|
8
8
|
"linux-x64",
|
|
9
9
|
"macos-arm64",
|
|
10
10
|
"windows-x64",
|
|
11
11
|
]);
|
|
12
|
-
export const
|
|
12
|
+
export const CROSS_PLATFORM_NEUTRAL_DRIVER = "ledger-specification-driver";
|
|
13
13
|
|
|
14
14
|
const SHA = /^[0-9a-f]{40}$/u;
|
|
15
15
|
const ROOT = /^sha256:[0-9a-f]{64}$/u;
|
|
@@ -36,7 +36,7 @@ function same(left, right) {
|
|
|
36
36
|
return adopterDeliveryGateDigest(left) === adopterDeliveryGateDigest(right);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export function
|
|
39
|
+
export function summarizeBaselineCapabilityInventory(inventory) {
|
|
40
40
|
exactKeys(
|
|
41
41
|
inventory,
|
|
42
42
|
[
|
|
@@ -197,7 +197,7 @@ function validateExecutionEvidence(execution) {
|
|
|
197
197
|
execution.retryRun.readbackRoot &&
|
|
198
198
|
execution.bootstrap?.status === "passed" &&
|
|
199
199
|
ROOT.test(execution.bootstrap?.resultRoot || "") &&
|
|
200
|
-
execution.neutralDriver?.id ===
|
|
200
|
+
execution.neutralDriver?.id === CROSS_PLATFORM_NEUTRAL_DRIVER &&
|
|
201
201
|
execution.neutralDriver?.status === "passed" &&
|
|
202
202
|
execution.neutralDriver?.kfdDependencyPresent === false;
|
|
203
203
|
if (!complete)
|
|
@@ -219,7 +219,7 @@ function validateAuthorityCeiling(authority) {
|
|
|
219
219
|
fail("qualification report must not grant production or release authority");
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
export function
|
|
222
|
+
export function validateCrossPlatformAdopterReport(report) {
|
|
223
223
|
exactKeys(
|
|
224
224
|
report,
|
|
225
225
|
[
|
|
@@ -237,10 +237,10 @@ export function validateV4CrossPlatformAdopterReport(report) {
|
|
|
237
237
|
);
|
|
238
238
|
if (
|
|
239
239
|
report.schemaVersion !== 1 ||
|
|
240
|
-
report.contract !==
|
|
240
|
+
report.contract !== CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT
|
|
241
241
|
)
|
|
242
242
|
fail("platform report contract is unsupported");
|
|
243
|
-
if (!
|
|
243
|
+
if (!CROSS_PLATFORM_ADOPTER_PLATFORMS.includes(report.platform))
|
|
244
244
|
fail(`undeclared platform ${report.platform}`);
|
|
245
245
|
if (!CONSUMER.test(report.consumer || ""))
|
|
246
246
|
fail("consumer must be a stable lowercase identity");
|
|
@@ -256,18 +256,18 @@ export function validateV4CrossPlatformAdopterReport(report) {
|
|
|
256
256
|
return structuredClone(report);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
export function
|
|
259
|
+
export function createCrossPlatformAdopterReport(input) {
|
|
260
260
|
const body = structuredClone(input);
|
|
261
261
|
const report = {
|
|
262
262
|
schemaVersion: 1,
|
|
263
|
-
contract:
|
|
263
|
+
contract: CROSS_PLATFORM_ADOPTER_REPORT_CONTRACT,
|
|
264
264
|
...body,
|
|
265
265
|
};
|
|
266
266
|
report.reportRoot = adopterDeliveryGateDigest(report);
|
|
267
|
-
return
|
|
267
|
+
return validateCrossPlatformAdopterReport(report);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
export function
|
|
270
|
+
export function qualifyCrossPlatformAdopters({ reports, consumers }) {
|
|
271
271
|
if (!Array.isArray(reports) || reports.length === 0)
|
|
272
272
|
fail("at least one raw platform report is required");
|
|
273
273
|
if (
|
|
@@ -277,9 +277,9 @@ export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
|
|
|
277
277
|
new Set(consumers).size !== consumers.length
|
|
278
278
|
)
|
|
279
279
|
fail("required consumers must be unique stable lowercase identities");
|
|
280
|
-
const normalized = reports.map(
|
|
280
|
+
const normalized = reports.map(validateCrossPlatformAdopterReport);
|
|
281
281
|
const expectedKeys = consumers.flatMap((consumer) =>
|
|
282
|
-
|
|
282
|
+
CROSS_PLATFORM_ADOPTER_PLATFORMS.map(
|
|
283
283
|
(platform) => `${consumer}:${platform}`,
|
|
284
284
|
),
|
|
285
285
|
);
|
|
@@ -310,14 +310,14 @@ export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
|
|
|
310
310
|
const orderedReports = expectedKeys.map((key) => reportByKey.get(key));
|
|
311
311
|
const body = {
|
|
312
312
|
schemaVersion: 1,
|
|
313
|
-
contract:
|
|
313
|
+
contract: CROSS_PLATFORM_ADOPTER_QUALIFICATION_CONTRACT,
|
|
314
314
|
sourceBinding: {
|
|
315
315
|
runtimeSha: reference.runtimeSha,
|
|
316
316
|
inventoryRoot: reference.inventoryRoot,
|
|
317
317
|
sourceCuts: structuredClone(reference.sourceCuts),
|
|
318
318
|
},
|
|
319
319
|
consumers: [...consumers],
|
|
320
|
-
platforms: [...
|
|
320
|
+
platforms: [...CROSS_PLATFORM_ADOPTER_PLATFORMS],
|
|
321
321
|
capabilityMatrix: structuredClone(normalized[0].capabilityMatrix),
|
|
322
322
|
reports: orderedReports.map(({ consumer, platform, reportRoot }) => ({
|
|
323
323
|
consumer,
|
|
@@ -325,8 +325,8 @@ export function qualifyV4CrossPlatformAdopters({ reports, consumers }) {
|
|
|
325
325
|
reportRoot,
|
|
326
326
|
})),
|
|
327
327
|
neutralDriver: {
|
|
328
|
-
id:
|
|
329
|
-
platformCoverage: [...
|
|
328
|
+
id: CROSS_PLATFORM_NEUTRAL_DRIVER,
|
|
329
|
+
platformCoverage: [...CROSS_PLATFORM_ADOPTER_PLATFORMS],
|
|
330
330
|
status: "passed",
|
|
331
331
|
},
|
|
332
332
|
authority: {
|
package/packages/core/{v4-delivery-warrant-fixture-runner.js → delivery-warrant-fixture-runner.js}
RENAMED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { TextDecoder } from "node:util";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./
|
|
4
|
+
ContractFault,
|
|
5
|
+
domainCanonicalBytes,
|
|
6
|
+
domainContentRoot,
|
|
7
|
+
validateContractFault,
|
|
8
|
+
validateEventEnvelope,
|
|
9
|
+
validateReceiptEnvelope,
|
|
10
|
+
validateRoot,
|
|
11
|
+
} from "./canonical-contracts.js";
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const DELIVERY_WARRANT_TRACE_CONTRACT =
|
|
14
14
|
"buildchain-v4-delivery-warrant-trace-fixture/v1";
|
|
15
|
-
export const
|
|
15
|
+
export const DELIVERY_WARRANT_RUNNER_CONTRACT =
|
|
16
16
|
"buildchain-v4-delivery-warrant-fixture-runner/v1";
|
|
17
|
-
export const
|
|
17
|
+
export const DELIVERY_WARRANT_PROJECTION_CONTRACT =
|
|
18
18
|
"buildchain-v4-delivery-warrant-semantic-projection/v1";
|
|
19
19
|
|
|
20
20
|
const ASCII_TOKEN_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
21
21
|
const UTF8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: false });
|
|
22
22
|
|
|
23
23
|
function fail(code, path, message) {
|
|
24
|
-
throw new
|
|
24
|
+
throw new ContractFault(code, path, message);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function exactKeys(value, keys, path) {
|
|
@@ -53,11 +53,11 @@ function nonNegativeInteger(value, path) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function equalCanonical(left, right) {
|
|
56
|
-
return
|
|
56
|
+
return domainCanonicalBytes(left).equals(domainCanonicalBytes(right));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function declaredRoot(value, expected, path, code) {
|
|
60
|
-
|
|
60
|
+
validateRoot(value, path);
|
|
61
61
|
if (value !== expected)
|
|
62
62
|
fail(code, path, `${path} does not match the retained canonical bytes`);
|
|
63
63
|
return value;
|
|
@@ -113,7 +113,7 @@ function validateOrderedEntries(entries, path) {
|
|
|
113
113
|
`${path} sequence must be contiguous and ordered`,
|
|
114
114
|
);
|
|
115
115
|
token(entry.type, `${path}/${index}/type`);
|
|
116
|
-
|
|
116
|
+
domainCanonicalBytes(entry.payload);
|
|
117
117
|
return entry;
|
|
118
118
|
});
|
|
119
119
|
}
|
|
@@ -141,12 +141,12 @@ function validateState(state, path) {
|
|
|
141
141
|
`${path}/candidates`,
|
|
142
142
|
"state candidates must be an array",
|
|
143
143
|
);
|
|
144
|
-
const canonicalUtf8 =
|
|
144
|
+
const canonicalUtf8 = domainCanonicalBytes(state).toString("utf8");
|
|
145
145
|
return {
|
|
146
146
|
generation,
|
|
147
147
|
fencingCounter,
|
|
148
148
|
canonicalUtf8,
|
|
149
|
-
root:
|
|
149
|
+
root: domainContentRoot("queue-state", state),
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -169,7 +169,7 @@ function validateDecision(decision, receipt, path) {
|
|
|
169
169
|
"an action cannot bind a rejected receipt",
|
|
170
170
|
);
|
|
171
171
|
} else {
|
|
172
|
-
|
|
172
|
+
validateContractFault(decision.fault, `${path}/fault`);
|
|
173
173
|
if (
|
|
174
174
|
receipt.outcome !== "rejected" ||
|
|
175
175
|
receipt.fault === null ||
|
|
@@ -219,14 +219,14 @@ function projectStep(step, index, priorStateRoot) {
|
|
|
219
219
|
"stale-prior-root",
|
|
220
220
|
);
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
validateEventEnvelope(step.event);
|
|
223
223
|
if (step.event.subjectRoot !== priorStateRoot)
|
|
224
224
|
fail(
|
|
225
225
|
"stale-prior-root",
|
|
226
226
|
`${path}/event/subjectRoot`,
|
|
227
227
|
"event subjectRoot must bind the exact prior state",
|
|
228
228
|
);
|
|
229
|
-
const eventRoot =
|
|
229
|
+
const eventRoot = domainContentRoot("observation", step.event);
|
|
230
230
|
|
|
231
231
|
const successor = validateState(
|
|
232
232
|
step.successorState,
|
|
@@ -239,7 +239,7 @@ function projectStep(step, index, priorStateRoot) {
|
|
|
239
239
|
"stale-successor-root",
|
|
240
240
|
);
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
validateReceiptEnvelope(step.receipt);
|
|
243
243
|
if (
|
|
244
244
|
step.receipt.eventRoot !== eventRoot ||
|
|
245
245
|
step.receipt.priorStateRoot !== priorStateRoot ||
|
|
@@ -266,10 +266,12 @@ function projectStep(step, index, priorStateRoot) {
|
|
|
266
266
|
step.observations,
|
|
267
267
|
`${path}/observations`,
|
|
268
268
|
);
|
|
269
|
-
const receiptCanonicalUtf8 =
|
|
269
|
+
const receiptCanonicalUtf8 = domainCanonicalBytes(step.receipt).toString(
|
|
270
|
+
"utf8",
|
|
271
|
+
);
|
|
270
272
|
const receiptRoot = declaredRoot(
|
|
271
273
|
step.receiptRoot,
|
|
272
|
-
|
|
274
|
+
domainContentRoot("transition-receipt", step.receipt),
|
|
273
275
|
`${path}/receiptRoot`,
|
|
274
276
|
"stale-receipt-root",
|
|
275
277
|
);
|
|
@@ -288,13 +290,15 @@ function projectStep(step, index, priorStateRoot) {
|
|
|
288
290
|
effects: effects.map((effect) => ({
|
|
289
291
|
sequence: effect.sequence,
|
|
290
292
|
type: effect.type,
|
|
291
|
-
canonicalUtf8:
|
|
293
|
+
canonicalUtf8: domainCanonicalBytes(effect.payload).toString("utf8"),
|
|
292
294
|
})),
|
|
293
295
|
observations: observations.map((observation) => ({
|
|
294
296
|
sequence: observation.sequence,
|
|
295
297
|
type: observation.type,
|
|
296
|
-
canonicalUtf8:
|
|
297
|
-
|
|
298
|
+
canonicalUtf8: domainCanonicalBytes(observation.payload).toString(
|
|
299
|
+
"utf8",
|
|
300
|
+
),
|
|
301
|
+
root: domainContentRoot("observation", observation.payload),
|
|
298
302
|
})),
|
|
299
303
|
receiptCanonicalUtf8,
|
|
300
304
|
receiptRoot,
|
|
@@ -303,7 +307,7 @@ function projectStep(step, index, priorStateRoot) {
|
|
|
303
307
|
};
|
|
304
308
|
}
|
|
305
309
|
|
|
306
|
-
export function
|
|
310
|
+
export function runDeliveryWarrantTraceFixture(
|
|
307
311
|
bytes,
|
|
308
312
|
{ verifyExpectedRoot = true } = {},
|
|
309
313
|
) {
|
|
@@ -315,8 +319,8 @@ export function runV4DeliveryWarrantTraceFixture(
|
|
|
315
319
|
);
|
|
316
320
|
if (
|
|
317
321
|
fixture.schemaVersion !== 1 ||
|
|
318
|
-
fixture.contract !==
|
|
319
|
-
fixture.runner !==
|
|
322
|
+
fixture.contract !== DELIVERY_WARRANT_TRACE_CONTRACT ||
|
|
323
|
+
fixture.runner !== DELIVERY_WARRANT_RUNNER_CONTRACT
|
|
320
324
|
)
|
|
321
325
|
fail(
|
|
322
326
|
"unsupported-trace-version",
|
|
@@ -354,13 +358,13 @@ export function runV4DeliveryWarrantTraceFixture(
|
|
|
354
358
|
return result.projection;
|
|
355
359
|
});
|
|
356
360
|
const projection = {
|
|
357
|
-
schema:
|
|
361
|
+
schema: DELIVERY_WARRANT_PROJECTION_CONTRACT,
|
|
358
362
|
traceId: fixture.trace.id,
|
|
359
363
|
traceKind: fixture.trace.kind,
|
|
360
364
|
steps,
|
|
361
365
|
};
|
|
362
|
-
const projectionRoot =
|
|
363
|
-
|
|
366
|
+
const projectionRoot = domainContentRoot("semantic-diff", projection);
|
|
367
|
+
validateRoot(fixture.expectedProjectionRoot, "$/expectedProjectionRoot");
|
|
364
368
|
if (verifyExpectedRoot && fixture.expectedProjectionRoot !== projectionRoot)
|
|
365
369
|
fail(
|
|
366
370
|
"stale-projection-root",
|