@defrex/autobuild 0.13.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.
- package/README.md +5 -3
- package/SPEC.md +673 -99
- package/bin/ab-dispatch-kernel.ts +4 -6
- package/docs/architecture.md +322 -75
- package/docs/assets/headline-wide.png +0 -0
- package/docs/configuration.md +112 -12
- package/docs/hosted-service.md +20 -2
- package/docs/integration-tree.md +117 -0
- package/docs/landing-policy.md +150 -0
- package/docs/mcp.md +24 -0
- package/docs/migration-1.0.md +68 -0
- package/docs/operator-api.md +20 -9
- package/docs/remote-store-protocol.md +114 -9
- package/docs/remote-ticket-protocol.md +26 -5
- package/docs/restacking.md +79 -0
- package/docs/setup.md +49 -6
- package/docs/ticket-dependencies.md +69 -0
- package/docs/ticket-migration.md +8 -0
- package/package.json +4 -3
- package/packages/core/src/cli/attention.ts +40 -163
- package/packages/core/src/cli/build-control.ts +75 -55
- package/packages/core/src/cli/bulk-control.ts +3 -2
- package/packages/core/src/cli/context.ts +68 -78
- package/packages/core/src/cli/dashboard/actions.ts +6 -3
- package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
- package/packages/core/src/cli/dashboard/live.ts +5 -0
- package/packages/core/src/cli/dashboard/model.ts +178 -40
- package/packages/core/src/cli/dashboard/poll.ts +15 -9
- package/packages/core/src/cli/dashboard/refresh.ts +176 -0
- package/packages/core/src/cli/dashboard/render.ts +78 -28
- package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
- package/packages/core/src/cli/dashboard/selection.ts +7 -1
- package/packages/core/src/cli/dashboard/tree.ts +107 -0
- package/packages/core/src/cli/dispatch-frontend.ts +173 -169
- package/packages/core/src/cli/dispatch-process.ts +14 -7
- package/packages/core/src/cli/dispatch-repository-feed.ts +196 -0
- package/packages/core/src/cli/dispatch.ts +397 -214
- package/packages/core/src/cli/dispatcher-liveness.ts +41 -21
- package/packages/core/src/cli/harvest.ts +71 -39
- package/packages/core/src/cli/help.ts +49 -32
- package/packages/core/src/cli/historical-build-state.ts +27 -0
- package/packages/core/src/cli/init-validation.ts +43 -2
- package/packages/core/src/cli/keyboard.ts +6 -0
- package/packages/core/src/cli/landings.ts +18 -0
- package/packages/core/src/cli/main.ts +52 -18
- package/packages/core/src/cli/mcp.ts +9 -0
- package/packages/core/src/cli/pr-attachments.ts +10 -13
- package/packages/core/src/cli/pr-summary-publication.ts +27 -60
- package/packages/core/src/cli/pr-summary.ts +43 -13
- package/packages/core/src/cli/publication-settlement.ts +177 -21
- package/packages/core/src/cli/repository-status.ts +49 -2
- package/packages/core/src/cli/status.ts +133 -36
- package/packages/core/src/cli/terminal-restore.ts +54 -0
- package/packages/core/src/cli/terminal.ts +16 -2
- package/packages/core/src/cli/terminals.ts +121 -219
- package/packages/core/src/cli/ticket-editor.ts +10 -3
- package/packages/core/src/cli/ticket.ts +115 -20
- package/packages/core/src/cli/upgrade-commit.ts +4 -0
- package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
- package/packages/core/src/cli/upgrade-landing.ts +69 -0
- package/packages/core/src/cli/upgrade.ts +16 -0
- package/packages/core/src/cli/wait.ts +194 -91
- package/packages/core/src/cli/watch.ts +111 -109
- package/packages/core/src/config/landing.ts +22 -0
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/pipeline-source.ts +4 -3
- package/packages/core/src/config/schema.ts +3 -0
- package/packages/core/src/events/catalog.ts +48 -3
- package/packages/core/src/events/payloads.ts +295 -6
- package/packages/core/src/events/repository.ts +38 -3
- package/packages/core/src/integration/harness.ts +11 -2
- package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +3330 -119
- package/packages/core/src/kernel/auto-merge-default.ts +1 -0
- package/packages/core/src/kernel/auto-merge.ts +29 -4
- package/packages/core/src/kernel/build-identity.ts +94 -0
- package/packages/core/src/kernel/change-presence.ts +179 -0
- package/packages/core/src/kernel/dispatch-status.ts +17 -1
- package/packages/core/src/kernel/dispatcher-liveness.ts +10 -4
- package/packages/core/src/kernel/engine.ts +89 -2
- package/packages/core/src/kernel/generators/build-log.ts +23 -0
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +25 -3
- package/packages/core/src/kernel/harvest.ts +25 -23
- package/packages/core/src/kernel/integration-completeness.ts +81 -0
- package/packages/core/src/kernel/integration-landing.ts +263 -0
- package/packages/core/src/kernel/integration-stack.ts +36 -0
- package/packages/core/src/kernel/integration-state.ts +135 -0
- package/packages/core/src/kernel/landing-policy.ts +47 -0
- package/packages/core/src/kernel/landing-publication.ts +41 -0
- package/packages/core/src/kernel/landing-readiness.ts +67 -0
- package/packages/core/src/kernel/landing-state.ts +96 -0
- package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
- package/packages/core/src/kernel/log-index-value.ts +38 -0
- package/packages/core/src/kernel/log-index.ts +35 -5
- package/packages/core/src/kernel/node-landing.ts +439 -0
- package/packages/core/src/kernel/node-parent.ts +184 -0
- package/packages/core/src/kernel/node-restack-state.ts +191 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
- package/packages/core/src/kernel/node-restack.ts +274 -0
- package/packages/core/src/kernel/read-facts.ts +704 -0
- package/packages/core/src/kernel/reconcile-head.ts +51 -0
- package/packages/core/src/kernel/reconcile-restack.ts +560 -0
- package/packages/core/src/kernel/reducer-registry.ts +153 -3
- package/packages/core/src/kernel/reducer.ts +121 -6
- package/packages/core/src/kernel/repository-attention.ts +179 -0
- package/packages/core/src/kernel/service-facts.ts +135 -0
- package/packages/core/src/kernel/snapshot-parent.ts +33 -0
- package/packages/core/src/kernel/terminal-guard.ts +133 -0
- package/packages/core/src/ontology.ts +9 -1
- package/packages/core/src/operator/annotations.ts +12 -0
- package/packages/core/src/operator/control.ts +11 -6
- package/packages/core/src/operator/index.ts +6 -0
- package/packages/core/src/operator/landings.ts +35 -0
- package/packages/core/src/operator/presentation.ts +1 -0
- package/packages/core/src/operator/protocol.ts +12 -3
- package/packages/core/src/operator/query.ts +40 -21
- package/packages/core/src/operator/read-view.ts +4 -13
- package/packages/core/src/operator/registry.ts +48 -19
- package/packages/core/src/operator/requests.ts +3 -22
- package/packages/core/src/operator/sandbox.ts +10 -9
- package/packages/core/src/operator/tickets.ts +57 -11
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/ports/forge/contract.ts +91 -3
- package/packages/core/src/ports/forge/fake.ts +142 -4
- package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
- package/packages/core/src/ports/forge/github-readiness.ts +421 -0
- package/packages/core/src/ports/forge/github.ts +631 -35
- package/packages/core/src/ports/forge/local-git.ts +119 -5
- package/packages/core/src/ports/forge/readiness.ts +99 -0
- package/packages/core/src/ports/tickets/contract.ts +41 -0
- package/packages/core/src/ports/tickets/create.ts +8 -1
- package/packages/core/src/ports/tickets/fake.ts +32 -1
- package/packages/core/src/ports/tickets/file-codec.ts +7 -0
- package/packages/core/src/ports/tickets/file.ts +18 -1
- package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
- package/packages/core/src/ports/tickets/linear.ts +124 -4
- package/packages/core/src/ports/tickets/migration.ts +25 -1
- package/packages/core/src/ports/tickets/operations.ts +7 -2
- package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
- package/packages/core/src/ports/tickets/remote.ts +10 -1
- package/packages/core/src/ports/tickets/revision.ts +3 -1
- package/packages/core/src/ports/tickets/tree.ts +148 -0
- package/packages/core/src/ports/tickets/update.ts +15 -2
- package/packages/core/src/ports/types.ts +135 -5
- package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
- package/packages/core/src/processes/build-child.ts +6 -6
- package/packages/core/src/processes/build-runner.ts +586 -87
- package/packages/core/src/processes/dispatch-failure-budget.ts +5 -4
- package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
- package/packages/core/src/processes/dispatcher.ts +2239 -357
- package/packages/core/src/processes/execution-no-progress.ts +46 -1
- package/packages/core/src/processes/harvest-execution-state.ts +15 -9
- package/packages/core/src/processes/harvest-runner.ts +34 -70
- package/packages/core/src/processes/harvest.ts +38 -15
- package/packages/core/src/processes/infrastructure-failure-budget.ts +13 -15
- package/packages/core/src/processes/orchestrator-tick.ts +2 -2
- package/packages/core/src/processes/publication-loss.ts +35 -21
- package/packages/core/src/processes/publication-state.ts +30 -5
- package/packages/core/src/processes/repo-view.ts +244 -1130
- package/packages/core/src/processes/tick-publication.ts +110 -0
- package/packages/core/src/store/adapter.ts +23 -0
- package/packages/core/src/store/build-scope.ts +35 -0
- package/packages/core/src/store/contract.ts +909 -0
- package/packages/core/src/store/digest.ts +52 -4
- package/packages/core/src/store/local/schema.ts +26 -13
- package/packages/core/src/store/local/store.ts +296 -55
- package/packages/core/src/store/memory.ts +181 -30
- package/packages/core/src/store/phase-session.ts +34 -0
- package/packages/core/src/store/reduced-reads.ts +240 -0
- package/packages/core/src/store/reducer-value-shapes.json +18323 -0
- package/packages/core/src/store/reducer-value-validation.ts +96 -0
- package/packages/core/src/store/reducer-values.ts +145 -0
- package/packages/core/src/store/remote/client.ts +85 -0
- package/packages/core/src/store/remote/compatibility.ts +21 -9
- package/packages/core/src/store/remote/index.ts +19 -0
- package/packages/core/src/store/remote/protocol.ts +27 -0
- package/packages/core/src/store/remote/version.ts +3 -1
- package/packages/core/src/store/repo-state-events.ts +3 -1
- package/packages/core/src/store/repo-tick.ts +72 -0
- package/packages/core/src/store/session-handle.ts +34 -0
- package/packages/core/src/store/snapshots.ts +10 -0
- package/packages/core/src/store/subscribe.ts +1 -1
- package/packages/core/src/store/ticket-assets.ts +4 -4
- package/packages/core/src/store/types.ts +71 -6
- package/packages/core/src/testing/dispatch-read-budget.ts +215 -0
- package/packages/core/src/testing/index.ts +10 -0
- package/packages/core/src/testing/reduced-read-budget.ts +502 -0
- package/packages/core/src/testing/refresh-scheduler.ts +32 -0
- package/skills/guide/SKILL.md +116 -62
- package/skills/guide/references/integration-tree.md +117 -0
- package/skills/guide/references/landing-policy.md +150 -0
- package/skills/guide/references/migration-1.0.md +68 -0
- package/skills/guide/references/operator-api.md +13 -6
- package/skills/guide/references/plugin-authoring.md +34 -0
- package/skills/guide/references/remote-store-protocol.md +114 -9
- package/skills/guide/references/remote-ticket-protocol.md +26 -5
- package/skills/guide/references/restacking.md +79 -0
- package/skills/guide/references/setup.md +49 -6
- package/skills/guide/references/ticket-dependencies.md +69 -0
- package/skills/guide/references/ticket-migration.md +8 -0
- package/skills/operate/SKILL.md +55 -5
- package/skills/reconcile/SKILL.md +55 -48
- package/skills/spec/SKILL.md +67 -1
- package/skills/tickets/SKILL.md +55 -2
- package/templates/autobuild.toml +3 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readBuildFacts, type CurrentBuildFacts } from '../store/reduced-reads'
|
|
1
2
|
/**
|
|
2
3
|
* The `ab context` materializer (SPEC §8.3): a phase-scoped hydration of the
|
|
3
4
|
* gitignored `.ab/` scratch dir. Everything derives from
|
|
@@ -16,14 +17,13 @@ import { mkdir, rm, writeFile } from 'node:fs/promises'
|
|
|
16
17
|
import { dirname, join } from 'node:path'
|
|
17
18
|
import { parseConfig } from '../config/load'
|
|
18
19
|
import type { VerifyStepConfig } from '../config/schema'
|
|
19
|
-
import type { AbEvent } from '../events/catalog'
|
|
20
20
|
import {
|
|
21
21
|
allowedTerminals,
|
|
22
22
|
phaseSpecFor,
|
|
23
23
|
type PhaseSpec,
|
|
24
24
|
type TerminalCommand,
|
|
25
25
|
} from '../kernel/phases'
|
|
26
|
-
import {
|
|
26
|
+
import type { BuildState } from '../kernel/reducer'
|
|
27
27
|
import {
|
|
28
28
|
isVerifyPhase,
|
|
29
29
|
verifyReportKind,
|
|
@@ -96,6 +96,18 @@ export interface ContextManifest {
|
|
|
96
96
|
commitRange?: CommitRange
|
|
97
97
|
/** Reconcile: `{baseSha}` freshly recorded by this attempt's phase start (§15.7). */
|
|
98
98
|
conflict?: { baseSha: string }
|
|
99
|
+
nodeChange?: {
|
|
100
|
+
owner: string
|
|
101
|
+
transaction: string
|
|
102
|
+
index: number
|
|
103
|
+
sha: string
|
|
104
|
+
build?: string
|
|
105
|
+
foreign: boolean
|
|
106
|
+
}
|
|
107
|
+
replay?: import('../events/payloads').EventPayload<'reconcile.prepared'> & {
|
|
108
|
+
conflicted?: boolean
|
|
109
|
+
needsCompletion: boolean
|
|
110
|
+
}
|
|
99
111
|
/** Agent-verify: the step's config from the workspace's autobuild.toml (§16.1). */
|
|
100
112
|
step?: { name: string; config: VerifyStepConfig }
|
|
101
113
|
/** The feedback this phase occurrence was started with (§15.3, §10). */
|
|
@@ -113,69 +125,12 @@ function requiredKinds(spec: PhaseSpec, phase: Phase): string[] {
|
|
|
113
125
|
|
|
114
126
|
/** All finding objects ever deposited, by id — verdict payloads carry them in
|
|
115
127
|
* full (§15.3), so feedback-by-id resolves without touching artifacts. */
|
|
116
|
-
function findingsById(events:
|
|
117
|
-
|
|
118
|
-
for (const event of events) {
|
|
119
|
-
if (event.type === 'plan-review.verdict' || event.type === 'code-review.verdict') {
|
|
120
|
-
for (const finding of event.payload.findings) byId.set(finding.id, finding)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return byId
|
|
128
|
+
function findingsById(events: CurrentBuildFacts): Map<string, Finding> {
|
|
129
|
+
return new Map(Object.values(events.findings).map((finding) => [finding.id, finding]))
|
|
124
130
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
* `implement.started`, `plan.started`, and agent `verify.started` may carry
|
|
129
|
-
* feedback — the carrier that gets answered guidance to a fresh session after
|
|
130
|
-
* a parked build re-attaches (§15.6-B). A `plan.started` without one (logs
|
|
131
|
-
* predating the field) falls
|
|
132
|
-
* back to deriving round-N feedback from the round-(N-1)
|
|
133
|
-
* `plan-review.verdict` — the plan loop's verdicts ARE its findings channel
|
|
134
|
-
* (§8.3: "prior plan rev + findings").
|
|
135
|
-
*/
|
|
136
|
-
function currentFeedback(events: AbEvent[], phase: Phase, round: number): Feedback | null {
|
|
137
|
-
if (isVerifyPhase(phase)) {
|
|
138
|
-
const step = verifyStep(phase)
|
|
139
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
140
|
-
const event = events[i]!
|
|
141
|
-
if (
|
|
142
|
-
event.type === 'verify.started' &&
|
|
143
|
-
event.payload.step === step &&
|
|
144
|
-
event.payload.attempt === round
|
|
145
|
-
) {
|
|
146
|
-
return event.payload.feedback ?? null
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return null
|
|
150
|
-
}
|
|
151
|
-
if (phase === 'implement') {
|
|
152
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
153
|
-
const event = events[i]!
|
|
154
|
-
if (event.type === 'implement.started' && event.payload.round === round) {
|
|
155
|
-
return event.payload.feedback ?? null
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return null
|
|
159
|
-
}
|
|
160
|
-
if (phase === 'plan') {
|
|
161
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
162
|
-
const event = events[i]!
|
|
163
|
-
if (event.type === 'plan.started' && event.payload.round === round) {
|
|
164
|
-
if (event.payload.feedback !== undefined) return event.payload.feedback
|
|
165
|
-
break // legacy start without the field — derive from the prior verdict
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (round <= 1) return null
|
|
169
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
170
|
-
const event = events[i]!
|
|
171
|
-
if (event.type === 'plan-review.verdict' && event.payload.round === round - 1) {
|
|
172
|
-
return event.payload.verdict === 'revise'
|
|
173
|
-
? { findings: event.payload.findings.map((finding) => finding.id) }
|
|
174
|
-
: null
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return null
|
|
131
|
+
function currentFeedback(events: CurrentBuildFacts, phase: Phase, round: number): Feedback | null {
|
|
132
|
+
const explicit = events.feedback[JSON.stringify([phase, round])]
|
|
133
|
+
return explicit ?? (phase === 'plan' ? (events.planFeedback[String(round)] ?? null) : null)
|
|
179
134
|
}
|
|
180
135
|
|
|
181
136
|
/** Empty and recreate `.ab/`; callers restore any tracked legacy entries. */
|
|
@@ -184,7 +139,7 @@ async function wipeAbDir(abDir: string): Promise<void> {
|
|
|
184
139
|
await mkdir(abDir, { recursive: true })
|
|
185
140
|
}
|
|
186
141
|
|
|
187
|
-
function dismissedIds(state: BuildState, events:
|
|
142
|
+
function dismissedIds(state: BuildState, events: CurrentBuildFacts): string[] {
|
|
188
143
|
const known = findingsById(events)
|
|
189
144
|
const ids = new Set<string>()
|
|
190
145
|
for (const escalation of state.answeredEscalations) {
|
|
@@ -205,8 +160,8 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
205
160
|
const { build, phase, round } = env
|
|
206
161
|
const spec = phaseSpecFor(phase)
|
|
207
162
|
const inputs = spec.inputs
|
|
208
|
-
const events = await store
|
|
209
|
-
const state =
|
|
163
|
+
const events = (await readBuildFacts(store, build)).value
|
|
164
|
+
const state = events.state
|
|
210
165
|
|
|
211
166
|
// Preserve legacy tracked scratch exactly while replacing disposable files.
|
|
212
167
|
// Some adapter contract fixtures intentionally use a non-Git workspace;
|
|
@@ -250,7 +205,16 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
250
205
|
/** Latest rev when `rev` omitted; silently skips absent kinds — the tree is
|
|
251
206
|
* a projection of what exists, and the manifest shows what materialized. */
|
|
252
207
|
async function writeArtifact(desiredPath: string, kind: string, rev?: number): Promise<void> {
|
|
253
|
-
const
|
|
208
|
+
const node = state.nodeRestack
|
|
209
|
+
const sourceKind =
|
|
210
|
+
phase === 'reconcile' && node?.conflict && ['spec', 'plan', 'implement-notes'].includes(kind)
|
|
211
|
+
? `node-source-${node.active!.id}-${node.conflict.index}-${kind}`
|
|
212
|
+
: kind
|
|
213
|
+
const artifact = await store.getArtifact(
|
|
214
|
+
build,
|
|
215
|
+
sourceKind,
|
|
216
|
+
sourceKind === kind ? rev : undefined,
|
|
217
|
+
)
|
|
254
218
|
if (artifact === null) return
|
|
255
219
|
const relPath = locate(desiredPath)
|
|
256
220
|
const target = join(abDir, relPath)
|
|
@@ -271,7 +235,7 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
271
235
|
}
|
|
272
236
|
|
|
273
237
|
if (inputs.ticket === true) {
|
|
274
|
-
const created = events.
|
|
238
|
+
const created = events.created
|
|
275
239
|
if (created !== undefined && created.type === 'build.created') {
|
|
276
240
|
const original = created.payload.ticket
|
|
277
241
|
const current =
|
|
@@ -432,21 +396,47 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
432
396
|
}
|
|
433
397
|
}
|
|
434
398
|
|
|
435
|
-
if (inputs.commitRange === true && state.
|
|
399
|
+
if (inputs.commitRange === true && state.kind === 'node' && state.integration?.cycle) {
|
|
400
|
+
manifest.commitRange = {
|
|
401
|
+
base: state.integration.cycle.parent,
|
|
402
|
+
head: state.integration.cycle.head,
|
|
403
|
+
}
|
|
404
|
+
} else if (inputs.commitRange === true && state.implement.commits !== undefined) {
|
|
436
405
|
manifest.commitRange = state.implement.commits
|
|
437
406
|
}
|
|
438
407
|
|
|
408
|
+
if (phase === 'reconcile' && state.nodeRestack?.conflict) {
|
|
409
|
+
const node = state.nodeRestack
|
|
410
|
+
const conflict = node.conflict!
|
|
411
|
+
const change = node.active!.changes[conflict.index]!
|
|
412
|
+
manifest.nodeChange = {
|
|
413
|
+
owner: build,
|
|
414
|
+
transaction: node.active!.id,
|
|
415
|
+
index: conflict.index,
|
|
416
|
+
sha: change.sha,
|
|
417
|
+
build: change.build,
|
|
418
|
+
foreign: change.build === undefined,
|
|
419
|
+
}
|
|
420
|
+
manifest.conflict = { baseSha: conflict.base }
|
|
421
|
+
if (!change.build)
|
|
422
|
+
await writeArtifact(
|
|
423
|
+
'foreign-change.patch',
|
|
424
|
+
`node-source-${node.active!.id}-${conflict.index}-foreign`,
|
|
425
|
+
)
|
|
426
|
+
}
|
|
439
427
|
if (inputs.conflict === true) {
|
|
440
428
|
// `pr.conflicted.baseSha` is the janitor's detection-time evidence. The
|
|
441
429
|
// runner refreshes the remote base immediately before each actual run and
|
|
442
430
|
// records the execution input in reconcile.started. A crashed same-attempt
|
|
443
431
|
// rerun can therefore have multiple starts; the newest matching AB_PHASE
|
|
444
432
|
// attempt is authoritative.
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
433
|
+
const baseSha = events.reconcileBases[String(round)]
|
|
434
|
+
if (baseSha !== undefined) manifest.conflict = { baseSha }
|
|
435
|
+
if (events.reconcileTransaction?.attempt === round) {
|
|
436
|
+
manifest.replay = {
|
|
437
|
+
...events.reconcileTransaction,
|
|
438
|
+
conflicted: events.reconcileReplay?.conflicted,
|
|
439
|
+
needsCompletion: events.reconcileReplay?.conflicted ?? true,
|
|
450
440
|
}
|
|
451
441
|
}
|
|
452
442
|
if (manifest.conflict === undefined) {
|
|
@@ -488,10 +478,10 @@ export async function buildContext(deps: ContextDeps): Promise<ContextManifest>
|
|
|
488
478
|
// Legacy tracked scratch is repository debt, not content Autobuild rewrites.
|
|
489
479
|
// Record it once per build from the provisioned base so harvest can groom it.
|
|
490
480
|
if (gitWorkspace && deps.ids !== undefined) {
|
|
491
|
-
const provisioned = events.
|
|
481
|
+
const provisioned = events.firstWorkspace
|
|
492
482
|
const marker = 'phase-scratch:tracked-at-provisioned-base'
|
|
493
|
-
const alreadyRecorded = events.some(
|
|
494
|
-
|
|
483
|
+
const alreadyRecorded = events.observations.some((observation) =>
|
|
484
|
+
observation.refs?.includes(marker),
|
|
495
485
|
)
|
|
496
486
|
if (
|
|
497
487
|
provisioned !== undefined &&
|
|
@@ -15,6 +15,7 @@ export function dashboardBuildControl(status: EffectiveStatus): DashboardBuildCo
|
|
|
15
15
|
case 'paused':
|
|
16
16
|
case 'blocked':
|
|
17
17
|
return { key: 'r', action: 'resume', label: 'resume' }
|
|
18
|
+
case 'collecting':
|
|
18
19
|
case 'queued':
|
|
19
20
|
case 'resuming':
|
|
20
21
|
case 'aborting':
|
|
@@ -36,8 +37,10 @@ export function buildActionAvailability(build: DashboardBuild): DashboardActionA
|
|
|
36
37
|
...(dashboardBuildControl(build.status)
|
|
37
38
|
? { primary: dashboardBuildControl(build.status)!.action }
|
|
38
39
|
: {}),
|
|
39
|
-
abort: ['queued', 'running', 'pausing', 'paused', 'resuming', 'blocked'].includes(
|
|
40
|
-
|
|
40
|
+
abort: ['queued', 'running', 'collecting', 'pausing', 'paused', 'resuming', 'blocked'].includes(
|
|
41
|
+
build.status,
|
|
42
|
+
),
|
|
43
|
+
discard: build.kind !== 'integration' && build.status === 'queued',
|
|
41
44
|
autoMerge: !['aborting', 'cleaning'].includes(build.status),
|
|
42
45
|
answer: build.blockers.length > 0,
|
|
43
46
|
}
|
|
@@ -46,7 +49,7 @@ export function buildActionAvailability(build: DashboardBuild): DashboardActionA
|
|
|
46
49
|
export function repositoryActionAvailability(model: DashboardModel) {
|
|
47
50
|
return {
|
|
48
51
|
intake: true,
|
|
49
|
-
defaultAutoMerge:
|
|
52
|
+
defaultAutoMerge: false,
|
|
50
53
|
bulkPause: model.builds.some((build) => build.status === 'running'),
|
|
51
54
|
bulkResume: model.builds.some((build) => build.status === 'paused'),
|
|
52
55
|
harvestToggle: true,
|
|
@@ -109,6 +109,11 @@ export class LiveRegion {
|
|
|
109
109
|
this.paintedRows = rows
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/** Force the cached frame to repaint after terminal ownership resumes. */
|
|
113
|
+
invalidate(): void {
|
|
114
|
+
this.paintedRows = undefined
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
/**
|
|
113
118
|
* Release the region: restore the normal screen, copy the last frame there,
|
|
114
119
|
* restore the cursor, and stop tracking. Idempotent.
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import { projectTree, treeVocabulary, type TreeProjection } from './tree'
|
|
2
|
+
export { treeVocabulary, consentQueue } from './tree'
|
|
3
|
+
import { landingAuthorized } from '../../kernel/landing-state'
|
|
4
|
+
import {
|
|
5
|
+
integrationComplete,
|
|
6
|
+
integrationFailed,
|
|
7
|
+
integrationCurrent,
|
|
8
|
+
integrationCycleVerified,
|
|
9
|
+
integrationNeedsRunner,
|
|
10
|
+
} from '../../kernel/integration-state'
|
|
11
|
+
import type { RepositoryReadFacts } from '../../store/reduced-reads'
|
|
1
12
|
/**
|
|
2
13
|
* The dashboard's pure projection: `BuildState` → what the operator sees.
|
|
3
14
|
*
|
|
@@ -76,6 +87,7 @@ import {
|
|
|
76
87
|
export type EffectiveStatus =
|
|
77
88
|
| 'queued'
|
|
78
89
|
| 'running'
|
|
90
|
+
| 'collecting'
|
|
79
91
|
| 'pausing'
|
|
80
92
|
| 'paused'
|
|
81
93
|
| 'resuming'
|
|
@@ -145,6 +157,22 @@ export interface DashboardHarvest {
|
|
|
145
157
|
}
|
|
146
158
|
|
|
147
159
|
export interface DashboardBuild {
|
|
160
|
+
tree?: TreeProjection
|
|
161
|
+
kind?: 'integration' | 'work'
|
|
162
|
+
target?: string
|
|
163
|
+
integration?:
|
|
164
|
+
| 'reparenting'
|
|
165
|
+
| 'opening'
|
|
166
|
+
| 'empty'
|
|
167
|
+
| 'collecting'
|
|
168
|
+
| 'verifying'
|
|
169
|
+
| 'verification failed'
|
|
170
|
+
| 'awaiting consent'
|
|
171
|
+
| 'ready to land'
|
|
172
|
+
| 'human landing'
|
|
173
|
+
| 'fenced landing'
|
|
174
|
+
| 'unfenced landing'
|
|
175
|
+
| 'unverified landing'
|
|
148
176
|
slug: string
|
|
149
177
|
status: EffectiveStatus
|
|
150
178
|
/** True when the build is BOTH paused and blocked: blocked wins the status
|
|
@@ -167,6 +195,7 @@ export interface DashboardBuild {
|
|
|
167
195
|
/** Current-spec per-loop review budget overrides. */
|
|
168
196
|
reviewRoundCeilings?: { plan?: number; code?: number }
|
|
169
197
|
/** Native auto-merge desired/applied state. */
|
|
198
|
+
landing?: BuildState['landing']
|
|
170
199
|
autoMerge: AutoMergeDisplay
|
|
171
200
|
pr?: { url: string; state: PrLifecycle }
|
|
172
201
|
/** Chronological session history projected from the retained raw log. */
|
|
@@ -329,6 +358,7 @@ function isVisible(status: EffectiveStatus | BuildState['status']): status is Ef
|
|
|
329
358
|
return (
|
|
330
359
|
status === 'queued' ||
|
|
331
360
|
status === 'running' ||
|
|
361
|
+
status === 'collecting' ||
|
|
332
362
|
status === 'pausing' ||
|
|
333
363
|
status === 'paused' ||
|
|
334
364
|
status === 'resuming' ||
|
|
@@ -339,6 +369,18 @@ function isVisible(status: EffectiveStatus | BuildState['status']): status is Ef
|
|
|
339
369
|
}
|
|
340
370
|
|
|
341
371
|
export function autoMergeDisplay(state: BuildState): AutoMergeDisplay {
|
|
372
|
+
if (state.landing?.decision || state.landing?.command) {
|
|
373
|
+
if (state.landing.command?.kind === 'hold' && !state.pr && !state.landing.native?.enabled)
|
|
374
|
+
return 'off'
|
|
375
|
+
if (state.landing.command?.kind === 'hold')
|
|
376
|
+
return state.landing.acknowledgedSeq === state.landing.command.seq ? 'off' : 'cancelling'
|
|
377
|
+
if (landingAuthorized(state.landing))
|
|
378
|
+
return state.landing.native?.enabled &&
|
|
379
|
+
state.landing.native.decisionSeq === state.landing.decision?.seq
|
|
380
|
+
? 'enabled'
|
|
381
|
+
: 'requested'
|
|
382
|
+
return 'off'
|
|
383
|
+
}
|
|
342
384
|
const { requested, commandSeq, applied } = state.autoMerge
|
|
343
385
|
if (requested) {
|
|
344
386
|
return applied?.enabled === true && applied.commandSeq === commandSeq ? 'enabled' : 'requested'
|
|
@@ -356,12 +398,7 @@ export function autoMergeDisplay(state: BuildState): AutoMergeDisplay {
|
|
|
356
398
|
* so the terminal row/detail and the web row/detail say the same words, and
|
|
357
399
|
* so it names the per-build control that unblocks the parked build. */
|
|
358
400
|
export function autoMergeConsentReason(slug: string): string {
|
|
359
|
-
return
|
|
360
|
-
`no auto-merge consent has been requested — request it with m on the build row or ` +
|
|
361
|
-
'`ab auto-merge ' +
|
|
362
|
-
slug +
|
|
363
|
-
' on`'
|
|
364
|
-
)
|
|
401
|
+
return `Landing awaits consent — use ab land ${slug}; use ab hold ${slug} to withdraw consent`
|
|
365
402
|
}
|
|
366
403
|
|
|
367
404
|
/**
|
|
@@ -496,7 +533,7 @@ export function projectBuildFromFacts(
|
|
|
496
533
|
? 'running work stopped; abort cleanup pending or in progress'
|
|
497
534
|
: undefined
|
|
498
535
|
|
|
499
|
-
if (status === 'queued') {
|
|
536
|
+
if (status === 'queued' && state.kind !== 'node') {
|
|
500
537
|
const created = dashboard.created
|
|
501
538
|
const workspace = dashboard.workspaceProvisioned
|
|
502
539
|
const released = dashboard.workspaceReleased
|
|
@@ -529,12 +566,15 @@ export function projectBuildFromFacts(
|
|
|
529
566
|
: 'runner attachment pending'
|
|
530
567
|
return {
|
|
531
568
|
slug: record.slug,
|
|
569
|
+
...buildVocabulary(state),
|
|
570
|
+
tree: projectTree(record, state, facts.log.restack, pipeline.verify.steps),
|
|
532
571
|
status,
|
|
533
572
|
alsoPaused: false,
|
|
534
573
|
...(record.ticket?.id !== undefined ? { ticketId: record.ticket.id } : {}),
|
|
535
574
|
steps: [],
|
|
536
575
|
dispatch,
|
|
537
576
|
blockers: [],
|
|
577
|
+
landing: state.landing,
|
|
538
578
|
autoMerge: autoMergeDisplay(state),
|
|
539
579
|
sessions: projectSessions(dashboard.sessionEvents, streams),
|
|
540
580
|
}
|
|
@@ -543,6 +583,8 @@ export function projectBuildFromFacts(
|
|
|
543
583
|
if (abortProgress !== undefined) {
|
|
544
584
|
return {
|
|
545
585
|
slug: record.slug,
|
|
586
|
+
...buildVocabulary(state),
|
|
587
|
+
tree: projectTree(record, state, facts.log.restack, pipeline.verify.steps),
|
|
546
588
|
status,
|
|
547
589
|
alsoPaused: false,
|
|
548
590
|
...(record.ticket?.id !== undefined ? { ticketId: record.ticket.id } : {}),
|
|
@@ -553,6 +595,7 @@ export function projectBuildFromFacts(
|
|
|
553
595
|
state.reviewRoundCeilings.code !== undefined
|
|
554
596
|
? { reviewRoundCeilings: { ...state.reviewRoundCeilings } }
|
|
555
597
|
: {}),
|
|
598
|
+
landing: state.landing,
|
|
556
599
|
autoMerge: autoMergeDisplay(state),
|
|
557
600
|
...(state.pr !== undefined && state.prState !== undefined
|
|
558
601
|
? { pr: { url: state.pr.url, state: state.prState } }
|
|
@@ -815,15 +858,16 @@ export function projectBuildFromFacts(
|
|
|
815
858
|
: { accumulatedMs: 0, runningSince: lastMs }
|
|
816
859
|
steps.push(step('merge', false, mergeCurrent, { qualifier: 'waiting', timing: mergeTiming }))
|
|
817
860
|
const autoMerge = autoMergeDisplay(state)
|
|
818
|
-
//
|
|
819
|
-
//
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
861
|
+
// Only a recorded consent decision can ask the operator to land. A
|
|
862
|
+
// finalized PR may still be awaiting the dispatcher's readiness decision.
|
|
863
|
+
if (mergeCurrent && !landingAuthorized(state.landing)) {
|
|
864
|
+
const reason =
|
|
865
|
+
state.landing?.command?.kind === 'hold'
|
|
866
|
+
? `Landing held — use ab land ${record.slug} when ready to release the hold`
|
|
867
|
+
: state.landing?.decision?.mode === 'consent'
|
|
868
|
+
? autoMergeConsentReason(record.slug)
|
|
869
|
+
: 'Landing policy decision pending'
|
|
870
|
+
steps[steps.length - 1] = { ...steps[steps.length - 1]!, reason }
|
|
827
871
|
}
|
|
828
872
|
|
|
829
873
|
const setupError =
|
|
@@ -849,10 +893,31 @@ export function projectBuildFromFacts(
|
|
|
849
893
|
|
|
850
894
|
return {
|
|
851
895
|
slug: record.slug,
|
|
896
|
+
...buildVocabulary(state),
|
|
897
|
+
tree: projectTree(record, state, facts.log.restack, pipeline.verify.steps),
|
|
852
898
|
status,
|
|
853
899
|
alsoPaused: state.status === 'paused' && status === 'blocked',
|
|
854
900
|
...(record.ticket?.id !== undefined ? { ticketId: record.ticket.id } : {}),
|
|
855
|
-
steps
|
|
901
|
+
steps:
|
|
902
|
+
state.kind === 'node'
|
|
903
|
+
? [
|
|
904
|
+
step('spec', state.specRev !== undefined, false),
|
|
905
|
+
step('open', state.nodeOpened !== undefined, state.nodeOpened === undefined),
|
|
906
|
+
step(buildVocabulary(state).integration!, false, state.nodeOpened !== undefined),
|
|
907
|
+
step('merge', false, state.pr !== undefined, {
|
|
908
|
+
qualifier: 'waiting',
|
|
909
|
+
reason: !integrationComplete(state)
|
|
910
|
+
? `integration incomplete${state.integration?.observation?.openChildren.length ? `: ${state.integration.observation.openChildren.join(', ')}` : ''}`
|
|
911
|
+
: integrationFailed(state)
|
|
912
|
+
? 'verification failed; file a repair child targeting this node'
|
|
913
|
+
: !state.integration?.cycle || !integrationCycleVerified(state)
|
|
914
|
+
? 'integration awaits verification'
|
|
915
|
+
: !landingAuthorized(state.landing)
|
|
916
|
+
? 'integration awaits explicit per-build consent'
|
|
917
|
+
: 'integration awaits guarded landing',
|
|
918
|
+
}),
|
|
919
|
+
]
|
|
920
|
+
: steps,
|
|
856
921
|
...(setupError !== undefined ? { setupError } : {}),
|
|
857
922
|
blockers: [
|
|
858
923
|
...state.openEscalations.map((e) => e.question),
|
|
@@ -861,6 +926,7 @@ export function projectBuildFromFacts(
|
|
|
861
926
|
...(state.reviewRoundCeilings.plan !== undefined || state.reviewRoundCeilings.code !== undefined
|
|
862
927
|
? { reviewRoundCeilings: { ...state.reviewRoundCeilings } }
|
|
863
928
|
: {}),
|
|
929
|
+
landing: state.landing,
|
|
864
930
|
autoMerge,
|
|
865
931
|
...(state.pr !== undefined && state.prState !== undefined
|
|
866
932
|
? { pr: { url: state.pr.url, state: state.prState } }
|
|
@@ -920,7 +986,7 @@ function escalationAttentionDismissed(events: RepositoryEvent[], terminalSeq: nu
|
|
|
920
986
|
}
|
|
921
987
|
|
|
922
988
|
function selectDashboardHarvestRun(
|
|
923
|
-
events: RepositoryEvent[],
|
|
989
|
+
events: RepositoryEvent[] | RepositoryReadFacts,
|
|
924
990
|
state: HarvestState,
|
|
925
991
|
): HarvestRunState | undefined {
|
|
926
992
|
const attention = state.runs.find((run) => {
|
|
@@ -928,7 +994,12 @@ function selectDashboardHarvestRun(
|
|
|
928
994
|
return run.recoveryExhaustion?.attentionAcknowledgedSeq === undefined
|
|
929
995
|
}
|
|
930
996
|
if (run.status !== 'escalated') return false
|
|
931
|
-
return
|
|
997
|
+
return (
|
|
998
|
+
run.terminalSeq === undefined ||
|
|
999
|
+
!(Array.isArray(events)
|
|
1000
|
+
? escalationAttentionDismissed(events, run.terminalSeq)
|
|
1001
|
+
: events.dismissedThrough > run.terminalSeq)
|
|
1002
|
+
)
|
|
932
1003
|
})
|
|
933
1004
|
return attention ?? openHarvestRun(state)
|
|
934
1005
|
}
|
|
@@ -937,7 +1008,7 @@ function selectDashboardHarvestRun(
|
|
|
937
1008
|
* exhausted, or escalated attention outranks merely open work; completed and
|
|
938
1009
|
* acknowledged terminal history never hides an older actionable run. */
|
|
939
1010
|
function projectHarvestRun(
|
|
940
|
-
events: RepositoryEvent[],
|
|
1011
|
+
events: RepositoryEvent[] | RepositoryReadFacts,
|
|
941
1012
|
state: HarvestState,
|
|
942
1013
|
): DashboardHarvest | undefined {
|
|
943
1014
|
const run = selectDashboardHarvestRun(events, state)
|
|
@@ -968,25 +1039,27 @@ function projectHarvestRun(
|
|
|
968
1039
|
const approved = run.reviews.some((review) => review.verdict === 'approve')
|
|
969
1040
|
const synthOutput = run.proposals.length > 0
|
|
970
1041
|
const reviewOutput = run.reviews.length > 0
|
|
971
|
-
const
|
|
972
|
-
run.status
|
|
973
|
-
?
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
(
|
|
977
|
-
|
|
978
|
-
event
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1042
|
+
const failureStoppedAt =
|
|
1043
|
+
run.status !== 'failed'
|
|
1044
|
+
? undefined
|
|
1045
|
+
: Array.isArray(events)
|
|
1046
|
+
? [...events]
|
|
1047
|
+
.reverse()
|
|
1048
|
+
.find(
|
|
1049
|
+
(event) =>
|
|
1050
|
+
event.type === 'harvest.failed' &&
|
|
1051
|
+
event.payload.run === run.run &&
|
|
1052
|
+
!event.payload.willRetry,
|
|
1053
|
+
)?.ts
|
|
1054
|
+
: events.failedAt[JSON.stringify(run.run)]
|
|
982
1055
|
// Both durable stop states freeze any open occurrence. A failure normally
|
|
983
1056
|
// closes its step immediately afterward, but projecting the boundary itself
|
|
984
1057
|
// must never make an errored row look like work is still accumulating time.
|
|
985
1058
|
const frozenAt =
|
|
986
1059
|
state.pausedAt !== undefined
|
|
987
1060
|
? Date.parse(state.pausedAt)
|
|
988
|
-
:
|
|
989
|
-
? Date.parse(
|
|
1061
|
+
: failureStoppedAt !== undefined
|
|
1062
|
+
? Date.parse(failureStoppedAt)
|
|
990
1063
|
: undefined
|
|
991
1064
|
const steps: PipelineStep[] = [
|
|
992
1065
|
step('scan', hasOutcome('scan', 'completed'), current('scan'), {
|
|
@@ -1073,8 +1146,10 @@ interface RepositoryHarvestProjection {
|
|
|
1073
1146
|
/** The repository-journal half of a legacy dashboard frame (AUT-545): the
|
|
1074
1147
|
* harvest projection and the pause flag exactly as `buildDashboardFromProjected`
|
|
1075
1148
|
* derives them, exposed for tests that pin the bounded read's equivalence. */
|
|
1076
|
-
export function projectRepositoryHarvest(
|
|
1077
|
-
|
|
1149
|
+
export function projectRepositoryHarvest(
|
|
1150
|
+
events: RepositoryEvent[] | RepositoryReadFacts,
|
|
1151
|
+
): RepositoryHarvestProjection {
|
|
1152
|
+
const state = Array.isArray(events) ? reduceHarvest(events) : events.harvest
|
|
1078
1153
|
const harvest = projectHarvestRun(events, state)
|
|
1079
1154
|
return {
|
|
1080
1155
|
harvestPaused: state.paused,
|
|
@@ -1082,7 +1157,9 @@ export function projectRepositoryHarvest(events: RepositoryEvent[]): RepositoryH
|
|
|
1082
1157
|
}
|
|
1083
1158
|
}
|
|
1084
1159
|
|
|
1085
|
-
export function projectHarvest(
|
|
1160
|
+
export function projectHarvest(
|
|
1161
|
+
events: RepositoryEvent[] | RepositoryReadFacts,
|
|
1162
|
+
): DashboardHarvest | undefined {
|
|
1086
1163
|
return projectRepositoryHarvest(events).harvest
|
|
1087
1164
|
}
|
|
1088
1165
|
|
|
@@ -1112,11 +1189,13 @@ export interface DashboardHeader extends DashboardFrameHeader {
|
|
|
1112
1189
|
export function buildDashboardFromProjected(
|
|
1113
1190
|
projectedBuilds: readonly DashboardBuild[],
|
|
1114
1191
|
header: DashboardHeader,
|
|
1115
|
-
repositoryEvents: RepositoryEvent[] = [],
|
|
1192
|
+
repositoryEvents: RepositoryEvent[] | RepositoryReadFacts = [],
|
|
1116
1193
|
): DashboardModel {
|
|
1117
1194
|
const builds = [...projectedBuilds].sort((a, b) => a.slug.localeCompare(b.slug))
|
|
1118
1195
|
const harvestProjection = projectRepositoryHarvest(repositoryEvents)
|
|
1119
|
-
const settings =
|
|
1196
|
+
const settings = Array.isArray(repositoryEvents)
|
|
1197
|
+
? reduceDispatchSettings(repositoryEvents)
|
|
1198
|
+
: repositoryEvents.settings
|
|
1120
1199
|
return {
|
|
1121
1200
|
repo: header.repo,
|
|
1122
1201
|
queued: header.queued,
|
|
@@ -1143,13 +1222,17 @@ export function buildDashboard(
|
|
|
1143
1222
|
entries: { record: BuildRecord; state: BuildState; events: AbEvent[] }[],
|
|
1144
1223
|
config: Config,
|
|
1145
1224
|
header: DashboardFrameHeader,
|
|
1146
|
-
repositoryEvents: RepositoryEvent[] = [],
|
|
1225
|
+
repositoryEvents: RepositoryEvent[] | RepositoryReadFacts = [],
|
|
1147
1226
|
): DashboardModel {
|
|
1148
1227
|
const builds = entries
|
|
1149
1228
|
.map(({ record, state, events }) => projectBuild(record, state, config, events))
|
|
1150
1229
|
.filter((build): build is DashboardBuild => build !== null)
|
|
1151
1230
|
const activeCount = entries.filter(
|
|
1152
|
-
({ state }) =>
|
|
1231
|
+
({ state }) =>
|
|
1232
|
+
(state.kind !== 'node' ||
|
|
1233
|
+
(integrationNeedsRunner(state) && state.phase?.startsWith('verify:'))) &&
|
|
1234
|
+
state.status !== 'done' &&
|
|
1235
|
+
state.status !== 'aborted',
|
|
1153
1236
|
).length
|
|
1154
1237
|
return buildDashboardFromProjected(
|
|
1155
1238
|
builds,
|
|
@@ -1162,3 +1245,58 @@ export function buildDashboard(
|
|
|
1162
1245
|
repositoryEvents,
|
|
1163
1246
|
)
|
|
1164
1247
|
}
|
|
1248
|
+
|
|
1249
|
+
/** One vocabulary for CLI, terminal, web and operator reads. */
|
|
1250
|
+
export function buildVocabulary(state: BuildState): {
|
|
1251
|
+
kind?: 'integration' | 'work'
|
|
1252
|
+
target?: string
|
|
1253
|
+
integration?:
|
|
1254
|
+
| 'reparenting'
|
|
1255
|
+
| 'opening'
|
|
1256
|
+
| 'empty'
|
|
1257
|
+
| 'collecting'
|
|
1258
|
+
| 'verifying'
|
|
1259
|
+
| 'verification failed'
|
|
1260
|
+
| 'awaiting consent'
|
|
1261
|
+
| 'ready to land'
|
|
1262
|
+
| 'human landing'
|
|
1263
|
+
| 'fenced landing'
|
|
1264
|
+
| 'unfenced landing'
|
|
1265
|
+
| 'unverified landing'
|
|
1266
|
+
} {
|
|
1267
|
+
return {
|
|
1268
|
+
kind: state.kind === 'node' ? treeVocabulary.integrationKind : treeVocabulary.work,
|
|
1269
|
+
...(state.target?.ticket.id || state.baseBranch
|
|
1270
|
+
? { target: state.target?.ticket.id ?? state.baseBranch }
|
|
1271
|
+
: {}),
|
|
1272
|
+
...(state.kind === 'node'
|
|
1273
|
+
? {
|
|
1274
|
+
integration:
|
|
1275
|
+
state.integration?.audit &&
|
|
1276
|
+
state.integration.audit.verifiedTree !== state.integration.audit.landedTree
|
|
1277
|
+
? 'unverified landing'
|
|
1278
|
+
: state.integration?.landing?.provenance === 'human'
|
|
1279
|
+
? 'human landing'
|
|
1280
|
+
: state.integration?.landing
|
|
1281
|
+
? state.integration.landing.fenced
|
|
1282
|
+
? 'fenced landing'
|
|
1283
|
+
: 'unfenced landing'
|
|
1284
|
+
: state.nodeRestack?.parentRequest || state.nodeRestack?.parentChange
|
|
1285
|
+
? 'reparenting'
|
|
1286
|
+
: integrationFailed(state)
|
|
1287
|
+
? 'verification failed'
|
|
1288
|
+
: integrationCurrent(state) && integrationComplete(state)
|
|
1289
|
+
? !integrationCycleVerified(state)
|
|
1290
|
+
? 'verifying'
|
|
1291
|
+
: landingAuthorized(state.landing)
|
|
1292
|
+
? treeVocabulary.readyToLand
|
|
1293
|
+
: `awaiting ${treeVocabulary.consent}`
|
|
1294
|
+
: !state.nodeOpened
|
|
1295
|
+
? 'opening'
|
|
1296
|
+
: !state.pr && (state.nodeComparison?.ahead ?? 0) === 0
|
|
1297
|
+
? 'empty'
|
|
1298
|
+
: 'collecting',
|
|
1299
|
+
}
|
|
1300
|
+
: {}),
|
|
1301
|
+
}
|
|
1302
|
+
}
|