@defrex/autobuild 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +423 -57
- package/docs/agent-runtimes.md +1 -1
- package/docs/answering-blocked-builds.md +44 -3
- package/docs/architecture.md +124 -29
- package/docs/cli.md +1 -0
- package/docs/configuration-overview.md +11 -1
- package/docs/configuration.md +334 -14
- package/docs/dispatcher.md +1 -1
- package/docs/forges.md +1 -0
- package/docs/integration-overview.md +2 -2
- package/docs/integration-tree.md +7 -4
- package/docs/merge-policy.md +78 -6
- package/docs/migration-1.0.md +4 -2
- package/docs/operating.md +3 -2
- package/docs/operator-api.md +45 -13
- package/docs/operator-surfaces.md +16 -3
- package/docs/plugin-authoring.md +45 -7
- package/docs/remote-store-protocol.md +28 -7
- package/docs/restacking.md +35 -11
- package/docs/ticket-dependencies.md +9 -4
- package/docs/ticket-sources.md +34 -6
- package/docs/tickets.md +7 -1
- package/docs/troubleshooting.md +1 -1
- package/docs/workspaces.md +1 -1
- package/package.json +3 -3
- package/packages/core/src/cli/attention.ts +2 -0
- package/packages/core/src/cli/binary-direct.ts +1 -0
- package/packages/core/src/cli/build-control.ts +65 -7
- package/packages/core/src/cli/context.ts +55 -14
- package/packages/core/src/cli/dashboard/actions.ts +13 -4
- package/packages/core/src/cli/dashboard/landing-display.ts +32 -8
- package/packages/core/src/cli/dashboard/model.ts +61 -8
- package/packages/core/src/cli/dashboard/render.ts +28 -3
- package/packages/core/src/cli/dashboard/tree.ts +9 -1
- package/packages/core/src/cli/dispatch-frontend.ts +10 -14
- package/packages/core/src/cli/dispatch-preflight.ts +1 -0
- package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
- package/packages/core/src/cli/dispatch.ts +9 -3
- package/packages/core/src/cli/help.ts +80 -11
- package/packages/core/src/cli/init-validation.ts +14 -1
- package/packages/core/src/cli/landings.ts +1 -1
- package/packages/core/src/cli/main.ts +60 -9
- package/packages/core/src/cli/publication-settlement.ts +10 -0
- package/packages/core/src/cli/repository-status.ts +37 -2
- package/packages/core/src/cli/status.ts +186 -12
- package/packages/core/src/cli/terminals.ts +197 -4
- package/packages/core/src/cli/ticket.ts +22 -4
- package/packages/core/src/cli/wait.ts +1 -0
- package/packages/core/src/cli/watch.ts +73 -0
- package/packages/core/src/config/landing.ts +12 -0
- package/packages/core/src/config/live.ts +4 -0
- package/packages/core/src/config/path-selectors.ts +68 -0
- package/packages/core/src/config/profiles.ts +96 -0
- package/packages/core/src/config/ready-assignee.ts +43 -11
- package/packages/core/src/config/roles.ts +33 -10
- package/packages/core/src/config/schema.ts +205 -81
- package/packages/core/src/events/catalog.ts +17 -3
- package/packages/core/src/events/compatibility.ts +4 -1
- package/packages/core/src/events/forge-degradation-policy.ts +16 -2
- package/packages/core/src/events/head-paths-limits.ts +25 -0
- package/packages/core/src/events/payloads.ts +323 -20
- package/packages/core/src/events/policy.ts +22 -0
- package/packages/core/src/events/repository.ts +47 -1
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +320 -130
- package/packages/core/src/kernel/build-creation.ts +29 -0
- package/packages/core/src/kernel/consent-revocation.ts +72 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +19 -8
- package/packages/core/src/kernel/engine.ts +48 -8
- package/packages/core/src/kernel/forge-health.ts +47 -0
- package/packages/core/src/kernel/guarded-forge.ts +76 -18
- package/packages/core/src/kernel/head-paths-state.ts +63 -0
- package/packages/core/src/kernel/head-paths.ts +401 -0
- package/packages/core/src/kernel/landing-policy-identity.ts +20 -0
- package/packages/core/src/kernel/landing-policy.ts +55 -2
- package/packages/core/src/kernel/landing-readiness.ts +104 -9
- package/packages/core/src/kernel/landing-state.ts +44 -4
- package/packages/core/src/kernel/leaf-restack-state.ts +50 -2
- package/packages/core/src/kernel/log-index.ts +27 -1
- package/packages/core/src/kernel/node-parent.ts +2 -0
- package/packages/core/src/kernel/node-polling.ts +13 -3
- package/packages/core/src/kernel/node-restack-state.ts +8 -1
- package/packages/core/src/kernel/node-restack-transaction.ts +45 -0
- package/packages/core/src/kernel/read-deferrals.ts +3 -1
- package/packages/core/src/kernel/read-facts.ts +37 -2
- package/packages/core/src/kernel/reducer-registry.ts +22 -1
- package/packages/core/src/kernel/reducer.ts +332 -16
- package/packages/core/src/kernel/target-observation.ts +2 -5
- package/packages/core/src/kernel/terminal-guard.ts +52 -3
- package/packages/core/src/kernel/ticket-handbacks.ts +40 -0
- package/packages/core/src/kernel/ticket-preparation.ts +15 -1
- package/packages/core/src/kernel/ticket-wait.ts +345 -0
- package/packages/core/src/kernel/verify-applicability.ts +9 -19
- package/packages/core/src/ontology.ts +1 -0
- package/packages/core/src/operator/annotations.ts +6 -0
- package/packages/core/src/operator/index.ts +3 -0
- package/packages/core/src/operator/protocol.ts +25 -2
- package/packages/core/src/operator/query.ts +1 -1
- package/packages/core/src/operator/registry.ts +122 -10
- package/packages/core/src/operator/repository-events.ts +67 -0
- package/packages/core/src/operator/sandbox-host.ts +3 -0
- package/packages/core/src/operator/tickets.ts +15 -3
- package/packages/core/src/plugin-sdk/index.ts +4 -0
- package/packages/core/src/ports/forge/create.ts +6 -0
- package/packages/core/src/ports/forge/github-transport.ts +40 -3
- package/packages/core/src/ports/forge/github.ts +12 -1
- package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
- package/packages/core/src/ports/forge-failure.ts +31 -2
- package/packages/core/src/ports/runner/routing.ts +66 -5
- package/packages/core/src/ports/tickets/assignees.ts +54 -0
- package/packages/core/src/ports/tickets/contract.ts +164 -4
- package/packages/core/src/ports/tickets/create.ts +17 -3
- package/packages/core/src/ports/tickets/fake.ts +5 -0
- package/packages/core/src/ports/tickets/github-fake.ts +18 -2
- package/packages/core/src/ports/tickets/github.ts +247 -29
- package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
- package/packages/core/src/ports/tickets/operations.ts +6 -1
- package/packages/core/src/ports/tickets/tree.ts +12 -2
- package/packages/core/src/ports/tickets/update.ts +6 -2
- package/packages/core/src/ports/types.ts +36 -5
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +9 -0
- package/packages/core/src/processes/build-child.ts +28 -7
- package/packages/core/src/processes/build-execution-state.ts +34 -2
- package/packages/core/src/processes/build-runner.ts +165 -19
- package/packages/core/src/processes/dispatcher.ts +837 -115
- package/packages/core/src/processes/execution-no-progress.ts +22 -2
- package/packages/core/src/processes/harvest-child.ts +4 -0
- package/packages/core/src/processes/harvest-runner.ts +5 -0
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/publication-state.ts +6 -1
- package/packages/core/src/processes/repo-view.ts +2 -0
- package/packages/core/src/scenarios/harness.ts +15 -1
- package/packages/core/src/store/digest.ts +41 -2
- package/packages/core/src/store/reduced-reads.ts +4 -1
- package/packages/core/src/store/reducer-value-shapes.json +10310 -8441
- package/packages/core/src/store/remote/client.ts +49 -10
- package/packages/core/src/store/remote/index.ts +4 -0
- package/packages/core/src/store/remote/protocol.ts +18 -1
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
- package/packages/core/src/store/remote/released-reducer-values/1.8.0.json +29043 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
- package/packages/core/src/store/repo-state-events.ts +3 -0
- package/packages/core/src/store/types.ts +27 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/reduced-read-budget.ts +419 -9
- package/skills/code-review/SKILL.md +8 -0
- package/skills/finalize/SKILL.md +4 -0
- package/skills/guide/SKILL.md +241 -47
- package/skills/guide/references/integration-tree.md +7 -4
- package/skills/guide/references/merge-policy.md +78 -6
- package/skills/guide/references/migration-1.0.md +4 -2
- package/skills/guide/references/operator-api.md +45 -13
- package/skills/guide/references/plugin-authoring.md +45 -7
- package/skills/guide/references/remote-store-protocol.md +28 -7
- package/skills/guide/references/restacking.md +35 -11
- package/skills/guide/references/ticket-dependencies.md +9 -4
- package/skills/implement/SKILL.md +15 -1
- package/skills/operate/SKILL.md +133 -16
- package/skills/plan/SKILL.md +17 -2
- package/skills/plan-review/SKILL.md +8 -0
- package/skills/reconcile/SKILL.md +21 -5
- package/skills/tickets/SKILL.md +23 -6
- package/templates/hosted-service/package.json +2 -2
|
@@ -17,6 +17,12 @@ import { nativeSessionHandleSchema } from './native-session'
|
|
|
17
17
|
import { z } from 'zod'
|
|
18
18
|
import { landingRuleSchema } from '../config/landing'
|
|
19
19
|
import { refineUniqueIssues } from '../ports/tickets/issue-links'
|
|
20
|
+
import {
|
|
21
|
+
HEAD_PATHS_ARTIFACT,
|
|
22
|
+
HEAD_PATHS_PREVIEW,
|
|
23
|
+
HEAD_PATHS_SOURCES,
|
|
24
|
+
LANDING_MATCHED_PATHS_PREVIEW,
|
|
25
|
+
} from './head-paths-limits'
|
|
20
26
|
import {
|
|
21
27
|
artifactRefSchema,
|
|
22
28
|
buildOutcomeSchema,
|
|
@@ -40,6 +46,36 @@ import {
|
|
|
40
46
|
type VerifyOutcome,
|
|
41
47
|
} from '../ontology'
|
|
42
48
|
|
|
49
|
+
/** Most tickets one wait may name. */
|
|
50
|
+
export const WAIT_TICKET_LIMIT = 20
|
|
51
|
+
/** Ticket ids an agent declares a wait on: 1..20 trimmed, nonblank, unique. */
|
|
52
|
+
export const waitTicketIdsSchema = z
|
|
53
|
+
.array(z.string().trim().min(1))
|
|
54
|
+
.min(1)
|
|
55
|
+
.max(WAIT_TICKET_LIMIT)
|
|
56
|
+
.superRefine((ids, ctx) => {
|
|
57
|
+
const seen = new Set<string>()
|
|
58
|
+
for (const [index, id] of ids.entries()) {
|
|
59
|
+
if (seen.has(id))
|
|
60
|
+
ctx.addIssue({ code: 'custom', path: [index], message: `duplicate ticket id "${id}"` })
|
|
61
|
+
seen.add(id)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
export const waitRefusalCauseSchema = z.enum([
|
|
65
|
+
'unknown-ticket',
|
|
66
|
+
'own-ticket',
|
|
67
|
+
'completed',
|
|
68
|
+
'no-source-ticket',
|
|
69
|
+
'publication-lost',
|
|
70
|
+
])
|
|
71
|
+
export type WaitRefusalCause = z.infer<typeof waitRefusalCauseSchema>
|
|
72
|
+
export const waitEndCauseSchema = z.enum(['operator', 'automatic'])
|
|
73
|
+
export type WaitEndCause = z.infer<typeof waitEndCauseSchema>
|
|
74
|
+
/** How a reduced ticket wait ended: a `wait.ended` cause, or `unresolvable`
|
|
75
|
+
* when the dispatcher raised `policy/wait-unresolvable` because a waited
|
|
76
|
+
* ticket was rejected or deleted. Reduced-only: no event payload carries it. */
|
|
77
|
+
export type ReducedWaitEndCause = WaitEndCause | 'unresolvable'
|
|
78
|
+
|
|
43
79
|
export const gitOid = z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/)
|
|
44
80
|
const targetLineageSchema = z
|
|
45
81
|
.array(
|
|
@@ -47,7 +83,13 @@ const targetLineageSchema = z
|
|
|
47
83
|
node: z.string().min(1),
|
|
48
84
|
from: gitOid,
|
|
49
85
|
receipts: z
|
|
50
|
-
.array(
|
|
86
|
+
.array(
|
|
87
|
+
z.strictObject({
|
|
88
|
+
id: z.string().min(1),
|
|
89
|
+
previous: gitOid,
|
|
90
|
+
head: gitOid,
|
|
91
|
+
}),
|
|
92
|
+
)
|
|
51
93
|
.min(1)
|
|
52
94
|
.max(64),
|
|
53
95
|
}),
|
|
@@ -67,7 +109,7 @@ export const reconcileTransactionSchema = z.strictObject({
|
|
|
67
109
|
localBranchHead: gitOid,
|
|
68
110
|
})
|
|
69
111
|
export const leafRestackSchema = reconcileTransactionSchema.omit({ attempt: true }).extend({
|
|
70
|
-
trigger: z.enum(['verify-entry', 'awaiting-landing']),
|
|
112
|
+
trigger: z.enum(['verify-entry', 'awaiting-landing', 'wait-resume']),
|
|
71
113
|
cycle: z.number().int().nonnegative(),
|
|
72
114
|
observation: z.number().int().positive(),
|
|
73
115
|
message: z.string().min(1),
|
|
@@ -82,6 +124,37 @@ export const landingCandidateSchema = z.strictObject({
|
|
|
82
124
|
parent: z.string().min(1),
|
|
83
125
|
cycle: z.string().min(1),
|
|
84
126
|
})
|
|
127
|
+
/** A bounded path summary: the exact count plus the sorted, unique first
|
|
128
|
+
* `max` paths. The complete set lives in the `head-paths` artifact. */
|
|
129
|
+
function pathPreview(max: number) {
|
|
130
|
+
return z
|
|
131
|
+
.strictObject({
|
|
132
|
+
total: z.number().int().nonnegative(),
|
|
133
|
+
preview: z.array(z.string().min(1)).max(max),
|
|
134
|
+
})
|
|
135
|
+
.superRefine(({ total, preview }, ctx) => {
|
|
136
|
+
if (preview.length !== Math.min(total, max))
|
|
137
|
+
ctx.addIssue({
|
|
138
|
+
code: 'custom',
|
|
139
|
+
path: ['preview'],
|
|
140
|
+
message: `preview must hold exactly min(total, ${max}) paths`,
|
|
141
|
+
})
|
|
142
|
+
for (let index = 1; index < preview.length; index++)
|
|
143
|
+
if (!(preview[index - 1]! < preview[index]!)) {
|
|
144
|
+
ctx.addIssue({
|
|
145
|
+
code: 'custom',
|
|
146
|
+
path: ['preview', index],
|
|
147
|
+
message: 'preview paths must be sorted and unique',
|
|
148
|
+
})
|
|
149
|
+
break
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const landingRuleRef = z.strictObject({
|
|
155
|
+
index: z.number().int().nonnegative(),
|
|
156
|
+
snapshot: landingRuleSchema,
|
|
157
|
+
})
|
|
85
158
|
const landingDecision = z.strictObject({
|
|
86
159
|
candidate: landingCandidateSchema,
|
|
87
160
|
from: z.enum(['leaf', 'node']),
|
|
@@ -91,10 +164,33 @@ const landingDecision = z.strictObject({
|
|
|
91
164
|
]),
|
|
92
165
|
labels: z.array(z.string()),
|
|
93
166
|
mode: z.enum(['auto', 'consent']),
|
|
94
|
-
rule: z.union([
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
167
|
+
rule: z.union([landingRuleRef, z.strictObject({ default: z.literal(true) })]),
|
|
168
|
+
/** Path-predicate rules only: the changed paths the rule's selectors
|
|
169
|
+
* matched, sorted, the first `LANDING_MATCHED_PATHS_PREVIEW` plus a total. */
|
|
170
|
+
paths: pathPreview(LANDING_MATCHED_PATHS_PREVIEW).optional(),
|
|
171
|
+
})
|
|
172
|
+
/** A landing decision the dispatcher could not make yet: evaluation reached a
|
|
173
|
+
* path-predicate rule and the candidate head's changed paths are not
|
|
174
|
+
* recorded. `policy` is the evaluated `[[merge]]` rules' identity, so an
|
|
175
|
+
* edited policy re-evaluates once. Never treated as an empty change. */
|
|
176
|
+
const landingDeferred = z.strictObject({
|
|
177
|
+
candidate: landingCandidateSchema,
|
|
178
|
+
reason: z.enum(['paths-unrecorded']),
|
|
179
|
+
rule: landingRuleRef,
|
|
180
|
+
policy: z.string().min(1),
|
|
181
|
+
})
|
|
182
|
+
/** Consent given under a path-predicate rule, revoked because a reconcile's
|
|
183
|
+
* own edits touched files those predicates match. `paths` holds the matched
|
|
184
|
+
* resolution paths: sorted, the first `LANDING_MATCHED_PATHS_PREVIEW` plus a
|
|
185
|
+
* total. */
|
|
186
|
+
const landingConsentRevoked = z.strictObject({
|
|
187
|
+
commandSeq: z.number().int().positive(),
|
|
188
|
+
source: z.enum(['reconcile', 'node-rewrite']),
|
|
189
|
+
rule: landingRuleRef,
|
|
190
|
+
previousHead: z.string().min(1),
|
|
191
|
+
head: z.string().min(1),
|
|
192
|
+
consentedHead: z.string().min(1).optional(),
|
|
193
|
+
paths: pathPreview(LANDING_MATCHED_PATHS_PREVIEW),
|
|
98
194
|
})
|
|
99
195
|
const nodeParent = z.strictObject({
|
|
100
196
|
target: z.strictObject({ ticket: ticketRefSchema, build: z.string().min(1) }).nullable(),
|
|
@@ -107,8 +203,59 @@ const parentChange = z.strictObject({
|
|
|
107
203
|
revision: z.string(),
|
|
108
204
|
})
|
|
109
205
|
|
|
206
|
+
const headPathsPreview = pathPreview(HEAD_PATHS_PREVIEW)
|
|
207
|
+
const headPathsRecorded = z
|
|
208
|
+
.strictObject({
|
|
209
|
+
source: z.enum(HEAD_PATHS_SOURCES),
|
|
210
|
+
// Plain commit names, like the node and integration heads they describe.
|
|
211
|
+
head: z.string().min(1),
|
|
212
|
+
destination: z.string().min(1),
|
|
213
|
+
mergeBase: z.string().min(1),
|
|
214
|
+
total: z.number().int().nonnegative(),
|
|
215
|
+
preview: z.array(z.string().min(1)).max(HEAD_PATHS_PREVIEW),
|
|
216
|
+
/** Reconcile-produced heads only: the paths the resolution itself edited. */
|
|
217
|
+
resolution: headPathsPreview.optional(),
|
|
218
|
+
artifact: z.strictObject({
|
|
219
|
+
kind: z.literal(HEAD_PATHS_ARTIFACT),
|
|
220
|
+
rev: z.number().int().nonnegative(),
|
|
221
|
+
}),
|
|
222
|
+
})
|
|
223
|
+
.superRefine((payload, ctx) => {
|
|
224
|
+
const summary = headPathsPreview.safeParse({
|
|
225
|
+
total: payload.total,
|
|
226
|
+
preview: payload.preview,
|
|
227
|
+
})
|
|
228
|
+
for (const issue of summary.error?.issues ?? [])
|
|
229
|
+
ctx.addIssue({
|
|
230
|
+
code: 'custom',
|
|
231
|
+
path: issue.path,
|
|
232
|
+
message: issue.message,
|
|
233
|
+
})
|
|
234
|
+
})
|
|
235
|
+
|
|
110
236
|
const empty = z.strictObject({})
|
|
111
237
|
const reasonOnly = z.strictObject({ reason: z.string().optional() })
|
|
238
|
+
/** Where an abort hands the build's ticket back. Triage is the default. */
|
|
239
|
+
export const abortDestinationSchema = z.enum(['triage', 'ready'])
|
|
240
|
+
export type AbortDestination = z.infer<typeof abortDestinationSchema>
|
|
241
|
+
/** Why a dispatcher returned a claimed or ready ticket other than as completion. */
|
|
242
|
+
export const handbackCauseSchema = z.enum([
|
|
243
|
+
'abort',
|
|
244
|
+
'spec-bounce',
|
|
245
|
+
'preparation-failed',
|
|
246
|
+
'pr-closed',
|
|
247
|
+
'discard',
|
|
248
|
+
])
|
|
249
|
+
export type HandbackCause = z.infer<typeof handbackCauseSchema>
|
|
250
|
+
/** What a hand-back report carries beyond its identity: the lifecycle role the
|
|
251
|
+
* ticket landed in, the role asked for when it differs, the operator's reason
|
|
252
|
+
* and the spec-standard parts that forced a fallback. */
|
|
253
|
+
export const handbackReport = {
|
|
254
|
+
role: abortDestinationSchema,
|
|
255
|
+
requested: abortDestinationSchema.optional(),
|
|
256
|
+
reason: z.string().min(1).max(2000).optional(),
|
|
257
|
+
missing: z.array(z.string().min(1)).min(1).optional(),
|
|
258
|
+
}
|
|
112
259
|
/** Fan-out provenance shared by the auto-merge command facts: the repository
|
|
113
260
|
* seq of the `dispatcher.auto-merge-default-set` fact that caused the command,
|
|
114
261
|
* when one did. Per-build commands omit it. `{}` stays valid, so existing
|
|
@@ -347,6 +494,10 @@ export const eventPayloadSchemas = {
|
|
|
347
494
|
)
|
|
348
495
|
.superRefine(refineUniqueIssues)
|
|
349
496
|
.optional(),
|
|
497
|
+
/** The `[profiles.<name>]` the ticket's labels selected, frozen at claim;
|
|
498
|
+
* later relabelling never changes it. Omitted for builds without a
|
|
499
|
+
* profile and in historical logs. */
|
|
500
|
+
profile: z.string().min(1).optional(),
|
|
350
501
|
}),
|
|
351
502
|
'node.opening': z.strictObject({
|
|
352
503
|
branch: z.string().min(1),
|
|
@@ -393,9 +544,15 @@ export const eventPayloadSchemas = {
|
|
|
393
544
|
}),
|
|
394
545
|
'node.parent-requested': parentChange,
|
|
395
546
|
'node.parent-accepted': parentChange,
|
|
396
|
-
'node.parent-pr-retargeted': z.strictObject({
|
|
547
|
+
'node.parent-pr-retargeted': z.strictObject({
|
|
548
|
+
id: z.string().min(1),
|
|
549
|
+
base: z.string().min(1),
|
|
550
|
+
}),
|
|
397
551
|
'node.parent-completed': z.strictObject({ id: z.string().min(1) }),
|
|
398
|
-
'node.parent-cancelled': z.strictObject({
|
|
552
|
+
'node.parent-cancelled': z.strictObject({
|
|
553
|
+
id: z.string().min(1),
|
|
554
|
+
reason: z.string(),
|
|
555
|
+
}),
|
|
399
556
|
'node.parent-rejection-cleared': z.strictObject({
|
|
400
557
|
revision: z.string(),
|
|
401
558
|
target: z.string().nullable(),
|
|
@@ -452,7 +609,10 @@ export const eventPayloadSchemas = {
|
|
|
452
609
|
index: z.number().int().nonnegative(),
|
|
453
610
|
base: z.string().min(1),
|
|
454
611
|
}),
|
|
455
|
-
'node.publish-intended': z.strictObject({
|
|
612
|
+
'node.publish-intended': z.strictObject({
|
|
613
|
+
id: z.string().min(1),
|
|
614
|
+
head: z.string().min(1),
|
|
615
|
+
}),
|
|
456
616
|
'node.rewritten': z.strictObject({
|
|
457
617
|
id: z.string().min(1),
|
|
458
618
|
previous: z.string().min(1),
|
|
@@ -492,7 +652,12 @@ export const eventPayloadSchemas = {
|
|
|
492
652
|
'node.issue-links-published': z.strictObject({
|
|
493
653
|
pr: z.number().int().positive(),
|
|
494
654
|
issueLinks: z
|
|
495
|
-
.array(
|
|
655
|
+
.array(
|
|
656
|
+
z.strictObject({
|
|
657
|
+
issue: issueNumber,
|
|
658
|
+
intent: z.enum(['closes', 'refs']),
|
|
659
|
+
}),
|
|
660
|
+
)
|
|
496
661
|
.superRefine(refineUniqueIssues),
|
|
497
662
|
}),
|
|
498
663
|
'node.inventory': z.strictObject({
|
|
@@ -502,7 +667,10 @@ export const eventPayloadSchemas = {
|
|
|
502
667
|
contributions: z.array(z.string()).optional(),
|
|
503
668
|
foreign: z.array(z.string()),
|
|
504
669
|
}),
|
|
505
|
-
'integration.abandoned': z.strictObject({
|
|
670
|
+
'integration.abandoned': z.strictObject({
|
|
671
|
+
id: z.string().min(1),
|
|
672
|
+
reason: z.string().min(1),
|
|
673
|
+
}),
|
|
506
674
|
'integration.observed': z.strictObject({
|
|
507
675
|
membershipSource: z.string().optional(),
|
|
508
676
|
openChildren: z.array(z.string()),
|
|
@@ -625,7 +793,12 @@ export const eventPayloadSchemas = {
|
|
|
625
793
|
/** Preserved branch heads not restored over the branch: already
|
|
626
794
|
* contained, or superseded by a recorded rewrite in the bounded record. */
|
|
627
795
|
restorationSkipped: z
|
|
628
|
-
.array(
|
|
796
|
+
.array(
|
|
797
|
+
z.strictObject({
|
|
798
|
+
sha: gitOid,
|
|
799
|
+
reason: z.enum(['contained', 'superseded']),
|
|
800
|
+
}),
|
|
801
|
+
)
|
|
629
802
|
.min(1)
|
|
630
803
|
.optional(),
|
|
631
804
|
}),
|
|
@@ -836,6 +1009,15 @@ export const eventPayloadSchemas = {
|
|
|
836
1009
|
sha: z.string().regex(/^[0-9a-f]{40,64}$/i),
|
|
837
1010
|
step: z.string().min(1),
|
|
838
1011
|
}),
|
|
1012
|
+
/** An implement session's commits, published before its ticket wait is
|
|
1013
|
+
* entered; `wait.published` with the same `id` completes it. */
|
|
1014
|
+
z.strictObject({
|
|
1015
|
+
operation: z.literal('wait'),
|
|
1016
|
+
id: z.string().min(1),
|
|
1017
|
+
branch: z.string().min(1),
|
|
1018
|
+
sha: gitOid,
|
|
1019
|
+
base: gitOid,
|
|
1020
|
+
}),
|
|
839
1021
|
]),
|
|
840
1022
|
/** Durable loss record: the dispatcher released (or is about to release) the
|
|
841
1023
|
* workspace while the referenced `publication.requested` (named by `request`,
|
|
@@ -856,7 +1038,7 @@ export const eventPayloadSchemas = {
|
|
|
856
1038
|
'publication.lost': z.strictObject({
|
|
857
1039
|
/** seq of the lost `publication.requested` event. */
|
|
858
1040
|
request: z.number().int().positive(),
|
|
859
|
-
operation: z.enum(['implement', 'reconcile', 'restack', 'finalize', 'finalize-step']),
|
|
1041
|
+
operation: z.enum(['implement', 'reconcile', 'restack', 'finalize', 'finalize-step', 'wait']),
|
|
860
1042
|
branch: z.string().min(1),
|
|
861
1043
|
sha: z.string().regex(/^[0-9a-f]{40,64}$/i),
|
|
862
1044
|
reason: z.string().trim().min(1),
|
|
@@ -868,6 +1050,20 @@ export const eventPayloadSchemas = {
|
|
|
868
1050
|
ticket: ticketRefSchema,
|
|
869
1051
|
state: z.string().min(1),
|
|
870
1052
|
label: z.string().min(1),
|
|
1053
|
+
// Optional so pre-destination checkpoints replay; a legacy checkpoint's
|
|
1054
|
+
// role derives from its state.
|
|
1055
|
+
role: handbackReport.role.optional(),
|
|
1056
|
+
requested: handbackReport.requested,
|
|
1057
|
+
reason: handbackReport.reason,
|
|
1058
|
+
missing: handbackReport.missing,
|
|
1059
|
+
}),
|
|
1060
|
+
/** Checkpoint for a non-abort build hand-back (closed PR, discard): the
|
|
1061
|
+
* ticket move and comment are committed and never repeated. */
|
|
1062
|
+
'build.ticket-returned': z.strictObject({
|
|
1063
|
+
ticket: ticketRefSchema,
|
|
1064
|
+
state: z.string().min(1),
|
|
1065
|
+
cause: z.enum(['pr-closed', 'discard']),
|
|
1066
|
+
role: abortDestinationSchema,
|
|
871
1067
|
}),
|
|
872
1068
|
/** A post-creation dispatch attempt stopped before runner attachment. */
|
|
873
1069
|
'dispatch.failed': z.strictObject({
|
|
@@ -881,7 +1077,10 @@ export const eventPayloadSchemas = {
|
|
|
881
1077
|
// ── Operator commands (D2: commands are events in the same log) ───────────
|
|
882
1078
|
'build.pause-requested': reasonOnly,
|
|
883
1079
|
'build.resume-requested': reasonOnly,
|
|
884
|
-
'build.abort-requested':
|
|
1080
|
+
'build.abort-requested': z.strictObject({
|
|
1081
|
+
reason: z.string().optional(),
|
|
1082
|
+
to: abortDestinationSchema.optional(),
|
|
1083
|
+
}),
|
|
885
1084
|
'build.discard-requested': empty,
|
|
886
1085
|
'build.janitor-attempt-failed': z.strictObject({
|
|
887
1086
|
firstFailureAt: z.iso.datetime(),
|
|
@@ -910,9 +1109,15 @@ export const eventPayloadSchemas = {
|
|
|
910
1109
|
after: z.iso.datetime(),
|
|
911
1110
|
}),
|
|
912
1111
|
'landing.decided': landingDecision,
|
|
1112
|
+
'landing.deferred': landingDeferred,
|
|
1113
|
+
'landing.consent-revoked': landingConsentRevoked,
|
|
913
1114
|
'build.hold-requested': empty,
|
|
914
|
-
'build.land-requested': z.strictObject({
|
|
915
|
-
|
|
1115
|
+
'build.land-requested': z.strictObject({
|
|
1116
|
+
decisionSeq: z.number().int().positive(),
|
|
1117
|
+
}),
|
|
1118
|
+
'landing.command-acknowledged': z.strictObject({
|
|
1119
|
+
commandSeq: z.number().int().positive(),
|
|
1120
|
+
}),
|
|
916
1121
|
'landing.native-enable-started': empty,
|
|
917
1122
|
'landing.forge-merged': z.strictObject({
|
|
918
1123
|
classification: z.enum(['human', 'possible-stale-enable']),
|
|
@@ -957,7 +1162,10 @@ export const eventPayloadSchemas = {
|
|
|
957
1162
|
}),
|
|
958
1163
|
z.strictObject({
|
|
959
1164
|
artifact: artifactRefSchema,
|
|
960
|
-
operator: z.strictObject({
|
|
1165
|
+
operator: z.strictObject({
|
|
1166
|
+
user: z.string().min(1),
|
|
1167
|
+
via: viaSchema.optional(),
|
|
1168
|
+
}),
|
|
961
1169
|
assets: z.array(pinnedAssetSchema).optional(),
|
|
962
1170
|
}),
|
|
963
1171
|
]),
|
|
@@ -995,6 +1203,10 @@ export const eventPayloadSchemas = {
|
|
|
995
1203
|
* continue, the interruption notice for a native resume. Absent on
|
|
996
1204
|
* historical events and when the runtime cannot report it. */
|
|
997
1205
|
prompt: z.string().min(1).optional(),
|
|
1206
|
+
/** The build's frozen profile and whether this session's configuration
|
|
1207
|
+
* still defined it. Present only for builds created with a profile; a
|
|
1208
|
+
* `configured: false` session resolved through the repository roles. */
|
|
1209
|
+
profile: z.strictObject({ name: z.string().min(1), configured: z.boolean() }).optional(),
|
|
998
1210
|
}),
|
|
999
1211
|
'session.suspended': z.strictObject({
|
|
1000
1212
|
session: z.string().min(1),
|
|
@@ -1154,7 +1366,10 @@ export const eventPayloadSchemas = {
|
|
|
1154
1366
|
headSha: gitOid.optional(),
|
|
1155
1367
|
restackId: z.string().min(1).optional(),
|
|
1156
1368
|
failed: z.array(
|
|
1157
|
-
z.strictObject({
|
|
1369
|
+
z.strictObject({
|
|
1370
|
+
step: z.string().min(1),
|
|
1371
|
+
report: artifactRefSchema.optional(),
|
|
1372
|
+
}),
|
|
1158
1373
|
),
|
|
1159
1374
|
cancelled: z.array(
|
|
1160
1375
|
z.strictObject({
|
|
@@ -1264,6 +1479,17 @@ export const eventPayloadSchemas = {
|
|
|
1264
1479
|
actual: gitOid.nullable(),
|
|
1265
1480
|
}),
|
|
1266
1481
|
'restack.completed': leafRestackSchema.extend({ headSha: gitOid }),
|
|
1482
|
+
/** A pre-publication wait-resume fast-forward: the local branch had no
|
|
1483
|
+
* commits beyond `from` and nothing was published, so it now points at
|
|
1484
|
+
* the target snapshot `to`. No remote write happened. */
|
|
1485
|
+
'restack.advanced': z.strictObject({
|
|
1486
|
+
trigger: z.literal('wait-resume'),
|
|
1487
|
+
cycle: z.number().int().nonnegative(),
|
|
1488
|
+
observation: z.number().int().positive(),
|
|
1489
|
+
branch: z.string().min(1),
|
|
1490
|
+
from: gitOid,
|
|
1491
|
+
to: gitOid,
|
|
1492
|
+
}),
|
|
1267
1493
|
'reconcile.started': z.strictObject({
|
|
1268
1494
|
attempt,
|
|
1269
1495
|
baseSha: z.string().min(1),
|
|
@@ -1292,11 +1518,33 @@ export const eventPayloadSchemas = {
|
|
|
1292
1518
|
conflicted: z.boolean(),
|
|
1293
1519
|
archives: z.array(archiveEntry),
|
|
1294
1520
|
}),
|
|
1521
|
+
/** The kernel abandoned an open reconcile occurrence with no publish
|
|
1522
|
+
* intent because its session declared a ticket wait and the target moved
|
|
1523
|
+
* before the build resumed. The workspace operation was aborted and nothing
|
|
1524
|
+
* was published; `restackId` names the automatic restack it also closes. */
|
|
1525
|
+
'reconcile.superseded': z.strictObject({
|
|
1526
|
+
attempt,
|
|
1527
|
+
cycle: z.number().int().nonnegative(),
|
|
1528
|
+
cause: z.literal('wait-resume'),
|
|
1529
|
+
restackId: z.string().min(1).optional(),
|
|
1530
|
+
}),
|
|
1295
1531
|
'reconcile.completed': z.union([
|
|
1296
|
-
z.strictObject({
|
|
1297
|
-
|
|
1532
|
+
z.strictObject({
|
|
1533
|
+
mergeCommit: z.string().min(1),
|
|
1534
|
+
artifact: artifactRefSchema,
|
|
1535
|
+
}),
|
|
1536
|
+
z.strictObject({
|
|
1537
|
+
headSha: gitOid,
|
|
1538
|
+
rewriteId: z.string().min(1),
|
|
1539
|
+
artifact: artifactRefSchema,
|
|
1540
|
+
}),
|
|
1298
1541
|
]),
|
|
1299
1542
|
|
|
1543
|
+
/** The paths a produced candidate head changes against its merge base with
|
|
1544
|
+
* the destination, recorded once per head before the write that establishes
|
|
1545
|
+
* it. A bounded summary; the complete sets are the `head-paths` artifact. */
|
|
1546
|
+
'head.paths-recorded': headPathsRecorded,
|
|
1547
|
+
|
|
1300
1548
|
// ── Cross-cutting ──────────────────────────────────────────────────────────
|
|
1301
1549
|
/** An agent found the build only partly resolves a linked `closes` issue.
|
|
1302
1550
|
* One-way: no fact can express an upgrade. Inert once links are sealed. */
|
|
@@ -1373,6 +1621,61 @@ export const eventPayloadSchemas = {
|
|
|
1373
1621
|
question: z.string().min(1),
|
|
1374
1622
|
refs: z.array(z.string()),
|
|
1375
1623
|
}),
|
|
1624
|
+
/** An agent's terminal declaring that its build waits on other tickets
|
|
1625
|
+
* (SPEC §11 "Ticket waits"). Advisory until the dispatcher validates it:
|
|
1626
|
+
* `wait.entered` or `wait.refused` with the same `id` answers it. */
|
|
1627
|
+
'wait.requested': z.strictObject({
|
|
1628
|
+
id: z.string().min(1),
|
|
1629
|
+
phase: phaseSchema,
|
|
1630
|
+
round,
|
|
1631
|
+
tickets: waitTicketIdsSchema,
|
|
1632
|
+
reason: z.string().trim().min(1),
|
|
1633
|
+
/** An implement session's unpublished commits at declaration. `published`:
|
|
1634
|
+
* the CLI already pushed `sha` (local workspace). `requested`: a
|
|
1635
|
+
* `publication.requested {operation: 'wait'}` with this id precedes this
|
|
1636
|
+
* event, and the dispatcher enters the wait only after `wait.published`. */
|
|
1637
|
+
publication: z
|
|
1638
|
+
.strictObject({
|
|
1639
|
+
branch: z.string().min(1),
|
|
1640
|
+
base: gitOid,
|
|
1641
|
+
sha: gitOid,
|
|
1642
|
+
settlement: z.enum(['published', 'requested']),
|
|
1643
|
+
})
|
|
1644
|
+
.optional(),
|
|
1645
|
+
}),
|
|
1646
|
+
/** The dispatcher published a wait's requested commits. */
|
|
1647
|
+
'wait.published': z.strictObject({ id: z.string().min(1), sha: gitOid }),
|
|
1648
|
+
/** The dispatcher refused a ticket wait. Nothing was written to the ticket
|
|
1649
|
+
* and no wait began; the declaring phase re-runs with `message` as its
|
|
1650
|
+
* guidance. `tickets` names the offending ids. */
|
|
1651
|
+
'wait.refused': z.strictObject({
|
|
1652
|
+
id: z.string().min(1),
|
|
1653
|
+
cause: waitRefusalCauseSchema,
|
|
1654
|
+
tickets: z.array(z.string().min(1)),
|
|
1655
|
+
message: z.string().trim().min(1),
|
|
1656
|
+
}),
|
|
1657
|
+
/** Entering a ticket wait. The source ticket's `blockedBy` already lists
|
|
1658
|
+
* every ticket; `escalation` identifies the wait's escalation, which an
|
|
1659
|
+
* operator answers to end the wait early. The dispatcher ends it with
|
|
1660
|
+
* `wait.ended {cause: automatic}` once every ticket completes, or raises
|
|
1661
|
+
* `policy/wait-unresolvable` when one is rejected or deleted. A waiting
|
|
1662
|
+
* leaf holds no slot. */
|
|
1663
|
+
'wait.entered': z.strictObject({
|
|
1664
|
+
id: z.string().min(1),
|
|
1665
|
+
escalation: z.string().min(1),
|
|
1666
|
+
tickets: z.array(ticketRefSchema).min(1).max(WAIT_TICKET_LIMIT),
|
|
1667
|
+
reason: z.string().trim().min(1),
|
|
1668
|
+
question: z.string().min(1),
|
|
1669
|
+
}),
|
|
1670
|
+
/** A ticket wait ended without an operator answer: `automatic`, written by
|
|
1671
|
+
* the dispatcher on the first tick after every waited ticket completed;
|
|
1672
|
+
* `operator` from an operator surface that ends the wait without
|
|
1673
|
+
* answering. An answer to the wait's escalation also ends it. */
|
|
1674
|
+
'wait.ended': z.strictObject({
|
|
1675
|
+
id: z.string().min(1),
|
|
1676
|
+
cause: waitEndCauseSchema,
|
|
1677
|
+
message: z.string().trim().min(1),
|
|
1678
|
+
}),
|
|
1376
1679
|
'phase.failed': z.strictObject({
|
|
1377
1680
|
phase: phaseSchema,
|
|
1378
1681
|
round: round.optional(),
|
|
@@ -17,6 +17,10 @@ export const buildEventPolicy = {
|
|
|
17
17
|
'build.janitor-escalated': 'decisive',
|
|
18
18
|
'landing.application-failed': 'decisive',
|
|
19
19
|
'landing.decided': 'decisive',
|
|
20
|
+
// A reader that ignores a deferral only evaluates the candidate again.
|
|
21
|
+
'landing.deferred': 'advisory',
|
|
22
|
+
// Decisive: a reader that ignored it would merge on revoked consent.
|
|
23
|
+
'landing.consent-revoked': 'decisive',
|
|
20
24
|
'build.hold-requested': 'decisive',
|
|
21
25
|
'build.land-requested': 'decisive',
|
|
22
26
|
'landing.command-acknowledged': 'decisive',
|
|
@@ -28,12 +32,20 @@ export const buildEventPolicy = {
|
|
|
28
32
|
'target.rewritten': 'decisive',
|
|
29
33
|
'target.rewrite-cleared': 'decisive',
|
|
30
34
|
'target.moved': 'decisive',
|
|
35
|
+
// Advisory although merge-rule path predicates decide on it: a decisive
|
|
36
|
+
// unknown type would make an older runtime in a hot-upgrade fleet defer
|
|
37
|
+
// every kernel decision on the build. An older runtime cannot parse a
|
|
38
|
+
// `[[merge]]` rule carrying `paths` or `within` (rule schemas are strict), so
|
|
39
|
+
// it never decides a path rule; ignoring the fact it sees "not recorded",
|
|
40
|
+
// which every consumer treats safely.
|
|
41
|
+
'head.paths-recorded': 'advisory',
|
|
31
42
|
'restack.prepared': 'decisive',
|
|
32
43
|
'restack.replayed': 'decisive',
|
|
33
44
|
'restack.publish-intended': 'decisive',
|
|
34
45
|
'restack.rewritten': 'decisive',
|
|
35
46
|
'restack.contended': 'decisive',
|
|
36
47
|
'restack.completed': 'decisive',
|
|
48
|
+
'restack.advanced': 'decisive',
|
|
37
49
|
'integration.abandoned': 'decisive',
|
|
38
50
|
'integration.observed': 'decisive',
|
|
39
51
|
'integration.prepared': 'decisive',
|
|
@@ -100,6 +112,7 @@ export const buildEventPolicy = {
|
|
|
100
112
|
'abort.remote-branch-deleted': 'decisive',
|
|
101
113
|
'abort.local-branch-deleted': 'decisive',
|
|
102
114
|
'abort.ticket-returned': 'decisive',
|
|
115
|
+
'build.ticket-returned': 'decisive',
|
|
103
116
|
'dispatch.failed': 'decisive',
|
|
104
117
|
'dispatch.comment-posted': 'advisory',
|
|
105
118
|
'build.pause-requested': 'decisive',
|
|
@@ -156,6 +169,7 @@ export const buildEventPolicy = {
|
|
|
156
169
|
'reconcile.publish-intended': 'decisive',
|
|
157
170
|
'reconcile.rewritten': 'decisive',
|
|
158
171
|
'reconcile.completed': 'decisive',
|
|
172
|
+
'reconcile.superseded': 'decisive',
|
|
159
173
|
'issue-link.downgraded': 'decisive',
|
|
160
174
|
'issue-links.sealed': 'decisive',
|
|
161
175
|
'observation.recorded': 'advisory',
|
|
@@ -166,6 +180,11 @@ export const buildEventPolicy = {
|
|
|
166
180
|
'session.build-read-recovered': 'decisive',
|
|
167
181
|
'phase.deferred': 'decisive',
|
|
168
182
|
'phase.deferral-escalated': 'decisive',
|
|
183
|
+
'wait.requested': 'decisive',
|
|
184
|
+
'wait.refused': 'decisive',
|
|
185
|
+
'wait.entered': 'decisive',
|
|
186
|
+
'wait.ended': 'decisive',
|
|
187
|
+
'wait.published': 'decisive',
|
|
169
188
|
} satisfies Record<EventType, FactClassification>
|
|
170
189
|
export const repositoryEventPolicy = {
|
|
171
190
|
'dispatcher.placement-set': 'advisory',
|
|
@@ -178,6 +197,8 @@ export const repositoryEventPolicy = {
|
|
|
178
197
|
'ticket-preparation.recovery-failed': 'decisive',
|
|
179
198
|
'ticket-preparation.handback-selected': 'decisive',
|
|
180
199
|
'ticket-preparation.resolved': 'decisive',
|
|
200
|
+
'ticket.handed-back': 'decisive',
|
|
201
|
+
'ticket.handback-settled': 'decisive',
|
|
181
202
|
|
|
182
203
|
'tickets.migration-recorded': 'decisive',
|
|
183
204
|
'change-presence.observed': 'decisive',
|
|
@@ -243,6 +264,7 @@ export const repositoryEventPolicy = {
|
|
|
243
264
|
'dispatcher.ticket-source-dependency-limited': 'decisive',
|
|
244
265
|
'dispatcher.forge-degraded': 'decisive',
|
|
245
266
|
'dispatcher.forge-recovered': 'decisive',
|
|
267
|
+
'forge.credential-limited': 'advisory',
|
|
246
268
|
'dispatcher.kernel-git-unavailable': 'advisory',
|
|
247
269
|
'dispatcher.kernel-git-recovered': 'advisory',
|
|
248
270
|
'dispatcher.ticket-source-degraded': 'decisive',
|