@defrex/autobuild 1.16.0 → 1.18.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 (97) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +132 -9
  3. package/docs/answering-blocked-builds.md +34 -1
  4. package/docs/architecture.md +42 -3
  5. package/docs/configuration.md +44 -7
  6. package/docs/dispatcher-hosting.md +5 -3
  7. package/docs/operator-api.md +29 -6
  8. package/docs/plugin-authoring.md +30 -1
  9. package/docs/remote-store-protocol.md +13 -3
  10. package/docs/remote-ticket-protocol.md +37 -2
  11. package/docs/restacking.md +46 -1
  12. package/docs/setup.md +24 -9
  13. package/docs/ticket-sources.md +28 -1
  14. package/docs/troubleshooting.md +54 -2
  15. package/docs/workspaces.md +3 -1
  16. package/package.json +4 -4
  17. package/packages/core/src/cli/accounts.ts +3 -0
  18. package/packages/core/src/cli/binary-direct.ts +14 -1
  19. package/packages/core/src/cli/binary.ts +10 -7
  20. package/packages/core/src/cli/dashboard/refresh.ts +8 -0
  21. package/packages/core/src/cli/dispatch.ts +503 -334
  22. package/packages/core/src/cli/secrets.ts +2 -0
  23. package/packages/core/src/config/schema.ts +17 -3
  24. package/packages/core/src/events/payloads.ts +8 -5
  25. package/packages/core/src/events/repository.ts +37 -1
  26. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/d41044cb2e54809c.json +194 -0
  27. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e0f89f52e48cbf62.json +197 -0
  28. package/packages/core/src/kernel/engine.ts +118 -0
  29. package/packages/core/src/kernel/reconcile-restack.ts +72 -9
  30. package/packages/core/src/kernel/reducer-revisions.ts +5 -0
  31. package/packages/core/src/kernel/repository-read-facts.ts +9 -2
  32. package/packages/core/src/kernel/ticket-preparation.ts +10 -0
  33. package/packages/core/src/kernel/tracked-dirt.ts +173 -0
  34. package/packages/core/src/ontology.ts +1 -0
  35. package/packages/core/src/operator/index.ts +10 -0
  36. package/packages/core/src/operator/merged-builds.ts +51 -0
  37. package/packages/core/src/operator/registry.ts +254 -110
  38. package/packages/core/src/operator/repo-argument.ts +43 -0
  39. package/packages/core/src/operator/tickets.ts +139 -25
  40. package/packages/core/src/plugin-sdk/index.ts +4 -0
  41. package/packages/core/src/plugins/manifest.ts +1 -1
  42. package/packages/core/src/ports/tickets/completion.ts +71 -0
  43. package/packages/core/src/ports/tickets/contract.ts +73 -0
  44. package/packages/core/src/ports/tickets/github-fake.ts +8 -0
  45. package/packages/core/src/ports/tickets/github-issues.ts +1 -0
  46. package/packages/core/src/ports/tickets/github.ts +18 -6
  47. package/packages/core/src/ports/tickets/grants.ts +2 -0
  48. package/packages/core/src/ports/tickets/hosted-index.ts +8 -0
  49. package/packages/core/src/ports/tickets/linear.ts +18 -2
  50. package/packages/core/src/ports/tickets/remote-protocol.ts +37 -8
  51. package/packages/core/src/ports/tickets/remote.ts +43 -3
  52. package/packages/core/src/ports/tickets/tree.ts +11 -1
  53. package/packages/core/src/ports/types.ts +47 -4
  54. package/packages/core/src/ports/workspace/vercel-command-diagnostics.ts +144 -0
  55. package/packages/core/src/ports/workspace/vercel-sandbox.ts +649 -160
  56. package/packages/core/src/processes/build-child.ts +15 -1
  57. package/packages/core/src/processes/build-runner.ts +349 -20
  58. package/packages/core/src/processes/dispatcher.ts +880 -283
  59. package/packages/core/src/processes/harvest-child.ts +21 -1
  60. package/packages/core/src/processes/harvest-runner.ts +82 -35
  61. package/packages/core/src/processes/pass-stages.ts +32 -6
  62. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  63. package/packages/core/src/processes/provisioning-progress.ts +23 -0
  64. package/packages/core/src/processes/repo-view.ts +25 -4
  65. package/packages/core/src/processes/workspace-preparation.ts +1 -0
  66. package/packages/core/src/store/adapter.ts +34 -5
  67. package/packages/core/src/store/build-feed.ts +148 -22
  68. package/packages/core/src/store/build-scope.ts +12 -3
  69. package/packages/core/src/store/caller-attribution.ts +170 -0
  70. package/packages/core/src/store/contract.ts +1038 -165
  71. package/packages/core/src/store/local/schema.ts +12 -1
  72. package/packages/core/src/store/local/store.ts +260 -25
  73. package/packages/core/src/store/memory.ts +156 -9
  74. package/packages/core/src/store/phase-session.ts +23 -3
  75. package/packages/core/src/store/reducer-value-shapes.json +8196 -8118
  76. package/packages/core/src/store/remote/client.ts +90 -11
  77. package/packages/core/src/store/remote/credentials.ts +2 -0
  78. package/packages/core/src/store/remote/index.ts +31 -5
  79. package/packages/core/src/store/remote/protocol.ts +45 -8
  80. package/packages/core/src/store/remote/released-clients.json +22 -0
  81. package/packages/core/src/store/remote/released-reducer-values/1.17.0.json +36367 -0
  82. package/packages/core/src/store/remote/released-reducer-values/1.18.0.json +36436 -0
  83. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  84. package/packages/core/src/store/session-handle.ts +12 -3
  85. package/packages/core/src/store/types.ts +48 -3
  86. package/packages/core/src/testing/dispatch-read-budget.ts +143 -16
  87. package/packages/core/src/testing/index.ts +2 -0
  88. package/packages/core/src/testing/reduced-read-budget.ts +420 -6
  89. package/skills/guide/SKILL.md +67 -13
  90. package/skills/guide/references/operator-api.md +29 -6
  91. package/skills/guide/references/plugin-authoring.md +30 -1
  92. package/skills/guide/references/remote-store-protocol.md +13 -3
  93. package/skills/guide/references/remote-ticket-protocol.md +37 -2
  94. package/skills/guide/references/restacking.md +46 -1
  95. package/skills/guide/references/setup.md +24 -9
  96. package/skills/operate/SKILL.md +42 -4
  97. package/templates/hosted-service/package.json +2 -2
@@ -5,6 +5,7 @@ import { ticketGrantRequest } from '../ports/tickets/grants'
5
5
  * durable boundary lives in the repository journal, so a replacement process
6
6
  * resumes the claimed snapshot rather than starting a duplicate run.
7
7
  */
8
+ import { withStoreCaller } from '../store/caller-attribution'
8
9
  import { join } from 'node:path'
9
10
  import { loadConfig } from '../config/load'
10
11
  import type { HarvestExecutionEnvironment } from '../ports/workspace/harvest-execution'
@@ -50,12 +51,31 @@ export function guestTicketSourceArgs(
50
51
  * composition likewise matches a local harvest in this checkout: a relative
51
52
  * or defaulted `[tickets].dir` resolves against the guest checkout and the
52
53
  * selected local state root (see `guestTicketSourceArgs`). */
53
- export async function runHarvestChild(
54
+ export function runHarvestChild(
54
55
  input: HarvestRunnerLaunch,
55
56
  env: Record<string, string | undefined> = process.env,
56
57
  openStore: StoreOpener = openProductionStore,
57
58
  /** Guest checkout root. The provider launches the runner with this as cwd. */
58
59
  workspacePath: string = process.cwd(),
60
+ ): Promise<void> {
61
+ // Every hosted request this runner makes, its ticket-grant renewals
62
+ // included, is attributed to its harvest execution.
63
+ return withStoreCaller(
64
+ {
65
+ kind: 'runner',
66
+ runner: 'harvest',
67
+ execution: input.instance,
68
+ ...(input.preparedRun ? { harvest: input.preparedRun.run } : {}),
69
+ },
70
+ () => runHarvestChildInScope(input, env, openStore, workspacePath),
71
+ )
72
+ }
73
+
74
+ async function runHarvestChildInScope(
75
+ input: HarvestRunnerLaunch,
76
+ env: Record<string, string | undefined>,
77
+ openStore: StoreOpener,
78
+ workspacePath: string,
59
79
  ): Promise<void> {
60
80
  const fullStore: BuildStore = openStore(input.storeRef, env.AB_TOKEN)
61
81
  const ticketAuthority =
@@ -1,4 +1,5 @@
1
1
  import { accountRedactor, redactAccountStore } from '../store/account-redaction'
2
+ import { type StoreCaller, withStoreCaller } from '../store/caller-attribution'
2
3
  import { creationAssignees } from '../ports/tickets/assignees'
3
4
  import { creationLabels } from '../ports/tickets/labels'
4
5
  import {
@@ -116,13 +117,16 @@ export interface HarvestRunnerDeps {
116
117
  * present, the runner skips its own claim and never releases at the end —
117
118
  * the owning loop holds the lease for its lifetime. Without
118
119
  * `holdsAuthority` it heartbeats with that holder; a prepared hosted guest
119
- * instead uses it only to match its durable authorization. Absent keeps the
120
- * standalone self-claiming behavior. */
120
+ * instead uses it only to match its durable authorization. Absent, and
121
+ * without `holdsAuthority` or `preparedRun`, keeps the standalone
122
+ * self-claiming behavior. */
121
123
  leaseHolder?: string
122
124
  /** The owning DispatchLoop's repository authority: synchronous, no I/O.
123
125
  * When present, the loop's lease resolver owns reclaiming the adopted
124
- * lease, so the runner never claims it itself; a false answer stops the
125
- * run before its next turn starts, as a lost lease. */
126
+ * lease, so the runner never claims, renews on its own behalf, or releases
127
+ * the repository lease — even when `leaseHolder` is omitted. A false answer
128
+ * before the run starts returns `held` with no store write; a false answer
129
+ * later stops the run before its next turn starts, as a lost lease. */
126
130
  holdsAuthority?: () => boolean
127
131
  /** Provider-native identity of the disposable environment this run
128
132
  * executes in (hosted harvest). Stamped into the run's harvest.started
@@ -305,6 +309,22 @@ export class HarvestRunner {
305
309
  return this.deps.preparedRun !== undefined && this.deps.holdsAuthority === undefined
306
310
  }
307
311
 
312
+ /** Whether this runner claims and releases the repository lease itself.
313
+ * Three ownership modes, mirroring `ensureLease`:
314
+ * - owning authority (`holdsAuthority`, with or without `leaseHolder`): the
315
+ * dispatcher owns the lease; the runner never claims or releases it;
316
+ * - prepared hosted guest (`preparedRun` without `holdsAuthority`): its
317
+ * authority is a durable execution authorization, never the lease;
318
+ * - standalone `ab harvest` (none of the three): claims its own lease
319
+ * under `instance` and releases it at the end. */
320
+ private get selfOwnsLease(): boolean {
321
+ return (
322
+ this.deps.leaseHolder === undefined &&
323
+ this.deps.holdsAuthority === undefined &&
324
+ !this.executionAuthority
325
+ )
326
+ }
327
+
308
328
  private currentConfig(): Config {
309
329
  return this.deps.getConfig?.() ?? this.deps.config
310
330
  }
@@ -319,14 +339,33 @@ export class HarvestRunner {
319
339
  )
320
340
  }
321
341
 
342
+ /** Hosted requests the runner makes are attributed to it. Preparation is
343
+ * the dispatcher's own work under its lease, so it keeps the ambient
344
+ * dispatcher attribution. */
322
345
  async run(preparationOnly = false): Promise<HarvestRunnerResult> {
346
+ if (preparationOnly) return this.runInScope(true)
347
+ return withStoreCaller(this.runnerCaller(this.deps.preparedRun?.run), () =>
348
+ this.runInScope(false),
349
+ )
350
+ }
351
+
352
+ private runnerCaller(harvest: string | undefined): StoreCaller {
353
+ return {
354
+ kind: 'runner',
355
+ runner: 'harvest',
356
+ execution: this.deps.instance,
357
+ ...(harvest !== undefined ? { harvest } : {}),
358
+ }
359
+ }
360
+
361
+ private async runInScope(preparationOnly: boolean): Promise<HarvestRunnerResult> {
323
362
  const { store, repo, instance } = this.deps
363
+ // An owning authority already lost (e.g. the dispatcher released its
364
+ // lease before this launch ran): exit without touching the store.
365
+ if (this.deps.holdsAuthority !== undefined && !this.deps.holdsAuthority())
366
+ return { outcome: 'held' }
324
367
  if (!this.deps.preparedRun) await store.ensureRepo(repo)
325
- if (
326
- this.deps.leaseHolder === undefined &&
327
- !this.executionAuthority &&
328
- !(await store.claimRepoLease(repo, instance, this.leaseTtlMs))
329
- ) {
368
+ if (this.selfOwnsLease && !(await store.claimRepoLease(repo, instance, this.leaseTtlMs))) {
330
369
  return { outcome: 'held' }
331
370
  }
332
371
  let initial: 'started' | 'resumed' = 'resumed'
@@ -462,28 +501,33 @@ export class HarvestRunner {
462
501
  }
463
502
  if (!run) throw new Error('prepared harvest run unavailable')
464
503
  if (preparationOnly) return { outcome: 'prepared', run: run.run, launch: initial }
465
- try {
466
- await this.ensureScanStep(run)
467
- await this.controlBoundary(run.run)
468
- const outcome = await this.executeWorkflow(run)
469
- return { outcome, launch: initial, run: run.run }
470
- } catch (error) {
471
- if (
472
- error instanceof HarvestLeaseLostError ||
473
- error instanceof HarvestParkedSignal ||
474
- error instanceof HarvestSuspendedSignal ||
475
- error instanceof HarvestPersistenceError
476
- ) {
477
- throw error
478
- }
479
- if (error instanceof SessionFailure) {
480
- await this.settleRecoveryExhaustion(run.run)
481
- return { outcome: 'failed', launch: initial, run: run.run }
504
+ const claimed = run
505
+ const launch = initial
506
+ // Execution carries the run id: on the local path it is known only now.
507
+ return await withStoreCaller(this.runnerCaller(claimed.run), async () => {
508
+ try {
509
+ await this.ensureScanStep(claimed)
510
+ await this.controlBoundary(claimed.run)
511
+ const outcome = await this.executeWorkflow(claimed)
512
+ return { outcome, launch, run: claimed.run }
513
+ } catch (error) {
514
+ if (
515
+ error instanceof HarvestLeaseLostError ||
516
+ error instanceof HarvestParkedSignal ||
517
+ error instanceof HarvestSuspendedSignal ||
518
+ error instanceof HarvestPersistenceError
519
+ ) {
520
+ throw error
521
+ }
522
+ if (error instanceof SessionFailure) {
523
+ await this.settleRecoveryExhaustion(claimed.run)
524
+ return { outcome: 'failed' as const, launch, run: claimed.run }
525
+ }
526
+ await this.recordWorkflowFailure(claimed.run, error)
527
+ await this.settleRecoveryExhaustion(claimed.run)
528
+ return { outcome: 'failed' as const, launch, run: claimed.run }
482
529
  }
483
- await this.recordWorkflowFailure(run.run, error)
484
- await this.settleRecoveryExhaustion(run.run)
485
- return { outcome: 'failed', launch: initial, run: run.run }
486
- }
530
+ })
487
531
  } catch (error) {
488
532
  if (error instanceof HarvestSuspendedSignal)
489
533
  return { outcome: 'suspended', ...(run ? { run: run.run } : {}) }
@@ -508,10 +552,10 @@ export class HarvestRunner {
508
552
  }
509
553
  this.producer = undefined
510
554
  }
511
- // An adopted holder is released by the owning DispatchLoop, never here;
512
- // a prepared hosted guest never held the lease.
513
- if (this.deps.leaseHolder === undefined && !this.executionAuthority)
514
- await store.releaseRepoLease(repo, instance)
555
+ // An adopted holder or an owning authority's lease is released by the
556
+ // owning DispatchLoop, never here; a prepared hosted guest never held
557
+ // the lease.
558
+ if (this.selfOwnsLease) await store.releaseRepoLease(repo, instance)
515
559
  }
516
560
  }
517
561
 
@@ -2051,8 +2095,11 @@ export class HarvestRunner {
2051
2095
  }
2052
2096
 
2053
2097
  private async startHeartbeat(): Promise<void> {
2054
- // A prepared hosted guest never renews the dispatcher's lease.
2098
+ // A prepared hosted guest never renews the dispatcher's lease, and an
2099
+ // owning authority without an adopted holder has nothing of its own to
2100
+ // renew.
2055
2101
  if (this.executionAuthority) return
2102
+ if (this.deps.holdsAuthority !== undefined && this.deps.leaseHolder === undefined) return
2056
2103
  const { store, repo } = this.deps
2057
2104
  const holder = this.deps.leaseHolder ?? this.deps.instance
2058
2105
  if (!(await store.heartbeatRepo(repo, holder))) this.leaseLost = true
@@ -83,6 +83,8 @@ export interface PassStagePartRecord {
83
83
  items: number
84
84
  total?: number
85
85
  stopped?: PassStop
86
+ /** Tickets whose preparation this part carried to the next pass. */
87
+ carried?: string[]
86
88
  }
87
89
 
88
90
  export interface PassStageRecord {
@@ -91,17 +93,23 @@ export interface PassStageRecord {
91
93
  items: number
92
94
  total?: number
93
95
  stopped?: PassStop
96
+ /** Tickets whose preparation the stage carried to the next pass (#1431). */
97
+ carried?: string[]
94
98
  parts?: PassStagePartRecord[]
95
99
  }
96
100
 
101
+ /** Most ticket ids one stage or part record carries. */
102
+ const MAX_CARRIED = 8
103
+
97
104
  function strongest(a: PassStop | undefined, b: PassStop | undefined): PassStop | undefined {
98
105
  if (a === 'deadline' || b === 'deadline') return 'deadline'
99
106
  return a ?? b
100
107
  }
101
108
 
102
109
  /** One stage's record from its parts: items and totals add, a part with no
103
- * reported total leaves the stage total unknown, and the strongest stop
104
- * marker wins. `parts` is kept only for a stage with more than one part. */
110
+ * reported total leaves the stage total unknown, the strongest stop marker
111
+ * wins and carried tickets are unioned (capped). `parts` is kept only for a
112
+ * stage with more than one part. */
105
113
  export function aggregateStage(
106
114
  stage: PassStage,
107
115
  ms: number,
@@ -110,10 +118,12 @@ export function aggregateStage(
110
118
  let items = 0
111
119
  let total: number | undefined = 0
112
120
  let stopped: PassStop | undefined
121
+ const carried = new Set<string>()
113
122
  for (const part of parts) {
114
123
  items += part.items
115
124
  total = total === undefined || part.total === undefined ? undefined : total + part.total
116
125
  stopped = strongest(stopped, part.stopped)
126
+ for (const id of part.carried ?? []) carried.add(id)
117
127
  }
118
128
  return {
119
129
  stage,
@@ -121,6 +131,7 @@ export function aggregateStage(
121
131
  items,
122
132
  ...(total !== undefined ? { total } : {}),
123
133
  ...(stopped !== undefined ? { stopped } : {}),
134
+ ...(carried.size > 0 ? { carried: [...carried].slice(0, MAX_CARRIED) } : {}),
124
135
  ...(parts.length > 1 ? { parts: parts.map((part) => ({ ...part })) } : {}),
125
136
  }
126
137
  }
@@ -128,8 +139,12 @@ export function aggregateStage(
128
139
  const progress = (items: number, total: number | undefined) =>
129
140
  total === undefined ? `${items}` : `${items}/${total}`
130
141
 
142
+ const carriedText = (carried: readonly string[] | undefined) =>
143
+ carried !== undefined && carried.length > 0 ? ` carried ${carried.join(', ')}` : ''
144
+
131
145
  /** The dispatch log's `stages:` summary, for example
132
- * `settlement 3.1s 6/11 (executions 5/9, harvest 1/2, sandboxes 0/0) · janitor 131.4s 4/12 (share)`. */
146
+ * `settlement 3.1s 6/11 (executions 5/9, harvest 1/2, sandboxes 0/0) · janitor 131.4s 4/12 (share)`.
147
+ * A carried preparation reads `intake 2.4s 0/22 (tickets 0/22 carried FLINT-1490, …)`. */
133
148
  export function formatPassStages(records: readonly PassStageRecord[]): string {
134
149
  return records
135
150
  .map((record) => {
@@ -137,10 +152,10 @@ export function formatPassStages(records: readonly PassStageRecord[]): string {
137
152
  ? ` (${record.parts
138
153
  .map(
139
154
  (part) =>
140
- `${part.part} ${progress(part.items, part.total)}${part.stopped ? ` ${part.stopped}` : ''}`,
155
+ `${part.part} ${progress(part.items, part.total)}${carriedText(part.carried)}${part.stopped ? ` ${part.stopped}` : ''}`,
141
156
  )
142
157
  .join(', ')})`
143
- : ''
158
+ : carriedText(record.carried)
144
159
  const stopped = record.stopped ? ` (${record.stopped})` : ''
145
160
  return `${record.stage} ${(record.ms / 1000).toFixed(1)}s ${progress(record.items, record.total)}${parts}${stopped}`
146
161
  })
@@ -178,6 +193,7 @@ interface PartState {
178
193
  started: number
179
194
  total?: number
180
195
  stopped?: PassStop
196
+ carried?: string[]
181
197
  }
182
198
 
183
199
  interface RunningStage {
@@ -242,6 +258,15 @@ export class PassStageTracker {
242
258
  return this.running?.parts.find((candidate) => candidate.part === part)?.started ?? 0
243
259
  }
244
260
 
261
+ /** Record that `part` carried `ticket`'s preparation to the next pass. */
262
+ carry(part: PassStagePart, ticket: string): void {
263
+ const state = this.enter(part)
264
+ if (state === undefined) return
265
+ state.carried ??= []
266
+ if (!state.carried.includes(ticket) && state.carried.length < MAX_CARRIED)
267
+ state.carried.push(ticket)
268
+ }
269
+
245
270
  stop(part: PassStagePart, stopped: PassStop): void {
246
271
  const state = this.enter(part)
247
272
  if (state !== undefined) state.stopped = strongest(state.stopped, stopped)
@@ -283,11 +308,12 @@ export class PassStageTracker {
283
308
  return aggregateStage(
284
309
  running.stage,
285
310
  this.clock() - running.startedAt,
286
- running.parts.map(({ part, items, total, stopped }) => ({
311
+ running.parts.map(({ part, items, total, stopped, carried }) => ({
287
312
  part,
288
313
  items,
289
314
  ...(total !== undefined ? { total } : {}),
290
315
  ...(stopped !== undefined ? { stopped } : {}),
316
+ ...(carried !== undefined ? { carried: [...carried] } : {}),
291
317
  })),
292
318
  )
293
319
  }
@@ -21,6 +21,7 @@ export const POLICY_PHASE_FAILURE_RESET_SCOPES = {
21
21
  'wait-unresolvable': 'none',
22
22
  'measurement-failed': 'none',
23
23
  'target-rewritten': 'none',
24
+ 'dirty-worktree': 'none',
24
25
  } as const satisfies Record<PolicyEscalationCause, PhaseFailureBudgetResetScope>
25
26
 
26
27
  export interface PhaseFailureResetEscalation {
@@ -0,0 +1,23 @@
1
+ import type { WorkspaceProvisionProgress } from '../ports/types'
2
+
3
+ /** The literal recorded when teardown abandons a provision that reported no
4
+ * progress. */
5
+ const ABANDONED = 'provisioning abandoned at dispatcher teardown'
6
+ const ADOPTS = 'the next supervisor adopts the open marker'
7
+
8
+ /** One readable label for a provider's progress report. */
9
+ export function describeProvisionProgress(progress: WorkspaceProvisionProgress): string {
10
+ return progress.step === undefined ? progress.stage : `${progress.stage} ${progress.step}`
11
+ }
12
+
13
+ /** The `dispatch.failed` message for a provision teardown abandoned: the
14
+ * stage it was in and how long that stage had run, when the provider reported
15
+ * one (#1400). */
16
+ export function provisioningAbandonmentMessage(
17
+ progress: { label: string; since: number } | undefined,
18
+ at: number,
19
+ ): string {
20
+ if (progress === undefined) return `${ABANDONED}; ${ADOPTS}`
21
+ const seconds = Math.max(0, Math.round((at - progress.since) / 1000))
22
+ return `${ABANDONED} during ${progress.label} after ${seconds}s; ${ADOPTS}`
23
+ }
@@ -66,7 +66,13 @@ import type {
66
66
  SubscribeOptions,
67
67
  Unsubscribe,
68
68
  } from '../store/types'
69
- import type { BuildPage, BuildPageOptions, ChangedBuilds } from '../store/types'
69
+ import type {
70
+ BuildPage,
71
+ BuildPageOptions,
72
+ ChangedBuilds,
73
+ MergedBuildPage,
74
+ MergedBuildPageOptions,
75
+ } from '../store/types'
70
76
 
71
77
  /** The write committed; only the subsequent local projection refresh failed. */
72
78
  export class CommittedRefreshError<T = unknown> extends Error {
@@ -145,7 +151,12 @@ export class RepoViewStore implements BuildStore {
145
151
  * `servedBuildFacts` serves them; `buildFacts` always reads. */
146
152
  private retained?: Map<
147
153
  string,
148
- { epoch: number; appends: number; updatedAt?: string; facts: CurrentBuildFacts }
154
+ {
155
+ epoch: number
156
+ appends: number
157
+ updatedAt?: string
158
+ facts: CurrentBuildFacts
159
+ }
149
160
  >
150
161
  /** Appends this view made per build: a served read must postdate them. */
151
162
  private readonly appends = new Map<string, number>()
@@ -310,6 +321,10 @@ export class RepoViewStore implements BuildStore {
310
321
  return this.backing.listBuildsPage(repo, opts)
311
322
  }
312
323
 
324
+ listMergedBuildsPage(repo: string, opts?: MergedBuildPageOptions): Promise<MergedBuildPage> {
325
+ return this.backing.listMergedBuildsPage(repo, opts)
326
+ }
327
+
313
328
  listBuildsForRepo(repo: string): Promise<BuildRecord[]> {
314
329
  return this.backing.listBuildsForRepo(repo)
315
330
  }
@@ -587,7 +602,10 @@ export class RepoViewStore implements BuildStore {
587
602
  repo: string,
588
603
  artifacts: ArtifactInput[],
589
604
  makeEvent: (deposited: RepositoryArtifactMeta[]) => RepositoryEventWrite<T>,
590
- ): Promise<{ event: RepositoryEventEnvelope<T>; artifacts: RepositoryArtifactMeta[] }> {
605
+ ): Promise<{
606
+ event: RepositoryEventEnvelope<T>
607
+ artifacts: RepositoryArtifactMeta[]
608
+ }> {
591
609
  const result = await this.backing.appendRepoWithArtifacts(repo, artifacts, makeEvent)
592
610
  if (repo === this.repo) {
593
611
  this.foldJournalAppend(result.event as RepositoryEvent)
@@ -783,7 +801,10 @@ export class RepoViewStore implements BuildStore {
783
801
  id: string,
784
802
  artifacts: ArtifactInput[],
785
803
  makeEvent: (deposited: SessionArtifactMeta[]) => SessionEventWrite<T>,
786
- ): Promise<{ event: SessionEventEnvelope<T>; artifacts: SessionArtifactMeta[] }> {
804
+ ): Promise<{
805
+ event: SessionEventEnvelope<T>
806
+ artifacts: SessionArtifactMeta[]
807
+ }> {
787
808
  return this.backing.appendSessionWithArtifacts(id, artifacts, makeEvent)
788
809
  }
789
810
  putSessionArtifact(id: string, artifact: ArtifactInput): Promise<SessionArtifactMeta> {
@@ -55,6 +55,7 @@ export function decisionUsesWorkspace(decision: Decision): boolean {
55
55
  case 'raise-escalation':
56
56
  case 'recover-target-rewrite':
57
57
  case 'accept-target-rewrite':
58
+ case 'supersede-dirty-preparation':
58
59
  return false
59
60
  default: {
60
61
  const unclassified: never = decision
@@ -7,12 +7,19 @@ export {
7
7
  repoTickCompletionSchema,
8
8
  repoTickObservationSchema,
9
9
  } from './repo-tick'
10
- export type { RepoTickCompletion, RepoTickObservation, RepoTickFinish } from './types'
10
+ export type {
11
+ RepoTickCompletion,
12
+ RepoTickObservation,
13
+ RepoTickFinish,
14
+ } from './types'
11
15
  export { validateEventWrite, prepareEventWrite } from '../events/catalog'
12
16
  export { humanActor } from '../events/envelope'
13
17
  export type { AbEvent, EventEnvelope, EventWrite } from '../events/catalog'
14
18
  export type { EventType } from '../events/payloads'
15
- export { validateRepositoryEventWrite, prepareRepositoryEventWrite } from '../events/repository'
19
+ export {
20
+ validateRepositoryEventWrite,
21
+ prepareRepositoryEventWrite,
22
+ } from '../events/repository'
16
23
  export type {
17
24
  RepositoryEvent,
18
25
  RepositoryEventEnvelope,
@@ -103,7 +110,12 @@ export type {
103
110
  StreamStatus,
104
111
  } from './streams/types'
105
112
  export { pollingSubscribe } from './subscribe'
106
- export { contentHash, systemClock, toBytes, validateExpectedSeq } from './types'
113
+ export {
114
+ contentHash,
115
+ systemClock,
116
+ toBytes,
117
+ validateExpectedSeq,
118
+ } from './types'
107
119
  export type {
108
120
  Artifact,
109
121
  ArtifactInput,
@@ -136,7 +148,12 @@ export {
136
148
  snapshotScopeKey,
137
149
  snapshotSupersedes,
138
150
  } from './snapshots'
139
- export type { ReducerSnapshot, ReducerValueScope, RollupScope, SnapshotScope } from './snapshots'
151
+ export type {
152
+ ReducerSnapshot,
153
+ ReducerValueScope,
154
+ RollupScope,
155
+ SnapshotScope,
156
+ } from './snapshots'
140
157
  export { rollupScopeKey } from './snapshots'
141
158
  export {
142
159
  KeyedMutex,
@@ -175,7 +192,10 @@ export { assertPublicSnapshotReducer } from './snapshots'
175
192
  export { readPersistedBuildDigests } from './reduced-reads'
176
193
  export { OpenBuildsCapabilityError, openBuildMember } from './open-builds'
177
194
 
178
- export { dispatchPlacementSchema, dispatchPlacementReducer } from '../kernel/dispatch-placement'
195
+ export {
196
+ dispatchPlacementSchema,
197
+ dispatchPlacementReducer,
198
+ } from '../kernel/dispatch-placement'
179
199
  export type { DispatchPlacement } from '../kernel/dispatch-placement'
180
200
  export { dispatchPlacementFactSchema } from '../events/repository'
181
201
  export type { DispatchPlacementFact } from '../events/repository'
@@ -197,9 +217,13 @@ export {
197
217
  parseBuildPageFilterParams,
198
218
  parseBuildPageLimitParam,
199
219
  parseChangePosition,
220
+ parseListingTarget,
221
+ parseMergedBuildWindowParams,
200
222
  requireBuildPageCursorOrder,
223
+ requireMergedCursor,
201
224
  resolveBuildPageFilters,
202
225
  resolveBuildPageLimit,
226
+ resolveMergedBuildWindow,
203
227
  sameBuildPageFilters,
204
228
  } from './build-feed'
205
229
  export type {
@@ -211,4 +235,9 @@ export type {
211
235
  BuildPageOrder,
212
236
  ChangedBuild,
213
237
  ChangedBuilds,
238
+ MergedBuild,
239
+ MergedBuildPage,
240
+ MergedBuildPageOptions,
241
+ MergedBuildTarget,
242
+ MergedBuildWindow,
214
243
  } from './build-feed'