@defrex/autobuild 0.14.0 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/SPEC.md +654 -98
- package/docs/architecture.md +226 -5
- package/docs/assets/headline-wide.png +0 -0
- package/docs/configuration.md +112 -12
- package/docs/hosted-service.md +18 -0
- package/docs/integration-tree.md +117 -0
- package/docs/landing-policy.md +150 -0
- package/docs/mcp.md +24 -0
- package/docs/migration-1.0.md +68 -0
- package/docs/operator-api.md +19 -8
- package/docs/remote-store-protocol.md +30 -7
- package/docs/remote-ticket-protocol.md +26 -5
- package/docs/restacking.md +79 -0
- package/docs/setup.md +49 -6
- package/docs/ticket-dependencies.md +69 -0
- package/docs/ticket-migration.md +8 -0
- package/package.json +3 -3
- package/packages/core/src/cli/attention.ts +25 -2
- package/packages/core/src/cli/build-control.ts +65 -41
- package/packages/core/src/cli/context.ts +54 -2
- package/packages/core/src/cli/dashboard/actions.ts +6 -3
- package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
- package/packages/core/src/cli/dashboard/live.ts +5 -0
- package/packages/core/src/cli/dashboard/model.ts +142 -18
- package/packages/core/src/cli/dashboard/poll.ts +15 -9
- package/packages/core/src/cli/dashboard/refresh.ts +176 -0
- package/packages/core/src/cli/dashboard/render.ts +78 -28
- package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
- package/packages/core/src/cli/dashboard/selection.ts +7 -1
- package/packages/core/src/cli/dashboard/tree.ts +107 -0
- package/packages/core/src/cli/dispatch-frontend.ts +156 -109
- package/packages/core/src/cli/dispatch.ts +250 -136
- package/packages/core/src/cli/dispatcher-liveness.ts +15 -2
- package/packages/core/src/cli/help.ts +49 -32
- package/packages/core/src/cli/init-validation.ts +43 -2
- package/packages/core/src/cli/keyboard.ts +6 -0
- package/packages/core/src/cli/landings.ts +18 -0
- package/packages/core/src/cli/main.ts +49 -15
- package/packages/core/src/cli/mcp.ts +9 -0
- package/packages/core/src/cli/publication-settlement.ts +168 -2
- package/packages/core/src/cli/repository-status.ts +11 -0
- package/packages/core/src/cli/status.ts +72 -5
- package/packages/core/src/cli/terminal-restore.ts +54 -0
- package/packages/core/src/cli/terminal.ts +16 -2
- package/packages/core/src/cli/terminals.ts +98 -79
- package/packages/core/src/cli/ticket-editor.ts +10 -3
- package/packages/core/src/cli/ticket.ts +113 -18
- package/packages/core/src/cli/upgrade-commit.ts +4 -0
- package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
- package/packages/core/src/cli/upgrade-landing.ts +69 -0
- package/packages/core/src/cli/upgrade.ts +16 -0
- package/packages/core/src/cli/wait.ts +115 -19
- package/packages/core/src/cli/watch.ts +51 -12
- package/packages/core/src/config/landing.ts +22 -0
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/schema.ts +3 -0
- package/packages/core/src/events/catalog.ts +48 -3
- package/packages/core/src/events/payloads.ts +295 -6
- package/packages/core/src/events/repository.ts +31 -0
- package/packages/core/src/integration/harness.ts +10 -0
- package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +1030 -239
- package/packages/core/src/kernel/auto-merge-default.ts +1 -0
- package/packages/core/src/kernel/auto-merge.ts +12 -3
- package/packages/core/src/kernel/build-identity.ts +94 -0
- package/packages/core/src/kernel/change-presence.ts +179 -0
- package/packages/core/src/kernel/dispatch-status.ts +17 -1
- package/packages/core/src/kernel/engine.ts +89 -2
- package/packages/core/src/kernel/generators/build-log.ts +23 -0
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +11 -0
- package/packages/core/src/kernel/integration-completeness.ts +81 -0
- package/packages/core/src/kernel/integration-landing.ts +263 -0
- package/packages/core/src/kernel/integration-stack.ts +36 -0
- package/packages/core/src/kernel/integration-state.ts +135 -0
- package/packages/core/src/kernel/landing-policy.ts +47 -0
- package/packages/core/src/kernel/landing-publication.ts +41 -0
- package/packages/core/src/kernel/landing-readiness.ts +67 -0
- package/packages/core/src/kernel/landing-state.ts +96 -0
- package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
- package/packages/core/src/kernel/log-index.ts +35 -5
- package/packages/core/src/kernel/node-landing.ts +439 -0
- package/packages/core/src/kernel/node-parent.ts +184 -0
- package/packages/core/src/kernel/node-restack-state.ts +191 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
- package/packages/core/src/kernel/node-restack.ts +274 -0
- package/packages/core/src/kernel/read-facts.ts +70 -3
- package/packages/core/src/kernel/reconcile-head.ts +51 -0
- package/packages/core/src/kernel/reconcile-restack.ts +560 -0
- package/packages/core/src/kernel/reducer-registry.ts +16 -0
- package/packages/core/src/kernel/reducer.ts +121 -6
- package/packages/core/src/kernel/snapshot-parent.ts +33 -0
- package/packages/core/src/ontology.ts +9 -1
- package/packages/core/src/operator/annotations.ts +12 -0
- package/packages/core/src/operator/control.ts +6 -0
- package/packages/core/src/operator/index.ts +4 -0
- package/packages/core/src/operator/landings.ts +35 -0
- package/packages/core/src/operator/presentation.ts +1 -0
- package/packages/core/src/operator/protocol.ts +12 -3
- package/packages/core/src/operator/query.ts +3 -1
- package/packages/core/src/operator/registry.ts +48 -19
- package/packages/core/src/operator/requests.ts +1 -8
- package/packages/core/src/operator/tickets.ts +55 -9
- package/packages/core/src/ports/forge/contract.ts +91 -3
- package/packages/core/src/ports/forge/fake.ts +142 -4
- package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
- package/packages/core/src/ports/forge/github-readiness.ts +421 -0
- package/packages/core/src/ports/forge/github.ts +631 -35
- package/packages/core/src/ports/forge/local-git.ts +119 -5
- package/packages/core/src/ports/forge/readiness.ts +99 -0
- package/packages/core/src/ports/tickets/contract.ts +41 -0
- package/packages/core/src/ports/tickets/create.ts +8 -1
- package/packages/core/src/ports/tickets/fake.ts +32 -1
- package/packages/core/src/ports/tickets/file-codec.ts +7 -0
- package/packages/core/src/ports/tickets/file.ts +18 -1
- package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
- package/packages/core/src/ports/tickets/linear.ts +124 -4
- package/packages/core/src/ports/tickets/migration.ts +25 -1
- package/packages/core/src/ports/tickets/operations.ts +7 -2
- package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
- package/packages/core/src/ports/tickets/remote.ts +10 -1
- package/packages/core/src/ports/tickets/revision.ts +3 -1
- package/packages/core/src/ports/tickets/tree.ts +148 -0
- package/packages/core/src/ports/tickets/update.ts +15 -2
- package/packages/core/src/ports/types.ts +135 -5
- package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
- package/packages/core/src/processes/build-runner.ts +530 -23
- package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
- package/packages/core/src/processes/dispatcher.ts +2145 -203
- package/packages/core/src/processes/execution-no-progress.ts +46 -1
- package/packages/core/src/processes/publication-state.ts +30 -5
- package/packages/core/src/processes/repo-view.ts +21 -2
- package/packages/core/src/store/build-scope.ts +18 -0
- package/packages/core/src/store/contract.ts +658 -0
- package/packages/core/src/store/digest.ts +52 -4
- package/packages/core/src/store/local/schema.ts +25 -13
- package/packages/core/src/store/local/store.ts +117 -1
- package/packages/core/src/store/memory.ts +62 -1
- package/packages/core/src/store/phase-session.ts +17 -0
- package/packages/core/src/store/reduced-reads.ts +2 -1
- package/packages/core/src/store/reducer-value-shapes.json +10707 -6440
- package/packages/core/src/store/remote/client.ts +44 -0
- package/packages/core/src/store/remote/compatibility.ts +19 -9
- package/packages/core/src/store/remote/protocol.ts +11 -0
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/store/session-handle.ts +15 -0
- package/packages/core/src/store/subscribe.ts +1 -1
- package/packages/core/src/store/types.ts +32 -4
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/reduced-read-budget.ts +48 -8
- package/packages/core/src/testing/refresh-scheduler.ts +32 -0
- package/skills/guide/SKILL.md +110 -61
- package/skills/guide/references/integration-tree.md +117 -0
- package/skills/guide/references/landing-policy.md +150 -0
- package/skills/guide/references/migration-1.0.md +68 -0
- package/skills/guide/references/operator-api.md +12 -5
- package/skills/guide/references/plugin-authoring.md +34 -0
- package/skills/guide/references/remote-store-protocol.md +30 -7
- package/skills/guide/references/remote-ticket-protocol.md +26 -5
- package/skills/guide/references/restacking.md +79 -0
- package/skills/guide/references/setup.md +49 -6
- package/skills/guide/references/ticket-dependencies.md +69 -0
- package/skills/guide/references/ticket-migration.md +8 -0
- package/skills/operate/SKILL.md +55 -5
- package/skills/reconcile/SKILL.md +55 -48
- package/skills/spec/SKILL.md +67 -1
- package/skills/tickets/SKILL.md +55 -2
- package/templates/autobuild.toml +3 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* blobs, never code (D3: code travels through the Forge; events carry SHAs).
|
|
12
12
|
*/
|
|
13
13
|
import { z } from 'zod'
|
|
14
|
+
import { landingRuleSchema } from '../config/landing'
|
|
14
15
|
import {
|
|
15
16
|
artifactRefSchema,
|
|
16
17
|
buildOutcomeSchema,
|
|
@@ -34,6 +35,60 @@ import {
|
|
|
34
35
|
type VerifyOutcome,
|
|
35
36
|
} from '../ontology'
|
|
36
37
|
|
|
38
|
+
const gitOid = z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/)
|
|
39
|
+
export const reconcileTransactionSchema = z.strictObject({
|
|
40
|
+
id: z.string().min(1),
|
|
41
|
+
attempt: z.number().int().positive(),
|
|
42
|
+
restackId: z.string().min(1).optional(),
|
|
43
|
+
branch: z.string().min(1),
|
|
44
|
+
oldHead: gitOid,
|
|
45
|
+
oldBase: gitOid,
|
|
46
|
+
targetBase: gitOid,
|
|
47
|
+
changeSha: gitOid,
|
|
48
|
+
workspaceHead: gitOid,
|
|
49
|
+
localBranchHead: gitOid,
|
|
50
|
+
})
|
|
51
|
+
export const leafRestackSchema = reconcileTransactionSchema.omit({ attempt: true }).extend({
|
|
52
|
+
trigger: z.enum(['verify-entry', 'awaiting-landing']),
|
|
53
|
+
cycle: z.number().int().nonnegative(),
|
|
54
|
+
observation: z.number().int().positive(),
|
|
55
|
+
message: z.string().min(1),
|
|
56
|
+
})
|
|
57
|
+
const archiveEntry = z.strictObject({
|
|
58
|
+
ref: z.string().startsWith('refs/autobuild/archive/'),
|
|
59
|
+
sha: gitOid,
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
export const landingCandidateSchema = z.strictObject({
|
|
63
|
+
head: z.string().min(1),
|
|
64
|
+
parent: z.string().min(1),
|
|
65
|
+
cycle: z.string().min(1),
|
|
66
|
+
})
|
|
67
|
+
const landingDecision = z.strictObject({
|
|
68
|
+
candidate: landingCandidateSchema,
|
|
69
|
+
from: z.enum(['leaf', 'node']),
|
|
70
|
+
into: z.discriminatedUnion('kind', [
|
|
71
|
+
z.strictObject({ kind: z.literal('root') }),
|
|
72
|
+
z.strictObject({ kind: z.literal('node'), ticket: z.string().min(1) }),
|
|
73
|
+
]),
|
|
74
|
+
labels: z.array(z.string()),
|
|
75
|
+
mode: z.enum(['auto', 'consent']),
|
|
76
|
+
rule: z.union([
|
|
77
|
+
z.strictObject({ index: z.number().int().nonnegative(), snapshot: landingRuleSchema }),
|
|
78
|
+
z.strictObject({ default: z.literal(true) }),
|
|
79
|
+
]),
|
|
80
|
+
})
|
|
81
|
+
const nodeParent = z.strictObject({
|
|
82
|
+
target: z.strictObject({ ticket: ticketRefSchema, build: z.string().min(1) }).nullable(),
|
|
83
|
+
branch: z.string().min(1),
|
|
84
|
+
})
|
|
85
|
+
const parentChange = z.strictObject({
|
|
86
|
+
id: z.string().min(1),
|
|
87
|
+
old: nodeParent,
|
|
88
|
+
next: nodeParent,
|
|
89
|
+
revision: z.string(),
|
|
90
|
+
})
|
|
91
|
+
|
|
37
92
|
const empty = z.strictObject({})
|
|
38
93
|
const reasonOnly = z.strictObject({ reason: z.string().optional() })
|
|
39
94
|
/** Fan-out provenance shared by the auto-merge command facts: the repository
|
|
@@ -41,6 +96,7 @@ const reasonOnly = z.strictObject({ reason: z.string().optional() })
|
|
|
41
96
|
* when one did. Per-build commands omit it. `{}` stays valid, so existing
|
|
42
97
|
* producers and logs replay unchanged. */
|
|
43
98
|
const autoMergeCommand = z.strictObject({
|
|
99
|
+
integrationConsent: z.literal(true).optional(),
|
|
44
100
|
defaultSeq: z.number().int().positive().optional(),
|
|
45
101
|
})
|
|
46
102
|
/** A fan-out reconciliation marker: the repository seq of the newest
|
|
@@ -55,7 +111,7 @@ const autoMergeDefaultObserved = z.strictObject({
|
|
|
55
111
|
})
|
|
56
112
|
const round = z.number().int().positive()
|
|
57
113
|
const attempt = z.number().int().positive()
|
|
58
|
-
const dispatchStage = z.enum(['create', 'workspace', 'spec', 'comment', 'launch'])
|
|
114
|
+
const dispatchStage = z.enum(['create', 'workspace', 'spec', 'comment', 'branch', 'launch'])
|
|
59
115
|
const infrastructureOperation = z.enum([
|
|
60
116
|
'provision',
|
|
61
117
|
'start',
|
|
@@ -142,6 +198,9 @@ const verifyStepSelectionSchema = z
|
|
|
142
198
|
})
|
|
143
199
|
|
|
144
200
|
const verifyCompletionBase = {
|
|
201
|
+
baseSha: gitOid.optional(),
|
|
202
|
+
headSha: gitOid.optional(),
|
|
203
|
+
restackId: z.string().min(1).optional(),
|
|
145
204
|
step: z.string().min(1),
|
|
146
205
|
attempt,
|
|
147
206
|
}
|
|
@@ -229,6 +288,8 @@ export const eventPayloadSchemas = {
|
|
|
229
288
|
ticket: ticketRefSchema,
|
|
230
289
|
repo: z.string().min(1),
|
|
231
290
|
baseBranch: z.string().min(1),
|
|
291
|
+
kind: z.enum(['work', 'node']).optional(),
|
|
292
|
+
target: z.strictObject({ ticket: ticketRefSchema, build: z.string().min(1) }).optional(),
|
|
232
293
|
/** Claim-time auto-merge intent retained across dispatch recovery until the
|
|
233
294
|
* ordinary human-authored command fact can be materialized. */
|
|
234
295
|
autoMergeRequestedBy: z.string().min(1).optional(),
|
|
@@ -247,6 +308,148 @@ export const eventPayloadSchemas = {
|
|
|
247
308
|
* and in historical logs. */
|
|
248
309
|
assets: z.array(pinnedAssetSchema).optional(),
|
|
249
310
|
}),
|
|
311
|
+
'node.opening': z.strictObject({
|
|
312
|
+
branch: z.string().min(1),
|
|
313
|
+
parent: z.string().min(1),
|
|
314
|
+
sha: z.string().min(1),
|
|
315
|
+
}),
|
|
316
|
+
'node.parent-requested': parentChange,
|
|
317
|
+
'node.parent-accepted': parentChange,
|
|
318
|
+
'node.parent-pr-retargeted': z.strictObject({ id: z.string().min(1), base: z.string().min(1) }),
|
|
319
|
+
'node.parent-completed': z.strictObject({ id: z.string().min(1) }),
|
|
320
|
+
'node.parent-cancelled': z.strictObject({ id: z.string().min(1), reason: z.string() }),
|
|
321
|
+
'node.parent-rejection-cleared': z.strictObject({
|
|
322
|
+
revision: z.string(),
|
|
323
|
+
target: z.string().nullable(),
|
|
324
|
+
}),
|
|
325
|
+
'node.parent-rejected': z.strictObject({
|
|
326
|
+
revision: z.string(),
|
|
327
|
+
target: z.string().nullable(),
|
|
328
|
+
reason: z.string(),
|
|
329
|
+
}),
|
|
330
|
+
'node.opened': z.strictObject({ sha: z.string().min(1) }),
|
|
331
|
+
'node.writer-reserved': z.strictObject({
|
|
332
|
+
id: z.string().min(1),
|
|
333
|
+
operation: z.enum(['restack', 'landing']),
|
|
334
|
+
expected: z.string().min(1),
|
|
335
|
+
parent: z.string().min(1),
|
|
336
|
+
oldBase: z.string().min(1),
|
|
337
|
+
source: z.string().min(1).optional(),
|
|
338
|
+
archive: z.string().min(1),
|
|
339
|
+
changes: z.array(
|
|
340
|
+
z.strictObject({
|
|
341
|
+
sha: z.string().min(1),
|
|
342
|
+
build: z.string().min(1).optional(),
|
|
343
|
+
mainline: z.literal(1).optional(),
|
|
344
|
+
}),
|
|
345
|
+
),
|
|
346
|
+
upstreamBuilds: z.array(z.string()),
|
|
347
|
+
merges: z.array(
|
|
348
|
+
z.strictObject({
|
|
349
|
+
sha: z.string().min(1),
|
|
350
|
+
parent: z.string().min(1),
|
|
351
|
+
identities: z.array(z.string()),
|
|
352
|
+
build: z.string().optional(),
|
|
353
|
+
missing: z.array(z.string()),
|
|
354
|
+
}),
|
|
355
|
+
),
|
|
356
|
+
}),
|
|
357
|
+
'node.item-prepared': z.strictObject({
|
|
358
|
+
id: z.string().min(1),
|
|
359
|
+
index: z.number().int().nonnegative(),
|
|
360
|
+
base: z.string().min(1),
|
|
361
|
+
}),
|
|
362
|
+
'node.item-replayed': z.strictObject({
|
|
363
|
+
id: z.string().min(1),
|
|
364
|
+
index: z.number().int().nonnegative(),
|
|
365
|
+
base: z.string().min(1),
|
|
366
|
+
head: z.string().min(1),
|
|
367
|
+
dropped: z.boolean(),
|
|
368
|
+
dropReason: z.enum(['upstream-identity', 'upstream-commit']).optional(),
|
|
369
|
+
}),
|
|
370
|
+
'node.item-conflicted': z.strictObject({
|
|
371
|
+
id: z.string().min(1),
|
|
372
|
+
index: z.number().int().nonnegative(),
|
|
373
|
+
base: z.string().min(1),
|
|
374
|
+
}),
|
|
375
|
+
'node.publish-intended': z.strictObject({ id: z.string().min(1), head: z.string().min(1) }),
|
|
376
|
+
'node.rewritten': z.strictObject({
|
|
377
|
+
id: z.string().min(1),
|
|
378
|
+
previous: z.string().min(1),
|
|
379
|
+
head: z.string().min(1),
|
|
380
|
+
}),
|
|
381
|
+
'node.writer-settled': z.strictObject({
|
|
382
|
+
id: z.string().min(1),
|
|
383
|
+
outcome: z.enum(['completed', 'contended', 'abandoned']),
|
|
384
|
+
actual: z.string().nullable().optional(),
|
|
385
|
+
}),
|
|
386
|
+
'node.contribution-recorded': z.strictObject({
|
|
387
|
+
landing: z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),
|
|
388
|
+
head: z.string().min(1),
|
|
389
|
+
base: z.string().min(1),
|
|
390
|
+
identities: z.array(
|
|
391
|
+
z.string().regex(/^(?:build:[a-z0-9][a-z0-9-]*|foreign:[0-9a-f]{40}(?:[0-9a-f]{24})?)$/),
|
|
392
|
+
),
|
|
393
|
+
}),
|
|
394
|
+
'node.inventory': z.strictObject({
|
|
395
|
+
head: z.string().min(1),
|
|
396
|
+
builds: z.array(z.string()),
|
|
397
|
+
contributions: z.array(z.string()).optional(),
|
|
398
|
+
foreign: z.array(z.string()),
|
|
399
|
+
}),
|
|
400
|
+
'integration.abandoned': z.strictObject({ id: z.string().min(1), reason: z.string().min(1) }),
|
|
401
|
+
'integration.observed': z.strictObject({
|
|
402
|
+
openChildren: z.array(z.string()),
|
|
403
|
+
diagnostics: z.array(z.string()),
|
|
404
|
+
contributions: z.array(z.string()),
|
|
405
|
+
}),
|
|
406
|
+
'integration.prepared': z.strictObject({
|
|
407
|
+
id: z.string().min(1),
|
|
408
|
+
head: z.string().min(1),
|
|
409
|
+
parent: z.string().min(1),
|
|
410
|
+
config: z.string().min(1),
|
|
411
|
+
}),
|
|
412
|
+
'integration.landing-intended': z
|
|
413
|
+
.strictObject({
|
|
414
|
+
id: z.string().min(1),
|
|
415
|
+
cycle: z.string().min(1),
|
|
416
|
+
head: z.string().min(1),
|
|
417
|
+
parent: z.string().min(1),
|
|
418
|
+
commandSeq: z.number().int().positive().optional(),
|
|
419
|
+
decisionSeq: z.number().int().positive().optional(),
|
|
420
|
+
fenced: z.boolean(),
|
|
421
|
+
evidence: z.array(z.string()),
|
|
422
|
+
})
|
|
423
|
+
.refine(
|
|
424
|
+
(value) => value.commandSeq !== undefined || value.decisionSeq !== undefined,
|
|
425
|
+
'landing intent requires decisionSeq or legacy commandSeq',
|
|
426
|
+
),
|
|
427
|
+
'integration.landed': z.strictObject({
|
|
428
|
+
operation: z.string().optional(),
|
|
429
|
+
head: z.string().min(1),
|
|
430
|
+
landed: z.string().min(1),
|
|
431
|
+
provenance: z.enum(['kernel', 'human']),
|
|
432
|
+
verified: z.boolean(),
|
|
433
|
+
fenced: z.boolean(),
|
|
434
|
+
}),
|
|
435
|
+
'integration.audited': z.strictObject({
|
|
436
|
+
operation: z.string().min(1),
|
|
437
|
+
verifiedTree: z.string().min(1),
|
|
438
|
+
landedTree: z.string().min(1),
|
|
439
|
+
identities: z.array(z.string()),
|
|
440
|
+
}),
|
|
441
|
+
'node.compared': z.strictObject({
|
|
442
|
+
parentSha: z.string().min(1),
|
|
443
|
+
headSha: z.string().min(1),
|
|
444
|
+
ahead: z.number().int().nonnegative(),
|
|
445
|
+
}),
|
|
446
|
+
'pr.opened': z.strictObject({
|
|
447
|
+
pr: z.strictObject({
|
|
448
|
+
number: z.number().int().positive(),
|
|
449
|
+
url: z.string().min(1),
|
|
450
|
+
headSha: z.string().min(1),
|
|
451
|
+
}),
|
|
452
|
+
}),
|
|
250
453
|
'build.completed': z.strictObject({ outcome: buildOutcomeSchema }),
|
|
251
454
|
'runner.attached': z.strictObject({
|
|
252
455
|
instance: z.string().min(1),
|
|
@@ -367,6 +570,12 @@ export const eventPayloadSchemas = {
|
|
|
367
570
|
* The dispatcher settles the request only after the VM session and execution
|
|
368
571
|
* lease are gone, then appends the ordinary phase completion fact. */
|
|
369
572
|
'publication.requested': z.discriminatedUnion('operation', [
|
|
573
|
+
z.strictObject({
|
|
574
|
+
operation: z.literal('restack'),
|
|
575
|
+
branch: z.string().min(1),
|
|
576
|
+
sha: gitOid,
|
|
577
|
+
rewrite: leafRestackSchema.extend({ headSha: gitOid }),
|
|
578
|
+
}),
|
|
370
579
|
z.strictObject({
|
|
371
580
|
operation: z.literal('implement'),
|
|
372
581
|
branch: z.string().min(1),
|
|
@@ -377,6 +586,7 @@ export const eventPayloadSchemas = {
|
|
|
377
586
|
}),
|
|
378
587
|
z.strictObject({
|
|
379
588
|
operation: z.literal('reconcile'),
|
|
589
|
+
rewrite: reconcileTransactionSchema.extend({ conflicted: z.boolean() }).optional(),
|
|
380
590
|
branch: z.string().min(1),
|
|
381
591
|
sha: z.string().regex(/^[0-9a-f]{40,64}$/i),
|
|
382
592
|
artifact: artifactRefSchema,
|
|
@@ -406,7 +616,7 @@ export const eventPayloadSchemas = {
|
|
|
406
616
|
'publication.lost': z.strictObject({
|
|
407
617
|
/** seq of the lost `publication.requested` event. */
|
|
408
618
|
request: z.number().int().positive(),
|
|
409
|
-
operation: z.enum(['implement', 'reconcile', 'finalize', 'finalize-step']),
|
|
619
|
+
operation: z.enum(['implement', 'reconcile', 'restack', 'finalize', 'finalize-step']),
|
|
410
620
|
branch: z.string().min(1),
|
|
411
621
|
sha: z.string().regex(/^[0-9a-f]{40,64}$/i),
|
|
412
622
|
reason: z.string().trim().min(1),
|
|
@@ -433,6 +643,29 @@ export const eventPayloadSchemas = {
|
|
|
433
643
|
'build.resume-requested': reasonOnly,
|
|
434
644
|
'build.abort-requested': reasonOnly,
|
|
435
645
|
'build.discard-requested': empty,
|
|
646
|
+
'landing.decided': landingDecision,
|
|
647
|
+
'build.hold-requested': empty,
|
|
648
|
+
'build.land-requested': z.strictObject({ decisionSeq: z.number().int().positive() }),
|
|
649
|
+
'landing.command-acknowledged': z.strictObject({ commandSeq: z.number().int().positive() }),
|
|
650
|
+
'landing.native-enable-started': empty,
|
|
651
|
+
'landing.forge-merged': z.strictObject({
|
|
652
|
+
classification: z.enum(['human', 'possible-stale-enable']),
|
|
653
|
+
overrodeHold: z.boolean(),
|
|
654
|
+
}),
|
|
655
|
+
'landing.native-applied': z.strictObject({
|
|
656
|
+
retry: z
|
|
657
|
+
.strictObject({
|
|
658
|
+
attempt: z.number().int().positive(),
|
|
659
|
+
after: z.string().datetime(),
|
|
660
|
+
})
|
|
661
|
+
.optional(),
|
|
662
|
+
enableSeq: z.number().int().positive().optional(),
|
|
663
|
+
enabled: z.boolean(),
|
|
664
|
+
candidate: landingCandidateSchema.optional(),
|
|
665
|
+
decisionSeq: z.number().int().positive().optional(),
|
|
666
|
+
commandSeq: z.number().int().positive().optional(),
|
|
667
|
+
operation: z.string().min(1).optional(),
|
|
668
|
+
}),
|
|
436
669
|
'build.auto-merge-requested': autoMergeCommand,
|
|
437
670
|
'build.auto-merge-cancelled': autoMergeCommand,
|
|
438
671
|
'build.auto-merge-default-observed': autoMergeDefaultObserved,
|
|
@@ -533,6 +766,9 @@ export const eventPayloadSchemas = {
|
|
|
533
766
|
|
|
534
767
|
// ── Verify / finalize ──────────────────────────────────────────────────────
|
|
535
768
|
'verify.started': z.strictObject({
|
|
769
|
+
baseSha: gitOid.optional(),
|
|
770
|
+
headSha: gitOid.optional(),
|
|
771
|
+
restackId: z.string().min(1).optional(),
|
|
536
772
|
step: z.string().min(1),
|
|
537
773
|
attempt,
|
|
538
774
|
/** An answered escalation raised by this agent verifier returns to the
|
|
@@ -606,7 +842,10 @@ export const eventPayloadSchemas = {
|
|
|
606
842
|
/** seq of the human auto-merge command this forge mutation applied. */
|
|
607
843
|
commandSeq: z.number().int().positive(),
|
|
608
844
|
}),
|
|
609
|
-
'pr.merged': z.strictObject({
|
|
845
|
+
'pr.merged': z.strictObject({
|
|
846
|
+
sha: z.string().min(1),
|
|
847
|
+
buildTrailerPresent: z.boolean().optional(),
|
|
848
|
+
}),
|
|
610
849
|
'pr.closed': empty,
|
|
611
850
|
'pr.conflicted': z.strictObject({ baseSha: z.string().min(1) }),
|
|
612
851
|
'reconcile.progress-checked': z.strictObject({
|
|
@@ -616,11 +855,49 @@ export const eventPayloadSchemas = {
|
|
|
616
855
|
attempt,
|
|
617
856
|
baseSha: z.string().min(1),
|
|
618
857
|
}),
|
|
619
|
-
'
|
|
620
|
-
'
|
|
621
|
-
|
|
858
|
+
'target.moved': z.strictObject({ branch: z.string().min(1), sha: gitOid }),
|
|
859
|
+
'restack.prepared': leafRestackSchema,
|
|
860
|
+
'restack.replayed': z.strictObject({ id: z.string().min(1), conflicted: z.boolean() }),
|
|
861
|
+
'restack.publish-intended': leafRestackSchema.extend({ headSha: gitOid }),
|
|
862
|
+
'restack.rewritten': leafRestackSchema.extend({
|
|
863
|
+
headSha: gitOid,
|
|
864
|
+
archives: z.array(archiveEntry),
|
|
865
|
+
observedHead: gitOid.nullable().optional(),
|
|
866
|
+
}),
|
|
867
|
+
'restack.contended': z.strictObject({
|
|
868
|
+
id: z.string().min(1),
|
|
869
|
+
request: z.number().int().positive(),
|
|
870
|
+
actual: gitOid.nullable(),
|
|
871
|
+
}),
|
|
872
|
+
'restack.completed': leafRestackSchema.extend({ headSha: gitOid }),
|
|
873
|
+
'reconcile.started': z.strictObject({
|
|
874
|
+
attempt,
|
|
875
|
+
baseSha: z.string().min(1),
|
|
876
|
+
restackId: z.string().min(1).optional(),
|
|
877
|
+
}),
|
|
878
|
+
'reconcile.prepared': reconcileTransactionSchema,
|
|
879
|
+
'reconcile.contended': z.strictObject({
|
|
880
|
+
id: z.string().min(1),
|
|
881
|
+
request: z.number().int().positive(),
|
|
882
|
+
actual: gitOid.nullable(),
|
|
883
|
+
}),
|
|
884
|
+
'reconcile.replayed': z.strictObject({ id: z.string().min(1), conflicted: z.boolean() }),
|
|
885
|
+
'reconcile.publish-intended': reconcileTransactionSchema.extend({
|
|
886
|
+
headSha: gitOid,
|
|
887
|
+
conflicted: z.boolean(),
|
|
622
888
|
artifact: artifactRefSchema,
|
|
623
889
|
}),
|
|
890
|
+
'reconcile.rewritten': reconcileTransactionSchema.extend({
|
|
891
|
+
headSha: gitOid,
|
|
892
|
+
/** Later readback when a successful CAS was overtaken before acknowledgement. */
|
|
893
|
+
observedHead: gitOid.nullable().optional(),
|
|
894
|
+
conflicted: z.boolean(),
|
|
895
|
+
archives: z.array(archiveEntry),
|
|
896
|
+
}),
|
|
897
|
+
'reconcile.completed': z.union([
|
|
898
|
+
z.strictObject({ mergeCommit: z.string().min(1), artifact: artifactRefSchema }),
|
|
899
|
+
z.strictObject({ headSha: gitOid, rewriteId: z.string().min(1), artifact: artifactRefSchema }),
|
|
900
|
+
]),
|
|
624
901
|
|
|
625
902
|
// ── Cross-cutting ──────────────────────────────────────────────────────────
|
|
626
903
|
'observation.recorded': z.strictObject({
|
|
@@ -673,6 +950,9 @@ export type EventPayload<T extends EventType> = z.infer<(typeof eventPayloadSche
|
|
|
673
950
|
|
|
674
951
|
/** Canonical read shape shared by the reducer, engine, and query surfaces. */
|
|
675
952
|
export interface NormalizedVerifyCompletion {
|
|
953
|
+
baseSha?: string
|
|
954
|
+
headSha?: string
|
|
955
|
+
restackId?: string
|
|
676
956
|
step: string
|
|
677
957
|
attempt: number
|
|
678
958
|
outcome: VerifyOutcome
|
|
@@ -690,6 +970,9 @@ export function normalizeVerifyCompletion(
|
|
|
690
970
|
): NormalizedVerifyCompletion {
|
|
691
971
|
if ('pass' in payload) {
|
|
692
972
|
return {
|
|
973
|
+
baseSha: payload.baseSha,
|
|
974
|
+
headSha: payload.headSha,
|
|
975
|
+
restackId: payload.restackId,
|
|
693
976
|
step: payload.step,
|
|
694
977
|
attempt: payload.attempt,
|
|
695
978
|
outcome: payload.pass ? 'pass' : 'fail',
|
|
@@ -698,6 +981,9 @@ export function normalizeVerifyCompletion(
|
|
|
698
981
|
}
|
|
699
982
|
if (payload.outcome === 'skipped') {
|
|
700
983
|
return {
|
|
984
|
+
baseSha: payload.baseSha,
|
|
985
|
+
headSha: payload.headSha,
|
|
986
|
+
restackId: payload.restackId,
|
|
701
987
|
step: payload.step,
|
|
702
988
|
attempt: payload.attempt,
|
|
703
989
|
outcome: 'skipped',
|
|
@@ -706,6 +992,9 @@ export function normalizeVerifyCompletion(
|
|
|
706
992
|
}
|
|
707
993
|
}
|
|
708
994
|
return {
|
|
995
|
+
baseSha: payload.baseSha,
|
|
996
|
+
headSha: payload.headSha,
|
|
997
|
+
restackId: payload.restackId,
|
|
709
998
|
step: payload.step,
|
|
710
999
|
attempt: payload.attempt,
|
|
711
1000
|
outcome: payload.outcome,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hardReadinessKeys } from '../ports/forge/readiness'
|
|
1
2
|
/**
|
|
2
3
|
* Repository-scoped event catalog. These events deliberately do not enter the
|
|
3
4
|
* build event union: repository controls and harvest runs are not synthetic
|
|
@@ -406,6 +407,14 @@ export const dispatcherStatusEventPayloadSchemas = {
|
|
|
406
407
|
run: dispatchRun.optional(),
|
|
407
408
|
holder: z.string().min(1),
|
|
408
409
|
}),
|
|
410
|
+
'dispatcher.forge-readiness-failed': z.strictObject({
|
|
411
|
+
run: dispatchRun,
|
|
412
|
+
forge: z.string().min(1),
|
|
413
|
+
rootBranch: z.string().min(1),
|
|
414
|
+
check: z.enum(hardReadinessKeys),
|
|
415
|
+
detail: z.string().min(1),
|
|
416
|
+
remediation: z.string().min(1),
|
|
417
|
+
}),
|
|
409
418
|
'dispatcher.config-rejected': z.strictObject({ run: dispatchRun, error: z.string().min(1) }),
|
|
410
419
|
'dispatcher.config-publication-failed': z.strictObject({
|
|
411
420
|
run: dispatchRun,
|
|
@@ -505,7 +514,26 @@ export const ticketSourceHealthEventPayloadSchemas = {
|
|
|
505
514
|
}),
|
|
506
515
|
} as const
|
|
507
516
|
|
|
517
|
+
/** Head-bound admission evidence. Historical observations remain append-only. */
|
|
518
|
+
export const changePresenceEventPayloadSchemas = {
|
|
519
|
+
'change-presence.observed': z.strictObject({
|
|
520
|
+
branch: z.string().min(1),
|
|
521
|
+
destination: z.string().min(1),
|
|
522
|
+
head: z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),
|
|
523
|
+
evidence: z.string().min(1),
|
|
524
|
+
identities: z
|
|
525
|
+
.array(
|
|
526
|
+
z.string().regex(/^(?:build:[a-z0-9][a-z0-9-]*|foreign:[0-9a-f]{40}(?:[0-9a-f]{24})?)$/),
|
|
527
|
+
)
|
|
528
|
+
.refine(
|
|
529
|
+
(ids) => ids.every((id, index) => index === 0 || ids[index - 1]! < id),
|
|
530
|
+
'identities must be sorted and unique',
|
|
531
|
+
),
|
|
532
|
+
}),
|
|
533
|
+
} as const
|
|
534
|
+
|
|
508
535
|
export const repositoryEventPayloadSchemas = {
|
|
536
|
+
...changePresenceEventPayloadSchemas,
|
|
509
537
|
...ticketSourceHealthEventPayloadSchemas,
|
|
510
538
|
...harvestEventPayloadSchemas,
|
|
511
539
|
...orchestratorSandboxEventPayloadSchemas,
|
|
@@ -527,6 +555,7 @@ export const REPOSITORY_ATTENTION_EVENTS = [
|
|
|
527
555
|
'dispatcher.ticket-source-recovered',
|
|
528
556
|
'dispatcher.tick-failed',
|
|
529
557
|
'dispatcher.config-rejected',
|
|
558
|
+
'dispatcher.forge-readiness-failed',
|
|
530
559
|
'dispatcher.harvest-runner-failed',
|
|
531
560
|
] as const satisfies readonly RepositoryEventType[]
|
|
532
561
|
export type RepositoryEventPayload<T extends RepositoryEventType> = z.infer<
|
|
@@ -565,6 +594,7 @@ export type HarvestEventWrite<T extends HarvestEventType = HarvestEventType> =
|
|
|
565
594
|
export const HARVEST_EVENT_TYPES = Object.keys(harvestEventPayloadSchemas) as HarvestEventType[]
|
|
566
595
|
|
|
567
596
|
const allowedActorKinds: Record<RepositoryEventType, readonly ActorKind[]> = {
|
|
597
|
+
'change-presence.observed': ['dispatcher', 'kernel'],
|
|
568
598
|
'harvest.pause-requested': ['human'],
|
|
569
599
|
'harvest.resume-requested': ['human'],
|
|
570
600
|
'harvest.paused': ['kernel'],
|
|
@@ -604,6 +634,7 @@ const allowedActorKinds: Record<RepositoryEventType, readonly ActorKind[]> = {
|
|
|
604
634
|
'dispatcher.run-stopped': ['dispatcher'],
|
|
605
635
|
'dispatcher.tick-yielded': ['dispatcher'],
|
|
606
636
|
'dispatcher.config-rejected': ['dispatcher'],
|
|
637
|
+
'dispatcher.forge-readiness-failed': ['dispatcher'],
|
|
607
638
|
'dispatcher.config-publication-failed': ['dispatcher'],
|
|
608
639
|
'dispatcher.tick-started': ['dispatcher'],
|
|
609
640
|
'dispatcher.tick-completed': ['dispatcher'],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { gitRewrite } from '../ports/forge/git-rewrite'
|
|
1
2
|
/**
|
|
2
3
|
* End-to-end harness (SPEC §15.6 as LIVE scenarios, §8.7, §12, §15.7):
|
|
3
4
|
* real components everywhere the seam matters.
|
|
@@ -465,10 +466,19 @@ export async function makeHarness(opts: {
|
|
|
465
466
|
// Ad-hoc scenario configs predating mandatory runtime defaults stay explicit
|
|
466
467
|
// at the harness boundary rather than relying on production wiring.
|
|
467
468
|
config.roles.default ??= { runtime: 'scripted' }
|
|
469
|
+
await git(['config', 'user.name', 'ab-e2e'], origin)
|
|
470
|
+
await git(['config', 'user.email', 'ab-e2e@example.invalid'], origin)
|
|
471
|
+
await git(['config', 'commit.gpgsign', 'false'], origin)
|
|
468
472
|
const forge = new FakeForge({
|
|
469
473
|
gatePresence: opts.gatePresence ?? 'present',
|
|
470
474
|
...(opts.pluginForge?.prAttachments === true ? { prAttachments: true } : {}),
|
|
471
475
|
})
|
|
476
|
+
const recordPush = forge.pushBranch.bind(forge)
|
|
477
|
+
forge.pushBranch = async (cwd, branch) => {
|
|
478
|
+
await recordPush(cwd, branch)
|
|
479
|
+
await git(['push', '-q', 'origin', `HEAD:refs/heads/${branch}`], cwd)
|
|
480
|
+
}
|
|
481
|
+
forge.rewrite = gitRewrite(spawnExec, false)
|
|
472
482
|
let selectedForge: Forge =
|
|
473
483
|
opts.localGitForge === true ? new LocalGitForge({ repoRoot: origin }) : forge
|
|
474
484
|
let plugins: PluginRegistry | undefined
|