@kungfu-tech/buildchain 4.0.2-alpha.9 → 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.
Files changed (281) hide show
  1. package/AGENTS.md +14 -5
  2. package/CONTRIBUTING.md +58 -0
  3. package/README.md +3 -3
  4. package/actions/promote-buildchain-ref/README.md +1 -1
  5. package/actions/release-candidate-promote/README.md +31 -0
  6. package/architecture/agent-change-map.md +190 -126
  7. package/architecture/{v4-architecture-constitution.md → architecture-constitution.md} +33 -30
  8. package/architecture/{v3-core-mechanism-inventory.md → baseline-core-mechanism-inventory.md} +1 -1
  9. package/architecture/{v4-bootstrap-authority.json → bootstrap-authority.json} +3 -3
  10. package/architecture/{v3-v4-capability-closure.md → capability-parity-closure.md} +3 -3
  11. package/architecture/{v3-v4-live-capability-inventory.json → capability-parity-live-capability-inventory.json} +4 -4
  12. package/architecture/{v4-capability-state-machine-manifest.json → capability-state-machine-manifest.json} +2 -2
  13. package/architecture/{v4-capability-state-machine-manifest.schema.json → capability-state-machine-manifest.schema.json} +2 -2
  14. package/architecture/ci-lane-change-budget.json +384 -0
  15. package/architecture/{v4-cross-platform-adopter-qualification.json → cross-platform-adopter-qualification.json} +4 -4
  16. package/architecture/{v4-delivery-authority-parity.json → delivery-authority-parity.json} +17 -17
  17. package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.json → delivery-warrant-shadow-bootstrap-plan.json} +4 -4
  18. package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.md → delivery-warrant-shadow-bootstrap-plan.md} +7 -7
  19. package/architecture/{v4-floating-consumer-policy.json → floating-consumer-policy.json} +2 -2
  20. package/architecture/{v4-floating-consumer-policy.md → floating-consumer-policy.md} +1 -1
  21. package/architecture/implementation-naming.json +1273 -0
  22. package/architecture/internal-capabilities.json +201 -154
  23. package/architecture/maintainability-debt.json +205 -146
  24. package/architecture/maintainability-policy.json +37 -33
  25. package/architecture/{v4-next-development-parity.json → next-development-parity.json} +12 -12
  26. package/architecture/{v4-partial-mutation-recovery-qualification.json → partial-mutation-recovery-qualification.json} +8 -5
  27. package/architecture/{v4-platform-stage-checkpoints.json → platform-stage-checkpoints.json} +3 -3
  28. package/architecture/{v4-provider-operation-journal-contract.json → provider-operation-journal-contract.json} +10 -7
  29. package/architecture/publication-facade-patches.json +64 -0
  30. package/architecture/{v4-publication-rehearsal-parity.json → publication-rehearsal-parity.json} +4 -4
  31. package/architecture/{v4-release-activation-shadow-domain.json → release-activation-shadow-domain.json} +9 -6
  32. package/architecture/release-tail-contract-inventory.json +6 -6
  33. package/architecture/{v4-release-topology.json → release-topology.json} +163 -72
  34. package/architecture/{v4-release-train-parity.json → release-train-parity.json} +2 -2
  35. package/architecture/{v4-runtime-ref-resume-authority.json → runtime-ref-resume-authority.json} +1 -1
  36. package/architecture/{v4-runtime-semantic-closure.json → runtime-semantic-closure.json} +2 -2
  37. package/architecture/{v4-rust-libnode-bridge-evaluation.json → rust-libnode-bridge-evaluation.json} +3 -3
  38. package/architecture/{v4-rust-libnode-bridge-spike.md → rust-libnode-bridge-spike.md} +6 -6
  39. package/architecture/rust-wasm-production-authority.json +58 -0
  40. package/architecture/{v4-stable-publication-fence.json → stable-publication-fence.json} +7 -4
  41. package/architecture/{v4-stage-capsule-contract.json → stage-capsule-contract.json} +1 -1
  42. package/architecture/{v4-stage-capsule-qualification.json → stage-capsule-qualification.json} +8 -8
  43. package/architecture/{v4-stage-capsule-resume-planner.json → stage-capsule-resume-planner.json} +2 -2
  44. package/architecture/{v4-stage-capsule-store-contract.json → stage-capsule-store-contract.json} +4 -4
  45. package/architecture/{v4-tail-reseal-parity.json → tail-reseal-parity.json} +35 -33
  46. package/architecture/universal-workflow-bootstrap.json +176 -0
  47. package/architecture/universal-workflow-fault-campaign.json +72 -0
  48. package/architecture/universal-workflow-train-admission.json +40 -0
  49. package/architecture/workflow-taxonomy.json +1462 -0
  50. package/bin/buildchain.mjs +10 -10
  51. package/bin/internal/adopter-delivery-cli.mjs +9 -9
  52. package/contracts/buildchain-v2-residuals-v1.json +57 -48
  53. package/contracts/dev-delivery-authority-v2.schema.json +16 -2
  54. package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
  55. package/contracts/v4-canonical-contracts-v1.schema.json +1 -0
  56. package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/Cargo.lock +1 -1
  57. package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/Cargo.toml +1 -1
  58. package/crates/{buildchain-v4-bridge → buildchain-host-bridge}/src/main.rs +3 -3
  59. package/dist/site/buildchain-contract.json +98 -53
  60. package/dist/site/buildchain-site.json +351 -102
  61. package/dist/site/capability-registry.json +7 -7
  62. package/dist/site/controller-registry.json +50 -13
  63. package/dist/site/kfd-claims.json +2773 -1052
  64. package/dist/site/kfd-upstream-aggregate.json +1 -1
  65. package/dist/site/manual-registry.json +14 -14
  66. package/dist/site/node-api-registry.json +13176 -10733
  67. package/dist/site/page-registry.json +332 -83
  68. package/dist/site/public-surface-audit.json +3227 -1222
  69. package/dist/site/publication-authority-registry.json +1135 -363
  70. package/dist/site/publication-registry.json +4 -4
  71. package/dist/site/release-provenance.json +18 -9
  72. package/dist/site/schemas/dev-delivery-authority-v2.schema.json +16 -2
  73. package/dist/site/site-manifest.json +18 -18
  74. package/dist/site/workflow-registry.json +5367 -1931
  75. package/docs/MAP.md +5 -3
  76. package/docs/auditable-demo.md +1 -1
  77. package/docs/cli.md +21 -8
  78. package/docs/dev-delivery-warrant.md +1 -1
  79. package/docs/engineering-housekeeper.md +3 -3
  80. package/docs/kfd-support.md +26 -2
  81. package/docs/next-development-transition.md +26 -3
  82. package/docs/node-api-reference.md +618 -358
  83. package/docs/oci-publication.md +173 -0
  84. package/docs/publication-authority.md +2 -2
  85. package/docs/publish-transaction.md +36 -3
  86. package/docs/release-candidate.md +3 -3
  87. package/docs/release-flow.md +67 -19
  88. package/docs/release-governance.md +8 -8
  89. package/docs/release-passport.md +27 -2
  90. package/docs/reusable-build-surface.md +17 -1
  91. package/docs/v4-adopter-delivery.md +4 -4
  92. package/docs/v4-canonical-contracts.md +7 -7
  93. package/docs/v4-delivery-warrant-read-candidate.md +3 -3
  94. package/docs/v4-delivery-warrant-semantic-diff.md +3 -3
  95. package/docs/v4-production-release.md +77 -8
  96. package/docs/v4-publication-rehearsal.md +3 -3
  97. package/docs/v4-runtime-ref-resume-authority.md +2 -2
  98. package/docs/v4-rust-wasm-production-authority.md +58 -0
  99. package/docs/v4-stage-capsule.md +9 -9
  100. package/docs/v4-tail-reseal.md +2 -2
  101. package/docs/workflow-catalog.md +155 -0
  102. package/docs/workflow-path-migration.md +109 -0
  103. package/package.json +39 -24
  104. package/packages/compatibility/adopter-delivery.js +16 -0
  105. package/packages/compatibility/cross-platform-adopter-qualification.js +12 -0
  106. package/packages/compatibility/floating-consumer-policy.js +14 -0
  107. package/packages/compatibility/publication-qualification.js +11 -0
  108. package/packages/compatibility/publication-rehearsal.js +18 -0
  109. package/packages/compatibility/runtime-ref-resume-authority.js +13 -0
  110. package/packages/compatibility/tail-reseal-receipt.js +7 -0
  111. package/packages/compatibility/tail-reseal.js +11 -0
  112. package/packages/core/{v4-adopter-delivery-parity.js → adopter-delivery-parity.js} +12 -12
  113. package/packages/core/{v4-adopter-delivery.js → adopter-delivery.js} +24 -24
  114. package/packages/core/artifact-verification-envelope.js +5 -5
  115. package/packages/core/buildchain-contract.js +6 -6
  116. package/packages/core/buildchain-domain.wasm +0 -0
  117. package/packages/core/buildchain-kfd-claims.js +2 -2
  118. package/packages/core/buildchain-publication-authority.js +43 -26
  119. package/packages/core/{v4-canonical-contracts.js → canonical-contracts.js} +39 -103
  120. package/packages/core/ci-lane-change-budget.js +14 -1
  121. package/packages/core/controller-evidence.js +4 -1
  122. package/packages/core/{v4-cross-platform-adopter-qualification.js → cross-platform-adopter-qualification.js} +19 -19
  123. package/packages/core/{v4-delivery-warrant-fixture-runner.js → delivery-warrant-fixture-runner.js} +36 -32
  124. package/packages/core/{v4-delivery-warrant-read-candidate.js → delivery-warrant-read-candidate.js} +40 -40
  125. package/packages/core/{v4-delivery-warrant-semantic-diff-gate.js → delivery-warrant-semantic-diff-gate.js} +58 -59
  126. package/packages/core/{v4-delivery-warrant-shadow-adapter.js → delivery-warrant-shadow-adapter.js} +15 -15
  127. package/packages/core/dev-delivery-candidate-identity.js +40 -6
  128. package/packages/core/dev-delivery-execution-transfer.js +6 -6
  129. package/packages/core/dev-delivery-native-proof.js +12 -8
  130. package/packages/core/dev-delivery-warrant-legacy-recovery.js +1 -1
  131. package/packages/core/dev-delivery-warrant-native-compatibility.js +4 -4
  132. package/packages/core/dev-delivery-warrant-state.js +14 -15
  133. package/packages/core/dev-delivery-warrant.js +15 -5
  134. package/packages/core/domain-wasm-artifact.js +7 -0
  135. package/packages/core/domain-wasm.js +216 -0
  136. package/packages/core/{v4-floating-consumer-evidence.js → floating-consumer-evidence.js} +14 -14
  137. package/packages/core/{v4-floating-consumer-policy.js → floating-consumer-policy.js} +28 -30
  138. package/packages/core/{v4-floating-consumer-release-passport.js → floating-consumer-release-passport.js} +25 -25
  139. package/packages/core/github-governance-authority.js +4 -4
  140. package/packages/core/index.js +4 -8
  141. package/packages/core/kfd-adopter-manifest.js +46 -47
  142. package/packages/core/next-development-projection.js +26 -3
  143. package/packages/core/next-development-transition.js +5 -6
  144. package/packages/core/oci-compose-qualification.js +143 -0
  145. package/packages/core/oci-publication-bundle.js +281 -0
  146. package/packages/core/oci-publication-graph.js +206 -0
  147. package/packages/core/paper-agent-entry.js +30 -4
  148. package/packages/core/paper-fleet.js +1 -1
  149. package/packages/core/paper-runtime-channels.js +348 -0
  150. package/packages/core/paper-scaffold-content.js +10 -0
  151. package/packages/core/paper.js +37 -71
  152. package/packages/core/partial-mutation-recovery-qualification.js +18 -0
  153. package/packages/core/{v4-platform-stage-checkpoints.js → platform-stage-checkpoints.js} +37 -37
  154. package/packages/core/product-publication.js +59 -0
  155. package/packages/core/{v4-protected-publication-source.js → protected-publication-source.js} +22 -24
  156. package/packages/core/provider-operation-journal.js +62 -0
  157. package/packages/core/{v4-provider-readback-idempotency.js → provider-readback-idempotency.js} +40 -125
  158. package/packages/core/public-export-compatibility.js +33 -0
  159. package/packages/core/publication-development.js +72 -0
  160. package/packages/core/{v4-publication-qualification.js → publication-qualification.js} +17 -17
  161. package/packages/core/{v4-publication-rehearsal-capsule.js → publication-rehearsal-capsule.js} +23 -23
  162. package/packages/core/publication-rehearsal-projection.js +2 -2
  163. package/packages/core/{v4-publication-rehearsal-provider-bindings.js → publication-rehearsal-provider-bindings.js} +4 -4
  164. package/packages/core/publication-rehearsal-runtime.js +21 -21
  165. package/packages/core/{v4-publication-rehearsal.js → publication-rehearsal.js} +33 -33
  166. package/packages/core/publication-sealed-bundle.js +78 -13
  167. package/packages/core/release-activation-shadow.js +32 -0
  168. package/packages/core/release-candidate.js +6 -6
  169. package/packages/core/release-invocation.js +64 -0
  170. package/packages/core/release-line-dry-run.js +1 -1
  171. package/packages/core/release-passport-contract.js +5 -5
  172. package/packages/core/release-passport.js +41 -40
  173. package/packages/core/release-tail-product-capabilities.js +9 -0
  174. package/packages/core/release-tail-provider-plane.js +68 -1048
  175. package/packages/core/{v4-runtime-ref-resume-authority.js → runtime-ref-resume-authority.js} +36 -40
  176. package/packages/core/{v4-runtime-selector-persistence.js → runtime-selector-persistence.js} +7 -7
  177. package/packages/core/stable-publication-fence.js +28 -0
  178. package/packages/core/{v4-stage-capsule-local-store.js → stage-capsule-local-store.js} +56 -54
  179. package/packages/core/{v4-stage-capsule-qualification-campaign.js → stage-capsule-qualification-campaign.js} +37 -38
  180. package/packages/core/{v4-stage-capsule-qualification.js → stage-capsule-qualification.js} +28 -29
  181. package/packages/core/{v4-stage-capsule-resume-planner.js → stage-capsule-resume-planner.js} +29 -29
  182. package/packages/core/{v4-stage-capsule-store.js → stage-capsule-store.js} +59 -56
  183. package/packages/core/{v4-stage-capsule.js → stage-capsule.js} +45 -45
  184. package/packages/core/{v4-tail-reseal-contract.js → tail-reseal-contract.js} +6 -6
  185. package/packages/core/{v4-tail-reseal-github.js → tail-reseal-github.js} +12 -12
  186. package/packages/core/{v4-tail-reseal-receipt.js → tail-reseal-receipt.js} +22 -22
  187. package/packages/core/{v4-tail-reseal.js → tail-reseal.js} +29 -29
  188. package/packages/core/universal-workflow-bootstrap.js +586 -0
  189. package/scripts/{v4-architecture.mjs → architecture.mjs} +6 -6
  190. package/scripts/binary-publication-evidence.mjs +135 -0
  191. package/scripts/{v4-bridge-bootstrap.mjs → bridge-bootstrap.mjs} +14 -18
  192. package/scripts/{v4-bridge-evidence.mjs → bridge-evidence.mjs} +8 -8
  193. package/scripts/build-contract-core.mjs +1 -14
  194. package/scripts/build-domain-wasm.mjs +177 -0
  195. package/scripts/{v3-v4-capability-catalog.mjs → capability-parity-catalog.mjs} +19 -19
  196. package/scripts/check-action-bundles.mjs +12 -2
  197. package/scripts/{check-v3-v4-capability-inventory.mjs → check-capability-parity-inventory.mjs} +42 -42
  198. package/scripts/check-ci-lane-change-budget.mjs +4 -1
  199. package/scripts/check-core-mechanism-inventory.mjs +8 -4
  200. package/scripts/{check-v4-floating-consumer-policy-contract.mjs → check-floating-consumer-policy-contract.mjs} +10 -10
  201. package/scripts/check-implementation-naming.mjs +135 -0
  202. package/scripts/check-inventory.mjs +39 -47
  203. package/scripts/check-maintainability.mjs +25 -115
  204. package/scripts/{check-v4-public-dogfood-contract.mjs → check-public-dogfood-contract.mjs} +37 -24
  205. package/scripts/{check-v4-release-topology.mjs → check-release-topology.mjs} +131 -52
  206. package/scripts/{check-v4-runtime-semantic-closure.mjs → check-runtime-semantic-closure.mjs} +23 -17
  207. package/scripts/check-universal-workflow-bootstrap.mjs +266 -0
  208. package/scripts/check-workflow-taxonomy.mjs +6 -0
  209. package/scripts/{v4-consumer-policy.mjs → consumer-policy.mjs} +15 -15
  210. package/scripts/copy-domain-wasm.mjs +14 -0
  211. package/scripts/{v4-cross-platform-adopter-qualification.mjs → cross-platform-adopter-qualification.mjs} +9 -9
  212. package/scripts/{v4-declarative-promotion-admission.mjs → declarative-promotion-admission.mjs} +4 -4
  213. package/scripts/dev-delivery-authority-command-adapters.mjs +1 -1
  214. package/scripts/dev-delivery-authority.mjs +8 -8
  215. package/scripts/dev-delivery-source-proof-reuse.mjs +2 -1
  216. package/scripts/dev-delivery-warrant-options.mjs +15 -10
  217. package/scripts/dev-delivery-warrant-store.mjs +98 -13
  218. package/scripts/dev-delivery-warrant-transition.mjs +109 -0
  219. package/scripts/dev-delivery-warrant.mjs +80 -103
  220. package/scripts/dev-pr-auto-merge.mjs +15 -15
  221. package/scripts/dev-pr-delivery-warrant.mjs +1 -1
  222. package/scripts/generate-channel-build-workflow.mjs +7 -2
  223. package/scripts/generate-channel-promotion-workflow.mjs +19 -34
  224. package/scripts/generate-release-candidate-passport.mjs +23 -23
  225. package/scripts/generate-site-bundle.mjs +28 -28
  226. package/scripts/generate-universal-workflow-facades.mjs +498 -0
  227. package/scripts/generate-workflow-taxonomy.mjs +25 -0
  228. package/scripts/github-output.mjs +31 -0
  229. package/scripts/{v4-host-adapter.mjs → host-adapter.mjs} +1 -1
  230. package/scripts/implementation-references.mjs +25 -0
  231. package/scripts/init-repo.mjs +1 -1
  232. package/scripts/maintainability-metrics.mjs +16 -5
  233. package/scripts/maintainability-public-surface.mjs +115 -0
  234. package/scripts/next-development-review.mjs +313 -0
  235. package/scripts/oci-compose-preview.mjs +261 -0
  236. package/scripts/paper-work-fleet-cli.mjs +2 -0
  237. package/scripts/{v4-platform-stage-checkpoint-rehearsal.mjs → platform-stage-checkpoint-rehearsal.mjs} +17 -17
  238. package/scripts/{v4-product-publication-intent.mjs → product-publication-intent.mjs} +28 -13
  239. package/scripts/publication-candidate-kind.mjs +93 -0
  240. package/scripts/publication-candidate-sealer.mjs +16 -1
  241. package/scripts/{v4-publication-rehearsal-fixture.mjs → publication-rehearsal-fixture.mjs} +5 -5
  242. package/scripts/publication-settlement.mjs +211 -0
  243. package/scripts/release-asset-client.mjs +91 -0
  244. package/scripts/{v4-release-candidate-adapter.mjs → release-candidate-adapter.mjs} +4 -4
  245. package/scripts/release-candidate-resolver.mjs +24 -35
  246. package/scripts/release-tail.mjs +5 -5
  247. package/scripts/resume-from-candidate-run.mjs +35 -42
  248. package/scripts/site-capability-metadata.mjs +9 -0
  249. package/scripts/source-verification-evidence.mjs +344 -0
  250. package/scripts/stable-candidate-qualification.mjs +1 -1
  251. package/scripts/{v4-stage-capsule-qualification.mjs → stage-capsule-qualification.mjs} +62 -62
  252. package/scripts/{v4-stage-capsule-resume-rehearsal.mjs → stage-capsule-resume-rehearsal.mjs} +6 -6
  253. package/scripts/{v4-tail-reseal-macos-rehearsal.mjs → tail-reseal-macos-rehearsal.mjs} +9 -9
  254. package/scripts/{v4-tail-reseal.mjs → tail-reseal.mjs} +19 -19
  255. package/scripts/universal-facade-maintainability.mjs +91 -0
  256. package/scripts/universal-workflow-backflow.mjs +212 -0
  257. package/scripts/universal-workflow-engine.mjs +620 -0
  258. package/scripts/universal-workflow-self-dogfood.mjs +205 -0
  259. package/scripts/verify-version-state-delta.mjs +175 -0
  260. package/scripts/{v4-warrant-shadow-plan.mjs → warrant-shadow-plan.mjs} +6 -6
  261. package/scripts/workflow-taxonomy.mjs +507 -0
  262. package/templates/native-dev-delivery.yml +4 -7
  263. package/templates/universal-buildchain-bootstrap-recovery.yml +282 -0
  264. package/templates/universal-buildchain-bootstrap.yml +28 -0
  265. package/actions/v4-release-candidate-promote/README.md +0 -3
  266. package/packages/core/v4-partial-mutation-recovery-qualification.js +0 -395
  267. package/packages/core/v4-product-publication.js +0 -387
  268. package/packages/core/v4-provider-operation-journal.js +0 -531
  269. package/packages/core/v4-release-activation-shadow.js +0 -519
  270. package/packages/core/v4-release-invocation.js +0 -425
  271. package/packages/core/v4-stable-publication-fence.js +0 -357
  272. /package/architecture/{v4-adopter-delivery-parity.json → adopter-delivery-parity.json} +0 -0
  273. /package/architecture/{v3-core-mechanism-inventory.json → baseline-core-mechanism-inventory.json} +0 -0
  274. /package/architecture/{v4-canonical-contract-fixtures.json → canonical-contract-fixtures.json} +0 -0
  275. /package/architecture/{v4-compatibility-facts-parity.json → compatibility-facts-parity.json} +0 -0
  276. /package/architecture/{v4-delivery-warrant-shadow-bootstrap-plan.schema.json → delivery-warrant-shadow-bootstrap-plan.schema.json} +0 -0
  277. /package/architecture/{v4-delivery-warrant-shadow-fixtures.json → delivery-warrant-shadow-fixtures.json} +0 -0
  278. /package/architecture/{v4-delivery-warrant-shadow-fixtures.schema.json → delivery-warrant-shadow-fixtures.schema.json} +0 -0
  279. /package/architecture/{v4-exception-ledger.json → exception-ledger.json} +0 -0
  280. /package/architecture/{v4-exception-ledger.schema.json → exception-ledger.schema.json} +0 -0
  281. /package/architecture/{v4-release-invocation-fixtures.json → release-invocation-fixtures.json} +0 -0
@@ -1,27 +1,27 @@
1
1
  import { TextDecoder } from "node:util";
2
2
 
3
3
  import {
4
- V4ContractFault,
5
- v4CanonicalBytes,
6
- v4ContentRoot,
7
- validateV4ContractFault,
8
- validateV4EventEnvelope,
9
- validateV4ReceiptEnvelope,
10
- validateV4Root,
11
- } from "./v4-canonical-contracts.js";
4
+ ContractFault,
5
+ domainCanonicalBytes,
6
+ domainContentRoot,
7
+ validateContractFault,
8
+ validateEventEnvelope,
9
+ validateReceiptEnvelope,
10
+ validateRoot,
11
+ } from "./canonical-contracts.js";
12
12
 
13
- export const V4_DELIVERY_WARRANT_TRACE_CONTRACT =
13
+ export const DELIVERY_WARRANT_TRACE_CONTRACT =
14
14
  "buildchain-v4-delivery-warrant-trace-fixture/v1";
15
- export const V4_DELIVERY_WARRANT_RUNNER_CONTRACT =
15
+ export const DELIVERY_WARRANT_RUNNER_CONTRACT =
16
16
  "buildchain-v4-delivery-warrant-fixture-runner/v1";
17
- export const V4_DELIVERY_WARRANT_PROJECTION_CONTRACT =
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 V4ContractFault(code, path, message);
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 v4CanonicalBytes(left).equals(v4CanonicalBytes(right));
56
+ return domainCanonicalBytes(left).equals(domainCanonicalBytes(right));
57
57
  }
58
58
 
59
59
  function declaredRoot(value, expected, path, code) {
60
- validateV4Root(value, path);
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
- v4CanonicalBytes(entry.payload);
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 = v4CanonicalBytes(state).toString("utf8");
144
+ const canonicalUtf8 = domainCanonicalBytes(state).toString("utf8");
145
145
  return {
146
146
  generation,
147
147
  fencingCounter,
148
148
  canonicalUtf8,
149
- root: v4ContentRoot("queue-state", state),
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
- validateV4ContractFault(decision.fault, `${path}/fault`);
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
- validateV4EventEnvelope(step.event);
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 = v4ContentRoot("observation", step.event);
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
- validateV4ReceiptEnvelope(step.receipt);
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 = v4CanonicalBytes(step.receipt).toString("utf8");
269
+ const receiptCanonicalUtf8 = domainCanonicalBytes(step.receipt).toString(
270
+ "utf8",
271
+ );
270
272
  const receiptRoot = declaredRoot(
271
273
  step.receiptRoot,
272
- v4ContentRoot("transition-receipt", step.receipt),
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: v4CanonicalBytes(effect.payload).toString("utf8"),
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: v4CanonicalBytes(observation.payload).toString("utf8"),
297
- root: v4ContentRoot("observation", observation.payload),
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 runV4DeliveryWarrantTraceFixture(
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 !== V4_DELIVERY_WARRANT_TRACE_CONTRACT ||
319
- fixture.runner !== V4_DELIVERY_WARRANT_RUNNER_CONTRACT
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: V4_DELIVERY_WARRANT_PROJECTION_CONTRACT,
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 = v4ContentRoot("semantic-diff", projection);
363
- validateV4Root(fixture.expectedProjectionRoot, "$/expectedProjectionRoot");
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",
@@ -5,19 +5,19 @@ import {
5
5
  observeDevDeliveryQueue,
6
6
  } from "./dev-delivery-warrant.js";
7
7
  import {
8
- v4CanonicalBytes,
9
- v4ContentRoot,
10
- validateV4Clock,
11
- validateV4Root,
12
- } from "./v4-canonical-contracts.js";
13
- import { invokeV4RustShadowHost } from "./v4-delivery-warrant-shadow-adapter.js";
14
- import { V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT } from "./v4-delivery-warrant-semantic-diff-gate.js";
8
+ domainCanonicalBytes,
9
+ domainContentRoot,
10
+ validateClock,
11
+ validateRoot,
12
+ } from "./canonical-contracts.js";
13
+ import { invokeRustShadowHost } from "./delivery-warrant-shadow-adapter.js";
14
+ import { DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT } from "./delivery-warrant-semantic-diff-gate.js";
15
15
 
16
- export const V4_DELIVERY_WARRANT_READ_PROJECTION_CONTRACT =
16
+ export const DELIVERY_WARRANT_READ_PROJECTION_CONTRACT =
17
17
  "buildchain-v4-delivery-warrant-read-projection/v1";
18
- export const V4_DELIVERY_WARRANT_READ_RESULT_CONTRACT =
18
+ export const DELIVERY_WARRANT_READ_RESULT_CONTRACT =
19
19
  "buildchain-v4-delivery-warrant-read-result/v1";
20
- export const V4_DELIVERY_WARRANT_READ_EVIDENCE_CONTRACT =
20
+ export const DELIVERY_WARRANT_READ_EVIDENCE_CONTRACT =
21
21
  "buildchain-v4-delivery-warrant-read-evidence/v1";
22
22
 
23
23
  const HOST_REQUEST_CONTRACT = "kungfu-buildchain-v4-host-request";
@@ -33,16 +33,16 @@ const REQUIRED_CAPABILITIES = Object.freeze([
33
33
  const REVISION = /^[0-9a-f]{40,64}$/u;
34
34
  const MAX_TIMEOUT_MS = 30_000;
35
35
 
36
- export class V4DeliveryWarrantReadFault extends Error {
36
+ export class DeliveryWarrantReadFault extends Error {
37
37
  constructor(code, message) {
38
38
  super(message);
39
- this.name = "V4DeliveryWarrantReadFault";
39
+ this.name = "DeliveryWarrantReadFault";
40
40
  this.code = code;
41
41
  }
42
42
  }
43
43
 
44
44
  function fail(code, message) {
45
- throw new V4DeliveryWarrantReadFault(code, message);
45
+ throw new DeliveryWarrantReadFault(code, message);
46
46
  }
47
47
 
48
48
  function validateSources(actual, expected) {
@@ -61,22 +61,22 @@ function validateSources(actual, expected) {
61
61
  fail("qualification-source-drift", "qualification revisions are invalid");
62
62
  }
63
63
 
64
- export function validateV4DeliveryWarrantReadQualification(
64
+ export function validateDeliveryWarrantReadQualification(
65
65
  report,
66
66
  { expectedRoot, expectedSources, observedAt },
67
67
  ) {
68
- validateV4Root(expectedRoot, "$/expectedQualificationRoot");
69
- validateV4Clock(observedAt, "$/observedAt");
68
+ validateRoot(expectedRoot, "$/expectedQualificationRoot");
69
+ validateClock(observedAt, "$/observedAt");
70
70
  const body = structuredClone(report || {});
71
71
  const reportedRoot = body.reportRoot;
72
72
  delete body.reportRoot;
73
73
  if (
74
74
  reportedRoot !== expectedRoot ||
75
- v4ContentRoot("semantic-diff", body) !== expectedRoot
75
+ domainContentRoot("semantic-diff", body) !== expectedRoot
76
76
  )
77
77
  fail("qualification-root-drift", "semantic-diff report root drifted");
78
78
  if (
79
- report.schema !== V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT ||
79
+ report.schema !== DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT ||
80
80
  report.authority !== "typescript-v3" ||
81
81
  report.rustAuthority !== "none" ||
82
82
  report.rustEffects !== "disabled" ||
@@ -92,16 +92,16 @@ export function validateV4DeliveryWarrantReadQualification(
92
92
  "qualification-not-eligible",
93
93
  "semantic-diff report does not authorize a read-only candidate",
94
94
  );
95
- validateV4Clock(report.retainUntil, "$/qualification/retainUntil");
95
+ validateClock(report.retainUntil, "$/qualification/retainUntil");
96
96
  if (Date.parse(report.retainUntil) <= Date.parse(observedAt))
97
97
  fail("qualification-expired", "semantic-diff retention window expired");
98
98
  validateSources(report.sources, expectedSources);
99
99
  return report;
100
100
  }
101
101
 
102
- export function projectV3QueueToV4ReadState(queueInput) {
102
+ export function projectBaselineQueueToReadState(queueInput) {
103
103
  const queue = normalizeDevDeliveryQueue(queueInput, {
104
- allowLegacyV3Readback: true,
104
+ allowLegacyBaselineReadback: true,
105
105
  });
106
106
  return {
107
107
  schema: STATE_CONTRACT,
@@ -137,7 +137,7 @@ export function projectV3QueueToV4ReadState(queueInput) {
137
137
  };
138
138
  }
139
139
 
140
- export function createV4DeliveryWarrantReadRequest(
140
+ export function createDeliveryWarrantReadRequest(
141
141
  state,
142
142
  { requestId = crypto.randomUUID(), timeoutMs = 5_000 } = {},
143
143
  ) {
@@ -155,7 +155,7 @@ export function createV4DeliveryWarrantReadRequest(
155
155
  command: { id: "delivery-warrant.state-project", arguments: [] },
156
156
  input: {
157
157
  encoding: "base64",
158
- bytes: v4CanonicalBytes(state).toString("base64"),
158
+ bytes: domainCanonicalBytes(state).toString("base64"),
159
159
  },
160
160
  requiredCapabilities: [...REQUIRED_CAPABILITIES],
161
161
  timeoutMs,
@@ -184,22 +184,22 @@ function validateProjection(response, request, expectedState) {
184
184
  fail("rust-projection-failed", "Rust read projection failed closed");
185
185
  const projection = response.structuredResult;
186
186
  if (
187
- projection?.schema !== V4_DELIVERY_WARRANT_READ_PROJECTION_CONTRACT ||
187
+ projection?.schema !== DELIVERY_WARRANT_READ_PROJECTION_CONTRACT ||
188
188
  !projection.stateRoot
189
189
  )
190
190
  fail("host-response-invalid", "Rust read projection shape is invalid");
191
- validateV4Root(projection.stateRoot, "$/projection/stateRoot");
191
+ validateRoot(projection.stateRoot, "$/projection/stateRoot");
192
192
  if (
193
- !v4CanonicalBytes(projection.state).equals(
194
- v4CanonicalBytes(expectedState),
193
+ !domainCanonicalBytes(projection.state).equals(
194
+ domainCanonicalBytes(expectedState),
195
195
  ) ||
196
- projection.stateRoot !== v4ContentRoot("queue-state", expectedState)
196
+ projection.stateRoot !== domainContentRoot("queue-state", expectedState)
197
197
  )
198
198
  fail("projection-drift", "Rust read projection disagrees with v3 state");
199
199
  return projection;
200
200
  }
201
201
 
202
- export async function runV4DeliveryWarrantReadCandidate(
202
+ export async function runDeliveryWarrantReadCandidate(
203
203
  queueInput,
204
204
  {
205
205
  qualification,
@@ -209,12 +209,12 @@ export async function runV4DeliveryWarrantReadCandidate(
209
209
  requestId,
210
210
  timeoutMs = 5_000,
211
211
  signal,
212
- invokeRust = invokeV4RustShadowHost,
212
+ invokeRust = invokeRustShadowHost,
213
213
  host = {},
214
214
  retain,
215
215
  } = {},
216
216
  ) {
217
- validateV4DeliveryWarrantReadQualification(qualification, {
217
+ validateDeliveryWarrantReadQualification(qualification, {
218
218
  expectedRoot: expectedQualificationRoot,
219
219
  expectedSources,
220
220
  observedAt,
@@ -222,10 +222,10 @@ export async function runV4DeliveryWarrantReadCandidate(
222
222
  if (typeof retain !== "function")
223
223
  fail("retention-required", "v4 read evidence retention is required");
224
224
  const queue = normalizeDevDeliveryQueue(queueInput, {
225
- allowLegacyV3Readback: true,
225
+ allowLegacyBaselineReadback: true,
226
226
  });
227
- const state = projectV3QueueToV4ReadState(queue);
228
- const request = createV4DeliveryWarrantReadRequest(state, {
227
+ const state = projectBaselineQueueToReadState(queue);
228
+ const request = createDeliveryWarrantReadRequest(state, {
229
229
  requestId,
230
230
  timeoutMs,
231
231
  });
@@ -241,10 +241,10 @@ export async function runV4DeliveryWarrantReadCandidate(
241
241
  const projection = validateProjection(response, request, state);
242
242
  const observation = observeDevDeliveryQueue(queue, {
243
243
  now: observedAt,
244
- allowLegacyV3Readback: true,
244
+ allowLegacyBaselineReadback: true,
245
245
  });
246
246
  const evidence = {
247
- schema: V4_DELIVERY_WARRANT_READ_EVIDENCE_CONTRACT,
247
+ schema: DELIVERY_WARRANT_READ_EVIDENCE_CONTRACT,
248
248
  authority: "typescript-v3",
249
249
  writerAuthority: "typescript-v3",
250
250
  rustAuthority: "read-only",
@@ -254,21 +254,21 @@ export async function runV4DeliveryWarrantReadCandidate(
254
254
  qualificationRoot: expectedQualificationRoot,
255
255
  legacyStateRoot: queue.stateRoot,
256
256
  v4StateRoot: projection.stateRoot,
257
- observationRoot: v4ContentRoot("observation", observation),
257
+ observationRoot: domainContentRoot("observation", observation),
258
258
  parity: "matched",
259
259
  };
260
- const evidenceRoot = v4ContentRoot("observation", evidence);
260
+ const evidenceRoot = domainContentRoot("observation", evidence);
261
261
  let retentionReceipt;
262
262
  try {
263
263
  retentionReceipt = await retain(
264
264
  structuredClone({ ...evidence, evidenceRoot }),
265
265
  );
266
- validateV4Root(retentionReceipt?.receiptRoot, "$/retention/receiptRoot");
266
+ validateRoot(retentionReceipt?.receiptRoot, "$/retention/receiptRoot");
267
267
  } catch {
268
268
  fail("retention-failed", "v4 read evidence retention failed");
269
269
  }
270
270
  return {
271
- schema: V4_DELIVERY_WARRANT_READ_RESULT_CONTRACT,
271
+ schema: DELIVERY_WARRANT_READ_RESULT_CONTRACT,
272
272
  mode: "v4-read",
273
273
  authority: "typescript-v3",
274
274
  writerAuthority: "typescript-v3",
@@ -1,42 +1,41 @@
1
1
  import crypto from "node:crypto";
2
2
 
3
3
  import {
4
- v4ContentRoot,
5
- validateV4Clock,
6
- validateV4Root,
7
- } from "./v4-canonical-contracts.js";
4
+ domainContentRoot,
5
+ validateClock,
6
+ validateRoot,
7
+ } from "./canonical-contracts.js";
8
8
  import {
9
- V4_DELIVERY_WARRANT_PROJECTION_CONTRACT,
10
- V4_DELIVERY_WARRANT_RUNNER_CONTRACT,
11
- V4_DELIVERY_WARRANT_TRACE_CONTRACT,
12
- } from "./v4-delivery-warrant-fixture-runner.js";
9
+ DELIVERY_WARRANT_PROJECTION_CONTRACT,
10
+ DELIVERY_WARRANT_RUNNER_CONTRACT,
11
+ DELIVERY_WARRANT_TRACE_CONTRACT,
12
+ } from "./delivery-warrant-fixture-runner.js";
13
13
  import {
14
- V4_DELIVERY_WARRANT_SHADOW_OBSERVATION_CONTRACT,
15
- runV4DeliveryWarrantShadow,
16
- } from "./v4-delivery-warrant-shadow-adapter.js";
14
+ DELIVERY_WARRANT_SHADOW_OBSERVATION_CONTRACT,
15
+ runDeliveryWarrantShadow,
16
+ } from "./delivery-warrant-shadow-adapter.js";
17
17
 
18
- export const V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT =
18
+ export const DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT =
19
19
  "buildchain-v4-delivery-warrant-semantic-diff-report/v1";
20
- export const V4_DELIVERY_WARRANT_SEMANTIC_DIFF_VALIDATOR_VERSION =
20
+ export const DELIVERY_WARRANT_SEMANTIC_DIFF_VALIDATOR_VERSION =
21
21
  "semantic-diff-gate-v1";
22
- export const V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REQUIRED_COVERAGE =
23
- Object.freeze([
24
- "cancellation",
25
- "cas",
26
- "conflict",
27
- "duplicate",
28
- "golden",
29
- "lease-fence",
30
- "property",
31
- "replay",
32
- "response-loss",
33
- ]);
22
+ export const DELIVERY_WARRANT_SEMANTIC_DIFF_REQUIRED_COVERAGE = Object.freeze([
23
+ "cancellation",
24
+ "cas",
25
+ "conflict",
26
+ "duplicate",
27
+ "golden",
28
+ "lease-fence",
29
+ "property",
30
+ "replay",
31
+ "response-loss",
32
+ ]);
34
33
 
35
34
  const REVISION = /^[0-9a-f]{40,64}$/u;
36
35
  const TOKEN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
37
36
  const stop = (code) => ({ code, retry: "stop" });
38
37
  const valueRoot = (value) =>
39
- value === undefined ? null : v4ContentRoot("semantic-diff", { value });
38
+ value === undefined ? null : domainContentRoot("semantic-diff", { value });
40
39
 
41
40
  function difference(path, kind, legacy, rust) {
42
41
  const summary = {
@@ -47,11 +46,11 @@ function difference(path, kind, legacy, rust) {
47
46
  };
48
47
  return {
49
48
  ...summary,
50
- differenceRoot: v4ContentRoot("semantic-diff", summary),
49
+ differenceRoot: domainContentRoot("semantic-diff", summary),
51
50
  };
52
51
  }
53
52
 
54
- export function compareV4DeliveryWarrantSemantics(legacy, rust, path = "$") {
53
+ export function compareDeliveryWarrantSemantics(legacy, rust, path = "$") {
55
54
  if (Object.is(legacy, rust)) return [];
56
55
  if (legacy === undefined)
57
56
  return [difference(path, "missing-legacy", legacy, rust)];
@@ -69,12 +68,12 @@ export function compareV4DeliveryWarrantSemantics(legacy, rust, path = "$") {
69
68
  ? Array.from({ length: Math.max(legacy.length, rust.length) }, (_, i) => i)
70
69
  : [...new Set([...Object.keys(legacy), ...Object.keys(rust)])].sort();
71
70
  return keys.flatMap((key) =>
72
- compareV4DeliveryWarrantSemantics(legacy[key], rust[key], `${path}/${key}`),
71
+ compareDeliveryWarrantSemantics(legacy[key], rust[key], `${path}/${key}`),
73
72
  );
74
73
  }
75
74
 
76
- export function v4DeliveryWarrantDispositionRoot(value) {
77
- return v4ContentRoot("semantic-diff", {
75
+ export function deliveryWarrantDispositionRoot(value) {
76
+ return domainContentRoot("semantic-diff", {
78
77
  differenceRoot: value.differenceRoot,
79
78
  disposition: value.disposition,
80
79
  reasonCode: value.reasonCode,
@@ -85,13 +84,13 @@ export function v4DeliveryWarrantDispositionRoot(value) {
85
84
  function dispositions(values = []) {
86
85
  return new Map(
87
86
  values.map((value) => {
88
- validateV4Root(value.differenceRoot);
89
- validateV4Root(value.reviewRoot);
90
- validateV4Root(value.dispositionRoot);
87
+ validateRoot(value.differenceRoot);
88
+ validateRoot(value.reviewRoot);
89
+ validateRoot(value.dispositionRoot);
91
90
  if (
92
91
  value.disposition !== "reviewed-exclusion" ||
93
92
  !TOKEN.test(value.reasonCode) ||
94
- value.dispositionRoot !== v4DeliveryWarrantDispositionRoot(value)
93
+ value.dispositionRoot !== deliveryWarrantDispositionRoot(value)
95
94
  )
96
95
  throw new TypeError(
97
96
  "semantic difference disposition is not review-rooted",
@@ -145,7 +144,7 @@ async function projectCase(definition, options, dispositionIndex) {
145
144
  blockers.push(stop("missing-observation"));
146
145
  if (
147
146
  observation &&
148
- (observation.schema !== V4_DELIVERY_WARRANT_SHADOW_OBSERVATION_CONTRACT ||
147
+ (observation.schema !== DELIVERY_WARRANT_SHADOW_OBSERVATION_CONTRACT ||
149
148
  observation.authority !== "typescript-v3" ||
150
149
  observation.rustAuthority !== "none" ||
151
150
  observation.rustEffects !== "disabled")
@@ -171,7 +170,7 @@ async function projectCase(definition, options, dispositionIndex) {
171
170
  const rust = observation?.rust?.projection;
172
171
  const differences = classify(
173
172
  rust
174
- ? compareV4DeliveryWarrantSemantics(result.authoritativeResult, rust)
173
+ ? compareDeliveryWarrantSemantics(result.authoritativeResult, rust)
175
174
  : [],
176
175
  dispositionIndex,
177
176
  );
@@ -182,18 +181,18 @@ async function projectCase(definition, options, dispositionIndex) {
182
181
  coverage: [...new Set(definition.coverage)].sort(),
183
182
  inputRoot,
184
183
  observationRoot: observation
185
- ? v4ContentRoot("semantic-diff", observation)
184
+ ? domainContentRoot("semantic-diff", observation)
186
185
  : null,
187
186
  legacyProjectionRoot: result.authoritativeResult?.projectionRoot || null,
188
187
  rustProjectionRoot: rust?.projectionRoot || null,
189
188
  differences,
190
- differenceRoot: v4ContentRoot("semantic-diff", differences),
189
+ differenceRoot: domainContentRoot("semantic-diff", differences),
191
190
  blockers,
192
191
  };
193
192
  return {
194
193
  report: {
195
194
  ...evidence,
196
- evidenceRoot: v4ContentRoot("semantic-diff", evidence),
195
+ evidenceRoot: domainContentRoot("semantic-diff", evidence),
197
196
  status: blockers.length ? "blocked" : "zero-unexplained-diff",
198
197
  },
199
198
  legacy: result.authoritativeResult,
@@ -220,7 +219,7 @@ function probeReceipts(probes, runtime) {
220
219
  return probes.map((probe) => {
221
220
  const target = runtime.get(probe.caseId);
222
221
  const differences = target?.rust
223
- ? compareV4DeliveryWarrantSemantics(
222
+ ? compareDeliveryWarrantSemantics(
224
223
  target.legacy,
225
224
  inject(target.rust, probe),
226
225
  )
@@ -233,15 +232,15 @@ function probeReceipts(probes, runtime) {
233
232
  detected: differences.length > 0,
234
233
  differenceRoots: differences.map((entry) => entry.differenceRoot).sort(),
235
234
  };
236
- return { ...receipt, receiptRoot: v4ContentRoot("semantic-diff", receipt) };
235
+ return {
236
+ ...receipt,
237
+ receiptRoot: domainContentRoot("semantic-diff", receipt),
238
+ };
237
239
  });
238
240
  }
239
241
 
240
- export async function runV4DeliveryWarrantSemanticDiffGate(
241
- cases,
242
- options = {},
243
- ) {
244
- validateV4Clock(options.recordedAt);
242
+ export async function runDeliveryWarrantSemanticDiffGate(cases, options = {}) {
243
+ validateClock(options.recordedAt);
245
244
  if (!Array.isArray(cases) || cases.length < 1 || cases.length > 64)
246
245
  throw new RangeError("semantic diff cases must contain 1-64 entries");
247
246
  if (
@@ -251,7 +250,7 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
251
250
  )
252
251
  throw new TypeError("semantic diff source binding is invalid");
253
252
  for (const key of ["traceSchemaRoot", "reportSchemaRoot", "runnerRoot"])
254
- validateV4Root(options.contracts?.[key]);
253
+ validateRoot(options.contracts?.[key]);
255
254
  const index = dispositions(options.dispositions);
256
255
  const projected = [];
257
256
  for (const entry of cases)
@@ -260,7 +259,7 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
260
259
  entry,
261
260
  {
262
261
  ...options,
263
- runShadow: options.runShadow || runV4DeliveryWarrantShadow,
262
+ runShadow: options.runShadow || runDeliveryWarrantShadow,
264
263
  },
265
264
  index,
266
265
  ),
@@ -268,7 +267,7 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
268
267
  const runtime = new Map(projected.map((entry, i) => [cases[i].id, entry]));
269
268
  const receipts = probeReceipts(options.faultProbes, runtime);
270
269
  const coverage = new Set(cases.flatMap((entry) => entry.coverage));
271
- const missing = V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REQUIRED_COVERAGE.filter(
270
+ const missing = DELIVERY_WARRANT_SEMANTIC_DIFF_REQUIRED_COVERAGE.filter(
272
271
  (entry) => !coverage.has(entry),
273
272
  );
274
273
  const blockers = projected.flatMap((entry) => entry.report.blockers);
@@ -276,7 +275,7 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
276
275
  if (receipts.some((entry) => !entry.detected))
277
276
  blockers.push(stop("fault-injection-undetected"));
278
277
  const body = {
279
- schema: V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT,
278
+ schema: DELIVERY_WARRANT_SEMANTIC_DIFF_REPORT_CONTRACT,
280
279
  authority: "typescript-v3",
281
280
  rustAuthority: "none",
282
281
  rustEffects: "disabled",
@@ -286,14 +285,14 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
286
285
  ).toISOString(),
287
286
  sources: options.sources,
288
287
  contracts: {
289
- trace: V4_DELIVERY_WARRANT_TRACE_CONTRACT,
290
- projection: V4_DELIVERY_WARRANT_PROJECTION_CONTRACT,
291
- observation: V4_DELIVERY_WARRANT_SHADOW_OBSERVATION_CONTRACT,
292
- runner: V4_DELIVERY_WARRANT_RUNNER_CONTRACT,
288
+ trace: DELIVERY_WARRANT_TRACE_CONTRACT,
289
+ projection: DELIVERY_WARRANT_PROJECTION_CONTRACT,
290
+ observation: DELIVERY_WARRANT_SHADOW_OBSERVATION_CONTRACT,
291
+ runner: DELIVERY_WARRANT_RUNNER_CONTRACT,
293
292
  ...options.contracts,
294
293
  },
295
294
  coverage: {
296
- required: [...V4_DELIVERY_WARRANT_SEMANTIC_DIFF_REQUIRED_COVERAGE],
295
+ required: [...DELIVERY_WARRANT_SEMANTIC_DIFF_REQUIRED_COVERAGE],
297
296
  observed: [...coverage].sort(),
298
297
  missing,
299
298
  },
@@ -316,12 +315,12 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
316
315
  };
317
316
  let retention = {
318
317
  status: "failed",
319
- evidenceRoot: v4ContentRoot("semantic-diff", body),
318
+ evidenceRoot: domainContentRoot("semantic-diff", body),
320
319
  receiptRoot: null,
321
320
  };
322
321
  try {
323
322
  const receipt = await options.retain?.(structuredClone(body));
324
- validateV4Root(receipt?.receiptRoot);
323
+ validateRoot(receipt?.receiptRoot);
325
324
  retention = {
326
325
  ...retention,
327
326
  status: "retained",
@@ -348,5 +347,5 @@ export async function runV4DeliveryWarrantSemanticDiffGate(
348
347
  v4WriteAuthorized: false,
349
348
  },
350
349
  };
351
- return { ...report, reportRoot: v4ContentRoot("semantic-diff", report) };
350
+ return { ...report, reportRoot: domainContentRoot("semantic-diff", report) };
352
351
  }