@kungfu-tech/buildchain 4.1.3-alpha.1 → 4.1.3-alpha.2

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 (202) hide show
  1. package/architecture/action-taxonomy.json +16 -0
  2. package/architecture/agent-change-map.md +239 -2
  3. package/architecture/ci-lane-change-budget.json +289 -0
  4. package/architecture/decisions/0005-minimal-consumer-contract.md +122 -0
  5. package/architecture/decisions/0006-business-attempt-journal.md +89 -0
  6. package/architecture/decisions/0007-hosted-pipeline-controller.md +106 -0
  7. package/architecture/decisions/0008-pipeline-product-publication.md +99 -0
  8. package/architecture/internal-capabilities.json +331 -2
  9. package/architecture/maintainability-debt.json +3 -1
  10. package/architecture/maintainability-policy.json +8 -8
  11. package/architecture/minimal-consumer-migration.json +7558 -0
  12. package/architecture/release-topology.json +245 -11
  13. package/architecture/universal-workflow-bootstrap.json +10 -0
  14. package/architecture/universal-workflow-capability-policy.json +1 -1
  15. package/architecture/workflow-taxonomy.json +55 -0
  16. package/dist/readers/business-attempt.cjs +805 -0
  17. package/dist/site/buildchain-contract.json +7 -5
  18. package/dist/site/buildchain-site.json +18 -13
  19. package/dist/site/capability-registry.json +3 -3
  20. package/dist/site/kfd-claims.json +311 -10
  21. package/dist/site/kfd-upstream-aggregate.json +1 -1
  22. package/dist/site/manual-registry.json +1 -1
  23. package/dist/site/node-api-registry.json +7 -7
  24. package/dist/site/page-registry.json +13 -8
  25. package/dist/site/public-surface-audit.json +201 -7
  26. package/dist/site/publication-authority-registry.json +121 -1
  27. package/dist/site/publication-registry.json +4 -4
  28. package/dist/site/site-manifest.json +5 -5
  29. package/dist/site/workflow-registry.json +416 -7
  30. package/docs/node-api-reference.md +11 -11
  31. package/docs/runtime-entry.md +45 -5
  32. package/docs/workflow-catalog.md +5 -0
  33. package/package.json +4 -3
  34. package/packages/core/consumer/contract/entries.js +85 -0
  35. package/packages/core/consumer/contract/examples.js +96 -0
  36. package/packages/core/consumer/contract/identity.js +65 -0
  37. package/packages/core/consumer/contract/inspection.js +45 -0
  38. package/packages/core/consumer/contract/plan.js +99 -0
  39. package/packages/core/consumer/contract/products.js +101 -0
  40. package/packages/core/consumer/contract/shape.js +46 -0
  41. package/packages/core/dev-delivery/candidate/admission.js +9 -5
  42. package/packages/core/dev-delivery/candidate/reservation.js +11 -0
  43. package/packages/core/dev-delivery/candidate/source-paths.js +12 -4
  44. package/packages/core/dev-delivery/native/actions.js +7 -1
  45. package/packages/core/dev-delivery/native/heartbeat-action.js +16 -0
  46. package/packages/core/dev-delivery/native/heartbeat.js +6 -4
  47. package/packages/core/dev-delivery/queue/landing-action.js +5 -0
  48. package/packages/core/governance/buildchain-publication-authority.js +5 -0
  49. package/packages/core/paper/operations/bootstrap.js +2 -0
  50. package/packages/core/paper/paper-npm-bootstrap.js +2 -2
  51. package/packages/core/providers/github/attempt-index.js +60 -0
  52. package/packages/core/providers/github/attempt-journal.js +154 -0
  53. package/packages/core/providers/github/discussions/materials.js +7 -2
  54. package/packages/core/providers/github/pipeline-checkout.js +49 -0
  55. package/packages/core/providers/github/pipeline-events.js +52 -0
  56. package/packages/core/providers/github/pipeline-integration.js +95 -0
  57. package/packages/core/providers/github/pipeline-policy.js +213 -0
  58. package/packages/core/providers/github/pipeline-product-payload.js +50 -0
  59. package/packages/core/providers/github/pipeline-product-release.js +191 -0
  60. package/packages/core/providers/github/pipeline-publication-artifacts.js +153 -0
  61. package/packages/core/providers/github/pipeline-run-entry.js +86 -0
  62. package/packages/core/providers/github/pipeline-runs.js +132 -0
  63. package/packages/core/providers/github/pipeline-source.js +178 -0
  64. package/packages/core/providers/github/pipeline-version.js +201 -0
  65. package/packages/core/providers/github/pipeline-worker.js +108 -0
  66. package/packages/core/publication/candidate/registry-hydration.js +2 -2
  67. package/packages/core/publication/npm/pack-preview.js +2 -2
  68. package/packages/core/publication/npm/pack-result.js +31 -0
  69. package/packages/core/publication/npm/package.js +3 -6
  70. package/packages/core/publication/npm/pipeline-channel.js +87 -0
  71. package/packages/core/publication/npm/pipeline-provider.js +109 -0
  72. package/packages/core/publication/npm/registry.js +12 -9
  73. package/packages/core/publication/pipeline/actions.js +100 -0
  74. package/packages/core/publication/pipeline/apply.js +182 -0
  75. package/packages/core/publication/pipeline/build-segments.js +107 -0
  76. package/packages/core/publication/pipeline/capsules.js +89 -0
  77. package/packages/core/publication/pipeline/context.js +39 -0
  78. package/packages/core/publication/pipeline/development-anchor.js +91 -0
  79. package/packages/core/publication/pipeline/development-current.js +63 -0
  80. package/packages/core/publication/pipeline/development-pr.js +85 -0
  81. package/packages/core/publication/pipeline/development-proof.js +76 -0
  82. package/packages/core/publication/pipeline/development-transition.js +112 -0
  83. package/packages/core/publication/pipeline/distribution.js +124 -0
  84. package/packages/core/publication/pipeline/documents.js +156 -0
  85. package/packages/core/publication/pipeline/effects.js +162 -0
  86. package/packages/core/publication/pipeline/files.js +66 -0
  87. package/packages/core/publication/pipeline/imported-materials.js +32 -0
  88. package/packages/core/publication/pipeline/journal.js +110 -0
  89. package/packages/core/publication/pipeline/next-development.js +116 -0
  90. package/packages/core/publication/pipeline/pack.js +151 -0
  91. package/packages/core/publication/pipeline/package-policy.js +22 -0
  92. package/packages/core/publication/pipeline/plan.js +114 -0
  93. package/packages/core/publication/pipeline/prepare.js +151 -0
  94. package/packages/core/publication/pipeline/qualification.js +170 -0
  95. package/packages/core/publication/pipeline/qualify.js +104 -0
  96. package/packages/core/publication/pipeline/recovery-admission.js +122 -0
  97. package/packages/core/publication/pipeline/recovery-build-download.js +80 -0
  98. package/packages/core/publication/pipeline/recovery-build-plan.js +122 -0
  99. package/packages/core/publication/pipeline/recovery-build-readback.js +68 -0
  100. package/packages/core/publication/pipeline/recovery-capsules.js +54 -0
  101. package/packages/core/publication/pipeline/recovery-import.js +80 -0
  102. package/packages/core/publication/pipeline/recovery-inspection.js +218 -0
  103. package/packages/core/publication/pipeline/recovery-materials.js +104 -0
  104. package/packages/core/publication/pipeline/recovery-plan.js +46 -0
  105. package/packages/core/publication/pipeline/recovery-prepare.js +73 -0
  106. package/packages/core/publication/pipeline/recovery-qualification.js +128 -0
  107. package/packages/core/publication/pipeline/recovery-readback.js +56 -0
  108. package/packages/core/publication/pipeline/recovery-signing.js +58 -0
  109. package/packages/core/publication/pipeline/sealed-products.js +79 -0
  110. package/packages/core/publication/pipeline/settle.js +43 -0
  111. package/packages/core/publication/pipeline/signing.js +140 -0
  112. package/packages/core/publication/pipeline/source-plan.js +83 -0
  113. package/packages/core/publication/pipeline/version.js +81 -0
  114. package/packages/core/publication/publication-reproducibility.js +2 -2
  115. package/packages/core/release/promote-candidate/product-provider-adapters.js +4 -3
  116. package/packages/core/release/promote-ref/internal/npm-existing-evidence.js +2 -1
  117. package/packages/core/release/promote-ref/internal/publish-command.js +16 -5
  118. package/packages/core/runtime/buildchain-domain.wasm +0 -0
  119. package/packages/core/runtime/domain-wasm-artifact.js +2 -2
  120. package/packages/core/runtime/entry/actions.js +27 -25
  121. package/packages/core/runtime/entry/attempt.js +25 -0
  122. package/packages/core/runtime/entry/selection.js +14 -0
  123. package/packages/core/runtime/entry/source.js +62 -0
  124. package/packages/core/workflow/attempt/identity.js +165 -0
  125. package/packages/core/workflow/attempt/journal.js +87 -0
  126. package/packages/core/workflow/attempt/materials.js +72 -0
  127. package/packages/core/workflow/attempt/reader-entry.js +12 -0
  128. package/packages/core/workflow/attempt/reader.js +149 -0
  129. package/packages/core/workflow/attempt/records.js +153 -0
  130. package/packages/core/workflow/attempt/store.js +75 -0
  131. package/packages/core/workflow/commands/pipeline-build.mjs +23 -0
  132. package/packages/core/workflow/pipeline/action-output.js +11 -0
  133. package/packages/core/workflow/pipeline/actions.js +62 -0
  134. package/packages/core/workflow/pipeline/build-control.js +140 -0
  135. package/packages/core/workflow/pipeline/build-evidence.js +92 -0
  136. package/packages/core/workflow/pipeline/build-qualification.js +145 -0
  137. package/packages/core/workflow/pipeline/build-result.js +69 -0
  138. package/packages/core/workflow/pipeline/build.js +95 -0
  139. package/packages/core/workflow/pipeline/cancellation.js +169 -0
  140. package/packages/core/workflow/pipeline/channel-control.js +127 -0
  141. package/packages/core/workflow/pipeline/controller.js +133 -0
  142. package/packages/core/workflow/pipeline/delivery-control.js +204 -0
  143. package/packages/core/workflow/pipeline/delivery-observation.js +118 -0
  144. package/packages/core/workflow/pipeline/delivery-request.js +198 -0
  145. package/packages/core/workflow/pipeline/events.js +84 -0
  146. package/packages/core/workflow/pipeline/fence.js +42 -0
  147. package/packages/core/workflow/pipeline/group-control.js +56 -0
  148. package/packages/core/workflow/pipeline/guard-build.js +37 -0
  149. package/packages/core/workflow/pipeline/guard.js +156 -0
  150. package/packages/core/workflow/pipeline/host.js +114 -0
  151. package/packages/core/workflow/pipeline/materials.js +58 -0
  152. package/packages/core/workflow/pipeline/notifications.js +36 -0
  153. package/packages/core/workflow/pipeline/parent-notification.js +27 -0
  154. package/packages/core/workflow/pipeline/platforms.js +21 -0
  155. package/packages/core/workflow/pipeline/progress.js +108 -0
  156. package/packages/core/workflow/pipeline/projection.js +20 -0
  157. package/packages/core/workflow/pipeline/reconcile.js +194 -0
  158. package/packages/core/workflow/pipeline/recovery-action.js +30 -0
  159. package/packages/core/workflow/pipeline/recovery-admission.js +122 -0
  160. package/packages/core/workflow/pipeline/recovery-build-control.js +95 -0
  161. package/packages/core/workflow/pipeline/recovery-build-evidence.js +71 -0
  162. package/packages/core/workflow/pipeline/recovery-build.js +121 -0
  163. package/packages/core/workflow/pipeline/recovery-controller.js +91 -0
  164. package/packages/core/workflow/pipeline/recovery-integration.js +66 -0
  165. package/packages/core/workflow/pipeline/recovery-merge-proof.js +90 -0
  166. package/packages/core/workflow/pipeline/recovery-ownership-settlement.js +150 -0
  167. package/packages/core/workflow/pipeline/recovery-ownership.js +91 -0
  168. package/packages/core/workflow/pipeline/recovery-plan.js +126 -0
  169. package/packages/core/workflow/pipeline/recovery-runtime.js +68 -0
  170. package/packages/core/workflow/pipeline/recovery-session.js +129 -0
  171. package/packages/core/workflow/pipeline/recovery-transition.js +135 -0
  172. package/packages/core/workflow/pipeline/recovery-unrecorded-build.js +74 -0
  173. package/packages/core/workflow/pipeline/runtime-source.js +111 -0
  174. package/packages/core/workflow/pipeline/selection.js +106 -0
  175. package/packages/core/workflow/pipeline/session.js +72 -0
  176. package/packages/core/workflow/pipeline/settlement.js +137 -0
  177. package/packages/core/workflow/pipeline/wake.js +38 -0
  178. package/packages/core/workflow/pipeline/web-status.js +108 -0
  179. package/scripts/build-release-discussion-reader.mjs +11 -7
  180. package/scripts/check-pipeline-publication-topology.mjs +36 -0
  181. package/scripts/check-release-topology.mjs +6 -1
  182. package/scripts/generate-minimal-consumer-contract.mjs +155 -0
  183. package/scripts/verify-golden-path.mjs +5 -1
  184. package/templates/minimal-consumer/binary/.buildchain/buildchain.toml +45 -0
  185. package/templates/minimal-consumer/binary/.github/workflows/buildchain-recover.yml +30 -0
  186. package/templates/minimal-consumer/binary/.github/workflows/buildchain.yml +28 -0
  187. package/templates/minimal-consumer/binary/package.json +6 -0
  188. package/templates/minimal-consumer/binary/src/build.mjs +5 -0
  189. package/templates/minimal-consumer/binary/src/hello.c +2 -0
  190. package/templates/minimal-consumer/binary/src/verify.mjs +3 -0
  191. package/templates/minimal-consumer/npm/.buildchain/buildchain.toml +46 -0
  192. package/templates/minimal-consumer/npm/.github/workflows/buildchain-recover.yml +30 -0
  193. package/templates/minimal-consumer/npm/.github/workflows/buildchain.yml +28 -0
  194. package/templates/minimal-consumer/npm/package.json +6 -0
  195. package/templates/minimal-consumer/npm/src/build.mjs +5 -0
  196. package/templates/minimal-consumer/npm/src/verify.mjs +3 -0
  197. package/templates/minimal-consumer/paper/.buildchain/buildchain.toml +45 -0
  198. package/templates/minimal-consumer/paper/.github/workflows/buildchain-recover.yml +30 -0
  199. package/templates/minimal-consumer/paper/.github/workflows/buildchain.yml +28 -0
  200. package/templates/minimal-consumer/paper/package.json +6 -0
  201. package/templates/minimal-consumer/paper/src/build.mjs +12 -0
  202. package/templates/minimal-consumer/paper/src/verify.mjs +3 -0
@@ -0,0 +1,122 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: minimal-consumer-contract
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-12
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-12
16
+ visible_context: Immutable seven-child Assignment and current Buildchain source and tests.
17
+ invisible_context_boundary: The new pipeline and recovery entries are not yet implemented or published.
18
+ ---
19
+
20
+ # ADR 0005: The consumer owns product intent, Buildchain owns execution
21
+
22
+ ## Contract and rollout boundary
23
+
24
+ Schema 2 is a closed TOML contract compiled by
25
+ `packages/core/consumer/contract/plan.js`. The compiler receives bytes and has no
26
+ filesystem, process or provider interface. It never runs a configured command.
27
+ Unknown fields fail, including arbitrary request envelopes and publication
28
+ commands. Build and verification commands remain product code, executed later
29
+ in an isolated job with no delivery, signing or publication credentials.
30
+
31
+ Consumers maintain `.buildchain/buildchain.toml` and two generated callers.
32
+ The normal entry receives the platform event and an optional `config-path`.
33
+ Recovery receives one exact `attempt` and an optional transient `runtime-ref`.
34
+ `entries.js` owns both interfaces and product-independent caller bytes.
35
+ No consumer assembles candidate, Warrant, fence, proof, nonce, run, transaction
36
+ or Discussion selectors. An attempt is a Buildchain business identity, not a
37
+ GitHub run ID, run-attempt number or Discussion number.
38
+
39
+ This first slice defines and tests that contract. Its generated examples are
40
+ qualification fixtures, not a claim that the new public entries already exist.
41
+ The normal controller is delivered in child 3; recovery in child 5; Buildchain
42
+ self migration and published alpha/stable qualification in child 6; old public
43
+ surface retirement in child 7. Schema 1 is not translated by the new compiler.
44
+ Existing consumers remain on the old implementation until the reviewed
45
+ migration replaces their configuration and entry together. There is no final
46
+ compatibility wrapper, hidden script, or product-specific entry.
47
+
48
+ ## Product plan
49
+
50
+ Each product declares an ID, type (`npm`, `binary`, `paper`), exact supported
51
+ platforms, optional install commands, build and verify commands, output
52
+ artifacts and publication targets. Artifact IDs are unique and targets must
53
+ cover exactly the declared output set. npm publishing is a typed npm target;
54
+ archive and PDF publication use GitHub Release. Provider credentials are
55
+ one-time setup, never TOML values or command arguments.
56
+
57
+ Version files, strategy, legal channel PR routes and required independent
58
+ review/merge queue are explicit. Existing dependency locks remain ordinary
59
+ product source and are retained by initialization/migration. The internal
60
+ executor must install dependencies under their lock and current supply-chain
61
+ policy. TOML cannot weaken branch protection or substitute a local check for
62
+ independent source, receipt or provider readback.
63
+
64
+ ## Events, identities and authority
65
+
66
+ The normal event vocabulary covers PR lifecycle, review, merge group and push.
67
+ Buildchain-owned `repository_dispatch` wake events are internal notifications;
68
+ their payload is untrusted until the controller verifies its retained attempt
69
+ and provider evidence. There is no manual JSON dispatch interface. Wake events
70
+ never create authorization and duplicate or old events cannot authorize a new
71
+ source. The controller owns deduplication, writer fencing and terminal wakeup.
72
+ Consumer YAML contains no event routing logic or internal workflow names.
73
+
74
+ The trusted `pull_request_target: closed` notification also covers closing a
75
+ conflicted PR, for which GitHub does not run `pull_request`. This is a
76
+ cancellation/settlement observation only and must never execute PR code.
77
+ Merge-group removal is reconciled from PR dequeue and live queue readback;
78
+ `merge_group` subscribes only to GitHub's supported `checks_requested` type.
79
+ See the [GitHub event contract](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows).
80
+
81
+ The platform-provided event is only an observation. Admission resolves the
82
+ repository, PR head/base and tree through trusted provider readback. Config
83
+ bytes bind to the exact Git blob, config path and source commit. The compiler
84
+ returns data; its digest is not merge or publication authority. PR-controlled
85
+ config and artifacts are not consumed in a job holding privileged credentials.
86
+ Caller permission declarations are upper bounds; internal jobs must narrow
87
+ them and keep untrusted builds separate from qualification and provider writes.
88
+ Fork events must never receive repository write credentials or inherited secrets.
89
+
90
+ The generated contract lock binds the contract version, entry SHA, selected
91
+ runtime SHA and configuration byte digest. It does not bind the consuming Git
92
+ commit: committing a tracked lock must not invalidate that same lock. Exact
93
+ source commit/tree identity is bound separately for each execution attempt.
94
+ Entry and runtime may differ. A normal run
95
+ uses its admitted lock; recovery may select a repaired runtime once through
96
+ the central entry. Downstream nodes do not compare Buildchain SHAs. A changed
97
+ contract requires an explicit reviewed config/lock upgrade; schema mismatch
98
+ fails rather than silently interpreting old data. An entry bug requires an
99
+ upgraded published entry and a full new execution.
100
+
101
+ ## Evidence and enforcement
102
+
103
+ `generate-minimal-consumer-contract.mjs --check` verifies all three generated
104
+ examples and the complete migration inventory of current public/self inputs,
105
+ caller edges, template/fixture configuration and consumer scripts. Inventory
106
+ destinations distinguish provider setup, plan-derived internal arguments and
107
+ attempt-owned material/authority. They are migration obligations, not deleted
108
+ functionality or already-migrated state.
109
+
110
+ `inspectConsumerContract` requires the exact two generated workflows and scans
111
+ the supplied complete consumer tree for known internal orchestration. The
112
+ caller comparison closes YAML wiring; the TOML validator closes configuration
113
+ keys. Source scanning detects known bypasses but is not a proof of arbitrary
114
+ program behavior. Credential isolation and provider authorization remain
115
+ mandatory even when this static gate passes. Child 7 must validate the final
116
+ reachable source/generator closure and adversarial cases after migration.
117
+
118
+ Tests compile all three plans, reject invalid input/state/route/target/review
119
+ changes, verify exact Git blob binding with different entry/runtime commits,
120
+ and build actual package contents, a native archive and a valid PDF in isolated
121
+ directories. These are local contract/product tests; they do not constitute
122
+ hosted execution, release, provider authorization or recovery qualification.
@@ -0,0 +1,89 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: minimal-consumer-attempt-journal
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-12
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-12
16
+ visible_context: Captured second-child Assignment, Discussion implementation and local fault tests.
17
+ invisible_context_boundary: Hosted pipeline integration and published consumer qualification belong to later slices.
18
+ ---
19
+
20
+ # ADR 0006: One PR intent, immutable generations and recoverable attempts
21
+
22
+ The internal `workflow/attempt` modules extend the existing Release Discussion
23
+ journal. PR number, repository identity and target branch identify the intent.
24
+ Exact source commit, tree, TOML blob/digest/path and observed protected base
25
+ identify a generation. A request key plus generation and predecessor identifies
26
+ a business attempt. Provider run, run-attempt and job identify each writer;
27
+ several provider runs may contribute to one business attempt.
28
+
29
+ The admitted ordered phase set covers admission, build, review, Warrant, merge,
30
+ publication, distribution and next-development. A channel-specific plan may
31
+ omit inapplicable phases. Every phase requires successful predecessors. Waiting,
32
+ failure, cancellation and supersession retain a reason. Terminal phase results
33
+ cannot be rewritten: recovery opens a successor with no inherited success.
34
+ Published historical results remain readable even when a new source or base
35
+ requires a new generation. Projection completion does not grant delivery,
36
+ publication or material-reuse authority.
37
+
38
+ Each event includes its content digest, previous event digest, exact attempt
39
+ and generation, sequence, bounded idempotency key, writer and runtime reader
40
+ identity. Replay rejects gaps, forks, conflicting duplicate keys, undeclared
41
+ or out-of-order phases, missing predecessors, identity drift and history bounds.
42
+ Identical repeated records have one meaning. A reader may receive pages out of
43
+ order; sequence and content links reconstruct the original history.
44
+
45
+ `businessAttemptStore` uses the existing provider-authenticated Discussion
46
+ transport, immutable attempt roots and reply pagination. Only the expected
47
+ writer's unedited records contribute. Initialization verifies the repository
48
+ node identity. Unknown mutation responses are reconciled by reading back the
49
+ same immutable identity before retry. No attempt state is written into the
50
+ consumer source tree and no independent index or second authoritative store
51
+ is introduced.
52
+
53
+ The store has no default lock. Its internal `exclusive.run` adapter must own
54
+ the repository/intent writer scope across hosted processes and retain that
55
+ exclusion through the final provider mutation. `assertOwner` is rechecked at
56
+ scope admission and immediately before create/append. Expected-head comparison
57
+ and current-attempt checks fence stale results. The adapter must not transfer
58
+ ownership while an in-flight provider mutation can still commit: a local mutex
59
+ or a check followed by an unfenced lease expiry is insufficient. Child 3 owns
60
+ the hosted controller adapter; this library slice does not claim hosted writer
61
+ exclusion from the injected test fixture. The provider remains the persistence
62
+ authority; a fork makes the reader fail closed rather than selecting a winner.
63
+
64
+ Material references distinguish artifacts, checkpoints, receipts, Passports
65
+ and provider readbacks. Each binds byte count, digest, producing attempt,
66
+ generation and a permanent consumer-repository URL. Signed URLs and credentials
67
+ are rejected. A reused material ID cannot acquire different bytes. The internal
68
+ material verifier checks retrieved bytes; storing a reference alone does not
69
+ prove retrieval, provider authorization or qualification for another attempt.
70
+ Existing receipt, Passport and provider journal rules continue to own those
71
+ facts. Recovery must qualify retained material under the successor's current
72
+ rules before emitting fresh evidence.
73
+
74
+ The retained `dist/readers/business-attempt.cjs` is self-contained and accepts
75
+ captured authenticated JSON on stdin. Its CLI outputs status, reason, attempt,
76
+ generation, missing phases and the one recovery selector. The bundle is
77
+ reproducibility-checked alongside the historical release reader and tested in
78
+ a fresh process with filesystem access restricted to the bundle. It has no
79
+ provider write or effect-recovery entry. A runtime's recorded reader digest
80
+ must be verified by the existing archive-loading boundary before execution;
81
+ the pure reader does not authenticate caller-supplied records itself.
82
+
83
+ The fault tests cover identity drift, incomplete and corrupted chains, duplicate
84
+ and out-of-order delivery, concurrent/stale writers, cancellation/failure state,
85
+ response loss after provider commit, restart, untrusted/edited records, material
86
+ integrity and published-history preservation. Hosted control, user-facing
87
+ attempt selection, actual provider recovery and self publication remain the
88
+ explicit responsibilities of children 3 through 7. This slice adds no public
89
+ workflow or consumer input.
@@ -0,0 +1,106 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: minimal-consumer-pipeline
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: medium
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-13
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-13
16
+ visible_context: Third-child Assignment, existing Warrant domain, GitHub adapter source and local fault tests.
17
+ invisible_context_boundary: Hosted integration and published consumer qualification have not yet completed.
18
+ ---
19
+
20
+ # ADR 0007: Hosted pipeline history and provider effects
21
+
22
+ The normal pipeline admits repository-owned channel PRs using policy read from
23
+ the protected base. PR TOML supplies the product commands to the credentialless
24
+ build job. It cannot grant itself a channel route or lower protected review
25
+ requirements. Source commit, tree, configuration blob and bytes are verified;
26
+ the PR and protected branch are read again before returning an observation.
27
+ Webhook fields select readback work and do not authorize effects. Terminal-only
28
+ events cannot start product execution. Internal journal ref pushes are ignored.
29
+
30
+ The hosted writer refines ADR 0006's storage boundary. GitHub Discussion appends
31
+ do not provide atomic expected-head updates, and workflow concurrency alone
32
+ does not fence an in-flight append from an interrupted writer. The pipeline
33
+ therefore admits the existing immutable attempt records through one Git-ref
34
+ journal. Each update has exactly one observed parent and uses a non-force
35
+ fast-forward update; competing children cannot both advance that parent.
36
+ The writer reads committed bytes back, including after a lost HTTP response.
37
+ Discussion is a readable projection of the admitted records. It is not a
38
+ second authority, and the earlier Discussion reader and histories remain
39
+ available. The hosted path does not claim that the library's injected
40
+ Discussion lock provides cross-process exclusion.
41
+
42
+ An attempt's source generation, phase order and terminal history retain their
43
+ ADR 0006 identities. Recovery opens a successor after terminal reconciliation;
44
+ it does not inherit successful phases or rewrite prior results. Duplicate
45
+ event keys must retain the same meaning. Product commands execute through the
46
+ existing consumer-shell session with a credential allowlist and private file
47
+ command channels. A subprocess result is an observation; independent hosted
48
+ completion, artifact and source qualification remain necessary for reuse.
49
+
50
+ Cancellation retains its exact provider readback material and commits a pending
51
+ attempt record before invoking the existing Warrant domain transaction. Queued
52
+ cleanup selects its own candidate even when another candidate is active.
53
+ Active cleanup requires the admitted run attempt and separate native/seal jobs
54
+ to be terminal in fresh provider readbacks. Lease expiry alone cannot release
55
+ the Warrant. The credentialed independent heartbeat and finalizer check attempt
56
+ stop requests. The native job retains its credentialless boundary and must
57
+ finish or reach its hosted timeout before ownership can transfer; the controller
58
+ does not cancel an entire GitHub run that could have acquired a newer run
59
+ attempt. Domain expected-old roots and active fences are derived
60
+ internally from fresh queue state.
61
+
62
+ The public normal entry accepts only `config-path`. Its jobs separate runtime
63
+ selection, provider control, credentialless product commands, independent build
64
+ readback and guarded native delivery. The internal delivery component transports
65
+ the retained request; admission, qualification and landing reject changed request
66
+ fields and a different provider run attempt. Candidate source roots include the
67
+ business attempt, so a terminal candidate cannot block a later attempt of the
68
+ same source. Scheduling uses an expected journal head and retains live executions
69
+ when jobs have not yet appeared in the provider inventory.
70
+
71
+ Attempt wake selects its runtime lock from the recorded source commit. A changed
72
+ source generation opens a successor only after old-candidate cleanup, then wakes
73
+ again if its source requires another runtime selection. Branch notifications wake
74
+ existing intents without inventing historical releases. Every declared product
75
+ platform runs on the standard hosted matrix; the independent native command uses
76
+ one declared platform, while exact merge-group verification repeats the complete
77
+ product matrix. No additional native platform coverage is inferred from that
78
+ single native execution.
79
+
80
+ The protected base supplies review policy. Fresh GitHub readback must enforce
81
+ the declared independent approval count, Code Owners, merge queue and required
82
+ checks. PR approvals bind the exact source commit. Release-channel PRs use that
83
+ protected queue; their merged source enters the separate publication stage.
84
+ Development settlement requires the exact source PR, protected ancestry,
85
+ successful exact merge-group execution and retained integration proof before
86
+ the Warrant state changes. Terminal notifications replay retained receipts if a
87
+ successor wake was interrupted.
88
+
89
+ If a cancellation write succeeds but its response is lost, the retained pending
90
+ material must match the candidate's terminal evidence before its attempt
91
+ projection is completed. An interrupted successor dispatch can be retried from
92
+ the same terminal evidence without rewriting history. Receipt material uses
93
+ the existing immutable recovery archive and verifies digest and size on read.
94
+ Neither the archive nor a planned operation grants merge or publication rights.
95
+
96
+ Local tests currently cover the journal's competing writers and response loss,
97
+ corrupt bytes, stale events and source drift, protected-policy selection,
98
+ credentialless subprocess exit failures, native stop fencing, exact provider
99
+ worker readback, queued versus active cleanup, lost settlement responses and
100
+ interrupted successor wake. Tests also exercise the public controller's build
101
+ and delivery handoff, duplicate-event retention, same-source successor identity,
102
+ runtime source selection, exact merged settlement response loss and readable
103
+ Discussion projection. Public workflow wiring is implemented; hosted execution
104
+ and published qualification have not been claimed from these local tests. Product release
105
+ drivers, the public recovery interface, self publication and final minimal
106
+ consumer qualification remain the responsibilities of subsequent children.
@@ -0,0 +1,99 @@
1
+ ---
2
+ status: draft
3
+ period: 2026-09-13
4
+ theme: minimal-consumer-product-publication
5
+ doc_type: architecture-decision-record
6
+ source_level: local-files
7
+ confidence: medium
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-09-13
12
+ ai_provenance:
13
+ model_family: GPT-6
14
+ product: Codex
15
+ generated_at: 2026-09-13
16
+ visible_context: Product contract, hosted pipeline, provider adapters and local failure-path tests.
17
+ invisible_context_boundary: No published entry qualification, production publication or external consumer adoption is established by this document.
18
+ ---
19
+
20
+ # ADR 0008: Product publication stays inside the business attempt
21
+
22
+ The normal pipeline reads the existing schema-2 TOML and derives every declared
23
+ product/platform/artifact and publication target. npm packages, native archives
24
+ and Paper PDFs use the same entry and product build/verify boundary. Consumers
25
+ do not supply standard packaging, signing, publication or recovery commands.
26
+
27
+ After exact protected integration, the internal product component reserves one
28
+ provider execution in the existing attempt journal. Its repository concurrency
29
+ group serializes publication effects. Product commands run on separate hosted
30
+ jobs with read-only checkout credentials and a credential-filtered subprocess
31
+ environment. Qualification independently reads every completed platform job,
32
+ artifact coordinate, manifest and actual payload. Missing platforms, redirected
33
+ npm provider configuration and conflicting bytes are rejected.
34
+
35
+ The plan binds the protected merge source, the original channel PR source, the
36
+ selected runtime commit/tree and the defining publisher workflow SHA separately.
37
+ Stable version materialization changes only declared version fields in an
38
+ isolated Git ref. Its actual commit/tree and original protected source remain in
39
+ the Passport; this is not a tree-equivalence claim. The Rust release domain admits
40
+ the exact canonical product `apply` job and retains QUALIFY/APPLY/SETTLE ownership.
41
+
42
+ When a preceding floating channel already names a version overlay, a new overlay
43
+ retains that exact observed commit as a second Git parent. Its first parent is
44
+ the current protected source, and independent tree comparison still permits only
45
+ the declared version-file changes. This explicit merge ancestry preserves the
46
+ previous release while allowing a provider-enforced fast-forward of the channel.
47
+
48
+ The signer attests the complete qualified-product manifest with a predicate that
49
+ binds both product sources, runtime, publisher and provider execution. The
50
+ publisher verifies the GitHub/Sigstore bundle independently with the actual
51
+ defining workflow SHA and provider run source SHA. A custom predicate carries the
52
+ distinct materialized product source. This keyless signature is not an
53
+ Authenticode or macOS application signature. npm's automatic provenance is
54
+ disabled for this sealed publication path because its default workflow source
55
+ would describe the controller checkout as the product build source. The retained
56
+ custom attestation is published with the qualification and Capsule documents.
57
+
58
+ Sealed payloads and signing bundles are retained in the existing immutable
59
+ material archive before publication. Each provider operation records its intent
60
+ before effects and retains exact successful readback before moving on. npm uses
61
+ the sealed tarball, ignores lifecycle scripts and requires the registry integrity
62
+ to match. GitHub assets and exact tags are never replaced. A lost response is
63
+ reconciled from current provider state; completed packages are not republished.
64
+ The Release contains product assets requested by TOML, its Passport, qualification,
65
+ Capsule aggregate, invocation and attestation bundle.
66
+
67
+ Publication success does not finish the business attempt. Distribution moves the
68
+ npm channel and the major Git channel, with exact prior readback and no forced
69
+ Git update or npm version regression. Divergent Git channel history stops for
70
+ source reconciliation. Alpha then prepares the next development version through
71
+ an ordinary protected PR. Its original publication and receipts remain successful
72
+ while that PR waits for review, queue integration or verification. Anchored
73
+ projects wait for a protected change to their declared version authority; the
74
+ pipeline does not invent an upstream anchor. Stable publication prepares the next
75
+ patch at Alpha zero from the current protected development source. A late
76
+ completion observes already advanced development through exact protected PR
77
+ proof and cannot regress its version. Stable and Alpha retain their distinct
78
+ transition identities and the original successful publication.
79
+
80
+ Provider authorization is a one-time repository setup. Hosted npm trusted
81
+ publishing is preferred; `BUILDCHAIN_NPM_TOKEN` is an optional publisher-only
82
+ credential. Internal PR creation uses the repository's automation App
83
+ (`BUILDCHAIN_APP_CLIENT_ID` variable and `BUILDCHAIN_APP_PRIVATE_KEY` secret), or
84
+ `BUILDCHAIN_AUTOMATION_TOKEN`. It does not use `GITHUB_TOKEN` to create a PR whose
85
+ ordinary checks would be suppressed. No such credential reaches product commands.
86
+ Review and branch protections still apply to generated PRs.
87
+
88
+ The local tests cover real npm packing, native archives and PDFs, source and
89
+ version drift, independent provider inventory, signature-verifier rejection,
90
+ immutable retention, lost provider responses and protected next-development
91
+ waiting/settlement. Hosted publication and the published floating consumer entry
92
+ require separate execution evidence; passing these tests alone does not qualify
93
+ that distribution boundary.
94
+
95
+ Restricted npm products require the configured package read credential for provider
96
+ readback; anonymous 404 responses cannot qualify private-package absence. This
97
+ credential is confined to the fixed npm registry and is not supplied to product
98
+ commands. npm OIDC publication does not imply private-package read authority
99
+ ([npm trusted publishing](https://docs.npmjs.com/trusted-publishers/)).