@defrex/autobuild 1.12.0 → 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 +435 -160
- package/bin/ab-build-runner.ts +8 -0
- package/docs/answering-blocked-builds.md +25 -3
- package/docs/architecture.md +124 -53
- package/docs/cli.md +1 -1
- package/docs/configuration.md +110 -15
- package/docs/dispatcher.md +19 -8
- package/docs/integration-overview.md +1 -1
- package/docs/integration-tree.md +12 -9
- package/docs/merge-policy.md +7 -2
- package/docs/operating.md +5 -3
- package/docs/operator-api.md +46 -23
- package/docs/operator-surfaces.md +7 -6
- package/docs/optimization-nodes.md +7 -6
- 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/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 +14 -8
- package/packages/core/src/cli/dashboard/poll.ts +218 -10
- package/packages/core/src/cli/dashboard/queue.ts +21 -10
- package/packages/core/src/cli/dashboard/row-text.ts +2 -1
- package/packages/core/src/cli/dashboard/vocabulary.ts +5 -1
- package/packages/core/src/cli/dispatch-frontend.ts +2 -1
- package/packages/core/src/cli/dispatch-tickets.ts +33 -12
- package/packages/core/src/cli/dispatch.ts +527 -144
- package/packages/core/src/cli/help.ts +38 -24
- package/packages/core/src/cli/main.ts +7 -5
- 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/repository-status.ts +19 -9
- package/packages/core/src/cli/status.ts +23 -11
- package/packages/core/src/cli/store-opening.ts +12 -0
- 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/events/payloads.ts +74 -14
- package/packages/core/src/events/repository.ts +14 -3
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +27 -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/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/c7c94fbe7f63cf07.json +84 -0
- package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
- package/packages/core/src/kernel/done-escalations.ts +269 -0
- package/packages/core/src/kernel/engine.ts +28 -9
- 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/open-pr-backpressure.ts +3 -3
- package/packages/core/src/kernel/reducer-registry.ts +3 -0
- package/packages/core/src/kernel/reducer-revisions.ts +15 -0
- package/packages/core/src/kernel/reducer.ts +27 -7
- package/packages/core/src/kernel/repository-attention.ts +14 -5
- package/packages/core/src/kernel/ticket-starts.ts +15 -4
- 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 +1 -1
- package/packages/core/src/operator/protocol.ts +8 -5
- package/packages/core/src/operator/query.ts +33 -19
- package/packages/core/src/operator/registry.ts +17 -13
- 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/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 +544 -212
- 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/reduced-reads.ts +23 -0
- package/packages/core/src/store/reducer-value-shapes.json +6628 -6469
- package/packages/core/src/store/reducer-value-validation.ts +181 -33
- 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 +11 -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 +18 -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/testing/dispatch-read-budget.ts +144 -10
- 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 +381 -18
- package/packages/core/src/testing/released-value-coverage.ts +423 -0
- package/packages/core/src/web/overview-source.ts +19 -6
- package/skills/guide/SKILL.md +138 -67
- package/skills/guide/references/integration-tree.md +12 -9
- package/skills/guide/references/merge-policy.md +7 -2
- package/skills/guide/references/operator-api.md +46 -23
- package/skills/guide/references/optimization-nodes.md +7 -6
- 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 +82 -51
- 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
|
@@ -76,23 +76,31 @@ function stepSection<T, C, S = string[]>(
|
|
|
76
76
|
label: string,
|
|
77
77
|
stepsSchema: z.ZodType<S>,
|
|
78
78
|
tableSchema: z.ZodType<T>,
|
|
79
|
-
compose: (steps: S, stepConfigs: Record<string, T>,
|
|
80
|
-
|
|
79
|
+
compose: (steps: S, stepConfigs: Record<string, T>, policies: VerifyPolicies) => C,
|
|
80
|
+
allowVerifyPolicies = false,
|
|
81
81
|
) {
|
|
82
82
|
const afterReconcileSchema = z.boolean().default(true)
|
|
83
|
+
const afterCleanRestackSchema = z.boolean().optional()
|
|
83
84
|
const schema = z
|
|
84
85
|
.unknown()
|
|
85
86
|
.transform((input, ctx): C => {
|
|
86
87
|
const stepConfigs: Record<string, T> = Object.create(null)
|
|
87
88
|
let steps = stepsSchema.parse(undefined)
|
|
88
|
-
|
|
89
|
+
const policies: VerifyPolicies = { afterReconcile: afterReconcileSchema.parse(undefined) }
|
|
89
90
|
for (const [key, raw] of ownEntries(input, label, ctx)) {
|
|
90
|
-
if (key === 'afterReconcile' &&
|
|
91
|
+
if (key === 'afterReconcile' && allowVerifyPolicies) {
|
|
91
92
|
const parsed = afterReconcileSchema.safeParse(raw)
|
|
92
|
-
if (parsed.success) afterReconcile = parsed.data
|
|
93
|
+
if (parsed.success) policies.afterReconcile = parsed.data
|
|
93
94
|
else forwardIssues(parsed.error.issues, ctx, [key])
|
|
94
95
|
continue
|
|
95
96
|
}
|
|
97
|
+
if (key === 'afterCleanRestack' && allowVerifyPolicies) {
|
|
98
|
+
const parsed = afterCleanRestackSchema.safeParse(raw)
|
|
99
|
+
if (parsed.success) {
|
|
100
|
+
if (parsed.data !== undefined) policies.afterCleanRestack = parsed.data
|
|
101
|
+
} else forwardIssues(parsed.error.issues, ctx, [key])
|
|
102
|
+
continue
|
|
103
|
+
}
|
|
96
104
|
if (key === 'steps') {
|
|
97
105
|
const parsed = stepsSchema.safeParse(raw)
|
|
98
106
|
if (parsed.success) steps = parsed.data
|
|
@@ -102,18 +110,18 @@ function stepSection<T, C, S = string[]>(
|
|
|
102
110
|
const table = parseEntry(tableSchema, raw, key, ctx)
|
|
103
111
|
if (table.ok) defineEntry(stepConfigs, key, table.value)
|
|
104
112
|
}
|
|
105
|
-
return compose(steps, stepConfigs,
|
|
113
|
+
return compose(steps, stepConfigs, policies)
|
|
106
114
|
})
|
|
107
115
|
.prefault({})
|
|
108
116
|
documentSchema(stepsSchema, {
|
|
109
|
-
...(
|
|
117
|
+
...(allowVerifyPolicies
|
|
110
118
|
? {
|
|
111
119
|
constraints:
|
|
112
120
|
'Each name is nonempty; each grouped stage contains at least one nonempty name. Names must be unique within and across stages.',
|
|
113
121
|
}
|
|
114
122
|
: {}),
|
|
115
123
|
description:
|
|
116
|
-
(
|
|
124
|
+
(allowVerifyPolicies
|
|
117
125
|
? 'Ordered verify stages: a name is a singleton stage; a nonempty array runs its members concurrently. Names must be unique within and across stages. '
|
|
118
126
|
: 'Ordered names of the configured step tables. ') +
|
|
119
127
|
'Names contain only ASCII letters, digits, ., _ and -, excluding "." and "..". Every listed step must have a table and every table must be listed.',
|
|
@@ -126,16 +134,30 @@ function stepSection<T, C, S = string[]>(
|
|
|
126
134
|
description:
|
|
127
135
|
'Whether verification runs after reconciliation. A step override takes precedence.',
|
|
128
136
|
})
|
|
137
|
+
documentSchema(afterCleanRestackSchema, {
|
|
138
|
+
default: 'false (omission is preserved)',
|
|
139
|
+
description:
|
|
140
|
+
'Whether verification re-runs on the restacked head after a clean awaiting-landing restack of a root-targeting leaf, before it lands. A step override takes precedence.',
|
|
141
|
+
})
|
|
129
142
|
return documentSchema(schema, {
|
|
130
143
|
structure: {
|
|
131
144
|
kind: 'steps',
|
|
132
145
|
steps: stepsSchema,
|
|
133
146
|
table: tableSchema,
|
|
134
|
-
...(
|
|
147
|
+
...(allowVerifyPolicies
|
|
148
|
+
? { afterReconcile: afterReconcileSchema, afterCleanRestack: afterCleanRestackSchema }
|
|
149
|
+
: {}),
|
|
135
150
|
},
|
|
136
151
|
})
|
|
137
152
|
}
|
|
138
153
|
|
|
154
|
+
/** Repository-wide verify policy scalars parsed beside `steps`. */
|
|
155
|
+
interface VerifyPolicies {
|
|
156
|
+
afterReconcile: boolean
|
|
157
|
+
/** Present only when the source sets it, preserving configuration identity. */
|
|
158
|
+
afterCleanRestack?: boolean
|
|
159
|
+
}
|
|
160
|
+
|
|
139
161
|
// ── [pr] / [pr.imageHost] ────────────────────────────────────────────────────
|
|
140
162
|
|
|
141
163
|
/** Optional public GitHub release used for review-window image copies.
|
|
@@ -220,6 +242,8 @@ export const vercelSandboxConfigSchema = z
|
|
|
220
242
|
timeoutSeconds: z.number().int().min(60).max(86_400),
|
|
221
243
|
/** Deadline for each provider acknowledgement; distinct from VM lifetime. */
|
|
222
244
|
operationTimeoutMs: z.number().int().min(1_000).max(300_000).default(30_000),
|
|
245
|
+
/** Budget for one stopped-sandbox recovery: explicit resume plus guest git. */
|
|
246
|
+
recoveryTimeoutMs: z.number().int().min(1_000).max(600_000).default(120_000),
|
|
223
247
|
/** Billing safety net: snapshots created for this environment expire after
|
|
224
248
|
* this duration instead of the provider's 30-day default. Absent means the
|
|
225
249
|
* provider default. */
|
|
@@ -308,6 +332,8 @@ documentFields(vercelSandboxConfigSchema, {
|
|
|
308
332
|
'VM/session lifetime in seconds and abrupt-orphan bound. Provider plan limits also apply.',
|
|
309
333
|
operationTimeoutMs:
|
|
310
334
|
'Deadline in milliseconds for each provider acknowledgement, independent of session lifetime.',
|
|
335
|
+
recoveryTimeoutMs:
|
|
336
|
+
'Budget in milliseconds for one stopped-sandbox recovery: an explicit cold resume plus the guest git work that follows it, including a push. Any invocation deadline bounds it further. Separate from operationTimeoutMs.',
|
|
311
337
|
snapshotExpirationSeconds:
|
|
312
338
|
'Snapshot expiration in seconds. Omission uses the provider expiration policy.',
|
|
313
339
|
region: 'Primary region; omission uses the provider region selection.',
|
|
@@ -334,9 +360,10 @@ type NormalizedVercelSandboxConfig = z.infer<typeof vercelSandboxConfigSchema>
|
|
|
334
360
|
* production config always materializes operationTimeoutMs. */
|
|
335
361
|
export type VercelSandboxConfig = Omit<
|
|
336
362
|
NormalizedVercelSandboxConfig,
|
|
337
|
-
'operationTimeoutMs' | 'provisioning' | 'runtimeProvisioning'
|
|
363
|
+
'operationTimeoutMs' | 'recoveryTimeoutMs' | 'provisioning' | 'runtimeProvisioning'
|
|
338
364
|
> & {
|
|
339
365
|
operationTimeoutMs?: number
|
|
366
|
+
recoveryTimeoutMs?: number
|
|
340
367
|
/** Optional only for source compatibility with direct adapter construction;
|
|
341
368
|
* schema-loaded repository configuration always materializes this list. */
|
|
342
369
|
provisioning?: VercelProvisioningStep[]
|
|
@@ -486,6 +513,7 @@ const verifyApplicabilityShape = {
|
|
|
486
513
|
default: 'false (omission is preserved)',
|
|
487
514
|
}),
|
|
488
515
|
afterReconcile: z.boolean().optional(),
|
|
516
|
+
afterCleanRestack: z.boolean().optional(),
|
|
489
517
|
/** Any-match positive path selectors; absent means unconditional. */
|
|
490
518
|
paths: z
|
|
491
519
|
.array(pathSelectorSchema)
|
|
@@ -510,6 +538,8 @@ documentFields(verifyCheckStepSchema, {
|
|
|
510
538
|
'Name of an existing command in [commands]; required for check steps and forbidden for agent steps.',
|
|
511
539
|
afterReconcile:
|
|
512
540
|
'Step override wins over `[verify].afterReconcile`; false skips this step after reconciliation only.',
|
|
541
|
+
afterCleanRestack:
|
|
542
|
+
'Step override wins over `[verify].afterCleanRestack`; true re-runs this step on the restacked head after a clean awaiting-landing restack of a root-targeting leaf, false records it skipped.',
|
|
513
543
|
failFast: 'Cancel unfinished members of this stage when this step fails. Defaults to false.',
|
|
514
544
|
paths: 'Apply only when at least one changed path matches. Available to both variants.',
|
|
515
545
|
always:
|
|
@@ -528,6 +558,8 @@ documentFields(verifyAgentStepSchema, {
|
|
|
528
558
|
skill: 'Exact installed skill name; required for agent steps and forbidden for check steps.',
|
|
529
559
|
afterReconcile:
|
|
530
560
|
'Step override wins over `[verify].afterReconcile`; false skips this step after reconciliation only.',
|
|
561
|
+
afterCleanRestack:
|
|
562
|
+
'Step override wins over `[verify].afterCleanRestack`; true re-runs this step on the restacked head after a clean awaiting-landing restack of a root-targeting leaf, false records it skipped.',
|
|
531
563
|
failFast: 'Cancel unfinished members of this stage when this step fails. Defaults to false.',
|
|
532
564
|
paths: 'Apply only when at least one changed path matches. Available to both variants.',
|
|
533
565
|
always:
|
|
@@ -542,6 +574,8 @@ export type VerifyStepConfig = z.infer<typeof verifyStepConfigSchema>
|
|
|
542
574
|
|
|
543
575
|
export interface VerifyConfig {
|
|
544
576
|
afterReconcile: boolean
|
|
577
|
+
/** Repository default for clean-restack re-verification; absent means false. */
|
|
578
|
+
afterCleanRestack?: boolean
|
|
545
579
|
/** Step order — each entry names a `verify:<step>` phase (§15.2.1). */
|
|
546
580
|
steps: string[]
|
|
547
581
|
/** Present only when the source contains grouped entries. */
|
|
@@ -551,7 +585,7 @@ export interface VerifyConfig {
|
|
|
551
585
|
}
|
|
552
586
|
|
|
553
587
|
/**
|
|
554
|
-
* [verify] mixes known scalars (`steps`, `afterReconcile`) with per-step
|
|
588
|
+
* [verify] mixes known scalars (`steps`, `afterReconcile`, `afterCleanRestack`) with per-step
|
|
555
589
|
* subtables, so it cannot be a strictObject; every other key is
|
|
556
590
|
* validated as a step table — nothing passes through loosely, and no step name
|
|
557
591
|
* is lost to the prototype chain (see `stepSection`).
|
|
@@ -567,10 +601,11 @@ export const verifySectionSchema = stepSection(
|
|
|
567
601
|
)
|
|
568
602
|
.default([]),
|
|
569
603
|
verifyStepConfigSchema,
|
|
570
|
-
(entries, stepConfigs, afterReconcile): VerifyConfig => ({
|
|
604
|
+
(entries, stepConfigs, { afterReconcile, afterCleanRestack }): VerifyConfig => ({
|
|
571
605
|
steps: entries.flat(),
|
|
572
606
|
stepConfigs,
|
|
573
607
|
afterReconcile,
|
|
608
|
+
...(afterCleanRestack !== undefined ? { afterCleanRestack } : {}),
|
|
574
609
|
...(entries.some(Array.isArray)
|
|
575
610
|
? {
|
|
576
611
|
stages: entries.map((entry) => (typeof entry === 'string' ? [entry] : entry)),
|
|
@@ -808,7 +843,7 @@ export const policySchema = z.strictObject({
|
|
|
808
843
|
nodeIdlePollSeconds: z.number().int().positive().default(120),
|
|
809
844
|
janitorBackoffMaxSeconds: z.number().int().positive().default(300),
|
|
810
845
|
harvestMaxDrift: z.number().int().nonnegative().default(3),
|
|
811
|
-
/** Open unmerged root PRs at which normal
|
|
846
|
+
/** Open unmerged root PRs at which high, normal and low intake pauses; unset disables backpressure. */
|
|
812
847
|
maxOpenPrs: z.number().int().positive().optional(),
|
|
813
848
|
/** Open unmerged root PRs at or below which paused intake resumes; defaults to `maxOpenPrs - 1`. */
|
|
814
849
|
resumeOpenPrs: z.number().int().nonnegative().optional(),
|
|
@@ -847,9 +882,9 @@ documentFields(policySchema, {
|
|
|
847
882
|
harvestMaxDrift:
|
|
848
883
|
'Other builds merged after the oldest unclaimed observation needed to start a run; `0` disables drift.',
|
|
849
884
|
maxOpenPrs:
|
|
850
|
-
'Open unmerged root build PRs (leaves and integration nodes) at which the dispatcher stops ordinary ready-queue claims of `normal
|
|
885
|
+
'Open unmerged root build PRs (leaves and integration nodes) at which the dispatcher stops ordinary ready-queue claims of `high`, `normal` and `low` tickets. In-flight work, reconciles, landings, `urgent` claims and every `ab start` (`tickets.start`) request continue, subject to capacity and repository pause. Unset disables open-PR backpressure.',
|
|
851
886
|
resumeOpenPrs:
|
|
852
|
-
'Open root PR count at or below which paused
|
|
887
|
+
'Open root PR count at or below which paused high, normal and low intake resumes; defaults to `maxOpenPrs - 1`. Reaching `maxOpenPrs` takes precedence, so when this equals `maxOpenPrs` intake stays paused at that count and resumes once the count falls below `maxOpenPrs`. Inert without `maxOpenPrs`.',
|
|
853
888
|
excludeHeldOpenPrs:
|
|
854
889
|
'Leave PRs whose active landing command is `hold` out of the open-PR backpressure count. Inert without `maxOpenPrs`.',
|
|
855
890
|
})
|
|
@@ -1440,7 +1475,7 @@ documentFields(configRootSchema, {
|
|
|
1440
1475
|
'Named observe-only hooks: the dispatcher delivers each matching watch record to a command or URL, in order and at least once.',
|
|
1441
1476
|
baseBranch: 'Branch used to cut builds, target PRs, and merge during reconciliation.',
|
|
1442
1477
|
capacity:
|
|
1443
|
-
'Slots for this repository. A build holds one from admission (a ticket claim, a start request or an admitted slot request) until it waits on a human, another ticket, the forge or its children, or ends. A build whose outside wait ends is admitted again ahead of
|
|
1478
|
+
'Slots for this repository. A build holds one from admission (a ticket claim, a start request or an admitted slot request) until it waits on a human, another ticket, the forge or its children, or ends. A build whose outside wait ends is admitted again ahead of ticket claims at its level, higher levels first (see [slot admission order](dispatcher.md#slot-admission-order)). Occupancy never exceeds capacity.',
|
|
1444
1479
|
ticketScanIntervalSeconds:
|
|
1445
1480
|
'Ticket-source ready scan cadence; tick spacing is the effective minimum.',
|
|
1446
1481
|
forge:
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
revisableChangesSchema,
|
|
25
25
|
} from '../objective'
|
|
26
26
|
import { refineUniqueIssues } from '../ports/tickets/issue-links'
|
|
27
|
-
import { ticketPrioritySchema } from '../ports/tickets/priority'
|
|
28
27
|
import {
|
|
29
28
|
HEAD_PATHS_ARTIFACT,
|
|
30
29
|
HEAD_PATHS_PREVIEW,
|
|
@@ -122,6 +121,55 @@ export const leafRestackSchema = reconcileTransactionSchema.omit({ attempt: true
|
|
|
122
121
|
observation: z.number().int().positive(),
|
|
123
122
|
message: z.string().min(1),
|
|
124
123
|
})
|
|
124
|
+
/** Frozen clean-restack verify policy (`[verify].afterCleanRestack` and its
|
|
125
|
+
* step overrides) resolved when a root-targeting leaf's awaiting-landing
|
|
126
|
+
* restack intent was built. Present only when at least one step is enabled;
|
|
127
|
+
* its completion opens a fresh verify cycle that re-runs the enabled steps. */
|
|
128
|
+
export const cleanRestackPolicySchema = z
|
|
129
|
+
.strictObject({
|
|
130
|
+
steps: z
|
|
131
|
+
.array(
|
|
132
|
+
z.strictObject({
|
|
133
|
+
step: z.string().min(1),
|
|
134
|
+
enabled: z.boolean(),
|
|
135
|
+
source: z.string().min(1),
|
|
136
|
+
}),
|
|
137
|
+
)
|
|
138
|
+
.min(1),
|
|
139
|
+
})
|
|
140
|
+
.superRefine((policy, ctx) => {
|
|
141
|
+
if (new Set(policy.steps.map((s) => s.step)).size !== policy.steps.length)
|
|
142
|
+
ctx.addIssue({ code: 'custom', message: 'duplicate policy step' })
|
|
143
|
+
for (const s of policy.steps)
|
|
144
|
+
if (
|
|
145
|
+
s.source !== 'verify.afterCleanRestack' &&
|
|
146
|
+
s.source !== `verify.${s.step}.afterCleanRestack`
|
|
147
|
+
)
|
|
148
|
+
ctx.addIssue({ code: 'custom', message: 'invalid policy source' })
|
|
149
|
+
if (!policy.steps.some((s) => s.enabled))
|
|
150
|
+
ctx.addIssue({ code: 'custom', message: 'a clean-restack policy enables at least one step' })
|
|
151
|
+
})
|
|
152
|
+
export type CleanRestackPolicy = z.infer<typeof cleanRestackPolicySchema>
|
|
153
|
+
|
|
154
|
+
/** A leaf restack intent and the facts recorded from it. Only an
|
|
155
|
+
* awaiting-landing intent may carry a frozen clean-restack policy. */
|
|
156
|
+
const leafRestackIntentShape = leafRestackSchema.extend({
|
|
157
|
+
headSha: gitOid,
|
|
158
|
+
cleanRestackPolicy: cleanRestackPolicySchema.optional(),
|
|
159
|
+
})
|
|
160
|
+
function refineCleanRestackPolicy(
|
|
161
|
+
value: { trigger: string; cleanRestackPolicy?: CleanRestackPolicy },
|
|
162
|
+
ctx: z.core.$RefinementCtx,
|
|
163
|
+
): void {
|
|
164
|
+
if (value.cleanRestackPolicy !== undefined && value.trigger !== 'awaiting-landing')
|
|
165
|
+
ctx.addIssue({
|
|
166
|
+
code: 'custom',
|
|
167
|
+
path: ['cleanRestackPolicy'],
|
|
168
|
+
message: 'a clean-restack policy belongs only to an awaiting-landing restack',
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
const leafRestackIntentSchema = leafRestackIntentShape.superRefine(refineCleanRestackPolicy)
|
|
172
|
+
|
|
125
173
|
const archiveEntry = z.strictObject({
|
|
126
174
|
ref: z.string().startsWith('refs/autobuild/archive/'),
|
|
127
175
|
sha: gitOid,
|
|
@@ -447,7 +495,7 @@ const verifyCompletedPayloadSchema = z.union([
|
|
|
447
495
|
z.strictObject({
|
|
448
496
|
...verifyCompletionBase,
|
|
449
497
|
outcome: z.literal('skipped'),
|
|
450
|
-
skipCause: z.
|
|
498
|
+
skipCause: z.enum(['post-reconcile-policy', 'clean-restack-policy']).optional(),
|
|
451
499
|
reason: z.string().trim().min(1, 'a skipped verification requires a non-blank reason'),
|
|
452
500
|
}),
|
|
453
501
|
]),
|
|
@@ -949,9 +997,12 @@ export const eventPayloadSchemas = {
|
|
|
949
997
|
* later relabelling never changes it. Omitted for builds without a
|
|
950
998
|
* profile and in historical logs. */
|
|
951
999
|
profile: z.string().min(1).optional(),
|
|
952
|
-
/** The
|
|
1000
|
+
/** The build's level when urgent, frozen at claim. Omitted otherwise and
|
|
953
1001
|
* in historical logs; `build.priority-set` changes it later. */
|
|
954
1002
|
priority: z.literal('urgent').optional(),
|
|
1003
|
+
/** The build's level when high or low (#1354); omitted otherwise and in
|
|
1004
|
+
* historical logs. An older reader drops it and reads normal. */
|
|
1005
|
+
level: z.enum(['high', 'low']).optional(),
|
|
955
1006
|
}),
|
|
956
1007
|
'node.opening': z.strictObject({
|
|
957
1008
|
branch: z.string().min(1),
|
|
@@ -1482,7 +1533,7 @@ export const eventPayloadSchemas = {
|
|
|
1482
1533
|
operation: z.literal('restack'),
|
|
1483
1534
|
branch: z.string().min(1),
|
|
1484
1535
|
sha: gitOid,
|
|
1485
|
-
rewrite:
|
|
1536
|
+
rewrite: leafRestackIntentSchema,
|
|
1486
1537
|
}),
|
|
1487
1538
|
z.strictObject({
|
|
1488
1539
|
operation: z.literal('implement'),
|
|
@@ -1667,8 +1718,13 @@ export const eventPayloadSchemas = {
|
|
|
1667
1718
|
/** Why the operator held the merge; absent on historical and reasonless holds. */
|
|
1668
1719
|
reason: z.string().min(1).max(CONTROL_REASON_LIMIT).optional(),
|
|
1669
1720
|
}),
|
|
1670
|
-
/** An operator changed the build's slot-admission
|
|
1671
|
-
|
|
1721
|
+
/** An operator changed the build's slot-admission level. `priority` keeps
|
|
1722
|
+
* its two-level domain (high and low write `normal`); `level` refines it
|
|
1723
|
+
* (#1354), and an older reader drops it and reads normal. */
|
|
1724
|
+
'build.priority-set': z.strictObject({
|
|
1725
|
+
priority: z.enum(['urgent', 'normal']),
|
|
1726
|
+
level: z.enum(['high', 'low']).optional(),
|
|
1727
|
+
}),
|
|
1672
1728
|
'build.land-requested': z.strictObject({
|
|
1673
1729
|
decisionSeq: z.number().int().positive(),
|
|
1674
1730
|
}),
|
|
@@ -2174,18 +2230,19 @@ export const eventPayloadSchemas = {
|
|
|
2174
2230
|
'restack.regenerated': z
|
|
2175
2231
|
.strictObject({ id: z.string().min(1), ...regenerationShape })
|
|
2176
2232
|
.superRefine(refineRegeneration),
|
|
2177
|
-
'restack.publish-intended':
|
|
2178
|
-
'restack.rewritten':
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2233
|
+
'restack.publish-intended': leafRestackIntentSchema,
|
|
2234
|
+
'restack.rewritten': leafRestackIntentShape
|
|
2235
|
+
.extend({
|
|
2236
|
+
archives: z.array(archiveEntry),
|
|
2237
|
+
observedHead: gitOid.nullable().optional(),
|
|
2238
|
+
})
|
|
2239
|
+
.superRefine(refineCleanRestackPolicy),
|
|
2183
2240
|
'restack.contended': z.strictObject({
|
|
2184
2241
|
id: z.string().min(1),
|
|
2185
2242
|
request: z.number().int().positive(),
|
|
2186
2243
|
actual: gitOid.nullable(),
|
|
2187
2244
|
}),
|
|
2188
|
-
'restack.completed':
|
|
2245
|
+
'restack.completed': leafRestackIntentSchema,
|
|
2189
2246
|
/** A pre-publication wait-resume fast-forward: the local branch had no
|
|
2190
2247
|
* commits beyond `from` and nothing was published, so it now points at
|
|
2191
2248
|
* the target snapshot `to`. No remote write happened. */
|
|
@@ -2420,9 +2477,12 @@ export interface NormalizedVerifyCompletion {
|
|
|
2420
2477
|
outcome: VerifyOutcome
|
|
2421
2478
|
report?: ArtifactRef
|
|
2422
2479
|
reason?: string
|
|
2423
|
-
skipCause?:
|
|
2480
|
+
skipCause?: VerifySkipCause
|
|
2424
2481
|
}
|
|
2425
2482
|
|
|
2483
|
+
/** Why a verify step was durably skipped by a frozen policy. */
|
|
2484
|
+
export type VerifySkipCause = 'post-reconcile-policy' | 'clean-restack-policy'
|
|
2485
|
+
|
|
2426
2486
|
/**
|
|
2427
2487
|
* Normalize exactly once at each event-consumer boundary. Legacy booleans keep
|
|
2428
2488
|
* their historical meaning; `skipped` is never represented as either boolean.
|
|
@@ -516,6 +516,12 @@ export const dispatcherStatusEventPayloadSchemas = {
|
|
|
516
516
|
/** Urgent non-node ready tickets that passed every intake gate except
|
|
517
517
|
* capacity in this admission scan; omitted when none. */
|
|
518
518
|
urgentWaiting: z.number().int().positive().optional(),
|
|
519
|
+
/** High non-node ready tickets that passed every intake gate except
|
|
520
|
+
* capacity, counted only while lower-level work waits; omitted when none. */
|
|
521
|
+
highWaiting: z.number().int().positive().optional(),
|
|
522
|
+
/** Normal non-node ready tickets that passed every intake gate except
|
|
523
|
+
* capacity, counted only while low work waits; omitted when none. */
|
|
524
|
+
normalWaiting: z.number().int().positive().optional(),
|
|
519
525
|
}),
|
|
520
526
|
/** A terminal frontend follows exactly one run. The referenced artifact is
|
|
521
527
|
* the composed Config the kernel is actually using, never an on-disk guess. */
|
|
@@ -1011,10 +1017,13 @@ export const ticketStartOutcomeSchema = z.enum([
|
|
|
1011
1017
|
])
|
|
1012
1018
|
export type TicketStartOutcome = z.infer<typeof ticketStartOutcomeSchema>
|
|
1013
1019
|
|
|
1014
|
-
/** A start request's slot-admission tier (SPEC §12). `manual` is
|
|
1015
|
-
* admission-only: a
|
|
1016
|
-
*
|
|
1020
|
+
/** A start request's persisted slot-admission tier (SPEC §12). `manual` is
|
|
1021
|
+
* admission-only: a build started by a manual request takes its ticket's
|
|
1022
|
+
* level, by any other request the request's. High and low tiers persist as
|
|
1023
|
+
* `normal` refined by the event's `level` key (#1354), so an older reader
|
|
1024
|
+
* sees a normal start. */
|
|
1017
1025
|
export const ticketStartPrioritySchema = z.enum(['manual', 'urgent', 'normal'])
|
|
1026
|
+
const startLevel = z.enum(['high', 'low']).optional()
|
|
1018
1027
|
export type TicketStartPriority = z.infer<typeof ticketStartPrioritySchema>
|
|
1019
1028
|
|
|
1020
1029
|
const startRequest = z.number().int().positive()
|
|
@@ -1030,6 +1039,7 @@ export const ticketStartEventPayloadSchemas = {
|
|
|
1030
1039
|
'ticket.start-requested': z.strictObject({
|
|
1031
1040
|
ticket: ticketRefSchema,
|
|
1032
1041
|
priority: ticketStartPrioritySchema,
|
|
1042
|
+
level: startLevel,
|
|
1033
1043
|
}),
|
|
1034
1044
|
'ticket.start-cancelled': z.strictObject({ request: startRequest, ticket: ticketRefSchema }),
|
|
1035
1045
|
'ticket.start-settled': z
|
|
@@ -1037,6 +1047,7 @@ export const ticketStartEventPayloadSchemas = {
|
|
|
1037
1047
|
request: startRequest,
|
|
1038
1048
|
ticket: ticketRefSchema,
|
|
1039
1049
|
priority: ticketStartPrioritySchema,
|
|
1050
|
+
level: startLevel,
|
|
1040
1051
|
outcome: ticketStartOutcomeSchema,
|
|
1041
1052
|
slug: z.string().min(1).optional(),
|
|
1042
1053
|
detail: nonblank.max(2000).optional(),
|
|
@@ -10233,6 +10233,33 @@
|
|
|
10233
10233
|
"$.terminal: object",
|
|
10234
10234
|
"$: object"
|
|
10235
10235
|
],
|
|
10236
|
+
"doneEscalationEntry": [
|
|
10237
|
+
"$.cancelled.[\"unit\",1]: boolean",
|
|
10238
|
+
"$.cancelled: object",
|
|
10239
|
+
"$.completed.[\"types\",1]: boolean",
|
|
10240
|
+
"$.completed.[\"types\",2]: boolean",
|
|
10241
|
+
"$.completed.[\"types\",3]: boolean",
|
|
10242
|
+
"$.completed.[\"unit\",1]: boolean",
|
|
10243
|
+
"$.completed.[\"unit\",3]: boolean",
|
|
10244
|
+
"$.completed: object",
|
|
10245
|
+
"$.kind: string",
|
|
10246
|
+
"$.members.[\"types\",1]: boolean",
|
|
10247
|
+
"$.members.[\"types\",2]: boolean",
|
|
10248
|
+
"$.members.[\"types\",3]: boolean",
|
|
10249
|
+
"$.members.[\"unit\",1]: boolean",
|
|
10250
|
+
"$.members.[\"unit\",2]: boolean",
|
|
10251
|
+
"$.members.[\"unit\",3]: boolean",
|
|
10252
|
+
"$.members: object",
|
|
10253
|
+
"$.open: array",
|
|
10254
|
+
"$.open[].id: string",
|
|
10255
|
+
"$.open[].janitor: boolean",
|
|
10256
|
+
"$.open[].session: string",
|
|
10257
|
+
"$.open[]: object",
|
|
10258
|
+
"$.owners.s_stage: string",
|
|
10259
|
+
"$.owners: object",
|
|
10260
|
+
"$.terminal: string",
|
|
10261
|
+
"$: object"
|
|
10262
|
+
],
|
|
10236
10263
|
"autoMergeDefault": [
|
|
10237
10264
|
"$.latest.actor.kind: string",
|
|
10238
10265
|
"$.latest.actor.user: string",
|