@defrex/autobuild 0.8.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 (251) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +192 -0
  3. package/SPEC.md +2269 -0
  4. package/bin/ab-build-runner.ts +47 -0
  5. package/bin/ab-dev.ts +27 -0
  6. package/bin/ab-dispatch-kernel.ts +92 -0
  7. package/bin/ab-harvest-runner.ts +29 -0
  8. package/bin/ab-init-probe.ts +19 -0
  9. package/bin/ab-process-group-reaper.ts +32 -0
  10. package/bin/ab.ts +6 -0
  11. package/bin/agent/ab +3 -0
  12. package/docs/answering-blocked-builds.md +89 -0
  13. package/docs/architecture.md +726 -0
  14. package/docs/assets/headline-wide.png +0 -0
  15. package/docs/configuration.md +1623 -0
  16. package/docs/hosted-dispatcher-cutover-validation.md +178 -0
  17. package/docs/hosted-dispatcher.md +204 -0
  18. package/docs/mcp.md +119 -0
  19. package/docs/operator-api.md +186 -0
  20. package/docs/remote-store-protocol.md +972 -0
  21. package/docs/remote-ticket-protocol.md +79 -0
  22. package/docs/setup.md +289 -0
  23. package/docs/spec-standard.md +63 -0
  24. package/docs/ticket-dependencies.md +59 -0
  25. package/docs/vercel-sandbox-rollout-probe.md +7 -0
  26. package/package.json +135 -0
  27. package/packages/core/src/cli/args.ts +74 -0
  28. package/packages/core/src/cli/artifact.ts +182 -0
  29. package/packages/core/src/cli/binary.ts +198 -0
  30. package/packages/core/src/cli/build-control.ts +789 -0
  31. package/packages/core/src/cli/build-progress.ts +55 -0
  32. package/packages/core/src/cli/bulk-control.ts +385 -0
  33. package/packages/core/src/cli/context.ts +470 -0
  34. package/packages/core/src/cli/dashboard/actions.ts +59 -0
  35. package/packages/core/src/cli/dashboard/cells.ts +92 -0
  36. package/packages/core/src/cli/dashboard/composer.ts +230 -0
  37. package/packages/core/src/cli/dashboard/detail.ts +100 -0
  38. package/packages/core/src/cli/dashboard/frame-image.ts +373 -0
  39. package/packages/core/src/cli/dashboard/live.ts +152 -0
  40. package/packages/core/src/cli/dashboard/model.ts +1173 -0
  41. package/packages/core/src/cli/dashboard/poll.ts +196 -0
  42. package/packages/core/src/cli/dashboard/render.ts +1568 -0
  43. package/packages/core/src/cli/dashboard/selection.ts +66 -0
  44. package/packages/core/src/cli/dashboard/session-feed.ts +244 -0
  45. package/packages/core/src/cli/dashboard/session-view.ts +506 -0
  46. package/packages/core/src/cli/dashboard/transcript.ts +108 -0
  47. package/packages/core/src/cli/dev.ts +46 -0
  48. package/packages/core/src/cli/dispatch-frontend.ts +1045 -0
  49. package/packages/core/src/cli/dispatch-process.ts +259 -0
  50. package/packages/core/src/cli/dispatch.ts +3692 -0
  51. package/packages/core/src/cli/dotenv.ts +48 -0
  52. package/packages/core/src/cli/env.ts +206 -0
  53. package/packages/core/src/cli/harvest.ts +698 -0
  54. package/packages/core/src/cli/help.ts +713 -0
  55. package/packages/core/src/cli/init-agent.ts +106 -0
  56. package/packages/core/src/cli/init-validation.ts +583 -0
  57. package/packages/core/src/cli/init.ts +756 -0
  58. package/packages/core/src/cli/installation.ts +333 -0
  59. package/packages/core/src/cli/keyboard.ts +261 -0
  60. package/packages/core/src/cli/main.ts +1399 -0
  61. package/packages/core/src/cli/mcp.ts +279 -0
  62. package/packages/core/src/cli/models.ts +65 -0
  63. package/packages/core/src/cli/observe.ts +55 -0
  64. package/packages/core/src/cli/plugin.ts +227 -0
  65. package/packages/core/src/cli/pr-attachments.ts +138 -0
  66. package/packages/core/src/cli/pr-summary.ts +124 -0
  67. package/packages/core/src/cli/publication-settlement.ts +188 -0
  68. package/packages/core/src/cli/repo-state.ts +213 -0
  69. package/packages/core/src/cli/repository-status.ts +80 -0
  70. package/packages/core/src/cli/self-update.ts +443 -0
  71. package/packages/core/src/cli/status.ts +895 -0
  72. package/packages/core/src/cli/store-opening.contract.ts +289 -0
  73. package/packages/core/src/cli/store-opening.ts +167 -0
  74. package/packages/core/src/cli/store-ref.ts +33 -0
  75. package/packages/core/src/cli/terminal-restore.ts +174 -0
  76. package/packages/core/src/cli/terminal.ts +361 -0
  77. package/packages/core/src/cli/terminals.ts +995 -0
  78. package/packages/core/src/cli/testkit.ts +194 -0
  79. package/packages/core/src/cli/ticket.ts +484 -0
  80. package/packages/core/src/cli/upgrade-agent.ts +180 -0
  81. package/packages/core/src/cli/upgrade-commit.ts +468 -0
  82. package/packages/core/src/cli/upgrade-notice.ts +91 -0
  83. package/packages/core/src/cli/upgrade-progress.ts +110 -0
  84. package/packages/core/src/cli/upgrade.ts +888 -0
  85. package/packages/core/src/cli/wait.ts +587 -0
  86. package/packages/core/src/cli/watch.ts +932 -0
  87. package/packages/core/src/config/live.ts +255 -0
  88. package/packages/core/src/config/load.ts +98 -0
  89. package/packages/core/src/config/roles.ts +438 -0
  90. package/packages/core/src/config/schema.ts +774 -0
  91. package/packages/core/src/distribution.ts +24 -0
  92. package/packages/core/src/events/catalog.ts +201 -0
  93. package/packages/core/src/events/envelope.ts +59 -0
  94. package/packages/core/src/events/payloads.ts +618 -0
  95. package/packages/core/src/events/repository.ts +559 -0
  96. package/packages/core/src/events/sessions.ts +180 -0
  97. package/packages/core/src/harvest/schema.ts +147 -0
  98. package/packages/core/src/ids.ts +45 -0
  99. package/packages/core/src/integration/harness.ts +681 -0
  100. package/packages/core/src/kernel/auto-merge.ts +259 -0
  101. package/packages/core/src/kernel/converge.ts +117 -0
  102. package/packages/core/src/kernel/dispatch-settings.ts +60 -0
  103. package/packages/core/src/kernel/dispatch-status.ts +141 -0
  104. package/packages/core/src/kernel/engine.ts +1047 -0
  105. package/packages/core/src/kernel/harvest.ts +823 -0
  106. package/packages/core/src/kernel/origin.ts +69 -0
  107. package/packages/core/src/kernel/phases.ts +196 -0
  108. package/packages/core/src/kernel/plan-verify-selection.ts +105 -0
  109. package/packages/core/src/kernel/pr-attachments.ts +82 -0
  110. package/packages/core/src/kernel/reducer.ts +752 -0
  111. package/packages/core/src/kernel/stall.ts +155 -0
  112. package/packages/core/src/kernel/verify-applicability.ts +52 -0
  113. package/packages/core/src/markdown.ts +67 -0
  114. package/packages/core/src/ontology.ts +288 -0
  115. package/packages/core/src/open-map.ts +203 -0
  116. package/packages/core/src/operator/annotations.ts +187 -0
  117. package/packages/core/src/operator/client.ts +311 -0
  118. package/packages/core/src/operator/control.ts +117 -0
  119. package/packages/core/src/operator/index.ts +62 -0
  120. package/packages/core/src/operator/presentation.ts +22 -0
  121. package/packages/core/src/operator/protocol.ts +98 -0
  122. package/packages/core/src/operator/query.ts +201 -0
  123. package/packages/core/src/operator/registry.ts +1043 -0
  124. package/packages/core/src/operator/requests.ts +138 -0
  125. package/packages/core/src/operator/sandbox.ts +458 -0
  126. package/packages/core/src/operator/server.ts +616 -0
  127. package/packages/core/src/operator/sessions.ts +223 -0
  128. package/packages/core/src/operator/tickets.ts +177 -0
  129. package/packages/core/src/plugin-sdk/index.ts +174 -0
  130. package/packages/core/src/plugins/contract-entry.ts +74 -0
  131. package/packages/core/src/plugins/contract-env.ts +3 -0
  132. package/packages/core/src/plugins/load.ts +259 -0
  133. package/packages/core/src/plugins/manifest.ts +236 -0
  134. package/packages/core/src/plugins/registry.ts +274 -0
  135. package/packages/core/src/plugins/runtimes.ts +75 -0
  136. package/packages/core/src/ports/forge/contract.ts +258 -0
  137. package/packages/core/src/ports/forge/create.ts +74 -0
  138. package/packages/core/src/ports/forge/fake.ts +488 -0
  139. package/packages/core/src/ports/forge/github-pr-attachments.ts +351 -0
  140. package/packages/core/src/ports/forge/github-transport.ts +352 -0
  141. package/packages/core/src/ports/forge/github.ts +1162 -0
  142. package/packages/core/src/ports/forge/local-git.ts +568 -0
  143. package/packages/core/src/ports/runner/claude.ts +873 -0
  144. package/packages/core/src/ports/runner/cli-stream.ts +90 -0
  145. package/packages/core/src/ports/runner/codex.ts +873 -0
  146. package/packages/core/src/ports/runner/contract.ts +492 -0
  147. package/packages/core/src/ports/runner/fake.ts +213 -0
  148. package/packages/core/src/ports/runner/json-record.ts +2 -0
  149. package/packages/core/src/ports/runner/live-contract-fixture.ts +176 -0
  150. package/packages/core/src/ports/runner/one-shot.ts +29 -0
  151. package/packages/core/src/ports/runner/pi-bridge-core.ts +136 -0
  152. package/packages/core/src/ports/runner/pi-bridge.js +6 -0
  153. package/packages/core/src/ports/runner/pi-rpc.ts +454 -0
  154. package/packages/core/src/ports/runner/pi.ts +617 -0
  155. package/packages/core/src/ports/runner/production.ts +74 -0
  156. package/packages/core/src/ports/runner/provider-error.ts +121 -0
  157. package/packages/core/src/ports/runner/routing.ts +234 -0
  158. package/packages/core/src/ports/runner/runtime.ts +214 -0
  159. package/packages/core/src/ports/runner/session-env.ts +34 -0
  160. package/packages/core/src/ports/runner/stream-parts.ts +103 -0
  161. package/packages/core/src/ports/tickets/contract.ts +570 -0
  162. package/packages/core/src/ports/tickets/create.ts +135 -0
  163. package/packages/core/src/ports/tickets/fake.ts +215 -0
  164. package/packages/core/src/ports/tickets/file.ts +559 -0
  165. package/packages/core/src/ports/tickets/linear.ts +811 -0
  166. package/packages/core/src/ports/tickets/operations.ts +161 -0
  167. package/packages/core/src/ports/tickets/remote-index.ts +13 -0
  168. package/packages/core/src/ports/tickets/remote-protocol.ts +80 -0
  169. package/packages/core/src/ports/tickets/remote-server.ts +185 -0
  170. package/packages/core/src/ports/tickets/remote.ts +130 -0
  171. package/packages/core/src/ports/tickets/update.ts +51 -0
  172. package/packages/core/src/ports/types.ts +528 -0
  173. package/packages/core/src/ports/workspace/build-execution.ts +123 -0
  174. package/packages/core/src/ports/workspace/contract.ts +136 -0
  175. package/packages/core/src/ports/workspace/create.ts +132 -0
  176. package/packages/core/src/ports/workspace/distribution-archive.ts +317 -0
  177. package/packages/core/src/ports/workspace/fake.ts +432 -0
  178. package/packages/core/src/ports/workspace/git-worktree.ts +848 -0
  179. package/packages/core/src/ports/workspace/harvest-execution.ts +111 -0
  180. package/packages/core/src/ports/workspace/in-process-build-execution.ts +30 -0
  181. package/packages/core/src/ports/workspace/local-build-execution.ts +88 -0
  182. package/packages/core/src/ports/workspace/operator-sandbox.ts +142 -0
  183. package/packages/core/src/ports/workspace/phase-scratch.ts +156 -0
  184. package/packages/core/src/ports/workspace/vercel-sandbox.ts +2541 -0
  185. package/packages/core/src/processes/build-child-exit.ts +78 -0
  186. package/packages/core/src/processes/build-child.ts +119 -0
  187. package/packages/core/src/processes/build-execution-state.ts +95 -0
  188. package/packages/core/src/processes/build-parent-watch.ts +35 -0
  189. package/packages/core/src/processes/build-runner.ts +2614 -0
  190. package/packages/core/src/processes/dispatcher.ts +2825 -0
  191. package/packages/core/src/processes/execution-settlement.ts +171 -0
  192. package/packages/core/src/processes/harvest-child.ts +115 -0
  193. package/packages/core/src/processes/harvest-execution-state.ts +121 -0
  194. package/packages/core/src/processes/harvest-runner.ts +1656 -0
  195. package/packages/core/src/processes/harvest.ts +595 -0
  196. package/packages/core/src/processes/infrastructure-failure-budget.ts +146 -0
  197. package/packages/core/src/processes/phase-failure-budget.ts +52 -0
  198. package/packages/core/src/processes/process-group-reaper.ts +35 -0
  199. package/packages/core/src/processes/process-group.ts +65 -0
  200. package/packages/core/src/processes/publication-loss.ts +62 -0
  201. package/packages/core/src/processes/publication-state.ts +93 -0
  202. package/packages/core/src/processes/sandbox-state.ts +101 -0
  203. package/packages/core/src/registry.ts +24 -0
  204. package/packages/core/src/sessions/reducer.ts +185 -0
  205. package/packages/core/src/skills.ts +7 -0
  206. package/packages/core/src/spec-standard.ts +47 -0
  207. package/packages/core/src/store/adapter.ts +80 -0
  208. package/packages/core/src/store/build-scope.ts +272 -0
  209. package/packages/core/src/store/contract.ts +2581 -0
  210. package/packages/core/src/store/local/blobs.ts +38 -0
  211. package/packages/core/src/store/local/schema.ts +180 -0
  212. package/packages/core/src/store/local/store.ts +1713 -0
  213. package/packages/core/src/store/memory.ts +1138 -0
  214. package/packages/core/src/store/phase-session.ts +425 -0
  215. package/packages/core/src/store/remote/client.ts +780 -0
  216. package/packages/core/src/store/remote/index.ts +12 -0
  217. package/packages/core/src/store/remote/protocol.ts +348 -0
  218. package/packages/core/src/store/remote/server.ts +923 -0
  219. package/packages/core/src/store/remote/token.ts +137 -0
  220. package/packages/core/src/store/remote/version.ts +10 -0
  221. package/packages/core/src/store/retention.ts +91 -0
  222. package/packages/core/src/store/session-handle.ts +265 -0
  223. package/packages/core/src/store/streams/assemble.ts +79 -0
  224. package/packages/core/src/store/streams/lock.ts +42 -0
  225. package/packages/core/src/store/streams/session-writer.ts +306 -0
  226. package/packages/core/src/store/streams/types.ts +171 -0
  227. package/packages/core/src/store/streams/wait.ts +127 -0
  228. package/packages/core/src/store/subscribe.ts +105 -0
  229. package/packages/core/src/store/types.ts +466 -0
  230. package/packages/core/src/testing/fixed.ts +44 -0
  231. package/packages/core/src/testing/store-failures.ts +32 -0
  232. package/packages/core/src/zod-issues.ts +91 -0
  233. package/skills/code-review/SKILL.md +100 -0
  234. package/skills/finalize/SKILL.md +44 -0
  235. package/skills/guide/SKILL.md +1781 -0
  236. package/skills/guide/references/operator-api.md +164 -0
  237. package/skills/guide/references/plugin-authoring.md +354 -0
  238. package/skills/guide/references/remote-store-protocol.md +972 -0
  239. package/skills/guide/references/remote-ticket-protocol.md +79 -0
  240. package/skills/guide/references/setup.md +289 -0
  241. package/skills/guide/references/spec-standard.md +63 -0
  242. package/skills/guide/references/ticket-dependencies.md +59 -0
  243. package/skills/harvest/SKILL.md +66 -0
  244. package/skills/harvest-review/SKILL.md +63 -0
  245. package/skills/implement/SKILL.md +82 -0
  246. package/skills/plan/SKILL.md +123 -0
  247. package/skills/plan-review/SKILL.md +121 -0
  248. package/skills/reconcile/SKILL.md +65 -0
  249. package/skills/spec/SKILL.md +132 -0
  250. package/skills/tickets/SKILL.md +139 -0
  251. package/templates/autobuild.toml +36 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Moving zod issues across a validation boundary without losing what zod
3
+ * reported, and expanding what a renderer cannot present as-is.
4
+ *
5
+ * A nested `safeParse` whose issues are relayed by hand — the shape every
6
+ * `z.transform` that validates a sub-value ends up in — is where detail goes to
7
+ * die. Re-encoding each issue as `{ code: 'custom', message }` keeps the prose
8
+ * and silently discards everything structured: `unrecognized_keys.keys`,
9
+ * `invalid_type.expected`, and, decisively, `invalid_union.errors`, which is
10
+ * where an untagged `z.union` keeps the entire reason it rejected the value.
11
+ * Its own `message` is the bare "Invalid input", so re-encoding turns a precise
12
+ * rejection into no information at all.
13
+ *
14
+ * The split is deliberate: `forwardIssues` relays, `expandIssues` presents.
15
+ * Forwarding keeps validation honest without deciding prose; expanding is what
16
+ * makes union branch detail reach a human, and belongs at operator-facing
17
+ * renderer boundaries rather than inside a validator.
18
+ */
19
+ import type { z } from 'zod'
20
+
21
+ /**
22
+ * The slice of zod's `$RefinementCtx` a transform needs to report issues.
23
+ *
24
+ * Taken from zod rather than hand-written: its `addIssue` already accepts every
25
+ * issue code — an issue this codebase raises (`{ code: 'custom', message }`,
26
+ * path optional because zod anchors it) and one relayed from an inner parse
27
+ * alike. Restating it as a `custom`-only shape is what made re-encoding look
28
+ * like the only option at each of these boundaries.
29
+ */
30
+ export type IssueSink = Pick<z.core.$RefinementCtx, 'addIssue'>
31
+
32
+ /**
33
+ * Relay every issue from an inner parse to an outer context verbatim, with only
34
+ * its path prefixed to anchor it where the inner value sits.
35
+ *
36
+ * Verbatim is the point. Each issue keeps its own code and its code-specific
37
+ * payload, so a caller downstream — the config loader's `unrecognized_keys`
38
+ * migration hints, `expandIssues`' union expansion — still sees what zod
39
+ * actually decided rather than a `custom` issue carrying prose.
40
+ */
41
+ export function forwardIssues(
42
+ issues: readonly z.core.$ZodIssue[],
43
+ ctx: IssueSink,
44
+ prefix: PropertyKey[] = [],
45
+ ): void {
46
+ for (const issue of issues) {
47
+ ctx.addIssue({ ...issue, path: [...prefix, ...issue.path] })
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Replace each union issue that carries branch detail with one issue per branch
53
+ * leaf, so a renderer that prints `path: message` prints why every alternative
54
+ * was rejected instead of the bare "Invalid input".
55
+ *
56
+ * A leaf keeps its real path (the union's, then its own) and its real code, so
57
+ * path-and-code-driven post-processing downstream still sees a real issue. Only
58
+ * the message is synthesized, and only by prefixing `option N of M:`.
59
+ *
60
+ * Expansion happens ONLY when it yields at least one leaf; otherwise the issue
61
+ * passes through untouched. That single rule is the whole tagged-choice
62
+ * guarantee: a `z.discriminatedUnion` that matches no tag reports
63
+ * `invalid_union` with `errors: []` and a message that already names the
64
+ * expected tags, so it has nothing to expand and renders exactly as it did
65
+ * before. Nesting recurses — a union inside a union yields leaves carrying both
66
+ * markers.
67
+ *
68
+ * `invalid_key` and `invalid_element` nest issues the same way. Neither reaches
69
+ * the currently covered config, plugin-manifest, findings, or ticket-update
70
+ * renderers, so they are left alone rather than handled speculatively.
71
+ */
72
+ export function expandIssues(issues: readonly z.core.$ZodIssue[]): z.core.$ZodIssue[] {
73
+ const expanded: z.core.$ZodIssue[] = []
74
+ for (const issue of issues) {
75
+ const leaves = issue.code === 'invalid_union' ? unionLeaves(issue) : []
76
+ if (leaves.length > 0) expanded.push(...leaves)
77
+ else expanded.push(issue)
78
+ }
79
+ return expanded
80
+ }
81
+
82
+ function unionLeaves(issue: z.core.$ZodIssueInvalidUnion): z.core.$ZodIssue[] {
83
+ const branches = issue.errors
84
+ return branches.flatMap((branch, index) =>
85
+ expandIssues(branch).map((leaf) => ({
86
+ ...leaf,
87
+ path: [...issue.path, ...leaf.path],
88
+ message: `option ${index + 1} of ${branches.length}: ${leaf.message}`,
89
+ })),
90
+ )
91
+ }
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: code-review
3
+ description: Review a build's implementation commits against its spec and plan. Invoked by the build-runner as the code-review phase; takes only the build slug.
4
+ ---
5
+
6
+ # /ab-code-review <build>
7
+
8
+ You are a fresh skeptic reviewing the diff. You have no memory of prior
9
+ rounds by design. Your verdict travels the typed channel; prose you print
10
+ goes nowhere.
11
+
12
+ ## Session shape
13
+
14
+ 1. Run `ab context`. You get `.ab/spec.md`, `.ab/plan.md`, the commit range
15
+ (`base`/`head` in `.ab/context.json`), `.ab/implement-notes.md`, and
16
+ `.ab/history/` with prior rounds' findings. When present,
17
+ `.ab/dismissed-findings.json` lists finding ids a human explicitly dismissed.
18
+ 2. Read the actual diff (`git diff <base>..<head>`), then the surrounding
19
+ code. Review what changed *and* what the change touches.
20
+ 3. Judge on exactly these axes, in this order:
21
+ - **Correctness** — bugs, broken edge cases, races, wrong behavior under
22
+ real inputs. This is most of your job. When the diff touches a
23
+ third-party API boundary, check the provider's own schema or reference
24
+ documentation for the actual request shapes, argument types, enum syntax,
25
+ and identifier constraints. Raise any mismatch or unverified assumption
26
+ as a concrete finding; memory, nearby adapter code, and green tests over a
27
+ fake or mock are not contract evidence because they can repeat the
28
+ author's assumption.
29
+ - **Spec conformance** — every acceptance criterion met; nothing beyond
30
+ the spec's scope smuggled in.
31
+ - **Tests** — do the new tests exercise the seams this change created or
32
+ moved? Would they fail if the change were wrong?
33
+ - **Fit** — matches the codebase's idioms; no needless indirection.
34
+ 4. Write `.ab/code-review.md`, then exactly one verdict:
35
+
36
+ ```
37
+ ab verdict approve --notes .ab/code-review.md
38
+ ab verdict revise --findings .ab/findings.json --notes .ab/code-review.md
39
+ ab verdict escalate --reason "…" --notes .ab/code-review.md
40
+ ```
41
+
42
+ ## Writing findings
43
+
44
+ Same schema as every review (the CLI validates and stamps ids): `severity`
45
+ (`blocking` | `important` | `minor`), optional `file`/`lines`, `summary`,
46
+ optional `detail`, and `persists` — ids of prior-round findings this one
47
+ continues.
48
+
49
+ `persists` means the defect a prior finding named is still present in the
50
+ work under review — not that a new problem falls in the same category as
51
+ one already fixed. Test it that way: if the exact defect the prior finding
52
+ named is gone, the chain ends there, however closely your new finding
53
+ resembles it. A new instance of a defect class whose reported instance was
54
+ fixed is fresh work and starts its own chain — raise it with no `persists`
55
+ link. Mark honestly in both directions: neither re-litigate a resolved
56
+ finding nor let a dodged one look fresh, because the kernel mechanically
57
+ escalates a chain that persists too long, and a stalemate is the only
58
+ thing that counter can usefully measure.
59
+
60
+ A human-dismissed id is settled: do not re-raise that finding. If a genuinely
61
+ different problem touches the same code, raise it with a new id and do not link
62
+ `persists` into the dismissed chain; dismissal settles one disagreement, not
63
+ the file.
64
+
65
+ Each finding must name a concrete failure, not a preference. "This could be
66
+ cleaner" is not a finding; "a sixth login attempt bypasses the limiter
67
+ because the window key uses the unnormalized email" is.
68
+
69
+ Severity measures proportion, not certainty. Rate a finding by what the
70
+ defect costs against the spec's acceptance criteria and the realistic
71
+ operating conditions of the work under review — never by how sure you are
72
+ that it is a defect. Certainty is the bar for raising a finding at all; it
73
+ says nothing about which level the finding belongs at.
74
+
75
+ - `blocking` — name the acceptance criterion the defect defeats. Approving
76
+ would deliver work the spec does not accept.
77
+ - `important` — name the acceptance criterion or stated invariant the defect
78
+ puts at material risk under realistic conditions, short of defeating it
79
+ outright.
80
+ - `minor` — real and in scope, but nothing above turns on it.
81
+
82
+ `blocking` and `important` both cost the producer a revision round, so if you
83
+ cannot name that criterion or invariant, the finding does not belong at
84
+ either level. A true defect that puts no acceptance criterion at risk, breaks
85
+ no stated invariant, and is unreachable under realistic input is `ab observe`,
86
+ not a finding — the same disposition an out-of-scope discovery gets.
87
+
88
+ Do not raise a bar the spec set: where the spec bounds a failure model or an
89
+ operating condition, conformance is measured against that bound, and a
90
+ stricter model you would have chosen is not a defect. Hostile or pathological
91
+ input that the surface's contract does not promise to handle is `minor` or an
92
+ observation, unless a security boundary, an acceptance criterion, or a stated
93
+ invariant makes it material.
94
+
95
+ Approve when the implementation satisfies the spec and is sound — not when
96
+ it is the diff you would have written. Known immaterial defects are not a
97
+ reason to withhold approval — record them with `ab observe` and approve.
98
+ Escalate only genuine judgment calls a human must make (the spec itself is
99
+ wrong, a security tradeoff outside your authority). Out-of-scope discoveries
100
+ are `ab observe`, never findings.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: finalize
3
+ description: Prepare a green build's pull request description. Invoked by the build-runner as the finalize phase; takes only the build slug.
4
+ ---
5
+
6
+ # /ab-finalize <build>
7
+
8
+ The build is green: plan approved, code approved, every verify step passed.
9
+ You write the PR description; the kernel opens the PR when you finish (you
10
+ never touch the forge).
11
+
12
+ ## Session shape
13
+
14
+ 1. Run `ab context`. You get `.ab/spec.md`, `.ab/plan.md`, every verify report,
15
+ the repo's PR template config if one exists, and — when a human answered an
16
+ escalation this phase raised on an earlier attempt — `.ab/guidance.json`,
17
+ their answer to it.
18
+ 2. Write `.ab/pr-description.md`:
19
+ - **Title line first** — imperative, ≤ 70 chars, from the spec's what.
20
+ - **What & why** — from the spec, compressed for a human reviewer who
21
+ hasn't read it.
22
+ - **How** — the approach actually taken (from the plan and the implement
23
+ notes), including deviations from the plan.
24
+ - **Verification** — which verify steps ran and what they proved; note
25
+ anything a human should re-check by hand.
26
+ - Follow the PR template if the context includes one.
27
+ Do not paste the audit trail — the kernel's summary comment appends verdict
28
+ history and links into the store.
29
+ 3. Finish:
30
+
31
+ ```
32
+ ab artifact put pr-description .ab/pr-description.md
33
+ ab done
34
+ ```
35
+
36
+ `ab done` validates the deposit; the kernel opens the PR from it. One
37
+ terminal command; if validation fails, fix what it names and rerun.
38
+
39
+ `.ab/guidance.json`, when present, is a human operator's answer to the
40
+ escalation that blocked this build: the escalation id and the answer text. It
41
+ is authoritative feedback for this attempt and the PR description must act on
42
+ it, while the spec remains the contract this phase is measured against — if the
43
+ two cannot both be satisfied, escalate instead of guessing. Finalize has no
44
+ review round of its own, so guidance is the only feedback it ever receives.