@defrex/autobuild 0.14.0 → 1.0.0-beta.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 (172) hide show
  1. package/README.md +4 -2
  2. package/SPEC.md +654 -98
  3. package/docs/architecture.md +226 -5
  4. package/docs/assets/headline-wide.png +0 -0
  5. package/docs/configuration.md +112 -12
  6. package/docs/hosted-service.md +18 -0
  7. package/docs/integration-tree.md +117 -0
  8. package/docs/landing-policy.md +150 -0
  9. package/docs/mcp.md +24 -0
  10. package/docs/migration-1.0.md +68 -0
  11. package/docs/operator-api.md +19 -8
  12. package/docs/remote-store-protocol.md +30 -7
  13. package/docs/remote-ticket-protocol.md +26 -5
  14. package/docs/restacking.md +79 -0
  15. package/docs/setup.md +49 -6
  16. package/docs/ticket-dependencies.md +69 -0
  17. package/docs/ticket-migration.md +8 -0
  18. package/package.json +3 -3
  19. package/packages/core/src/cli/attention.ts +25 -2
  20. package/packages/core/src/cli/build-control.ts +65 -41
  21. package/packages/core/src/cli/context.ts +54 -2
  22. package/packages/core/src/cli/dashboard/actions.ts +6 -3
  23. package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
  24. package/packages/core/src/cli/dashboard/live.ts +5 -0
  25. package/packages/core/src/cli/dashboard/model.ts +142 -18
  26. package/packages/core/src/cli/dashboard/poll.ts +15 -9
  27. package/packages/core/src/cli/dashboard/refresh.ts +176 -0
  28. package/packages/core/src/cli/dashboard/render.ts +78 -28
  29. package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
  30. package/packages/core/src/cli/dashboard/selection.ts +7 -1
  31. package/packages/core/src/cli/dashboard/tree.ts +107 -0
  32. package/packages/core/src/cli/dispatch-frontend.ts +156 -109
  33. package/packages/core/src/cli/dispatch.ts +250 -136
  34. package/packages/core/src/cli/dispatcher-liveness.ts +15 -2
  35. package/packages/core/src/cli/help.ts +49 -32
  36. package/packages/core/src/cli/init-validation.ts +43 -2
  37. package/packages/core/src/cli/keyboard.ts +6 -0
  38. package/packages/core/src/cli/landings.ts +18 -0
  39. package/packages/core/src/cli/main.ts +49 -15
  40. package/packages/core/src/cli/mcp.ts +9 -0
  41. package/packages/core/src/cli/publication-settlement.ts +168 -2
  42. package/packages/core/src/cli/repository-status.ts +11 -0
  43. package/packages/core/src/cli/status.ts +72 -5
  44. package/packages/core/src/cli/terminal-restore.ts +54 -0
  45. package/packages/core/src/cli/terminal.ts +16 -2
  46. package/packages/core/src/cli/terminals.ts +98 -79
  47. package/packages/core/src/cli/ticket-editor.ts +10 -3
  48. package/packages/core/src/cli/ticket.ts +113 -18
  49. package/packages/core/src/cli/upgrade-commit.ts +4 -0
  50. package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
  51. package/packages/core/src/cli/upgrade-landing.ts +69 -0
  52. package/packages/core/src/cli/upgrade.ts +16 -0
  53. package/packages/core/src/cli/wait.ts +115 -19
  54. package/packages/core/src/cli/watch.ts +51 -12
  55. package/packages/core/src/config/landing.ts +22 -0
  56. package/packages/core/src/config/live.ts +1 -0
  57. package/packages/core/src/config/schema.ts +3 -0
  58. package/packages/core/src/events/catalog.ts +48 -3
  59. package/packages/core/src/events/payloads.ts +295 -6
  60. package/packages/core/src/events/repository.ts +31 -0
  61. package/packages/core/src/integration/harness.ts +10 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +1030 -239
  63. package/packages/core/src/kernel/auto-merge-default.ts +1 -0
  64. package/packages/core/src/kernel/auto-merge.ts +12 -3
  65. package/packages/core/src/kernel/build-identity.ts +94 -0
  66. package/packages/core/src/kernel/change-presence.ts +179 -0
  67. package/packages/core/src/kernel/dispatch-status.ts +17 -1
  68. package/packages/core/src/kernel/engine.ts +89 -2
  69. package/packages/core/src/kernel/generators/build-log.ts +23 -0
  70. package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
  71. package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
  72. package/packages/core/src/kernel/generators/repository-journals.ts +11 -0
  73. package/packages/core/src/kernel/integration-completeness.ts +81 -0
  74. package/packages/core/src/kernel/integration-landing.ts +263 -0
  75. package/packages/core/src/kernel/integration-stack.ts +36 -0
  76. package/packages/core/src/kernel/integration-state.ts +135 -0
  77. package/packages/core/src/kernel/landing-policy.ts +47 -0
  78. package/packages/core/src/kernel/landing-publication.ts +41 -0
  79. package/packages/core/src/kernel/landing-readiness.ts +67 -0
  80. package/packages/core/src/kernel/landing-state.ts +96 -0
  81. package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
  82. package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
  83. package/packages/core/src/kernel/log-index.ts +35 -5
  84. package/packages/core/src/kernel/node-landing.ts +439 -0
  85. package/packages/core/src/kernel/node-parent.ts +184 -0
  86. package/packages/core/src/kernel/node-restack-state.ts +191 -0
  87. package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
  88. package/packages/core/src/kernel/node-restack.ts +274 -0
  89. package/packages/core/src/kernel/read-facts.ts +70 -3
  90. package/packages/core/src/kernel/reconcile-head.ts +51 -0
  91. package/packages/core/src/kernel/reconcile-restack.ts +560 -0
  92. package/packages/core/src/kernel/reducer-registry.ts +16 -0
  93. package/packages/core/src/kernel/reducer.ts +121 -6
  94. package/packages/core/src/kernel/snapshot-parent.ts +33 -0
  95. package/packages/core/src/ontology.ts +9 -1
  96. package/packages/core/src/operator/annotations.ts +12 -0
  97. package/packages/core/src/operator/control.ts +6 -0
  98. package/packages/core/src/operator/index.ts +4 -0
  99. package/packages/core/src/operator/landings.ts +35 -0
  100. package/packages/core/src/operator/presentation.ts +1 -0
  101. package/packages/core/src/operator/protocol.ts +12 -3
  102. package/packages/core/src/operator/query.ts +3 -1
  103. package/packages/core/src/operator/registry.ts +48 -19
  104. package/packages/core/src/operator/requests.ts +1 -8
  105. package/packages/core/src/operator/tickets.ts +55 -9
  106. package/packages/core/src/ports/forge/contract.ts +91 -3
  107. package/packages/core/src/ports/forge/fake.ts +142 -4
  108. package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
  109. package/packages/core/src/ports/forge/github-readiness.ts +421 -0
  110. package/packages/core/src/ports/forge/github.ts +631 -35
  111. package/packages/core/src/ports/forge/local-git.ts +119 -5
  112. package/packages/core/src/ports/forge/readiness.ts +99 -0
  113. package/packages/core/src/ports/tickets/contract.ts +41 -0
  114. package/packages/core/src/ports/tickets/create.ts +8 -1
  115. package/packages/core/src/ports/tickets/fake.ts +32 -1
  116. package/packages/core/src/ports/tickets/file-codec.ts +7 -0
  117. package/packages/core/src/ports/tickets/file.ts +18 -1
  118. package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
  119. package/packages/core/src/ports/tickets/linear.ts +124 -4
  120. package/packages/core/src/ports/tickets/migration.ts +25 -1
  121. package/packages/core/src/ports/tickets/operations.ts +7 -2
  122. package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
  123. package/packages/core/src/ports/tickets/remote.ts +10 -1
  124. package/packages/core/src/ports/tickets/revision.ts +3 -1
  125. package/packages/core/src/ports/tickets/tree.ts +148 -0
  126. package/packages/core/src/ports/tickets/update.ts +15 -2
  127. package/packages/core/src/ports/types.ts +135 -5
  128. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  129. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
  130. package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
  131. package/packages/core/src/processes/build-runner.ts +530 -23
  132. package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
  133. package/packages/core/src/processes/dispatcher.ts +2145 -203
  134. package/packages/core/src/processes/execution-no-progress.ts +46 -1
  135. package/packages/core/src/processes/publication-state.ts +30 -5
  136. package/packages/core/src/processes/repo-view.ts +21 -2
  137. package/packages/core/src/store/build-scope.ts +18 -0
  138. package/packages/core/src/store/contract.ts +658 -0
  139. package/packages/core/src/store/digest.ts +52 -4
  140. package/packages/core/src/store/local/schema.ts +25 -13
  141. package/packages/core/src/store/local/store.ts +117 -1
  142. package/packages/core/src/store/memory.ts +62 -1
  143. package/packages/core/src/store/phase-session.ts +17 -0
  144. package/packages/core/src/store/reduced-reads.ts +2 -1
  145. package/packages/core/src/store/reducer-value-shapes.json +10707 -6440
  146. package/packages/core/src/store/remote/client.ts +44 -0
  147. package/packages/core/src/store/remote/compatibility.ts +19 -9
  148. package/packages/core/src/store/remote/protocol.ts +11 -0
  149. package/packages/core/src/store/repo-state-events.ts +2 -0
  150. package/packages/core/src/store/session-handle.ts +15 -0
  151. package/packages/core/src/store/subscribe.ts +1 -1
  152. package/packages/core/src/store/types.ts +32 -4
  153. package/packages/core/src/testing/index.ts +2 -0
  154. package/packages/core/src/testing/reduced-read-budget.ts +48 -8
  155. package/packages/core/src/testing/refresh-scheduler.ts +32 -0
  156. package/skills/guide/SKILL.md +110 -61
  157. package/skills/guide/references/integration-tree.md +117 -0
  158. package/skills/guide/references/landing-policy.md +150 -0
  159. package/skills/guide/references/migration-1.0.md +68 -0
  160. package/skills/guide/references/operator-api.md +12 -5
  161. package/skills/guide/references/plugin-authoring.md +34 -0
  162. package/skills/guide/references/remote-store-protocol.md +30 -7
  163. package/skills/guide/references/remote-ticket-protocol.md +26 -5
  164. package/skills/guide/references/restacking.md +79 -0
  165. package/skills/guide/references/setup.md +49 -6
  166. package/skills/guide/references/ticket-dependencies.md +69 -0
  167. package/skills/guide/references/ticket-migration.md +8 -0
  168. package/skills/operate/SKILL.md +55 -5
  169. package/skills/reconcile/SKILL.md +55 -48
  170. package/skills/spec/SKILL.md +67 -1
  171. package/skills/tickets/SKILL.md +55 -2
  172. package/templates/autobuild.toml +3 -0
@@ -0,0 +1,150 @@
1
+ # Landing policy
2
+
3
+ Landing authorization is an ordered, strict `[[landing]]` array in
4
+ `autobuild.toml`. Rules require `mode = "auto"` or `"consent"`; optional
5
+ predicates are ANDed, omissions are wildcards, and the first match wins.
6
+
7
+ | Predicate | Matches |
8
+ |---|---|
9
+ | `from` | `leaf` or `node` |
10
+ | `into` | `root`, any `node`, or an exact destination node ticket id |
11
+ | `label` | An exact, case-sensitive source ticket label |
12
+
13
+ Blank destinations and labels are invalid. With no match, leaves use auto and
14
+ nodes consent. Destination means the frozen effective destination, not mutable
15
+ source metadata. Successful source reads supply labels at readiness; unavailable
16
+ data defers the decision rather than pretending labels are empty.
17
+
18
+ A leaf is ready after verification and finalize on a current base; a node must
19
+ be complete and verified at its exact head and parent. `landing.decided` retains
20
+ that candidate, labels, mode and the full matched rule/index or explicit default.
21
+ Editing configuration does not revise that decision. A replacement candidate
22
+ gets a fresh decision. Policy is live dispatcher configuration, separate from
23
+ the pinned execution pipeline.
24
+
25
+ `ab hold <slug>` suppresses landing and revokes consent, even before readiness.
26
+ `ab land <slug>` requires readiness, clears hold and consents to this landing
27
+ into its destination. Consent survives head replacement, restacking, verification
28
+ and re-finalization until hold or completion; it approves the landing rather than
29
+ an immutable diff. Accepted node reparenting revokes it. Commands and receipts
30
+ are sequence-correlated: hold acknowledgement confirms native cancellation;
31
+ land acknowledgement does not claim gates passed. MCP/operator tools offer the
32
+ same actions; the terminal uses `l`/`o`, and the web has no consent controls.
33
+
34
+ ## Worked configurations
35
+
36
+ These independent minimal configurations each parse on their own. Add your
37
+ repository's commands, roles and verification before operating it.
38
+
39
+ ### Continuous deployment
40
+
41
+ ```toml
42
+ baseBranch = "main"
43
+ landing = []
44
+
45
+ [tickets]
46
+ source = "file"
47
+ readyState = "ready"
48
+ ```
49
+
50
+ Root leaves and leaves entering nodes default to auto; every node defaults to
51
+ consent. No special rule is needed for a repository without integration nodes.
52
+
53
+ ### Staged release
54
+
55
+ ```toml
56
+ baseBranch = "main"
57
+
58
+ [[landing]]
59
+ into = "root"
60
+ mode = "consent"
61
+
62
+ [[landing]]
63
+ into = "node"
64
+ mode = "auto"
65
+
66
+ [tickets]
67
+ source = "file"
68
+ readyState = "ready"
69
+ ```
70
+
71
+ Leaves and nodes entering the root match rule 1 and require consent. Leaves and
72
+ nested nodes entering any node match rule 2 and land automatically when ready.
73
+ A specific destination can replace `"node"` with its ticket id, such as
74
+ `"REL-1"`; it matches that frozen destination only.
75
+
76
+ ### Team review
77
+
78
+ ```toml
79
+ baseBranch = "main"
80
+
81
+ [[landing]]
82
+ label = "review"
83
+ mode = "consent"
84
+
85
+ [[landing]]
86
+ from = "node"
87
+ mode = "consent"
88
+
89
+ [[landing]]
90
+ mode = "auto"
91
+
92
+ [tickets]
93
+ source = "file"
94
+ readyState = "ready"
95
+ ```
96
+
97
+ Any source carrying exactly `review` matches rule 1. Other nodes match rule 2;
98
+ other leaves match rule 3. `Review` does not match `review`. Moving the catch-all
99
+ to the front would shadow both safeguards and automatically authorize nodes too.
100
+ Authorization never bypasses verification, checks, protection or merge gates.
101
+
102
+ ## Landing methods
103
+
104
+ Root-target leaves squash into one identity-bearing commit per build.
105
+ Node-target children use serialized, exact-parent guarded fast-forwards;
106
+ node-to-local-git-root landing also fast-forwards, preserving the contributions.
107
+ Node-to-GitHub-root landing uses PR rebase merge guarded on verified head after
108
+ a final parent freshness read. Enforced up-to-date protection provides a fenced
109
+ landing; uncertainty is recorded as unfenced and requires immutable landed-tree
110
+ audit. A mismatch raises operator attention without rewriting the shared parent.
111
+ Pending audits survive completion and retry until settled.
112
+
113
+ Root leaf native auto-merge is used behind a real merge-blocking gate. An
114
+ authoritatively ungated root permits an inspected-head guarded direct squash;
115
+ unknown gate state defers. Node targets instead require authoritative proof of
116
+ an ungated destination, cancel native auto-merge and serialize the guarded push.
117
+ Gated or unproven node destinations stay open with actionable diagnostics.
118
+ Successful push proves landing; forge acknowledgement is best-effort, including
119
+ a landed-SHA comment and closing an unacknowledged open review.
120
+
121
+ Native application receipts bind to exact candidates; consent does not. Every
122
+ replacement confirms cancellation first; the next poll reconciles native state
123
+ before other actions. Stale enables are repaired by polling. This bounded model
124
+ requires replacement-head checks to take far longer than a poll interval. It
125
+ has no durable native-effect reservation. Human forge merges record whether a
126
+ hold was overridden; possible stale-enable landings raise operator attention.
127
+ No result is undone by rewriting the target.
128
+
129
+ ## Forge requirements
130
+
131
+ The kernel must publish and fetch immutable exact archive refs under
132
+ `refs/autobuild/archive/<slug>/<sha>` and replace branches with an exact
133
+ expected-old-head guard. Namespace or permission failures stop publication;
134
+ there is no branch/tag fallback. Archive retention remains indefinite pending a
135
+ retention policy. See [restacking](restacking.md).
136
+
137
+ Tree admission requires node branch creation, authoritative branch-head reads
138
+ and comparison. Reparenting additionally requires PR retargeting. Controlled
139
+ landing requires exact-parent guarded publication and authoritative gate proof;
140
+ GitHub root nodes also need rebase merge support. Root leaves require squash
141
+ support. Readiness inspection reports method/publication hard failures and
142
+ linear-history/freshness recommendations without changing provider settings or
143
+ pushing probes. Unknown permission never proves permission.
144
+
145
+ Legacy plugins can remain readable without supporting tree operations: old
146
+ ticket sources read as work/root and refuse tree metadata writes. This read
147
+ compatibility does not grant forge tree capabilities. Upgrade adapters before
148
+ admitting nodes or requesting unsupported retargeting or landing operations.
149
+ For the lifecycle see [integration trees](integration-tree.md); for old controls
150
+ and upgrade conversion see [migration](migration-1.0.md).
package/docs/mcp.md CHANGED
@@ -123,3 +123,27 @@ The endpoint requires no additional variables beyond the hosted service's
123
123
  existing web/auth set. Note that consent renders when the client sends
124
124
  `prompt=consent`; a client that omits it gets a code directly (the plugin's
125
125
  designed behavior).
126
+
127
+ ### Tree and consent reads
128
+
129
+ `landings.list` takes `{repo}` and returns slug-sorted ready consent or held
130
+ landings, with effective target, source branch, candidate, verification receipts
131
+ and node completeness/children. It reads reduced durable state; `builds.control`
132
+ with `land` rechecks readiness and live completeness. `hold` remains available
133
+ before readiness. `tickets.tree` takes `{repo}` and returns `{root, children,
134
+ diagnostics}` from exhaustive configured-source enumeration. Source ancestry is
135
+ separate from frozen build ancestry. Both tools are read-only and repository scoped.
136
+
137
+ The CLI equivalents are `ab landings [--json] [--store <ref>]` and
138
+ `ab ticket tree [--json]`. Default `ab watch` attention includes node landings,
139
+ restack conflicts and derived `build.consent-ready` observations with durable
140
+ cursor positions. `ab wait` supports `consent`, `node-landed` and
141
+ `restack-conflicted`; current-state conditions return immediately. Explicit
142
+ watch event globs emit durable events only. A readiness episode changes on a
143
+ new candidate or exit/re-entry, and cursor resume suppresses its duplicate.
144
+
145
+ Consent and hold readiness produce only `build.consent-ready`; merge attention is
146
+ reserved for current gate deferrals and unsafe forge outcomes. Named and
147
+ repository-wide watches report an already-ready landing on first discovery.
148
+ Readiness observations use the same `{kind, branch, ticket?, build?}` effective
149
+ target shape as queue entries.
@@ -0,0 +1,68 @@
1
+ # Migrating from 0.x to 1.0
2
+
3
+ The integration tree changes replay and landing authorization. It does not cut a
4
+ release or rename `baseBranch`: that setting now names the tree root. Existing
5
+ tickets default to work with no target and continue targeting the root. Adopt
6
+ nodes only when useful; see [integration trees](integration-tree.md).
7
+
8
+ ## Configuration and installed skills
9
+
10
+ Run `ab upgrade` against the intended repository. It updates the recognized
11
+ installation and three-way merges vendored skills with their pristine defaults;
12
+ review local conflicts. `--no-self-update` skips installation update while still
13
+ performing repository migration and skill merging. Preserve local customizations
14
+ and use the installed [setup reference](setup.md) to review verification and roles.
15
+
16
+ When `landing` is absent, upgrade reads the target repository's configured
17
+ BuildStore journal, ignoring ambient `AB_STORE` for that choice, and appends:
18
+
19
+ | Legacy repository default | Leaf rule | Node rule |
20
+ |---|---|---|
21
+ | ON | auto | consent |
22
+ | OFF or no fact | consent | consent |
23
+
24
+ A genuinely absent local journal counts as no fact. An unreadable or unavailable
25
+ journal fails migration with guidance: restore store access and retry, or write
26
+ explicit rules after deciding the desired policy. Existing valid landing arrays
27
+ are preserved byte-for-byte, including root-level `landing = []`, which selects
28
+ the new leaf-auto/node-consent defaults. Fresh init uses those new defaults.
29
+ See [landing policy](landing-policy.md) for complete worked configurations.
30
+
31
+ The repository auto-merge default, its fan-out and old CLI/default controls are
32
+ retired. Use `ab land` and `ab hold`, not an old repository switch. Historical
33
+ explicit per-build `build.auto-merge-requested`/`cancelled` facts map to land/hold
34
+ until a new landing command supersedes them; historical default-seeded requests
35
+ confer no consent. New claims do not materialize old defaults.
36
+
37
+ ## Builds already in flight
38
+
39
+ Historical events and merge reconciliations keep their replay/display meaning;
40
+ old merge commits remain valid history. Later replay uses the promoted historical
41
+ contribution base. The current engine can restack resumed builds at newly reached
42
+ verification or waiting-for-landing boundaries, and current landing rules govern
43
+ new readiness decisions. There is no claim-version switch promising every old
44
+ build finishes with the old merge standard. Drain old work before switching
45
+ versions if retaining old execution behavior is required. Simultaneous old and
46
+ new writers are not a supported migration strategy.
47
+
48
+ Execution pipeline configuration stays pinned to the build; live dispatcher
49
+ landing policy is separate. A recorded readiness decision retains its rule
50
+ snapshot despite configuration edits; a new candidate receives a new decision.
51
+ Explicit consent persists through replay and re-verification until hold or
52
+ completion, except accepted node reparenting revokes it.
53
+
54
+ ## The reversed rebase ban
55
+
56
+ The old ban protected event-recorded SHAs and avoided resolving the same conflict
57
+ for every WIP commit. The new standard replays one net leaf change or ordered
58
+ node contributions, retains displaced history through immutable archive refs and
59
+ durable rewrite facts, and resolves each conflicted item once. Ordinary agent
60
+ rebase of WIP history is still inappropriate. Agents resolve kernel-prepared
61
+ replay; the kernel owns branch replacement with expected-head guards.
62
+
63
+ Root leaves squash; node destinations and local-git root nodes fast-forward;
64
+ GitHub root nodes use guarded rebase merge with recorded fencing/audit limits.
65
+ Check [forge requirements](landing-policy.md#forge-requirements) and
66
+ [restacking](restacking.md) before enabling nodes on a plugin forge. Ensure
67
+ archive publication/read permissions, tree capabilities and required merge
68
+ methods are available; legacy read compatibility is insufficient.
@@ -112,17 +112,15 @@ JSON bodies are strict: unknown fields are rejected.
112
112
 
113
113
  | Method and path | Body |
114
114
  |---|---|
115
- | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"auto-merge-on"\|"auto-merge-off"}` |
115
+ | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}` |
116
116
  | `POST …/builds/{slug}/answer` | One answer variant described below. |
117
117
  | `PUT …/settings/intake` | `{"enabled":boolean}` |
118
118
  | `POST …/settings/intake/toggle` | Empty body. |
119
- | `PUT …/settings/auto-merge-default` | `{"enabled":boolean}` |
120
- | `POST …/settings/auto-merge-default/toggle` | Empty body. |
121
119
  | `POST …/bulk-control` | `{"action":"pause"\|"resume"}`. The hold fact, intake fact, then eligible build events are written in that order. |
122
120
  | `POST …/harvest/control` | `{"action":"toggle-gate"}` or `{"action":"run","run":"…"}`. A run action is bound to that concrete projected run. |
123
121
  | `POST …/tickets/states` | `{name,about?}` → `{state,created}`; requires attributed operator identity (`tickets.state.create` in MCP). Hosted duplicate names are refused case-insensitively. |
124
- | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[]}`; omitted state preserves the backend default. |
125
- | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, and complete-replacement `labels`. Body bytes are not normalized. |
122
+ | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[],"kind"?:"work"|"node","target"?:"id"|null}`; omitted state preserves the backend default. |
123
+ | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, complete-replacement `labels`, `kind` (`work` or `node`), and nullable `target` (null clears). Body bytes are not normalized. |
126
124
  | `POST …/tickets/{id}/move` | `{"state":"backend state name"}`. |
127
125
  | `POST …/tickets/{id}/block` | `{"blockerIds":["…"]}`. |
128
126
  | `POST …/tickets/{id}/unblock` | `{"blockerIds":["…"]}`. |
@@ -239,9 +237,13 @@ record the first signal in the stop fact, and release its lease before exit.
239
237
 
240
238
  The default watch reports actionable conditions only:
241
239
 
242
- - Build `escalation.raised`, or `build.merge-decision`: a finalized open PR
243
- with auto-merge off or a current actionable merge-gate deferral. Armed consent
244
- awaiting application is silent. One merge decision is reported per build/PR.
240
+ - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, or
241
+ conflicted `restack.replayed` events. `build.consent-ready` is the single
242
+ signal for a ready consent or held landing, including first repository-wide
243
+ discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
244
+ Unready and stale candidates stay silent. `build.merge-decision` remains for
245
+ current actionable merge-gate deferrals and unsafe forge outcomes, once per
246
+ build/PR; it does not duplicate consent or hold attention.
245
247
  - Repository `harvest.escalated`, `harvest.recovery-exhausted`,
246
248
  `dispatcher.config-rejected`, `dispatcher.config-reloaded` with nonempty
247
249
  `restartRequired`, abnormal `dispatcher.run-stopped`, and `dispatcher.lost`.
@@ -291,3 +293,12 @@ Hosted ticket tools resolve independent project ticket policy before legacy uplo
291
293
  configuration. Queue, detail, state discovery and mutations work before any build
292
294
  or dispatcher run; detail reports a null matching build. Ticket policy publication
293
295
  never creates synthetic build or repository history.
296
+
297
+ Ticket results include kind (default work) and optional same-source node target.
298
+ Metadata-only patches are accepted. Target validation and demotion guards apply
299
+ to CLI, HTTP and MCP alike; unsupported sources refuse even explicit defaults
300
+ or clears before changing other fields. Dispatch routing is unchanged.
301
+
302
+ Landing controls use `land` and `hold` with acknowledged durable state. Land
303
+ requires readiness and survives restacks; hold persists until land. Repository
304
+ auto-merge settings are retired; configure ordered `[[landing]]` rules.
@@ -12,21 +12,24 @@ persistence requirements, and conformance bar for the protocol shipped in this
12
12
  distribution are all defined here. Protocol implementations must retain contracts for every supported client line;
13
13
  protocol changes update this document and executable contracts together.
14
14
 
15
- A service accepts stable clients from its own `major.minor` release line and
16
- the two preceding minor lines in the same major. A major starts a new family:
15
+ A service accepts stable and prerelease clients from its own `major.minor`
16
+ release line and the two preceding minor lines in the same major. A major starts a new family:
17
17
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
18
18
  Patch versions are interchangeable in both directions and must never change
19
19
  the protocol. Upgrade the service first, then projects independently within
20
20
  its window. Supported release lines retain their wire handlers and known
21
21
  protocol identities; an unknown protocol is refused independently of version.
22
- Malformed, missing, and prerelease identities are refused with HTTP 409.
22
+ Stable and prerelease service and client identities share their numeric major/minor
23
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
24
+ whitespace are refused with HTTP 409.
23
25
  A newer client is told to upgrade the service; a client below the window is
24
26
  told to upgrade the project's Autobuild. Diagnostics name the service version
25
27
  and supported range.
26
28
 
27
29
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
28
30
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
29
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
31
+ Range endpoints remain stable versions. The range is inclusive at the minimum
32
+ and exclusive at the maximum; a 0.11.x
30
33
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
31
34
  headers, or available backend.
32
35
 
@@ -510,22 +513,37 @@ creation operation and must not reset timestamps, events, artifacts, or lease
510
513
  state when the repository already exists. Event sequence numbering starts at 1
511
514
  for each repository independently of every build and other repository.
512
515
 
513
- A `BuildDigest` is the projection of one build's log onto its terminal fact
514
- and its `observation.recorded` occurrences:
516
+ A `BuildDigest` projects terminal, observation, and compact landing evidence
517
+ from one build's log:
515
518
 
516
519
  ```jsonc
517
520
  // BuildDigest
518
521
  {
522
+ "integrationAuditPending": true, // optional: kernel landing audit requested, not yet settled
519
523
  "slug": "ab-fix-login-3",
520
524
  "terminal": "done", // optional: "done" | "aborted", omitted while the log has neither
521
525
  "observations": [ // ascending-seq pairs for the log's observation.recorded events
522
526
  { "seq": 1, "ts": "2026-07-15T12:00:01.000Z" },
523
527
  { "seq": 4, "ts": "2026-07-15T12:00:04.000Z" }
524
528
  ],
525
- "merged": "2026-07-15T12:00:06.000Z" // optional: ts of the log's latest pr.merged, omitted when none
529
+ "merged": "2026-07-15T12:00:06.000Z", // optional: ts of the log's latest pr.merged, omitted when none
530
+ "mergedSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", // optional: that merge's actual landing SHA
531
+ "nodeContribution": { // optional: latest node.contribution-recorded payload
532
+ "landing": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
533
+ "head": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
534
+ "base": "cccccccccccccccccccccccccccccccccccccccc",
535
+ "identities": ["build:child"]
536
+ }
526
537
  }
527
538
  ```
528
539
 
540
+ The optional `mergedSha` and `nodeContribution` fields let admission index
541
+ confirmed landing evidence without fetching every historical build's full facts.
542
+ A node contribution is usable only when its `landing` matches `mergedSha`;
543
+ recording or recovering a contribution advances `readinessChangeSeq`. These
544
+ members are additive: older peers can omit them, leaving presence unproven rather
545
+ than substituting source completion. They do not change the protocol version.
546
+
529
547
  The digest is derived from the event log on every call — the server persists
530
548
  nothing and there is no refresh step. Protocol version `3` reshaped the
531
549
  digest's `observations` from bare sequence numbers to `{seq, ts}` pairs and
@@ -1295,3 +1313,8 @@ These operations never renew the lease. Repository records optionally expose
1295
1313
  `tick: {run, open?: {startedAt}, finished?: {run, startedAt, completedAt, ...completion}}`.
1296
1314
  They retain the previous completion while a new tick is open and after lease
1297
1315
  release. Build and session credentials cannot mutate repository ticks.
1316
+
1317
+ The optional `integrationAuditPending` digest fact is introduced on the 0.14
1318
+ release line without changing protocol identity 4. It survives build completion
1319
+ and is cleared by audit settlement. Services omit it for historical 0.12/0.13
1320
+ clients, retaining their decoders and the supported three-line window.
@@ -6,21 +6,24 @@ version headers with the remote BuildStore. The version must be in the
6
6
  published service window and the protocol must
7
7
  match its known release-line identity (`3` for 0.9, 0.10, and 0.11).
8
8
 
9
- A service accepts stable clients from its own `major.minor` release line and
10
- the two preceding minor lines in the same major. A major starts a new family:
9
+ A service accepts stable and prerelease clients from its own `major.minor`
10
+ release line and the two preceding minor lines in the same major. A major starts a new family:
11
11
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
12
12
  Patch versions are interchangeable in both directions and must never change
13
13
  the protocol. Upgrade the service first, then projects independently within
14
14
  its window. Supported release lines retain their wire handlers and known
15
15
  protocol identities; an unknown protocol is refused independently of version.
16
- Malformed, missing, and prerelease identities are refused with HTTP 409.
16
+ Stable and prerelease service and client identities share their numeric major/minor
17
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
18
+ whitespace are refused with HTTP 409.
17
19
  A newer client is told to upgrade the service; a client below the window is
18
20
  told to upgrade the project's Autobuild. Diagnostics name the service version
19
21
  and supported range.
20
22
 
21
23
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
22
24
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
23
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
25
+ Range endpoints remain stable versions. The range is inclusive at the minimum
26
+ and exclusive at the maximum; a 0.11.x
24
27
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
25
28
  headers, or available backend.
26
29
 
@@ -273,7 +276,7 @@ snapshot of fields, blockers and revision.
273
276
 
274
277
  `POST /tickets/mutate-if-revision` accepts the usual authenticated context and
275
278
  `input: { id, expectedRevision, mutation }`. Mutation is one of
276
- `{ kind: "update", patch: { title?, body?, labels? } }`,
279
+ `{ kind: "update", patch: { title?, body?, labels?, kind?, target? } }`,
277
280
  `{ kind: "transition", state }`, or
278
281
  `{ kind: "blockers", operation: "block" | "unblock", ids: string[] }`.
279
282
  Unknown keys and empty patches are refused. Success returns `{ ok: true }`.
@@ -312,3 +315,21 @@ before source construction. Their ordinary create grants remain unchanged.
312
315
 
313
316
  See the [migration procedure](ticket-migration.md) for preflight, state mapping,
314
317
  resumption and portable file records.
318
+
319
+ ## Integration tree metadata
320
+
321
+ Hosted tickets store `kind` (`work` or `node`, default `work`) and optional
322
+ `target`, the canonical readable id of a node in the same project. Create accepts
323
+ both fields; update and guarded update preserve omitted fields and accept
324
+ `target: null` to clear an edge. Targets must exist and be nodes. Self-targets,
325
+ ancestor cycles, and demoting a node with targeting tickets (including completed
326
+ work) are rejected before any part of a mixed patch is written. Graph mutations
327
+ serialize per project in the same transaction as validation and revision checks.
328
+ Effective metadata changes increment the revision; equivalent aliases are no-ops.
329
+
330
+ Ticket responses include these fields only with `x-autobuild-ticket-tree: 1`.
331
+ This capability is independent of revision and comment capabilities and of the
332
+ client version. Without it, both fields are projected away, preserving historical
333
+ strict decoders. Current hosted clients send all three capability headers and
334
+ default absent kind to `work`. Unfiltered listing includes all ticket states and
335
+ empty nodes for `ab ticket tree`; dispatch and landing behavior are unchanged.
@@ -0,0 +1,79 @@
1
+ # Restacking and change identity
2
+
3
+ A leaf contributes one net change, independent of its WIP commit count. Before
4
+ verification the kernel collapses its contribution relative to the effective
5
+ diff base and replays it onto the sampled destination. Implementation and review
6
+ do not rewrite history. Verification failures return to implementation; later
7
+ commits append until the next approved cycle. Later reviews use the effective
8
+ base from the preceding successful restack; the original cut remains provenance.
9
+
10
+ The terminal `Autobuild-Build: <slug>` trailer identifies a change across SHA
11
+ rewrites. Reachable identities determine presence, including blockers; old SHAs
12
+ alone do not. Each canonical leaf replay has one parent and one identity,
13
+ including an empty resolved change. Root leaf squash retains that identity;
14
+ node fast-forwards preserve ordered contributing identities.
15
+
16
+ ## Timing and evidence
17
+
18
+ Destination observations are durable `target.moved` facts, including while an
19
+ agent runs. Verify-entry restack freezes a current base before verification;
20
+ path selection excludes upstream-only paths. After finalize and post-steps,
21
+ waiting leaves restack when the target moves. Node-target finalize contributions
22
+ are canonicalized before guarded landing even when the target SHA is unchanged.
23
+ Clean replay starts no agent. A clean waiting leaf rewrite preserves prior
24
+ verification; reports retain their actual cycle base/head. Conflicted replay
25
+ runs reconcile and verification, and initial verification cannot be skipped
26
+ through post-reconcile policy.
27
+
28
+ Every open node observes its parent and cascades movement to descendants,
29
+ including empty nodes without PRs. Movement coalesces onto the newest sample
30
+ after an active frozen transaction finishes; no separate throttle is configured.
31
+ Unlike clean waiting leaves, nodes must reverify any changed head or parent.
32
+
33
+ Before replacement the kernel publishes retained tips, displaced heads and the
34
+ temporary change under immutable exact archive refs. `restack.*` facts record
35
+ preparation, replay, intent, archived replacement, contention and completion.
36
+ Unpublished request/loss records alone cannot preserve objects from a released
37
+ sandbox. Publication uses exact expected-head CAS; contention retains evidence
38
+ and retries without overwriting another writer. Remote guests park for trusted
39
+ publication after teardown. Historical merge reconciliations keep their original
40
+ interpretation and supply a promoted contribution base for later replay.
41
+
42
+ ## Node contributions and recovery
43
+
44
+ Node replay enumerates oldest-first first-parent contributions above the last
45
+ completed boundary (initially the opening SHA). Inherited foreign history is
46
+ excluded from node ownership; the boundary advances only on confirmed completion.
47
+ Ordered source identities survive, and identities already reachable upstream
48
+ are dropped. Untagged commits, including empty ones, are foreign.
49
+
50
+ A separate node writer lease and durable reservation serialize restacks and
51
+ child landings. Reservations freeze expected head, parent, contribution boundary,
52
+ archives, changes and merge proofs. Lease expiry recovers the same operation,
53
+ not a competing one. Prepared/conflicted/replayed item receipts, publication
54
+ intent, proven replacement and settlement distinguish each recovery boundary.
55
+ Inventory exposes source identities, node-owned foreign commits, active operation,
56
+ conflict item and unsafe merge evidence.
57
+
58
+ Only a conflicted item attaches a reconcile runner. It receives the original
59
+ source build's pinned spec, approved plan and implement-notes, with the integration
60
+ owner identified separately. Missing artifacts or invalid identity escalate.
61
+ Foreign conflicts receive commit metadata and a diff; unclear intent escalates.
62
+ Completion validates exactly one commit on the item's replay base, preserving
63
+ identity or foreign status. The agent never publishes the stack; dispatcher
64
+ publication waits for session and execution settlement.
65
+
66
+ ## Foreign merges
67
+
68
+ Before any replay or publication, inspect every merge's non-first-parent history,
69
+ including nested side history, against identities reachable in the frozen parent.
70
+ Flattening is safe only when the merge has no own identity and every side-history
71
+ identity is already present upstream. It becomes one foreign first-parent delta,
72
+ including resolution content or an empty result; side identities stay inherited.
73
+ An identity-bearing merge, absent upstream side identity, malformed or ambiguous
74
+ identity refuses the whole restack. The branch and contribution boundary remain
75
+ untouched and the integration build escalates with offending evidence. The kernel
76
+ never preserves merge topology or decomposes an unsafe merge automatically.
77
+
78
+ See [integration trees](integration-tree.md), [landing](landing-policy.md), and
79
+ [migration](migration-1.0.md).
package/docs/setup.md CHANGED
@@ -119,8 +119,8 @@ exits nonzero on failure. Then:
119
119
  5. Commit the config, setup files, lockfiles, and installed reference changes,
120
120
  then push them to `baseBranch`. A remote sandbox clones the authoritative
121
121
  GitHub revision; it cannot acquire local-only edits.
122
- 6. Run `ab init --validate`. Fix every named failure and rerun until every check
123
- passes. Only then use the installed grooming/ticket skills to create the
122
+ 6. Run `ab init --validate`. Fix every named failure, review warnings and unknowns, and rerun
123
+ validation. Only then use the installed grooming/ticket skills to create the
124
124
  first groomed Ready ticket and start `ab dispatch`.
125
125
 
126
126
  Validation is explicit and noninteractive. It does not dispatch, claim a
@@ -208,21 +208,24 @@ sources agree with the running system by construction:
208
208
  **running dispatcher's version** (read from the deployed distribution's
209
209
  `package.json`), so the guest runs the dispatcher's own release.
210
210
 
211
- A service accepts stable clients from its own `major.minor` release line and
212
- the two preceding minor lines in the same major. A major starts a new family:
211
+ A service accepts stable and prerelease clients from its own `major.minor`
212
+ release line and the two preceding minor lines in the same major. A major starts a new family:
213
213
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
214
214
  Patch versions are interchangeable in both directions and must never change
215
215
  the protocol. Upgrade the service first, then projects independently within
216
216
  its window. Supported release lines retain their wire handlers and known
217
217
  protocol identities; an unknown protocol is refused independently of version.
218
- Malformed, missing, and prerelease identities are refused with HTTP 409.
218
+ Stable and prerelease service and client identities share their numeric major/minor
219
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
220
+ whitespace are refused with HTTP 409.
219
221
  A newer client is told to upgrade the service; a client below the window is
220
222
  told to upgrade the project's Autobuild. Diagnostics name the service version
221
223
  and supported range.
222
224
 
223
225
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
224
226
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
225
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
227
+ Range endpoints remain stable versions. The range is inclusive at the minimum
228
+ and exclusive at the maximum; a 0.11.x
226
229
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
227
230
  headers, or available backend.
228
231
 
@@ -473,3 +476,43 @@ To retain earlier names configure `triageState = "Backlog"`,
473
476
  `claimedState = "Doing"`, `doneState = "Done"`, and the desired `readyState`.
474
477
  Existing ticket rows are never renamed. Older combined-service clients continue
475
478
  using the uploaded dispatcher configuration until independent policy is published.
479
+
480
+ ## Forge readiness
481
+
482
+ Validation inspects the configured forge once on the host, including when builds
483
+ run in Vercel Sandbox. Forge credentials never enter the guest. Each setting is
484
+ PASS, FAIL, WARN, or UNKNOWN; unknown never means permission was proved.
485
+
486
+ For GitHub, enable **Allow squash merging** and **Allow rebase merging** in
487
+ Settings → General. The kernel needs direct publication and force-push permission
488
+ throughout `refs/heads/ab/` and `refs/heads/ab-node/`, including future branch
489
+ names. It also publishes immutable `refs/autobuild/archive/` refs, a non-head
490
+ namespace. Review protection rules, inherited organization rulesets, push rules,
491
+ and actor restrictions for all three namespaces. GitHub's branch APIs cannot
492
+ prove archive-domain access: manually verify it with your administrator without
493
+ creating probe refs or overwriting archives. Autobuild never changes settings or
494
+ performs test pushes.
495
+
496
+ Require **linear history** on protected root and node target branches to prevent
497
+ merge commits from GitHub's update-branch action. On the configured root, enable
498
+ **Require branches to be up to date before merging**, with nonempty required
499
+ checks enforced for all merge actors. This makes root node landings fenced;
500
+ without it they are best-effort. Both are recommendations, so missing settings
501
+ produce warnings rather than hard failures.
502
+
503
+ Inspection needs **Metadata:read** for rulesets and **Administration:read** for
504
+ classic protection; classic private-repository tokens need `repo` access.
505
+ Publication separately needs **Contents:write**. Read access never proves write
506
+ access. Insufficient scope, incomplete inventories, ambiguous patterns, or
507
+ unproven actor bypass produce UNKNOWN with access/remediation guidance. Plugins
508
+ without the optional readiness capability report UNKNOWN and need an adapter
509
+ upgrade; local Git passes these hosted-policy checks trivially.
510
+
511
+ Known hard failures make `ab init --validate` exit unsuccessfully. Warnings and
512
+ unknowns preserve the workspace validation result and require operator review.
513
+ Dispatch reports known hard failures once per invocation as durable
514
+ `dispatcher.forge-readiness-failed` repository notices without adding an admission
515
+ gate. External orchestrators follow these through `ab watch` with no slugs or an
516
+ explicit repository watch; `ab wait` remains build-only. The dashboard and operator
517
+ repository query retain all failures for that run. After correcting settings or
518
+ access, revalidate and restart dispatch to refresh its startup diagnostics.