@defrex/autobuild 1.11.1 → 1.13.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 +1 -1
- package/SPEC.md +601 -203
- package/bin/ab-build-runner.ts +8 -0
- package/docs/answering-blocked-builds.md +32 -2
- package/docs/architecture.md +188 -57
- package/docs/assets/headline-wide.png +0 -0
- package/docs/cli.md +1 -1
- package/docs/configuration.md +120 -23
- package/docs/dispatcher.md +19 -8
- package/docs/integration-overview.md +1 -1
- package/docs/integration-tree.md +33 -18
- package/docs/merge-policy.md +7 -2
- package/docs/operating.md +5 -3
- package/docs/operator-api.md +48 -25
- package/docs/operator-surfaces.md +39 -3
- package/docs/optimization-nodes.md +10 -8
- package/docs/plugin-authoring.md +46 -18
- package/docs/remote-store-protocol.md +51 -12
- package/docs/remote-ticket-protocol.md +85 -38
- package/docs/restacking.md +48 -3
- package/docs/setup.md +2 -1
- package/docs/ticket-migration.md +2 -2
- package/docs/ticket-sources.md +23 -8
- package/docs/tickets.md +4 -4
- package/docs/troubleshooting.md +17 -2
- package/docs/verification.md +3 -1
- package/package.json +3 -3
- package/packages/core/src/cli/ambient-errors.ts +17 -0
- package/packages/core/src/cli/bounded-io.ts +174 -0
- package/packages/core/src/cli/build-control.ts +72 -6
- package/packages/core/src/cli/dashboard/actions.ts +4 -0
- package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
- package/packages/core/src/cli/dashboard/model.ts +93 -29
- package/packages/core/src/cli/dashboard/poll.ts +231 -34
- package/packages/core/src/cli/dashboard/queue.ts +21 -10
- package/packages/core/src/cli/dashboard/render.ts +14 -37
- package/packages/core/src/cli/dashboard/row-text.ts +26 -8
- package/packages/core/src/cli/dashboard/tone-ansi.ts +39 -0
- package/packages/core/src/cli/dashboard/vocabulary.ts +165 -20
- package/packages/core/src/cli/dispatch-frontend.ts +2 -1
- package/packages/core/src/cli/dispatch-handoff.ts +41 -10
- package/packages/core/src/cli/dispatch-launch-contract.ts +5 -0
- package/packages/core/src/cli/dispatch-launcher-cadence.ts +80 -0
- package/packages/core/src/cli/dispatch-launcher.ts +9 -10
- package/packages/core/src/cli/dispatch-preflight.ts +12 -3
- package/packages/core/src/cli/dispatch-release-observer.ts +53 -0
- package/packages/core/src/cli/dispatch-runtime-cache.ts +204 -82
- package/packages/core/src/cli/dispatch-runtime-dependencies.ts +250 -43
- package/packages/core/src/cli/dispatch-tickets.ts +33 -12
- package/packages/core/src/cli/dispatch-upgrade-install.ts +36 -16
- package/packages/core/src/cli/dispatch-upgrade-source.ts +8 -2
- package/packages/core/src/cli/dispatch-yield-observer.ts +82 -0
- package/packages/core/src/cli/dispatch.ts +595 -149
- package/packages/core/src/cli/env.ts +2 -15
- package/packages/core/src/cli/help.ts +43 -28
- package/packages/core/src/cli/main.ts +11 -7
- package/packages/core/src/cli/production-store.ts +102 -0
- package/packages/core/src/cli/publication-settlement.ts +4 -0
- package/packages/core/src/cli/remote-poll.ts +22 -5
- package/packages/core/src/cli/repo-state.ts +2 -3
- package/packages/core/src/cli/repository-status.ts +44 -28
- package/packages/core/src/cli/sessionless-store.ts +26 -0
- package/packages/core/src/cli/status.ts +188 -47
- package/packages/core/src/cli/store-opening.ts +26 -57
- package/packages/core/src/cli/store-ref.ts +6 -1
- package/packages/core/src/cli/ticket-start.ts +3 -3
- package/packages/core/src/cli/ticket.ts +12 -11
- package/packages/core/src/cli/wait.ts +8 -28
- package/packages/core/src/cli/watch.ts +113 -50
- package/packages/core/src/config/reference-metadata.ts +7 -1
- package/packages/core/src/config/reference.ts +5 -2
- package/packages/core/src/config/schema.ts +51 -16
- package/packages/core/src/distribution-packaging.ts +156 -18
- package/packages/core/src/events/catalog-identity.ts +28 -0
- package/packages/core/src/events/catalog.ts +3 -9
- package/packages/core/src/events/compatibility.ts +2 -30
- package/packages/core/src/events/payloads.ts +85 -14
- package/packages/core/src/events/policy.ts +3 -0
- package/packages/core/src/events/repository.ts +15 -4
- package/packages/core/src/events/sessions.ts +1 -1
- package/packages/core/src/events/validation-error.ts +12 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +36 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3064e337cc75f8d6.json +310 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a1e90a969d32a367.json +307 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/da3bc91c49211eab.json +310 -0
- package/packages/core/src/kernel/auto-merge-default.ts +2 -1
- package/packages/core/src/kernel/capacity-build.ts +21 -0
- package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
- package/packages/core/src/kernel/discard-in-flight.ts +13 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +578 -235
- package/packages/core/src/kernel/done-escalations.ts +269 -0
- package/packages/core/src/kernel/engine.ts +30 -17
- package/packages/core/src/kernel/integration-landing.ts +24 -4
- package/packages/core/src/kernel/integration-stack.ts +39 -0
- package/packages/core/src/kernel/janitor-failure.ts +20 -1
- package/packages/core/src/kernel/log-index-value.ts +3 -0
- package/packages/core/src/kernel/log-index.ts +41 -2
- package/packages/core/src/kernel/measurement.ts +24 -0
- package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
- package/packages/core/src/kernel/read-facts.ts +8 -370
- package/packages/core/src/kernel/reducer-registry.ts +43 -125
- package/packages/core/src/kernel/reducer-revisions.ts +18 -0
- package/packages/core/src/kernel/reducer-value-entry.ts +98 -0
- package/packages/core/src/kernel/reducer-value-index.ts +75 -0
- package/packages/core/src/kernel/reducer.ts +84 -16
- package/packages/core/src/kernel/reopen-state.ts +10 -0
- package/packages/core/src/kernel/repository-attention.ts +14 -5
- package/packages/core/src/kernel/repository-read-facts.ts +375 -0
- package/packages/core/src/kernel/ticket-starts.ts +15 -4
- package/packages/core/src/kernel/verify-stage-state.ts +145 -3
- package/packages/core/src/kernel/verify-stages.ts +46 -7
- package/packages/core/src/operator/attention.ts +28 -3
- package/packages/core/src/operator/done-escalations.ts +38 -0
- package/packages/core/src/operator/presentation.ts +14 -1
- package/packages/core/src/operator/protocol.ts +8 -5
- package/packages/core/src/operator/query.ts +72 -57
- package/packages/core/src/operator/registry.ts +19 -15
- package/packages/core/src/operator/ticket-start.ts +8 -7
- package/packages/core/src/operator/tickets.ts +28 -9
- package/packages/core/src/plugin-sdk/index.ts +10 -0
- package/packages/core/src/plugins/manifest.ts +14 -1
- package/packages/core/src/ports/forge/create.ts +8 -0
- package/packages/core/src/ports/forge/github-transport.ts +5 -1
- package/packages/core/src/ports/forge/github.ts +3 -0
- package/packages/core/src/ports/tickets/contract.ts +147 -76
- package/packages/core/src/ports/tickets/create.ts +47 -7
- package/packages/core/src/ports/tickets/fake.ts +8 -4
- package/packages/core/src/ports/tickets/file-codec.ts +4 -3
- package/packages/core/src/ports/tickets/file.ts +7 -3
- package/packages/core/src/ports/tickets/github.ts +1 -0
- package/packages/core/src/ports/tickets/grants.ts +11 -3
- package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
- package/packages/core/src/ports/tickets/linear.ts +28 -9
- package/packages/core/src/ports/tickets/migration.ts +4 -4
- package/packages/core/src/ports/tickets/operations.ts +4 -2
- package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
- package/packages/core/src/ports/tickets/priority.ts +127 -21
- package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
- package/packages/core/src/ports/tickets/remote.ts +104 -11
- package/packages/core/src/ports/tickets/revision.ts +5 -3
- package/packages/core/src/ports/tickets/search.ts +9 -0
- package/packages/core/src/ports/tickets/tree.ts +8 -6
- package/packages/core/src/ports/types.ts +30 -15
- package/packages/core/src/ports/workspace/build-execution.ts +4 -0
- package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
- package/packages/core/src/ports/workspace/create.ts +16 -3
- package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
- package/packages/core/src/ports/workspace/fake.ts +15 -3
- package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +510 -145
- package/packages/core/src/processes/build-execution-state.ts +4 -0
- package/packages/core/src/processes/build-runner.ts +14 -1
- package/packages/core/src/processes/dispatcher.ts +777 -288
- package/packages/core/src/processes/execution-no-progress.ts +1 -0
- package/packages/core/src/processes/execution-settlement.ts +1 -0
- package/packages/core/src/processes/harvest-runner.ts +12 -7
- package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
- package/packages/core/src/processes/invocation-budget.ts +176 -0
- package/packages/core/src/processes/publication-loss.ts +38 -3
- package/packages/core/src/processes/workspace-preservation.ts +86 -15
- package/packages/core/src/store/contract.ts +81 -3
- package/packages/core/src/store/event-reads.ts +30 -1
- package/packages/core/src/store/local/capabilities.ts +115 -0
- package/packages/core/src/store/local/store.ts +86 -56
- package/packages/core/src/store/reduced-reads.ts +32 -1
- package/packages/core/src/store/reducer-value-read.ts +235 -0
- package/packages/core/src/store/reducer-value-shapes.json +6722 -6475
- package/packages/core/src/store/reducer-value-validation.ts +181 -33
- package/packages/core/src/store/reducer-values.ts +36 -204
- package/packages/core/src/store/remote/client.ts +169 -29
- package/packages/core/src/store/remote/compatibility.ts +113 -56
- package/packages/core/src/store/remote/credentials.ts +4 -1
- package/packages/core/src/store/remote/protocol.ts +3 -0
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.12.0.json +35806 -0
- package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/remote/released-value-policy.ts +144 -0
- package/packages/core/src/store/remote/retry.ts +406 -0
- package/packages/core/src/store/rollup-lease.ts +41 -0
- package/packages/core/src/store/rollups.ts +7 -38
- package/packages/core/src/store/snapshots.ts +1 -1
- package/packages/core/src/testing/dispatch-read-budget.ts +409 -14
- package/packages/core/src/testing/import-graph.ts +78 -0
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/invocation-budget.ts +42 -0
- package/packages/core/src/testing/reduced-read-budget.ts +602 -40
- package/packages/core/src/testing/released-value-coverage.ts +423 -0
- package/packages/core/src/testing/slot-agreement.ts +52 -0
- package/packages/core/src/web/assets/app.js +5 -5
- package/packages/core/src/web/overview-source.ts +19 -6
- package/skills/guide/SKILL.md +245 -103
- package/skills/guide/references/integration-tree.md +33 -18
- package/skills/guide/references/merge-policy.md +7 -2
- package/skills/guide/references/operator-api.md +48 -25
- package/skills/guide/references/optimization-nodes.md +10 -8
- package/skills/guide/references/plugin-authoring.md +46 -18
- package/skills/guide/references/remote-store-protocol.md +51 -12
- package/skills/guide/references/remote-ticket-protocol.md +85 -38
- package/skills/guide/references/restacking.md +48 -3
- package/skills/guide/references/setup.md +2 -1
- package/skills/guide/references/ticket-migration.md +2 -2
- package/skills/operate/SKILL.md +114 -65
- package/skills/plan/SKILL.md +4 -3
- package/skills/spec/SKILL.md +9 -5
- package/skills/tickets/SKILL.md +25 -17
- package/templates/hosted-service/package.json +2 -2
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/** Bounded concurrency for runtime tree IO. Every helper caps in-flight work at
|
|
2
|
+
* an explicit finite limit, stops starting work after the first failure and
|
|
3
|
+
* settles only once every started operation has settled, so callers can clean
|
|
4
|
+
* up without racing outstanding writes. Stage-level helpers join whole
|
|
5
|
+
* concurrent branches under the same settle-before-report contract. */
|
|
6
|
+
|
|
7
|
+
/** Filesystem operations in flight per traversal, and the prefetch window. */
|
|
8
|
+
export const TREE_IO_CONCURRENCY = 16
|
|
9
|
+
/** Dependency packages digested or copied at once. */
|
|
10
|
+
export const PACKAGE_CONCURRENCY = 4
|
|
11
|
+
|
|
12
|
+
function assertLimit(limit: number): void {
|
|
13
|
+
if (!Number.isInteger(limit) || limit < 1)
|
|
14
|
+
throw new RangeError(`concurrency limit must be a positive integer: ${limit}`)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Runs `work` over a growing LIFO stack with at most `limit` items in flight.
|
|
18
|
+
* `work` may push more items. After the first failure no item starts; the
|
|
19
|
+
* returned promise settles only once every in-flight item has settled, then
|
|
20
|
+
* rejects with the first error. */
|
|
21
|
+
export async function drainStack<T>(
|
|
22
|
+
initial: T[],
|
|
23
|
+
limit: number,
|
|
24
|
+
work: (item: T, push: (item: T) => void) => Promise<void>,
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
assertLimit(limit)
|
|
27
|
+
const stack = [...initial]
|
|
28
|
+
let active = 0
|
|
29
|
+
let failed = false
|
|
30
|
+
let error: unknown
|
|
31
|
+
let waiting: Array<() => void> = []
|
|
32
|
+
const wake = () => {
|
|
33
|
+
const ready = waiting
|
|
34
|
+
waiting = []
|
|
35
|
+
for (const resolve of ready) resolve()
|
|
36
|
+
}
|
|
37
|
+
const push = (item: T) => {
|
|
38
|
+
stack.push(item)
|
|
39
|
+
wake()
|
|
40
|
+
}
|
|
41
|
+
const worker = async (): Promise<void> => {
|
|
42
|
+
for (;;) {
|
|
43
|
+
if (failed) return
|
|
44
|
+
if (stack.length === 0) {
|
|
45
|
+
if (active === 0) return wake()
|
|
46
|
+
await new Promise<void>((resolve) => waiting.push(resolve))
|
|
47
|
+
continue
|
|
48
|
+
}
|
|
49
|
+
const item = stack.pop() as T
|
|
50
|
+
active++
|
|
51
|
+
try {
|
|
52
|
+
await work(item, push)
|
|
53
|
+
} catch (cause) {
|
|
54
|
+
if (!failed) {
|
|
55
|
+
failed = true
|
|
56
|
+
error = cause
|
|
57
|
+
}
|
|
58
|
+
} finally {
|
|
59
|
+
active--
|
|
60
|
+
wake()
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
await Promise.all(Array.from({ length: limit }, worker))
|
|
65
|
+
if (failed) throw error
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Runs `work` over a fixed list with at most `limit` items in flight, under the
|
|
69
|
+
* same failure contract as {@link drainStack}. */
|
|
70
|
+
export async function forEachBounded<T>(
|
|
71
|
+
items: readonly T[],
|
|
72
|
+
limit: number,
|
|
73
|
+
work: (item: T, index: number) => Promise<void>,
|
|
74
|
+
): Promise<void> {
|
|
75
|
+
assertLimit(limit)
|
|
76
|
+
let next = 0
|
|
77
|
+
let failed = false
|
|
78
|
+
let error: unknown
|
|
79
|
+
const worker = async (): Promise<void> => {
|
|
80
|
+
while (!failed && next < items.length) {
|
|
81
|
+
const index = next++
|
|
82
|
+
try {
|
|
83
|
+
await work(items[index] as T, index)
|
|
84
|
+
} catch (cause) {
|
|
85
|
+
if (!failed) {
|
|
86
|
+
failed = true
|
|
87
|
+
error = cause
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker))
|
|
93
|
+
if (failed) throw error
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Starts at most `window` fetches ahead of the consumer and hands results to
|
|
97
|
+
* `consume` strictly in input order. On a fetch or consume failure it starts
|
|
98
|
+
* no more fetches, awaits the outstanding ones, then rethrows. */
|
|
99
|
+
export async function orderedPrefetch<T, R>(
|
|
100
|
+
items: readonly T[],
|
|
101
|
+
window: number,
|
|
102
|
+
fetch: (item: T) => Promise<R>,
|
|
103
|
+
consume: (result: R, item: T) => void | Promise<void>,
|
|
104
|
+
): Promise<void> {
|
|
105
|
+
assertLimit(window)
|
|
106
|
+
const pending: Array<Promise<R>> = []
|
|
107
|
+
let started = 0
|
|
108
|
+
const fill = () => {
|
|
109
|
+
while (pending.length < window && started < items.length) {
|
|
110
|
+
const item = items[started++] as T
|
|
111
|
+
const promise = Promise.resolve().then(() => fetch(item))
|
|
112
|
+
// Observed here so an early rejection is never unhandled; the consumer
|
|
113
|
+
// still receives it when it reaches this slot.
|
|
114
|
+
promise.catch(() => {})
|
|
115
|
+
pending.push(promise)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
for (let index = 0; index < items.length; index++) {
|
|
120
|
+
fill()
|
|
121
|
+
const result = await (pending.shift() as Promise<R>)
|
|
122
|
+
await consume(result, items[index] as T)
|
|
123
|
+
}
|
|
124
|
+
} catch (error) {
|
|
125
|
+
await Promise.allSettled(pending)
|
|
126
|
+
throw error
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Awaits every task, then rejects with the first failure in argument order or
|
|
131
|
+
* resolves with every value in order. Concurrent branches therefore all settle
|
|
132
|
+
* before a caller cleans up, and report the error a serial run would have hit
|
|
133
|
+
* first. Build every task in the argument expression so none rejects unheard. */
|
|
134
|
+
export async function settleInOrder<T extends readonly unknown[]>(
|
|
135
|
+
tasks: {
|
|
136
|
+
readonly [K in keyof T]: Promise<T[K]>
|
|
137
|
+
},
|
|
138
|
+
): Promise<T> {
|
|
139
|
+
const outcomes = await Promise.allSettled(tasks as readonly Promise<unknown>[])
|
|
140
|
+
for (const outcome of outcomes) if (outcome.status === 'rejected') throw outcome.reason
|
|
141
|
+
return outcomes.map((outcome) => (outcome as PromiseFulfilledResult<unknown>).value) as never
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Starts `start` speculatively and runs `body` alongside it. `take` awaits the
|
|
145
|
+
* speculative value, rethrowing its error at the point the body needs it. When
|
|
146
|
+
* the body ends without taking it, the signal aborts and its outcome, even a
|
|
147
|
+
* failure, is discarded. Either way this settles only after the speculative
|
|
148
|
+
* task has settled, so nothing it started outlives the caller. */
|
|
149
|
+
export async function withSpeculation<T, R>(
|
|
150
|
+
start: (signal: AbortSignal) => Promise<T>,
|
|
151
|
+
body: (take: () => Promise<T>) => Promise<R>,
|
|
152
|
+
): Promise<R> {
|
|
153
|
+
const controller = new AbortController()
|
|
154
|
+
let taken = false
|
|
155
|
+
// Contained at once, synchronous throws included, so a failure is never
|
|
156
|
+
// an unhandled rejection however early it lands.
|
|
157
|
+
const outcome: Promise<{ value: T } | { error: unknown }> = Promise.resolve()
|
|
158
|
+
.then(() => start(controller.signal))
|
|
159
|
+
.then(
|
|
160
|
+
(value) => ({ value }),
|
|
161
|
+
(error: unknown) => ({ error }),
|
|
162
|
+
)
|
|
163
|
+
try {
|
|
164
|
+
return await body(async () => {
|
|
165
|
+
taken = true
|
|
166
|
+
const settled = await outcome
|
|
167
|
+
if ('error' in settled) throw settled.error
|
|
168
|
+
return settled.value
|
|
169
|
+
})
|
|
170
|
+
} finally {
|
|
171
|
+
if (!taken) controller.abort()
|
|
172
|
+
await outcome
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
landRefusalReason,
|
|
7
7
|
} from '../kernel/landing-readiness'
|
|
8
8
|
import { observeIntegration } from '../kernel/integration-completeness'
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
9
|
+
import type { BuildPriority, TicketSource } from '../ports/types'
|
|
10
|
+
import { buildPrioritySchema, prioritySetPayload } from '../ports/tickets/priority'
|
|
11
11
|
import { readBuildFacts } from '../store/reduced-reads'
|
|
12
12
|
/**
|
|
13
13
|
* Durable operator controls for one build.
|
|
@@ -50,6 +50,9 @@ export const DISMISSAL_ANSWER = 'Operator dismissed the cited findings with no f
|
|
|
50
50
|
export const SPEC_REVISION_ANSWER = 'Operator replaced the spec; the build restarts from plan'
|
|
51
51
|
export const ACCEPT_TARGET_ANSWER =
|
|
52
52
|
"Operator accepted the rewritten target; the build's own commits restack onto it"
|
|
53
|
+
/** A bare answer on a done build closes its open escalations; nothing resumes. */
|
|
54
|
+
export const DONE_ACKNOWLEDGEMENT_ANSWER =
|
|
55
|
+
'Operator acknowledged the escalation on a completed build'
|
|
53
56
|
|
|
54
57
|
/** Both forms are lazy: completing an earlier authorization must not open the
|
|
55
58
|
* replacement source supplied to the retrying invocation. */
|
|
@@ -71,7 +74,7 @@ export type BuildControlAction =
|
|
|
71
74
|
}
|
|
72
75
|
| { kind: 'land'; head?: string }
|
|
73
76
|
/** Slot-admission priority for an active build; never changes the ticket. */
|
|
74
|
-
| { kind: 'priority'; priority:
|
|
77
|
+
| { kind: 'priority'; priority: BuildPriority }
|
|
75
78
|
| { kind: 'pause' }
|
|
76
79
|
| { kind: 'resume' }
|
|
77
80
|
| {
|
|
@@ -142,6 +145,8 @@ export type BuildControlResult =
|
|
|
142
145
|
reviewRoundCeiling?: { loop: 'plan' | 'code'; value: number }
|
|
143
146
|
/** A durable post-append fact says this build cannot restart. */
|
|
144
147
|
terminalSignal?: TerminalSignal
|
|
148
|
+
/** The build is done: the answer only closed its open escalations. */
|
|
149
|
+
acknowledged?: true
|
|
145
150
|
}
|
|
146
151
|
| {
|
|
147
152
|
kind: 'reopened'
|
|
@@ -643,17 +648,17 @@ export async function controlBuild(opts: ControlBuildOpts): Promise<BuildControl
|
|
|
643
648
|
|
|
644
649
|
if (opts.action.kind === 'reopen') return reopenBuild(opts, record, user, opts.action)
|
|
645
650
|
if (opts.action.kind === 'priority') {
|
|
646
|
-
const parsed =
|
|
651
|
+
const parsed = buildPrioritySchema.safeParse(opts.action.priority)
|
|
647
652
|
if (!parsed.success)
|
|
648
653
|
throw new BuildControlError(
|
|
649
654
|
'invalid-argument',
|
|
650
|
-
`priority must be urgent or
|
|
655
|
+
`priority must be urgent, high, normal or low, got "${String(opts.action.priority)}"; nothing was recorded`,
|
|
651
656
|
)
|
|
652
657
|
activeState(opts.slug, state)
|
|
653
658
|
const event = await opts.store.appendIfCurrent(opts.slug, state.lastSeq, {
|
|
654
659
|
actor: humanActor(user, opts.via),
|
|
655
660
|
type: 'build.priority-set',
|
|
656
|
-
payload:
|
|
661
|
+
payload: prioritySetPayload(parsed.data),
|
|
657
662
|
})
|
|
658
663
|
if (event === null) return controlBuild(opts)
|
|
659
664
|
return { kind: 'command', slug: opts.slug, command: 'priority', event }
|
|
@@ -669,6 +674,8 @@ export async function controlBuild(opts: ControlBuildOpts): Promise<BuildControl
|
|
|
669
674
|
'invalid-argument',
|
|
670
675
|
`hold reason must be 1–${HOLD_REASON_LIMIT} characters after trimming; nothing was recorded`,
|
|
671
676
|
)
|
|
677
|
+
if (opts.action.kind === 'answer' && state.status === 'done')
|
|
678
|
+
return acknowledgeDoneEscalations(opts, opts.action, state, user)
|
|
672
679
|
activeState(opts.slug, state)
|
|
673
680
|
switch (opts.action.kind) {
|
|
674
681
|
case 'pause':
|
|
@@ -1199,6 +1206,65 @@ export async function controlBuild(opts: ControlBuildOpts): Promise<BuildControl
|
|
|
1199
1206
|
}
|
|
1200
1207
|
}
|
|
1201
1208
|
|
|
1209
|
+
/** An escalation raised after completion, such as a post-landing integration
|
|
1210
|
+
* audit, is closed by guidance or a bare answer. Nothing else is recorded: a
|
|
1211
|
+
* done build never resumes, so modes that change an active build are refused
|
|
1212
|
+
* before any write or spec read. */
|
|
1213
|
+
async function acknowledgeDoneEscalations(
|
|
1214
|
+
opts: ControlBuildOpts,
|
|
1215
|
+
action: Extract<BuildControlAction, { kind: 'answer' }>,
|
|
1216
|
+
state: BuildState,
|
|
1217
|
+
user: string,
|
|
1218
|
+
): Promise<BuildControlResult> {
|
|
1219
|
+
if (action.resolve !== undefined || action.reviewRoundCeiling !== undefined)
|
|
1220
|
+
throw new BuildControlError(
|
|
1221
|
+
'inactive',
|
|
1222
|
+
`build "${opts.slug}" is done; an answer can only acknowledge its open escalations ` +
|
|
1223
|
+
'with guidance text or a bare answer — --revise-spec, --revise-spec-from-ticket, ' +
|
|
1224
|
+
'--dismiss, --accept-target and --review-round-ceiling change an active build; ' +
|
|
1225
|
+
'nothing was recorded',
|
|
1226
|
+
)
|
|
1227
|
+
const captured = action.escalationIds === undefined ? undefined : new Set(action.escalationIds)
|
|
1228
|
+
const open = selectedAll(state, captured)
|
|
1229
|
+
if (open.length === 0) {
|
|
1230
|
+
if (captured === undefined) activeState(opts.slug, state)
|
|
1231
|
+
throw new BuildControlError(
|
|
1232
|
+
'no-open-escalations',
|
|
1233
|
+
`build "${opts.slug}" is no longer blocked by the captured escalation(s)`,
|
|
1234
|
+
)
|
|
1235
|
+
}
|
|
1236
|
+
const guidance = (action.text ?? '').trim()
|
|
1237
|
+
const resolution = guidance === '' ? 'retry' : 'guidance'
|
|
1238
|
+
const answer = guidance === '' ? DONE_ACKNOWLEDGEMENT_ANSWER : guidance
|
|
1239
|
+
const actor = humanActor(user, opts.via)
|
|
1240
|
+
let count = 0
|
|
1241
|
+
for (const escalation of open) {
|
|
1242
|
+
for (;;) {
|
|
1243
|
+
const fresh = (await readBuildFacts(opts.store, opts.slug)).value.state
|
|
1244
|
+
if (fresh.status !== 'done') activeState(opts.slug, fresh)
|
|
1245
|
+
if (!fresh.openEscalations.some((item) => item.id === escalation.id)) break
|
|
1246
|
+
if (
|
|
1247
|
+
await opts.store.appendIfCurrent(opts.slug, fresh.lastSeq, {
|
|
1248
|
+
actor,
|
|
1249
|
+
type: 'escalation.answered',
|
|
1250
|
+
payload: { id: escalation.id, answer, resolution },
|
|
1251
|
+
})
|
|
1252
|
+
) {
|
|
1253
|
+
count += 1
|
|
1254
|
+
break
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
return {
|
|
1259
|
+
kind: 'answered',
|
|
1260
|
+
slug: opts.slug,
|
|
1261
|
+
count,
|
|
1262
|
+
resolution,
|
|
1263
|
+
resumed: false,
|
|
1264
|
+
acknowledged: true,
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1202
1268
|
/** Read, validate and deposit a replacement spec body: the supplied file or
|
|
1203
1269
|
* the build's ticket, which also re-pins the ticket's assets. A supplied body
|
|
1204
1270
|
* leaves the pinned set alone (`assets` absent). The deposit is inert until a
|
|
@@ -34,6 +34,10 @@ export interface DashboardActionAvailability {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export function buildActionAvailability(build: DashboardBuild): DashboardActionAvailability {
|
|
37
|
+
// A completed build with an open escalation: acknowledging it is the only
|
|
38
|
+
// action; the build never resumes, aborts or merges again.
|
|
39
|
+
if (build.statusBasis?.done)
|
|
40
|
+
return { abort: false, discard: false, autoMerge: false, answer: true }
|
|
37
41
|
return {
|
|
38
42
|
...(dashboardBuildControl(build.status)
|
|
39
43
|
? { primary: dashboardBuildControl(build.status)!.action }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { distanceSuffix } from './target-distance'
|
|
2
2
|
import type { Config } from '../../config/schema'
|
|
3
3
|
import type { BuildState } from '../../kernel/reducer'
|
|
4
|
+
import { openOnDone } from '../../kernel/done-escalations'
|
|
4
5
|
import type { LeafRestackState } from '../../kernel/leaf-restack-state'
|
|
5
6
|
import {
|
|
6
7
|
integrationComplete,
|
|
@@ -98,25 +99,30 @@ export function projectIntegrationRow(
|
|
|
98
99
|
state: done ? 'done' : active ? 'current' : 'pending',
|
|
99
100
|
...(qualifier ? { qualifier } : {}),
|
|
100
101
|
})
|
|
102
|
+
const merged = state.status === 'done' && state.outcome === 'merged'
|
|
101
103
|
const conflicted = state.nodeRestack?.conflict || (restack.active && restack.replay?.conflicted)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
: failed.length
|
|
104
|
+
// A landed node with an open escalation (the post-landing audit) shows its
|
|
105
|
+
// question: the row exists only until an operator acknowledges it.
|
|
106
|
+
const alert: IntegrationRow['alert'] = openOnDone(state)
|
|
107
|
+
? { tone: 'red', text: state.openEscalations.map((open) => open.question).join(' ') }
|
|
108
|
+
: state.janitor?.attention
|
|
109
|
+
? { tone: 'red', text: `Janitor failing: ${state.janitor.message}` }
|
|
110
|
+
: conflicted
|
|
110
111
|
? {
|
|
111
112
|
tone: 'red',
|
|
112
|
-
text:
|
|
113
|
+
text: `restack onto ${destination} conflicted — open the detail view for files`,
|
|
113
114
|
}
|
|
114
|
-
:
|
|
115
|
+
: failed.length
|
|
115
116
|
? {
|
|
116
|
-
tone: '
|
|
117
|
-
text:
|
|
117
|
+
tone: 'red',
|
|
118
|
+
text: `${failed.join(', ')} failed — file a repair child targeting ${record.ticket?.id ?? record.slug}`,
|
|
118
119
|
}
|
|
119
|
-
:
|
|
120
|
+
: ready && mode === 'consent' && state.landing?.command?.kind !== 'land'
|
|
121
|
+
? {
|
|
122
|
+
tone: 'yellow',
|
|
123
|
+
text: `ready to merge into ${destination} — press l, or ab merge ${record.slug}`,
|
|
124
|
+
}
|
|
125
|
+
: undefined
|
|
120
126
|
return {
|
|
121
127
|
destination,
|
|
122
128
|
parentDistance: nodeParentDistance(state),
|
|
@@ -132,20 +138,21 @@ export function projectIntegrationRow(
|
|
|
132
138
|
: { known: false },
|
|
133
139
|
verified,
|
|
134
140
|
steps: [
|
|
135
|
-
|
|
136
|
-
step('
|
|
137
|
-
step('
|
|
141
|
+
// A merged node's pipeline is over: every step is done.
|
|
142
|
+
step('spec', merged || state.specRev !== undefined, false),
|
|
143
|
+
step('open', merged || !!state.nodeOpened, !merged && !state.nodeOpened),
|
|
144
|
+
step('collect', merged || complete, !merged && !!state.nodeOpened && !complete),
|
|
138
145
|
step(
|
|
139
146
|
'verify',
|
|
140
|
-
verified,
|
|
141
|
-
current && !verified,
|
|
147
|
+
merged || verified,
|
|
148
|
+
!merged && current && !verified,
|
|
142
149
|
failed.length
|
|
143
150
|
? 'failed'
|
|
144
151
|
: current && !verified
|
|
145
152
|
? `${passed}/${expected.length}`
|
|
146
153
|
: undefined,
|
|
147
154
|
),
|
|
148
|
-
step('merge', !!state.integration?.landing, ready, mode),
|
|
155
|
+
step('merge', merged || !!state.integration?.landing, !merged && ready, mode),
|
|
149
156
|
],
|
|
150
157
|
...(alert ? { alert } : {}),
|
|
151
158
|
}
|
|
@@ -153,6 +160,23 @@ export function projectIntegrationRow(
|
|
|
153
160
|
|
|
154
161
|
/** Recomputed from the whole already-read repository, even on an empty parent delta.
|
|
155
162
|
* Never mutate cached rows or snapshots; leaf identity is preserved. */
|
|
163
|
+
/** The settled child builds `enrichIntegrationRows` needs records for beyond
|
|
164
|
+
* `listed`: children of the rendered node rows whose ticket identity or title
|
|
165
|
+
* is still unresolved. Bounded by the rendered rows, never by history. */
|
|
166
|
+
export function unresolvedIntegrationRecords(
|
|
167
|
+
rows: readonly DashboardBuild[],
|
|
168
|
+
listed: ReadonlySet<string>,
|
|
169
|
+
): string[] {
|
|
170
|
+
const wanted = new Set<string>()
|
|
171
|
+
for (const row of rows)
|
|
172
|
+
for (const child of row.integrationDetail?.children ?? []) {
|
|
173
|
+
if (!child.builds?.length) continue
|
|
174
|
+
if (!child.builds.includes(child.id) && child.title !== 'title unavailable') continue
|
|
175
|
+
for (const slug of child.builds) if (!listed.has(slug)) wanted.add(slug)
|
|
176
|
+
}
|
|
177
|
+
return [...wanted]
|
|
178
|
+
}
|
|
179
|
+
|
|
156
180
|
export function enrichIntegrationRows(
|
|
157
181
|
rows: readonly DashboardBuild[],
|
|
158
182
|
records: readonly BuildRecord[] = [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { workTargetDistance } from './target-distance'
|
|
2
2
|
import { openTicketWait, waitingOnLine } from '../../kernel/ticket-wait'
|
|
3
|
-
import {
|
|
3
|
+
import { openOnDone } from '../../kernel/done-escalations'
|
|
4
4
|
import { openPrBackpressureReducer } from '../../kernel/open-pr-backpressure-state'
|
|
5
5
|
import type { DashboardRollback } from './rollback'
|
|
6
6
|
import type { DispatchUpgradeState } from '../../kernel/dispatch-upgrade'
|
|
@@ -14,16 +14,18 @@ import {
|
|
|
14
14
|
} from './integration-row'
|
|
15
15
|
import {
|
|
16
16
|
dispatchCapacity,
|
|
17
|
+
epilogueLeaf,
|
|
17
18
|
slotWaitText,
|
|
18
19
|
startClaimDemand,
|
|
19
|
-
|
|
20
|
+
claimDemand,
|
|
20
21
|
type DispatchCapacity,
|
|
22
|
+
type SlotState,
|
|
21
23
|
} from '../../kernel/dispatch-capacity'
|
|
22
24
|
import { openBuildWorkspace, provisionMarkerReducer } from '../../processes/dispatcher-selectors'
|
|
23
25
|
import { projectTree, treeVocabulary, type TreeProjection } from './tree'
|
|
24
26
|
import { holdReason } from './landing-display'
|
|
25
27
|
import { reopenedSummary, reopenedText } from './reopen-display'
|
|
26
|
-
import { reopenSpecPending } from '../../kernel/reopen-state'
|
|
28
|
+
import { reopenSpecPending, reviseSpecPending } from '../../kernel/reopen-state'
|
|
27
29
|
import { ciFailureText, currentCiFailure } from '../../kernel/forge-checks'
|
|
28
30
|
export { treeVocabulary, consentQueue } from './tree'
|
|
29
31
|
import {
|
|
@@ -32,6 +34,7 @@ import {
|
|
|
32
34
|
landingFallbackReason,
|
|
33
35
|
} from '../../kernel/landing-state'
|
|
34
36
|
import { projectObjectiveRow, type ObjectiveRow } from './objective-row'
|
|
37
|
+
import type { StatusBasis } from './vocabulary'
|
|
35
38
|
export {
|
|
36
39
|
objectiveElapsedHours,
|
|
37
40
|
objectiveNumber,
|
|
@@ -249,6 +252,13 @@ export function dashboardWait(state: BuildState): DashboardWait | undefined {
|
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
export interface DashboardBuild {
|
|
255
|
+
/** Display-only lifecycle facts the row's status word is chosen from
|
|
256
|
+
* (`buildStatusText`); absent on hand-built rows, which imply it from
|
|
257
|
+
* `status`. */
|
|
258
|
+
statusBasis?: StatusBasis
|
|
259
|
+
/** The build's slot state from the frame's capacity projection (SPEC §12
|
|
260
|
+
* "What holds a slot"); absent is unknown, never `none`. */
|
|
261
|
+
slot?: SlotState
|
|
252
262
|
draining?: boolean
|
|
253
263
|
/** A work row's standing alert, such as a parked build waiting for a slot. */
|
|
254
264
|
alert?: { tone: 'yellow' | 'red'; text: string }
|
|
@@ -400,7 +410,8 @@ export interface DashboardModel {
|
|
|
400
410
|
repo: string
|
|
401
411
|
/** Ready tickets waiting for a slot — the dispatcher's standing queue depth. */
|
|
402
412
|
queued: number
|
|
403
|
-
/** Shared
|
|
413
|
+
/** Shared slot counter: builds holding a slot against configured capacity;
|
|
414
|
+
* paused, blocked and idle builds hold none. */
|
|
404
415
|
active: DashboardCounter
|
|
405
416
|
capacity?: DispatchCapacity
|
|
406
417
|
/** Absent: the recorded run's effective configuration projected this model.
|
|
@@ -457,11 +468,28 @@ export interface DashboardModel {
|
|
|
457
468
|
export function effectiveStatus(state: BuildState): EffectiveStatus | BuildState['status'] {
|
|
458
469
|
// Terminal outcomes outrank every pending command and visual override. An
|
|
459
470
|
// acknowledged abort remains in its cleanup display stage, while `done`
|
|
460
|
-
// stays filterable as terminal
|
|
461
|
-
//
|
|
462
|
-
|
|
471
|
+
// stays filterable as terminal, unless an escalation raised after
|
|
472
|
+
// completion is still open: that build reads `blocked` until an operator
|
|
473
|
+
// acknowledges it. Only nonterminal abort intent projects as `aborting`;
|
|
474
|
+
// blocked and pause/resume overrides follow it.
|
|
475
|
+
if (state.status === 'done') return openOnDone(state) ? 'blocked' : 'done'
|
|
463
476
|
if (state.status === 'aborted') return 'cleaning'
|
|
464
477
|
if (state.pendingCommands.some((command) => command.command === 'abort')) return 'aborting'
|
|
478
|
+
const resting = restingStatus(state)
|
|
479
|
+
if (resting === 'running' && state.pendingCommands.some((command) => command.command === 'pause'))
|
|
480
|
+
return 'pausing'
|
|
481
|
+
if (resting === 'paused' && state.pendingCommands.some((command) => command.command === 'resume'))
|
|
482
|
+
return 'resuming'
|
|
483
|
+
return resting
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** `effectiveStatus` with every pending command ignored: what the build rests
|
|
487
|
+
* on until a pause, resume or abort is acknowledged. */
|
|
488
|
+
export function restingStatus(
|
|
489
|
+
state: BuildState,
|
|
490
|
+
): Exclude<EffectiveStatus, 'pausing' | 'resuming' | 'aborting'> | 'done' {
|
|
491
|
+
if (state.status === 'done') return openOnDone(state) ? 'blocked' : 'done'
|
|
492
|
+
if (state.status === 'aborted') return 'cleaning'
|
|
465
493
|
if (state.kind === 'node' && integrationFailed(state)) return 'blocked'
|
|
466
494
|
// A ticket wait whose escalation is the only one open reads as waiting; any
|
|
467
495
|
// other open question outranks it and the build reads blocked.
|
|
@@ -477,19 +505,40 @@ export function effectiveStatus(state: BuildState): EffectiveStatus | BuildState
|
|
|
477
505
|
) {
|
|
478
506
|
return 'blocked'
|
|
479
507
|
}
|
|
480
|
-
if (state.status === 'running') {
|
|
481
|
-
return state.pendingCommands.some((command) => command.command === 'pause')
|
|
482
|
-
? 'pausing'
|
|
483
|
-
: 'running'
|
|
484
|
-
}
|
|
485
|
-
if (state.status === 'paused') {
|
|
486
|
-
return state.pendingCommands.some((command) => command.command === 'resume')
|
|
487
|
-
? 'resuming'
|
|
488
|
-
: 'paused'
|
|
489
|
-
}
|
|
490
508
|
return state.status
|
|
491
509
|
}
|
|
492
510
|
|
|
511
|
+
/** The lifecycle facts a nonterminal build's status word is chosen from
|
|
512
|
+
* (`buildStatusText`), or undefined for a `done` build. A `done` build with an
|
|
513
|
+
* open escalation rests `blocked` with the `done` marker and nothing else: no
|
|
514
|
+
* command or merge decision applies to it. Display-only. */
|
|
515
|
+
export function statusBasis(state: BuildState): StatusBasis | undefined {
|
|
516
|
+
const resting = restingStatus(state)
|
|
517
|
+
if (resting === 'done') return undefined
|
|
518
|
+
if (state.status === 'done') return { resting: 'blocked', runner: false, done: true }
|
|
519
|
+
const pending = (command: string) => state.pendingCommands.some((c) => c.command === command)
|
|
520
|
+
const settled = epilogueLeaf(state)
|
|
521
|
+
? state.landing?.command?.kind === 'hold'
|
|
522
|
+
? ('hold' as const)
|
|
523
|
+
: landingAuthorized(state.landing)
|
|
524
|
+
? ('merging' as const)
|
|
525
|
+
: ('decision' as const)
|
|
526
|
+
: undefined
|
|
527
|
+
const waitTickets =
|
|
528
|
+
resting === 'waiting' ? openTicketWait(state)?.tickets.map((ticket) => ticket.id) : undefined
|
|
529
|
+
return {
|
|
530
|
+
resting,
|
|
531
|
+
...(pending('pause') ? { pause: true as const } : {}),
|
|
532
|
+
...(pending('abort') ? { abort: true as const } : {}),
|
|
533
|
+
...(pending('resume') ? { resume: true as const } : {}),
|
|
534
|
+
runner: state.openExecution !== undefined,
|
|
535
|
+
...(state.kind === 'node' ? { node: true as const } : {}),
|
|
536
|
+
...(settled !== undefined ? { settled } : {}),
|
|
537
|
+
...(reviseSpecPending(state) ? { reviseSpec: true as const } : {}),
|
|
538
|
+
...(waitTickets?.length ? { waitTickets } : {}),
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
493
542
|
function isVisible(status: EffectiveStatus | BuildState['status']): status is EffectiveStatus {
|
|
494
543
|
return (
|
|
495
544
|
status === 'queued' ||
|
|
@@ -670,6 +719,7 @@ export function projectBuildFromFacts(
|
|
|
670
719
|
const dashboard = facts.dashboard
|
|
671
720
|
const status = effectiveStatus(state)
|
|
672
721
|
if (!isVisible(status)) return null
|
|
722
|
+
const basis = statusBasis(state)
|
|
673
723
|
const wait = dashboardWait(state)
|
|
674
724
|
const objective = projectObjectiveRow(state)
|
|
675
725
|
const abortProgress =
|
|
@@ -748,6 +798,7 @@ export function projectBuildFromFacts(
|
|
|
748
798
|
createdAt: record.createdAt,
|
|
749
799
|
},
|
|
750
800
|
status,
|
|
801
|
+
...(basis !== undefined ? { statusBasis: basis } : {}),
|
|
751
802
|
alsoPaused: false,
|
|
752
803
|
...(record.ticket?.id !== undefined ? { ticketId: record.ticket.id } : {}),
|
|
753
804
|
steps: [],
|
|
@@ -797,6 +848,7 @@ export function projectBuildFromFacts(
|
|
|
797
848
|
createdAt: record.createdAt,
|
|
798
849
|
},
|
|
799
850
|
status,
|
|
851
|
+
...(basis !== undefined ? { statusBasis: basis } : {}),
|
|
800
852
|
alsoPaused: false,
|
|
801
853
|
...(record.ticket?.id !== undefined ? { ticketId: record.ticket.id } : {}),
|
|
802
854
|
steps: [],
|
|
@@ -881,7 +933,7 @@ export function projectBuildFromFacts(
|
|
|
881
933
|
// away, so they are derived here (display-only, at the one call site that
|
|
882
934
|
// already has the log in hand). A running build keeps its open interval live
|
|
883
935
|
// (the renderer ticks it against `now`); a paused build freezes every open
|
|
884
|
-
// interval at its acknowledgement (including while
|
|
936
|
+
// interval at its acknowledgement (including while a resume is pending), while a
|
|
885
937
|
// blocked build freezes at the latest non-distance durable event. Timers do
|
|
886
938
|
// not advance behind either gate (AC 10). Each step scopes by the SAME seq boundary its state uses, so
|
|
887
939
|
// durations and states restart in lockstep (AC 12).
|
|
@@ -1034,7 +1086,7 @@ export function projectBuildFromFacts(
|
|
|
1034
1086
|
Object.values(state.verifyStage.cancellations)
|
|
1035
1087
|
.filter((c) => c.seq > cycleSince && c.step === s)
|
|
1036
1088
|
.map((c) => `not run: cancelled by verify:${c.cause.step}`)
|
|
1037
|
-
.at(-1) ?? stepResults.find((r) => r.skipCause
|
|
1089
|
+
.at(-1) ?? stepResults.find((r) => r.skipCause !== undefined)?.reason,
|
|
1038
1090
|
count,
|
|
1039
1091
|
timing: timingFor(intervals, phase, cycleSince, frozenNow),
|
|
1040
1092
|
}),
|
|
@@ -1168,6 +1220,7 @@ export function projectBuildFromFacts(
|
|
|
1168
1220
|
createdAt: record.createdAt,
|
|
1169
1221
|
},
|
|
1170
1222
|
status,
|
|
1223
|
+
...(basis !== undefined ? { statusBasis: basis } : {}),
|
|
1171
1224
|
alsoPaused: state.status === 'paused' && (status === 'blocked' || status === 'waiting'),
|
|
1172
1225
|
...(record.ticket?.id !== undefined ? { ticketId: record.ticket.id } : {}),
|
|
1173
1226
|
steps:
|
|
@@ -1499,6 +1552,20 @@ export function decorateSlotWaits(
|
|
|
1499
1552
|
})
|
|
1500
1553
|
}
|
|
1501
1554
|
|
|
1555
|
+
/** Each row's slot state from the capacity projection. Returns copies;
|
|
1556
|
+
* cached projected rows stay intact. */
|
|
1557
|
+
function decorateSlots(
|
|
1558
|
+
rows: readonly DashboardBuild[],
|
|
1559
|
+
capacity: DispatchCapacity | undefined,
|
|
1560
|
+
): DashboardBuild[] {
|
|
1561
|
+
const slots = capacity?.slots
|
|
1562
|
+
if (!slots) return [...rows]
|
|
1563
|
+
return rows.map((row) => {
|
|
1564
|
+
const slot = slots[row.slug]
|
|
1565
|
+
return slot ? { ...row, slot } : row
|
|
1566
|
+
})
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1502
1569
|
export function buildDashboardFromProjected(
|
|
1503
1570
|
projectedBuilds: readonly DashboardBuild[],
|
|
1504
1571
|
header: DashboardHeader,
|
|
@@ -1511,8 +1578,11 @@ export function buildDashboardFromProjected(
|
|
|
1511
1578
|
repositoryEvents,
|
|
1512
1579
|
upgrades,
|
|
1513
1580
|
)
|
|
1514
|
-
const builds =
|
|
1515
|
-
|
|
1581
|
+
const builds = decorateSlots(
|
|
1582
|
+
decorateSlotWaits(
|
|
1583
|
+
enrichIntegrationRows(projectedBuilds.map((row) => enrichDrainingRow(row, draining))),
|
|
1584
|
+
header.capacityProjection,
|
|
1585
|
+
),
|
|
1516
1586
|
header.capacityProjection,
|
|
1517
1587
|
).sort((a, b) => a.slug.localeCompare(b.slug))
|
|
1518
1588
|
// Member order matches the terminal model's historical literal.
|
|
@@ -1524,7 +1594,7 @@ export function buildDashboardFromProjected(
|
|
|
1524
1594
|
queued: repository.queued,
|
|
1525
1595
|
active: {
|
|
1526
1596
|
current: header.capacityProjection?.occupied ?? header.activeCount,
|
|
1527
|
-
limit: header.capacityProjection?.
|
|
1597
|
+
limit: header.capacityProjection?.configured ?? header.capacity,
|
|
1528
1598
|
},
|
|
1529
1599
|
...(header.capacityProjection ? { capacity: header.capacityProjection } : {}),
|
|
1530
1600
|
drained: repository.drained,
|
|
@@ -1563,17 +1633,11 @@ export function buildDashboard(
|
|
|
1563
1633
|
})),
|
|
1564
1634
|
config.capacity,
|
|
1565
1635
|
new Date(),
|
|
1566
|
-
migrationIdentity(
|
|
1567
|
-
Array.isArray(repositoryEvents)
|
|
1568
|
-
? ticketMigrationsReducer.reduce(repositoryEvents)
|
|
1569
|
-
: repositoryEvents.ticketMigrations,
|
|
1570
|
-
config.tickets.source,
|
|
1571
|
-
),
|
|
1572
1636
|
{
|
|
1573
1637
|
...(Array.isArray(repositoryEvents)
|
|
1574
1638
|
? {}
|
|
1575
1639
|
: {
|
|
1576
|
-
|
|
1640
|
+
claims: claimDemand(repositoryEvents),
|
|
1577
1641
|
startRequests: startClaimDemand(repositoryEvents),
|
|
1578
1642
|
}),
|
|
1579
1643
|
openPrs: {
|