@kungfu-tech/buildchain 3.0.9-alpha.9 → 4.0.0-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 (262) hide show
  1. package/AGENTS.md +39 -0
  2. package/README.md +17 -13
  3. package/actions/promote-buildchain-ref/README.md +0 -10
  4. package/actions/release-tail/README.md +6 -10
  5. package/architecture/internal-capabilities.json +502 -0
  6. package/architecture/maintainability-baseline.json +59 -0
  7. package/architecture/maintainability-policy.json +1384 -0
  8. package/architecture/release-tail-contract-inventory.json +587 -0
  9. package/architecture/v3-core-mechanism-inventory.json +1043 -0
  10. package/architecture/v3-core-mechanism-inventory.md +67 -0
  11. package/architecture/v4-adopter-delivery-parity.json +47 -0
  12. package/architecture/v4-architecture-constitution.md +210 -0
  13. package/architecture/v4-bootstrap-authority.json +56 -0
  14. package/architecture/v4-canonical-contract-fixtures.json +105 -0
  15. package/architecture/v4-capability-state-machine-manifest.json +480 -0
  16. package/architecture/v4-capability-state-machine-manifest.schema.json +202 -0
  17. package/architecture/v4-delivery-warrant-shadow-bootstrap-plan.json +830 -0
  18. package/architecture/v4-delivery-warrant-shadow-bootstrap-plan.md +223 -0
  19. package/architecture/v4-delivery-warrant-shadow-bootstrap-plan.schema.json +318 -0
  20. package/architecture/v4-delivery-warrant-shadow-fixtures.json +227 -0
  21. package/architecture/v4-delivery-warrant-shadow-fixtures.schema.json +67 -0
  22. package/architecture/v4-exception-ledger.json +5 -0
  23. package/architecture/v4-exception-ledger.schema.json +56 -0
  24. package/architecture/v4-partial-mutation-recovery-qualification.json +65 -0
  25. package/architecture/v4-platform-stage-checkpoints.json +97 -0
  26. package/architecture/v4-provider-operation-journal-contract.json +113 -0
  27. package/architecture/v4-release-activation-shadow-domain.json +61 -0
  28. package/architecture/v4-release-train-parity.json +68 -0
  29. package/architecture/v4-rust-libnode-bridge-evaluation.json +107 -0
  30. package/architecture/v4-rust-libnode-bridge-spike.md +85 -0
  31. package/architecture/v4-stable-publication-fence.json +66 -0
  32. package/architecture/v4-stage-capsule-contract.json +90 -0
  33. package/architecture/v4-stage-capsule-qualification.json +99 -0
  34. package/architecture/v4-stage-capsule-resume-planner.json +52 -0
  35. package/architecture/v4-stage-capsule-store-contract.json +72 -0
  36. package/bin/buildchain.mjs +15 -10
  37. package/contracts/auditable-demo-scenario-v1.schema.json +1 -1
  38. package/contracts/buildchain-v2-residuals-v1.json +2 -2
  39. package/contracts/fixtures/v4-delivery-warrant-trace-v1/golden.json +158 -0
  40. package/contracts/fixtures/v4-delivery-warrant-trace-v1/property.json +380 -0
  41. package/contracts/fixtures/v4-delivery-warrant-trace-v1/replay.json +163 -0
  42. package/contracts/fixtures/v4-partial-mutation-recovery-v1/shared.json +155 -0
  43. package/contracts/fixtures/v4-provider-operation-journal-v1/shared.json +457 -0
  44. package/contracts/fixtures/v4-provider-readback-idempotency-v1/shared.json +682 -0
  45. package/contracts/fixtures/v4-release-activation-shadow-v1/shared.json +53 -0
  46. package/contracts/fixtures/v4-stable-publication-fence-v1/shared.json +56 -0
  47. package/contracts/fixtures/v4-stage-capsule-resume-v1/late-platform-failure.json +176 -0
  48. package/contracts/fixtures/v4-stage-capsule-store-v1/shared.json +132 -0
  49. package/contracts/fixtures/v4-stage-capsule-v1/shared.json +111 -0
  50. package/contracts/v4-canonical-contracts-v1.schema.json +182 -0
  51. package/contracts/v4-delivery-warrant-semantic-diff-report-v1.schema.json +284 -0
  52. package/contracts/v4-delivery-warrant-trace-v1.schema.json +215 -0
  53. package/contracts/v4-host-contract-v1.schema.json +135 -0
  54. package/contracts/v4-partial-mutation-recovery-v1.schema.json +168 -0
  55. package/contracts/v4-provider-operation-journal-v1.schema.json +381 -0
  56. package/contracts/v4-release-activation-shadow-v1.schema.json +186 -0
  57. package/contracts/v4-stable-publication-fence-v1.schema.json +125 -0
  58. package/contracts/v4-stage-capsule-resume-v1.schema.json +225 -0
  59. package/contracts/v4-stage-capsule-store-v1.schema.json +154 -0
  60. package/contracts/v4-stage-capsule-v1.schema.json +178 -0
  61. package/crates/buildchain-v4-bridge/Cargo.lock +213 -0
  62. package/crates/buildchain-v4-bridge/Cargo.toml +12 -0
  63. package/crates/buildchain-v4-bridge/src/main.rs +495 -0
  64. package/dist/site/agent-index.json +0 -4
  65. package/dist/site/artifact-schemas.json +0 -8
  66. package/dist/site/buildchain-contract.json +103 -397
  67. package/dist/site/buildchain-site.json +302 -386
  68. package/dist/site/capability-registry.json +9 -11
  69. package/dist/site/cli-registry.json +8 -53
  70. package/dist/site/controller-registry.json +48 -8
  71. package/dist/site/kfd-claims.json +129 -167
  72. package/dist/site/kfd-upstream-aggregate.json +9 -9
  73. package/dist/site/manual-registry.json +18 -49
  74. package/dist/site/node-api-registry.json +4345 -7345
  75. package/dist/site/page-registry.json +278 -346
  76. package/dist/site/public-surface-audit.json +85 -404
  77. package/dist/site/publication-authority-registry.json +11 -1
  78. package/dist/site/publication-registry.json +4 -4
  79. package/dist/site/release-provenance.json +3 -9
  80. package/dist/site/schemas/kfd-support-projection-v1.schema.json +106 -0
  81. package/dist/site/site-manifest.json +22 -38
  82. package/dist/site/workflow-registry.json +78 -35
  83. package/docs/MAP.md +8 -5
  84. package/docs/auditable-demo.md +2 -2
  85. package/docs/aws-us-elastic-runner-burst-plane.md +7 -59
  86. package/docs/cli-reference.md +15 -213
  87. package/docs/cli.md +14 -14
  88. package/docs/dev-alpha-candidate-patrol.md +3 -11
  89. package/docs/dev-delivery-warrant.md +29 -194
  90. package/docs/engineering-housekeeper.md +12 -4
  91. package/docs/getting-started.md +1 -1
  92. package/docs/install.md +5 -5
  93. package/docs/kfd-support.md +2 -7
  94. package/docs/lifecycle-protocol.md +2 -4
  95. package/docs/node-api-reference.md +414 -554
  96. package/docs/release-flow.md +31 -31
  97. package/docs/release-governance.md +16 -28
  98. package/docs/release-passport.md +2 -15
  99. package/docs/release-tail-contract.md +13 -6
  100. package/docs/release-tail-provider-plane.md +13 -19
  101. package/docs/release-train.md +4 -4
  102. package/docs/reusable-build-surface.md +14 -27
  103. package/docs/site-bundle-contract.md +1 -5
  104. package/docs/stable-candidate-patrol.md +7 -7
  105. package/docs/v4-canonical-contracts.md +92 -0
  106. package/docs/v4-delivery-warrant-read-candidate.md +73 -0
  107. package/docs/v4-delivery-warrant-semantic-diff.md +75 -0
  108. package/docs/v4-production-release.md +63 -0
  109. package/docs/v4-stage-capsule.md +193 -0
  110. package/docs/versioning.md +3 -5
  111. package/package.json +19 -19
  112. package/packages/core/adopter-delivery-gate.js +576 -0
  113. package/packages/core/adopter-delivery-json.js +66 -0
  114. package/packages/core/artifact-signing.js +0 -61
  115. package/packages/core/artifact-verification-envelope.js +5 -5
  116. package/packages/core/build-facts.js +12 -4
  117. package/packages/core/buildchain-agent-manuals.js +0 -2
  118. package/packages/core/buildchain-channel-identity.js +3 -2
  119. package/packages/core/buildchain-config.js +4 -69
  120. package/packages/core/buildchain-contract.js +232 -46
  121. package/packages/core/buildchain-kfd-claims.js +1 -1
  122. package/packages/core/channel-candidate.js +0 -8
  123. package/packages/core/channel-promotion-baseline.js +0 -52
  124. package/packages/core/controller-evidence.js +3 -4
  125. package/packages/core/dev-alpha-candidate-selection.js +2 -10
  126. package/packages/core/dev-delivery-warrant-cancellation.js +0 -1
  127. package/packages/core/dev-delivery-warrant-settlement.js +20 -67
  128. package/packages/core/dev-delivery-warrant.js +50 -138
  129. package/packages/core/diagnostics.js +3 -8
  130. package/packages/core/github-governance-authority.js +3 -1
  131. package/packages/core/kfd-adopter-category-driver.js +167 -0
  132. package/packages/core/kfd-adopter-manifest.js +47 -46
  133. package/packages/core/kfd-gate.js +15 -45
  134. package/packages/core/paper-agent-entry.js +7 -16
  135. package/packages/core/paper-fleet.js +2 -2
  136. package/packages/core/paper-repository.js +2 -3
  137. package/packages/core/paper-scaffold-content.js +2 -23
  138. package/packages/core/paper.js +11 -43
  139. package/packages/core/publication-reproducibility.js +4 -4
  140. package/packages/core/release-line-bootstrap.js +21 -8
  141. package/packages/core/release-passport-contract.js +5 -5
  142. package/packages/core/release-passport.js +20 -131
  143. package/packages/core/self-dogfood-version.js +48 -35
  144. package/packages/core/spawn-command.js +232 -8
  145. package/packages/core/v4-adopter-delivery-parity.js +219 -0
  146. package/packages/core/v4-canonical-contracts.js +284 -0
  147. package/packages/core/v4-delivery-warrant-fixture-runner.js +371 -0
  148. package/packages/core/v4-delivery-warrant-read-candidate.js +279 -0
  149. package/packages/core/v4-delivery-warrant-semantic-diff-gate.js +352 -0
  150. package/packages/core/v4-delivery-warrant-shadow-adapter.js +447 -0
  151. package/packages/core/v4-partial-mutation-recovery-qualification.js +395 -0
  152. package/packages/core/v4-platform-stage-checkpoints.js +471 -0
  153. package/packages/core/v4-provider-operation-journal.js +531 -0
  154. package/packages/core/v4-provider-readback-idempotency.js +394 -0
  155. package/packages/core/v4-release-activation-shadow.js +519 -0
  156. package/packages/core/v4-stable-publication-fence.js +357 -0
  157. package/packages/core/v4-stage-capsule-local-store.js +426 -0
  158. package/packages/core/v4-stage-capsule-qualification-campaign.js +512 -0
  159. package/packages/core/v4-stage-capsule-qualification.js +456 -0
  160. package/packages/core/v4-stage-capsule-resume-planner.js +397 -0
  161. package/packages/core/v4-stage-capsule-store.js +401 -0
  162. package/packages/core/v4-stage-capsule.js +319 -0
  163. package/scripts/assemble-self-publication-admission.mjs +1 -1
  164. package/scripts/audit-publication-control-plane.mjs +5 -5
  165. package/scripts/auditable-demo-bundle-verification.mjs +3 -2
  166. package/scripts/auditable-demo-platform.mjs +2 -2
  167. package/scripts/auditable-demo-renditions.mjs +1 -1
  168. package/scripts/auditable-demo.mjs +2 -2
  169. package/scripts/aws-macos-jit-controller-core.mjs +13 -346
  170. package/scripts/aws-macos-jit-controller-runtime.mjs +2 -210
  171. package/scripts/aws-macos-jit-controller.mjs +37 -275
  172. package/scripts/aws-macos-jit-core.mjs +3 -41
  173. package/scripts/aws-macos-jit.mjs +0 -12
  174. package/scripts/aws-windows-jit-campaign.mjs +2 -2
  175. package/scripts/aws-windows-jit-controller-core.mjs +1 -1
  176. package/scripts/aws-windows-jit-controller.mjs +3 -3
  177. package/scripts/build-contract-core.mjs +3 -8
  178. package/scripts/build-standalone-binary.mjs +3 -14
  179. package/scripts/buildchain-channel-router.mjs +4 -0
  180. package/scripts/buildchain-cli-help.mjs +7 -16
  181. package/scripts/buildchain-contract-lock.mjs +0 -6
  182. package/scripts/check-action-bundles.mjs +3 -4
  183. package/scripts/check-internal-architecture.mjs +7 -6
  184. package/scripts/check-inventory.mjs +30 -25
  185. package/scripts/check-v4-public-dogfood-contract.mjs +270 -0
  186. package/scripts/create-release-bundle.mjs +8 -4
  187. package/scripts/dev-alpha-candidate-patrol.mjs +1 -22
  188. package/scripts/dev-delivery-proof.mjs +2 -64
  189. package/scripts/dev-delivery-warrant.mjs +61 -86
  190. package/scripts/dev-pr-auto-merge.mjs +4 -30
  191. package/scripts/dev-pr-delivery-warrant.mjs +0 -55
  192. package/scripts/dispatch-artifact-signing-authority.mjs +7 -4
  193. package/scripts/generate-buildchain-kfd-witnesses.mjs +94 -88
  194. package/scripts/generate-channel-build-workflow.mjs +54 -24
  195. package/scripts/generate-channel-promotion-workflow.mjs +15 -6
  196. package/scripts/generate-site-bundle.mjs +8 -27
  197. package/scripts/git-fetch-process-tree.mjs +34 -1
  198. package/scripts/init-repo.mjs +64 -159
  199. package/scripts/inspect-artifact-signing-requests.mjs +0 -6
  200. package/scripts/locked-source-checkout.mjs +3 -4
  201. package/scripts/maintainability-metrics.mjs +8 -2
  202. package/scripts/npm-publish-dry-run.mjs +2 -2
  203. package/scripts/npm-publish-transaction.mjs +2 -2
  204. package/scripts/publication-commit-evidence.mjs +23 -69
  205. package/scripts/release-candidate-resolver.mjs +11 -17
  206. package/scripts/release-tail.mjs +3 -49
  207. package/scripts/resume-from-candidate-run.mjs +9 -123
  208. package/scripts/run-lifecycle-core.mjs +12 -13
  209. package/scripts/seal-artifact-signing-requests.mjs +17 -21
  210. package/scripts/site-capability-metadata.mjs +3 -20
  211. package/scripts/stable-candidate-qualification.mjs +10 -10
  212. package/scripts/v4-architecture.mjs +12 -2
  213. package/scripts/v4-bridge-bootstrap.mjs +141 -0
  214. package/scripts/v4-bridge-evidence.mjs +141 -0
  215. package/scripts/v4-host-adapter.mjs +182 -0
  216. package/scripts/v4-platform-stage-checkpoint-rehearsal.mjs +207 -0
  217. package/scripts/v4-stage-capsule-qualification.mjs +528 -0
  218. package/scripts/v4-stage-capsule-resume-rehearsal.mjs +57 -0
  219. package/scripts/v4-warrant-shadow-plan.mjs +601 -0
  220. package/scripts/verify-golden-path.mjs +5 -5
  221. package/scripts/web-surface-cloudfront-rewrite.mjs +15 -15
  222. package/scripts/web-surface-core.mjs +2 -8
  223. package/scripts/workflow-call-contract.mjs +5 -184
  224. package/contracts/dev-delivery-authority-v2.schema.json +0 -253
  225. package/contracts/fixtures/kfd-adopter-release-v1/kfd-4-perspective.json +0 -16
  226. package/contracts/fixtures/kfd-adopter-release-v1/kfd-4-replay.json +0 -57
  227. package/contracts/fixtures/next-development-transition-v1/anchored-manual-waiting.json +0 -47
  228. package/contracts/fixtures/next-development-transition-v1/semver-auto-planned.json +0 -47
  229. package/contracts/fixtures/next-development-transition-v1/version-model-cases.json +0 -40
  230. package/contracts/next-development-request-v1.schema.json +0 -66
  231. package/contracts/next-development-transition-v1.schema.json +0 -292
  232. package/contracts/publication-rehearsal-capsule-v1.schema.json +0 -173
  233. package/dist/site/schemas/dev-delivery-authority-v2.schema.json +0 -442
  234. package/dist/site/schemas/publication-rehearsal-capsule-v1.schema.json +0 -269
  235. package/dist/site/schemas/release-tail-capabilities-v1.schema.json +0 -353
  236. package/dist/site/schemas/release-tail-provider-bindings-v1.schema.json +0 -94
  237. package/docs/dev-delivery-qualification-landing-adr.md +0 -137
  238. package/docs/next-development-transition.md +0 -119
  239. package/docs/publication-rehearsal.md +0 -94
  240. package/packages/core/buildchain-compatibility-proof.js +0 -631
  241. package/packages/core/dev-delivery-authority.js +0 -996
  242. package/packages/core/dev-delivery-native-proof.js +0 -418
  243. package/packages/core/dev-delivery-warrant-shadow.js +0 -502
  244. package/packages/core/next-development-candidate-reservation.js +0 -186
  245. package/packages/core/next-development-controller.js +0 -726
  246. package/packages/core/next-development-projection.js +0 -288
  247. package/packages/core/next-development-transition.js +0 -738
  248. package/packages/core/publication-rehearsal-projection.js +0 -173
  249. package/packages/core/publication-rehearsal-runtime.js +0 -921
  250. package/scripts/aws-macos-jit-instance-rehydrate.mjs +0 -260
  251. package/scripts/aws-macos-jit-source-rebind.mjs +0 -724
  252. package/scripts/dev-delivery-authority.mjs +0 -368
  253. package/scripts/dev-delivery-native-run.mjs +0 -235
  254. package/scripts/dev-delivery-two-phase-resume.mjs +0 -90
  255. package/scripts/dev-delivery-two-phase.mjs +0 -577
  256. package/scripts/generate-next-development-guidance.mjs +0 -49
  257. package/scripts/materialize-self-release-candidate-version.mjs +0 -137
  258. package/scripts/next-development-self-dogfood-harness.mjs +0 -409
  259. package/scripts/next-development-self-dogfood.mjs +0 -532
  260. package/scripts/next-development-transition.mjs +0 -47
  261. package/scripts/release-candidate-tail-reseal.mjs +0 -426
  262. package/templates/native-dev-delivery.yml +0 -86
@@ -0,0 +1,67 @@
1
+ ---
2
+ status: draft
3
+ period: 2026-08-05
4
+ theme: buildchain-v4-core-mechanism-inventory
5
+ doc_type: analysis
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: internal
9
+ evidence_grade: A
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-08-06
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-08-06
16
+ boundary: Based only on visible repository sources, tests, generated registries, and exact-head Git metadata.
17
+ ---
18
+
19
+ # v3 Core Mechanism Inventory
20
+
21
+ This is the human projection of
22
+ [`v3-core-mechanism-inventory.json`](v3-core-mechanism-inventory.json).
23
+ The JSON inventory is authoritative and validated by
24
+ `scripts/check-core-mechanism-inventory.mjs`.
25
+
26
+ The exact `dev/v3/v3.0` cut is commit
27
+ `e6d6ecd6204518298898962f01aba5d73ed70b60`, tree
28
+ `26c8476dcc63d1b8cf9b32fe12ffbf3ee52246cf`. It contains 275
29
+ hand-maintained source files, 104,953 source lines, 64 workflows, 225 internal
30
+ dependency edges, and zero dependency cycles. These numbers constrain migration
31
+ drift; they do not prove semantic correctness.
32
+
33
+ ## Authority map
34
+
35
+ | Mechanism | Current authority and durable state | v4 disposition |
36
+ | --------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------- |
37
+ | Dev Delivery Warrant | Rooted queue on a selected Git ref; leased candidate admission | Rust authority with compatibility projection |
38
+ | Release Candidate Passport | Immutable candidate workflow artifacts and Passport root | Preserve schema and byte semantics |
39
+ | Candidate Recovery | Original artifacts plus immutable recovery receipt | Port verifier first; preserve no-rebuild invariant |
40
+ | Stable Candidate Ledger | Rooted ledger on `ledger-ref` | Preserve contract; select store authority explicitly |
41
+ | Publish Transaction | Version state Git ref, local state projection, sealed evidence | Primary Rust transaction authority with v3 reader |
42
+ | Release Activation | Ordered six-phase transaction and receipt set | Port state machine and receipts together |
43
+ | Publication Authority | Authority registry, admission, gate, provenance and qualification receipts | Rust primary authority; preserve JSON contracts |
44
+ | GitHub Governance | Provider policy snapshot, CODEOWNERS, rulesets and receipt | Separate provider policy adapter |
45
+ | Passport and Artifact Proof | `buildchain.release.json`, evidence, locators and verification reports | Preserve public schemas and verifier semantics |
46
+ | Propagation Work Control | Rooted Work, stage receipts, recovery cursor and family authority | Reuse as v4 orchestration boundary |
47
+
48
+ ## Boundary
49
+
50
+ This inventory does not choose the v4 store, provider adapter, bridge ABI, or
51
+ migration sequence. It records those as unresolved per mechanism. It also does
52
+ not change v3 behavior: the only executable addition validates the inventory
53
+ against current files and generated/package public-surface registries.
54
+
55
+ The reverse scan includes workflows, actions, the CLI command registry, package
56
+ and Node exports, tests, generated references, and Git-ref-backed stores. A
57
+ missing coordinate, absent public surface, empty evidence dimension, or
58
+ ambiguous source owner fails the check instead of becoming an implicit v4
59
+ assumption.
60
+
61
+ The executable scan walks 13 declared discovery rules against the repository,
62
+ not only against the paths already listed in the inventory. It currently owns
63
+ 50 exact source coordinates, independently rediscovers 38 state-bearing
64
+ authority coordinates, validates 39 public surfaces across action, CLI, Node
65
+ export, and workflow registries, and checks three concrete Git-ref store
66
+ markers. A newly matching split state-machine or authority file therefore
67
+ fails as an orphan until the inventory gives it one mechanism owner.
@@ -0,0 +1,47 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "contract": "kungfu-buildchain-v4-adopter-delivery-parity-plan",
4
+ "sourceAuthority": {
5
+ "branch": "dev/v3/v3.0",
6
+ "commit": "c3f58d76391c1c6ceddfc900a68e91c7ab82a575",
7
+ "vectorSuiteRoot": "sha256:cf329805d928a9883cbafbdfdf21ef66c6a0889ed8dfe14356b4e0d25d6738f9",
8
+ "kfdPackage": "@kungfu-tech/kfd@1.0.0-alpha.62"
9
+ },
10
+ "target": {
11
+ "branch": "dev/v4/v4.0",
12
+ "baseline": "3079091f770ce9fdca950e106259e34e5171f763",
13
+ "mode": "effect-disabled",
14
+ "productionWriterAuthority": false
15
+ },
16
+ "vectors": [
17
+ {
18
+ "id": "golden-two-driver-offline-replay",
19
+ "mode": "gate-core-parity"
20
+ },
21
+ {
22
+ "id": "negative-driver-mismatch",
23
+ "mode": "gate-core-parity"
24
+ },
25
+ {
26
+ "id": "negative-category-conflict",
27
+ "mode": "published-kfd-driver-parity"
28
+ },
29
+ {
30
+ "id": "negative-evidence-substitution",
31
+ "mode": "retained-v3-release-passport-boundary"
32
+ },
33
+ {
34
+ "id": "negative-stale-package-cut",
35
+ "mode": "published-kfd-driver-parity"
36
+ },
37
+ {
38
+ "id": "fault-driver-throw",
39
+ "mode": "gate-core-parity"
40
+ }
41
+ ],
42
+ "nonClaims": [
43
+ "The Rust projection has no provider, credential, release, signing or production-writer authority.",
44
+ "KFD semantics are evaluated only by exact published KFD bytes before the effect-disabled carrier projection.",
45
+ "Release Passport evidence substitution remains on the protected v3 boundary and is not reimplemented as a v4 writer."
46
+ ]
47
+ }
@@ -0,0 +1,210 @@
1
+ ---
2
+ status: draft
3
+ period: 2026-08-07
4
+ theme: buildchain-v4-architecture-constitution
5
+ doc_type: architecture-constitution
6
+ source_level: local-files + protected-git-evidence
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: self-reviewed
11
+ last_reviewed: 2026-08-13
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-08-07
16
+ boundary: Derived from the exact v3 mechanism inventory, retained v4 qualification evidence, and visible repository contracts; provider credentials and private provider state were not read.
17
+ ---
18
+
19
+ # Buildchain v4 Architecture Constitution
20
+
21
+ This constitution governs the `dev/v4/v4.0` release line. The executable
22
+ authority is [`v4-capability-state-machine-manifest.json`](v4-capability-state-machine-manifest.json),
23
+ validated by `buildchain architecture validate`. This document explains that
24
+ contract; it cannot override it.
25
+
26
+ ## 1. Release-line authority
27
+
28
+ The first v4 line was created from the exact protected v3 merge that contains
29
+ this constitution and
30
+ [`v4-bootstrap-authority.json`](v4-bootstrap-authority.json). The exact source,
31
+ bootstrap revision, N-1 qualification, protection, and merge-queue evidence are
32
+ recorded there under the state `qualified-protected-v4-bootstrap`; a local
33
+ branch or unrecorded candidate commit is not release-line authority.
34
+
35
+ Later v4 candidates are qualified by an exact N-1 Git revision. The verifier
36
+ loads the authority files with `git show <authority-revision>:<path>` and rejects
37
+ an authority revision equal to the candidate revision. A candidate therefore
38
+ cannot qualify itself by editing its own manifest, ceilings, or exception
39
+ ledger.
40
+
41
+ ## 2. Dependency direction
42
+
43
+ Dependencies point inward only:
44
+
45
+ ```text
46
+ workflows -> TypeScript adapters -> libnode host -> Rust domain -> contracts
47
+ legacy compatibility -> TypeScript adapters / contracts
48
+ ```
49
+
50
+ Contracts contain serialization and compatibility facts, not provider SDK
51
+ types. Rust domain code contains semantic state transitions, not GitHub, npm,
52
+ filesystem, credential, or workflow adapters. Provider SDK imports in contracts
53
+ or Rust domain are hard-zero violations. Cycles are forbidden.
54
+
55
+ ## 3. Single-writer rule
56
+
57
+ Every state machine has exactly one authoritative writer. The v4 cutover marks
58
+ the TypeScript v4 control and provider plane authoritative and the legacy v3
59
+ writer retired. Rust v4 owns the deterministic release-activation, journal,
60
+ stable-fence, and recovery domain semantics while the TypeScript v4 adapter
61
+ remains byte-equivalent at that boundary. A second writer, permanent dual
62
+ write, cross-machine mutable file, or implicit compatibility authority has a
63
+ hard-zero budget.
64
+
65
+ ## 4. Explicit complexity budgets
66
+
67
+ Complexity is governed by independent dimensions: authority, semantic state,
68
+ boundary, structural, Agent cognitive, and recovery/fault. There is no
69
+ aggregate score, so a favorable metric cannot cancel an authority or recovery
70
+ violation. Every delta is reported by dimension.
71
+
72
+ Hard-zero ceilings cannot be raised by a candidate. A non-zero temporary
73
+ exception must already exist in the N-1 authority ledger and name its owner,
74
+ scope, evidence, expiry, removal condition, and budget dimension. Expired,
75
+ ownerless, broadened, or candidate-created exceptions fail qualification.
76
+
77
+ ## 5. Manifest and projection
78
+
79
+ The manifest declares capability ownership and every governed state machine's
80
+ writer, schemas, store, states, events, invariants, effects, adapters, tests,
81
+ migration phase, recovery policy, and budgets. `architecture list` and
82
+ `architecture show` are generated directly from the validated manifest; no
83
+ second hand-maintained architecture list is authoritative.
84
+
85
+ ## 6. Production cutover boundary
86
+
87
+ The v4 line owns Delivery Warrant, Release Transaction, activation,
88
+ publication, propagation, and release-tail state. This does not introduce a
89
+ daemon, a service database, provider SDKs in contracts or Rust domain code, or
90
+ a second writer. The retained `release/v3/v3.0` coordinate is rollback evidence
91
+ only and cannot regain production authority without a new reviewed cutover.
92
+
93
+ ## 7. Wave 0 host boundary
94
+
95
+ The bounded Rust/libnode bridge spike is recorded in
96
+ [`v4-rust-libnode-bridge-spike.md`](v4-rust-libnode-bridge-spike.md). Wave 0
97
+ uses a replaceable subprocess host behind a closed byte-oriented contract; the
98
+ Rust trunk owns process lifecycle and transport, while existing TypeScript
99
+ remains the only production writer. This selection is evidence for later
100
+ qualification, not a final ABI or consumer migration.
101
+
102
+ ## 8. Wave 2 Stage Capsule contract
103
+
104
+ The executable Stage Capsule architecture contract is
105
+ [`v4-stage-capsule-contract.json`](v4-stage-capsule-contract.json). It fixes one
106
+ schema authority, one TypeScript v3 writer, validation-only Rust, and zero
107
+ provider imports or production write-authority changes. Identity, retention
108
+ promise, current availability, qualification, content roots, and rooted
109
+ transport observations remain distinct. Later store, checkpoint, resume, and
110
+ reconciliation work must consume this contract rather than create competing
111
+ identity or writer authority.
112
+
113
+ The successor storage slice is governed by
114
+ [`v4-stage-capsule-store-contract.json`](v4-stage-capsule-store-contract.json).
115
+ It adds provider-neutral output-manifest, retention-state, transport, and store
116
+ receipt roots plus a deterministic no-network local filesystem reference
117
+ store. GitHub Artifact and S3-compatible adapters remain effect-disabled or
118
+ fixture-backed. Provider locations, retention promises, observed availability,
119
+ and qualification evidence stay separate facts; none becomes Capsule identity,
120
+ qualification authority, or a production writer.
121
+
122
+ Final Wave 2 qualification is governed by
123
+ [`v4-stage-capsule-qualification.json`](v4-stage-capsule-qualification.json).
124
+ It consumes the existing Capsule, store, checkpoint, and resume authorities for
125
+ six real-runner shadow campaigns and one exact terminal reconciliation. A
126
+ qualification root is evidence only: TypeScript v3 remains production
127
+ authority, retained state is non-destructive, and production reuse, provider
128
+ effects, release effects, and public cutover remain outside this transition.
129
+
130
+ ## 9. Wave 3 provider operation journal
131
+
132
+ The executable provider operation journal contract is
133
+ [`v4-provider-operation-journal-contract.json`](v4-provider-operation-journal-contract.json).
134
+ It freezes one closed schema authority and one Rust v4 state-fold authority
135
+ for append-only intent, attempt, rooted observation, confirmation, and
136
+ reconciliation records. The TypeScript v4 plane performs provider adaptation
137
+ and conformance projection against the same fixtures; v4 is the sole
138
+ production writer.
139
+
140
+ Logical operation identity excludes attempt ordinals and mutable provider or
141
+ runner facts. Every retry preserves `operationRoot`, while every attempt and
142
+ observation has a distinct causal entry root. The fold rejects impossible
143
+ transitions, non-append sequence, confirmation without successful rooted
144
+ observation, conflicting confirmation, reconciliation disagreement, and
145
+ authority-root escalation. Provider SDK imports, live mutations, production
146
+ write-authority changes, and v3 behavior changes retain hard-zero budgets.
147
+
148
+ GitHub release, npm publication, and OCI manifest readback adapters remain
149
+ fixture-backed and effect-disabled. They discard provider-shaped transport
150
+ fields at the boundary and emit only rooted, provider-neutral samples. Duplicate
151
+ and reordered samples fold by byte-sorted sample root into one journal
152
+ observation. Not-found and eventually-visible reads stay unknown; already
153
+ applied reads may become a successful observation, but no adapter may confirm
154
+ the operation or advance release state without independent journal
155
+ qualification. Conflicting, malformed, and root-mismatched evidence fails
156
+ closed with typed faults.
157
+
158
+ ## 10. Release activation production domain
159
+
160
+ The executable release activation boundary is
161
+ [`v4-release-activation-shadow-domain.json`](v4-release-activation-shadow-domain.json).
162
+ It consumes an explicit qualification root, dependency graph, compensation
163
+ boundaries, provider-operation identities, and append-only journal facts to
164
+ derive one deterministic activation plan and resume state. Rust is the sole v4
165
+ plan-and-fold authority; TypeScript must remain byte-equivalent against
166
+ the same closed schema and fixture.
167
+
168
+ Confirmed operations are never eligible for replay. Attempting, observed, and
169
+ confirmable operations require provider-neutral readback before any retry,
170
+ while planned or retryable operations become eligible only after every declared
171
+ dependency is confirmed. Missing qualification, dependency cycles, operation or
172
+ authority drift, conflicting event ordinals, and impossible journal transitions
173
+ fail closed. This pure domain performs no provider call itself; the TypeScript
174
+ v4 provider adapter may execute only exact eligible operations and must append
175
+ rooted readback before confirmation or retry.
176
+
177
+ ## 11. Stable publication production fence
178
+
179
+ The stable-candidate production publication boundary is governed by
180
+ [`v4-stable-publication-fence.json`](v4-stable-publication-fence.json). It
181
+ binds one exact candidate root to source, metadata, provider-operation journal,
182
+ protected ancestry, provider confirmations, and an independently sealed
183
+ qualification before a production publication plan can exist.
184
+
185
+ Candidate generation N cannot qualify itself. An N-1 policy requires the
186
+ immediately preceding authority generation; an independent-seal policy requires
187
+ a qualifier authority distinct from the publisher authority. Stable refs, npm
188
+ tags, OCI tags, and GitHub Releases remain exact target-shaped facts. The pure
189
+ fence authorizes the exact target count but performs no network or credential
190
+ operation itself; only the TypeScript v4 provider adapter may apply authorized
191
+ targets, and it must read them back before completion.
192
+
193
+ ## 12. Wave 3 partial-mutation recovery qualification
194
+
195
+ The executable recovery qualification boundary is
196
+ [`v4-partial-mutation-recovery-qualification.json`](v4-partial-mutation-recovery-qualification.json).
197
+ It consumes retained Stage Capsule resume evidence and release-activation journal
198
+ state only after exact source, policy, platform, qualification, plan, state,
199
+ operation, journal, and compensation-boundary roots agree.
200
+
201
+ Every nonterminal operation maps deterministically to `retry`, `wait`,
202
+ `reconcile`, `compensate`, or `escalate`; confirmed operations are permanent
203
+ `terminal-noop` facts and never re-enter the next-operation set. Missing,
204
+ expired, corrupt, conflicting, cross-boundary, or attempt-budget-exhausted
205
+ evidence fails closed at an exact Stage Capsule or provider-operation
206
+ checkpoint. The Rust domain is the sole v4 planner and TypeScript is a
207
+ byte-equivalent projection. Both are pure: they perform zero provider,
208
+ filesystem, network, credential, ref, package, image, or release mutation.
209
+ Their exact plan is the only recovery authority consumed by the TypeScript v4
210
+ provider adapter.
@@ -0,0 +1,56 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "contract": "kungfu-buildchain-v4-bootstrap-authority",
4
+ "releaseLine": {
5
+ "candidateBranch": "dev/v4/v4.0",
6
+ "sourceBranch": "dev/v3/v3.0",
7
+ "sourceCommit": "b9fbfd9d6ee909ee3a8c4bd6116e7ddafd7b05e1",
8
+ "sourceTree": "20abc99c7fb11f1ad63eb11be7c5bef3172abec1",
9
+ "bootstrapCommit": "d827bb223e4b78551feed69827f3e67839821171",
10
+ "bootstrapTree": "6d52d21f25a65b09cb9b344c7dffea192ff5b1d9",
11
+ "status": "qualified-protected-v4-bootstrap"
12
+ },
13
+ "qualification": {
14
+ "schemaVersion": 1,
15
+ "contract": "kungfu-buildchain-v4-n-minus-one-qualification",
16
+ "authorityRevision": "b9fbfd9d6ee909ee3a8c4bd6116e7ddafd7b05e1",
17
+ "candidateRevision": "d827bb223e4b78551feed69827f3e67839821171",
18
+ "qualificationRoot": "sha256:ea58bf84bd8ba32d0d7931328a2209f937bd3b81d3215b27f2ca67abc704a673",
19
+ "candidateSelfQualified": false,
20
+ "frozenManifestFields": 4,
21
+ "activeExceptions": 0,
22
+ "protectedDelivery": {
23
+ "pullRequest": 2408,
24
+ "mergeGroupHead": "b9fbfd9d6ee909ee3a8c4bd6116e7ddafd7b05e1",
25
+ "requiredCheck": "check",
26
+ "requiredCheckRun": 31134446779
27
+ },
28
+ "releaseLineCreation": {
29
+ "dryRun": 31140240480,
30
+ "applyRun": 31140281203,
31
+ "applyRunOutcome": "refs-created-protection-completed-by-exact-reconcile",
32
+ "devMergeQueueRuleset": 20536161,
33
+ "defaultBranch": "dev/v3/v3.0",
34
+ "alphaPullRequestCreated": false
35
+ },
36
+ "verifiedAt": "2026-08-07T02:20:03Z"
37
+ },
38
+ "authorityFiles": [
39
+ "architecture/v4-bootstrap-authority.json",
40
+ "architecture/v4-capability-state-machine-manifest.json",
41
+ "architecture/v4-exception-ledger.json"
42
+ ],
43
+ "bootstrapRule": {
44
+ "authorityRevision": "the exact protected dev/v3/v3.0 merge containing this contract",
45
+ "candidateRevision": "the exact dev/v4/v4.0 candidate revision",
46
+ "requiredRelationship": "candidate descends from authority revision",
47
+ "selfQualification": "forbidden",
48
+ "fallback": "dev/v3/v3.0 remains production and bootstrap authority"
49
+ },
50
+ "handoffRule": {
51
+ "condition": "a protected v4 release has passed N-1 qualification, recovery, independent review, and exact readback",
52
+ "nextAuthority": "the exact prior qualified protected v4 revision",
53
+ "candidateMayWidenCeilings": false,
54
+ "candidateMayCreateQualificationExceptions": false
55
+ }
56
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "contract": "buildchain-v4-canonical-contract-fixtures",
4
+ "canonicalization": "buildchain-canonical-json/v1",
5
+ "rootConstruction": "sha256(domain + NUL + canonical-bytes)",
6
+ "validCases": [
7
+ {
8
+ "id": "ascii-key-order",
9
+ "domain": "queue-state",
10
+ "clock": "2026-08-07T15:00:00.000Z",
11
+ "value": { "z": 1, "a": 2, "A": [true, null] },
12
+ "expectedCanonicalUtf8": "{\"A\":[true,null],\"a\":2,\"z\":1}\n",
13
+ "expectedRoot": "sha256:55693e621e85b454876b11af9842c106ab7eb7ab92c6ca5ea7fa498ea6cf74f4"
14
+ },
15
+ {
16
+ "id": "utf8-string-and-escapes",
17
+ "domain": "observation",
18
+ "clock": "2024-02-29T23:59:59.999Z",
19
+ "value": { "line": "一行\\n二行", "quote": "\\\"", "slash": "/" },
20
+ "expectedCanonicalUtf8": "{\"line\":\"一行\\\\n二行\",\"quote\":\"\\\\\\\"\",\"slash\":\"/\"}\n",
21
+ "expectedRoot": "sha256:54a49dcafaac0e3e480c9fb63ff50a976490a5cf467cb2c34fb0ec02e2d16afd"
22
+ },
23
+ {
24
+ "id": "safe-integer-boundaries",
25
+ "domain": "transition-receipt",
26
+ "clock": "2000-02-29T00:00:00.000Z",
27
+ "value": { "maximum": 9007199254740991, "minimum": -9007199254740991 },
28
+ "expectedCanonicalUtf8": "{\"maximum\":9007199254740991,\"minimum\":-9007199254740991}\n",
29
+ "expectedRoot": "sha256:52f61241c03d451b7568a704c502eac50e12ef53717ee49f4a89109e65bc6b8c"
30
+ }
31
+ ],
32
+ "invalidCases": [
33
+ {
34
+ "id": "fractional-number",
35
+ "kind": "canonical",
36
+ "value": 1.5,
37
+ "fault": "unsupported-number"
38
+ },
39
+ {
40
+ "id": "unsafe-integer",
41
+ "kind": "canonical",
42
+ "value": 9007199254740992,
43
+ "fault": "unsupported-number"
44
+ },
45
+ {
46
+ "id": "non-ascii-key",
47
+ "kind": "canonical",
48
+ "value": { "键": 1 },
49
+ "fault": "unsupported-object-key"
50
+ },
51
+ {
52
+ "id": "bad-clock-offset",
53
+ "kind": "clock",
54
+ "value": "2026-08-07T23:00:00.000+08:00",
55
+ "fault": "invalid-clock"
56
+ },
57
+ {
58
+ "id": "bad-clock-date",
59
+ "kind": "clock",
60
+ "value": "2026-02-30T00:00:00.000Z",
61
+ "fault": "invalid-clock"
62
+ },
63
+ {
64
+ "id": "bad-clock-year-zero",
65
+ "kind": "clock",
66
+ "value": "0000-01-01T00:00:00.000Z",
67
+ "fault": "invalid-clock"
68
+ },
69
+ {
70
+ "id": "unknown-domain",
71
+ "kind": "root",
72
+ "value": "provider-state",
73
+ "fault": "unsupported-root-domain"
74
+ },
75
+ {
76
+ "id": "event-extra-key",
77
+ "kind": "event",
78
+ "value": {
79
+ "schema": "buildchain-v4-event-envelope/v1",
80
+ "eventId": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
81
+ "eventType": "candidate-submitted",
82
+ "occurredAt": "2026-08-07T15:00:00.000Z",
83
+ "subjectRoot": "sha256:2222222222222222222222222222222222222222222222222222222222222222",
84
+ "payload": {},
85
+ "sampledNow": "2026-08-07T15:00:00.000Z"
86
+ },
87
+ "fault": "invalid-envelope-shape"
88
+ },
89
+ {
90
+ "id": "receipt-fault-outcome-drift",
91
+ "kind": "receipt",
92
+ "value": {
93
+ "schema": "buildchain-v4-receipt-envelope/v1",
94
+ "receiptType": "candidate-submitted",
95
+ "recordedAt": "2026-08-07T15:00:00.000Z",
96
+ "eventRoot": "sha256:3333333333333333333333333333333333333333333333333333333333333333",
97
+ "priorStateRoot": null,
98
+ "nextStateRoot": null,
99
+ "outcome": "rejected",
100
+ "fault": null
101
+ },
102
+ "fault": "invalid-receipt"
103
+ }
104
+ ]
105
+ }