@defrex/autobuild 1.0.0-beta.0 → 1.0.0-beta.2
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 +9 -4
- package/SPEC.md +295 -62
- package/bin/ab-build-runner.ts +10 -8
- package/docs/architecture.md +179 -25
- package/docs/configuration.md +41 -6
- package/docs/hosted-service.md +35 -0
- package/docs/integration-tree.md +81 -4
- package/docs/landing-policy.md +11 -0
- package/docs/migration-1.0.md +9 -0
- package/docs/operator-api.md +18 -0
- package/docs/remote-store-protocol.md +11 -0
- package/docs/restacking.md +42 -7
- package/docs/setup.md +25 -0
- package/docs/ticket-dependencies.md +6 -45
- package/package.json +3 -3
- package/packages/core/src/cli/attention.ts +4 -1
- package/packages/core/src/cli/binary.ts +17 -1
- package/packages/core/src/cli/context.ts +53 -1
- package/packages/core/src/cli/dashboard/actions.ts +4 -0
- package/packages/core/src/cli/dashboard/detail.ts +45 -1
- package/packages/core/src/cli/dashboard/facts.ts +7 -2
- package/packages/core/src/cli/dashboard/integration-detail.ts +142 -0
- package/packages/core/src/cli/dashboard/integration-row.ts +248 -0
- package/packages/core/src/cli/dashboard/landing-display.ts +64 -0
- package/packages/core/src/cli/dashboard/model.ts +140 -16
- package/packages/core/src/cli/dashboard/poll.ts +40 -4
- package/packages/core/src/cli/dashboard/refresh.ts +20 -13
- package/packages/core/src/cli/dashboard/render.ts +106 -5
- package/packages/core/src/cli/dashboard/transcript.ts +2 -1
- package/packages/core/src/cli/dispatch-frontend.ts +22 -12
- package/packages/core/src/cli/dispatch.ts +59 -25
- package/packages/core/src/cli/help.ts +19 -2
- package/packages/core/src/cli/main.ts +37 -0
- package/packages/core/src/cli/publication-settlement.ts +49 -5
- package/packages/core/src/cli/repository-status.ts +97 -2
- package/packages/core/src/cli/status.ts +24 -1
- package/packages/core/src/cli/terminals.ts +94 -93
- package/packages/core/src/cli/wait.ts +11 -2
- package/packages/core/src/cli/watch.ts +12 -0
- package/packages/core/src/config/schema.ts +3 -0
- package/packages/core/src/events/catalog.ts +38 -0
- package/packages/core/src/events/compatibility.ts +183 -0
- package/packages/core/src/events/native-session.ts +13 -0
- package/packages/core/src/events/payloads.ts +148 -2
- package/packages/core/src/events/policy.ts +209 -0
- package/packages/core/src/events/repository.ts +48 -0
- package/packages/core/src/integration/harness.ts +4 -4
- package/packages/core/src/kernel/__snapshots__/{reducer-registry.test.ts.snap → reducer-accumulator-shapes.json} +771 -538
- package/packages/core/src/kernel/change-presence.ts +4 -2
- package/packages/core/src/kernel/dispatch-capacity.ts +119 -0
- package/packages/core/src/kernel/dispatcher-liveness.ts +5 -1
- package/packages/core/src/kernel/engine.ts +25 -5
- package/packages/core/src/kernel/forge-health.ts +19 -0
- package/packages/core/src/kernel/generators/build-log.ts +18 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +1 -1
- package/packages/core/src/kernel/generators/repository-journals.ts +10 -0
- package/packages/core/src/kernel/guarded-forge.ts +159 -0
- package/packages/core/src/kernel/incremental.ts +4 -2
- package/packages/core/src/kernel/integration-completeness.ts +61 -0
- package/packages/core/src/kernel/integration-landing.ts +5 -4
- package/packages/core/src/kernel/janitor-failure.ts +36 -0
- package/packages/core/src/kernel/landing-publication.ts +35 -15
- package/packages/core/src/kernel/landing-state.ts +7 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +1 -1
- package/packages/core/src/kernel/log-index.ts +12 -1
- package/packages/core/src/kernel/mixed-version.ts +52 -0
- package/packages/core/src/kernel/node-landing.ts +14 -11
- package/packages/core/src/kernel/node-restack-demand.ts +29 -0
- package/packages/core/src/kernel/node-restack-state.ts +46 -16
- package/packages/core/src/kernel/node-restack-transaction.ts +151 -8
- package/packages/core/src/kernel/node-restack.ts +34 -10
- package/packages/core/src/kernel/publication.ts +22 -0
- package/packages/core/src/kernel/read-deferrals.ts +111 -0
- package/packages/core/src/kernel/read-facts.ts +27 -6
- package/packages/core/src/kernel/reconcile-restack.ts +23 -2
- package/packages/core/src/kernel/reducer-registry.ts +15 -2
- package/packages/core/src/kernel/reducer.ts +196 -10
- package/packages/core/src/kernel/repository-attention.ts +38 -1
- package/packages/core/src/kernel/terminal-guard.ts +11 -4
- package/packages/core/src/operator/annotations.ts +6 -0
- package/packages/core/src/operator/index.ts +2 -0
- package/packages/core/src/operator/presentation.ts +5 -0
- package/packages/core/src/operator/query.ts +45 -11
- package/packages/core/src/operator/registry.ts +17 -1
- package/packages/core/src/operator/restack.ts +51 -0
- package/packages/core/src/plugin-sdk/index.ts +10 -0
- package/packages/core/src/plugins/load.ts +3 -4
- package/packages/core/src/plugins/manifest.ts +1 -1
- package/packages/core/src/ports/forge/contract.ts +23 -0
- package/packages/core/src/ports/forge/fake.ts +6 -2
- package/packages/core/src/ports/forge/git-rewrite.ts +92 -64
- package/packages/core/src/ports/forge/github-transport.ts +45 -2
- package/packages/core/src/ports/forge/github.ts +56 -17
- package/packages/core/src/ports/forge/local-git.ts +7 -2
- package/packages/core/src/ports/forge-failure.ts +40 -0
- package/packages/core/src/ports/forge-request-context.ts +35 -0
- package/packages/core/src/ports/forge-telemetry.ts +16 -0
- package/packages/core/src/ports/runner/claude.ts +136 -9
- package/packages/core/src/ports/runner/codex.ts +112 -7
- package/packages/core/src/ports/runner/contract.ts +78 -0
- package/packages/core/src/ports/runner/fake.ts +59 -1
- package/packages/core/src/ports/runner/native-cli-fixture.ts +86 -0
- package/packages/core/src/ports/runner/native-process-fixture.ts +38 -0
- package/packages/core/src/ports/runner/native-session.ts +110 -0
- package/packages/core/src/ports/runner/pi-rpc.ts +7 -1
- package/packages/core/src/ports/runner/pi.ts +162 -2
- package/packages/core/src/ports/types.ts +53 -5
- package/packages/core/src/ports/workspace/git-worktree.ts +45 -51
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +28 -12
- package/packages/core/src/processes/build-child-exit.ts +50 -2
- package/packages/core/src/processes/build-child.ts +15 -7
- package/packages/core/src/processes/build-runner.ts +909 -213
- package/packages/core/src/processes/dispatcher.ts +652 -334
- package/packages/core/src/processes/execution-no-progress.ts +15 -0
- package/packages/core/src/processes/pause-execution-fixture.ts +37 -0
- package/packages/core/src/processes/phase-failure-budget.ts +2 -1
- package/packages/core/src/processes/publication-loss.ts +7 -3
- package/packages/core/src/processes/repo-view.ts +53 -6
- package/packages/core/src/processes/tick-publication.ts +6 -2
- package/packages/core/src/runtime-identity.ts +37 -0
- package/packages/core/src/store/adapter.ts +4 -2
- package/packages/core/src/store/build-scope.ts +9 -0
- package/packages/core/src/store/contract.ts +203 -16
- package/packages/core/src/store/digest.ts +20 -2
- package/packages/core/src/store/local/schema.ts +6 -0
- package/packages/core/src/store/local/store.ts +57 -4
- package/packages/core/src/store/memory.ts +83 -2
- package/packages/core/src/store/new-build.ts +2 -2
- package/packages/core/src/store/phase-session.ts +13 -0
- package/packages/core/src/store/reduced-reads.ts +43 -4
- package/packages/core/src/store/reducer-value-shapes.json +8238 -5764
- package/packages/core/src/store/reducer-value-validation.ts +103 -3
- package/packages/core/src/store/reducer-values.ts +21 -6
- package/packages/core/src/store/remote/client.ts +146 -20
- package/packages/core/src/store/remote/compatibility.ts +6 -0
- package/packages/core/src/store/remote/index.ts +2 -0
- package/packages/core/src/store/remote/protocol.ts +19 -0
- package/packages/core/src/store/remote/version.ts +2 -0
- package/packages/core/src/store/repo-state-events.ts +3 -1
- package/packages/core/src/store/repo-tick.ts +6 -1
- package/packages/core/src/store/session-handle.ts +8 -0
- package/packages/core/src/store/snapshots.ts +21 -5
- package/packages/core/src/store/types.ts +19 -1
- package/packages/core/src/testing/dispatch-read-budget.ts +17 -2
- package/packages/core/src/testing/index.ts +7 -0
- package/packages/core/src/testing/newer-writer.ts +37 -0
- package/packages/core/src/testing/reduced-read-budget.ts +3 -0
- package/skills/guide/SKILL.md +144 -27
- package/skills/guide/references/integration-tree.md +81 -4
- package/skills/guide/references/landing-policy.md +11 -0
- package/skills/guide/references/migration-1.0.md +9 -0
- package/skills/guide/references/operator-api.md +18 -0
- package/skills/guide/references/plugin-authoring.md +55 -7
- package/skills/guide/references/remote-store-protocol.md +11 -0
- package/skills/guide/references/restacking.md +42 -7
- package/skills/guide/references/setup.md +25 -0
- package/skills/guide/references/ticket-dependencies.md +6 -45
- package/skills/implement/SKILL.md +4 -2
- package/skills/operate/SKILL.md +63 -6
- package/skills/reconcile/SKILL.md +3 -1
- package/skills/spec/SKILL.md +49 -39
- package/skills/tickets/SKILL.md +15 -43
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/** Persisted facts are open on reads; producer schemas remain closed on writes. */
|
|
2
|
+
import type { z } from 'zod'
|
|
3
|
+
import type { Actor } from './envelope'
|
|
4
|
+
import type { AbEvent } from './catalog'
|
|
5
|
+
import { eventPayloadSchemas } from './payloads'
|
|
6
|
+
import { repositoryEventPayloadSchemas, type RepositoryEvent } from './repository'
|
|
7
|
+
import {
|
|
8
|
+
buildEventPolicy,
|
|
9
|
+
repositoryEventPolicy,
|
|
10
|
+
compatibilityMetadataSchema,
|
|
11
|
+
type CompatibilityMetadata,
|
|
12
|
+
} from './policy'
|
|
13
|
+
|
|
14
|
+
export interface StoredEvent {
|
|
15
|
+
build?: string
|
|
16
|
+
repo?: string
|
|
17
|
+
seq: number
|
|
18
|
+
ts: string
|
|
19
|
+
actor: Actor
|
|
20
|
+
type: string
|
|
21
|
+
payload: unknown
|
|
22
|
+
compatibility?: CompatibilityMetadata
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Change this revision whenever projection semantics change without new types. */
|
|
26
|
+
export const READ_DECODER_REVISION = 2
|
|
27
|
+
export function catalogIdentity(
|
|
28
|
+
build: Record<string, string> = buildEventPolicy,
|
|
29
|
+
repository: Record<string, string> = repositoryEventPolicy,
|
|
30
|
+
): string {
|
|
31
|
+
const sorted = (catalog: Record<string, string>) =>
|
|
32
|
+
Object.entries(catalog).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
33
|
+
return new Bun.CryptoHasher('sha256')
|
|
34
|
+
.update(JSON.stringify([READ_DECODER_REVISION, sorted(build), sorted(repository)]))
|
|
35
|
+
.digest('hex')
|
|
36
|
+
}
|
|
37
|
+
export const READ_CATALOG_IDENTITY = catalogIdentity()
|
|
38
|
+
|
|
39
|
+
/** Remove only keys reported as unknown by the original schema, then run that
|
|
40
|
+
* schema again. Its required fields, enums and refinements remain authoritative. */
|
|
41
|
+
export function projectPayload(schema: z.ZodType, payload: unknown): unknown {
|
|
42
|
+
const projected = structuredClone(payload)
|
|
43
|
+
for (;;) {
|
|
44
|
+
const result = schema.safeParse(projected)
|
|
45
|
+
if (result.success) return result.data
|
|
46
|
+
let removed = false
|
|
47
|
+
for (const issue of removableKeys(result.error.issues)) {
|
|
48
|
+
let object: unknown = projected
|
|
49
|
+
for (const key of issue.path) object = (object as Record<PropertyKey, unknown>)?.[key]
|
|
50
|
+
if (object === null || typeof object !== 'object') continue
|
|
51
|
+
for (const key of issue.keys) {
|
|
52
|
+
if (!Object.hasOwn(object, key)) continue
|
|
53
|
+
delete (object as Record<string, unknown>)[key]
|
|
54
|
+
removed = true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!removed) throw result.error
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
type UnknownKeys = { path: PropertyKey[]; keys: string[] }
|
|
61
|
+
function removableKeys(
|
|
62
|
+
issues: readonly z.core.$ZodIssue[],
|
|
63
|
+
prefix: PropertyKey[] = [],
|
|
64
|
+
): UnknownKeys[] {
|
|
65
|
+
return issues.flatMap((issue): UnknownKeys[] => {
|
|
66
|
+
const path = [...prefix, ...issue.path]
|
|
67
|
+
if (issue.code === 'unrecognized_keys') return [{ path, keys: issue.keys }]
|
|
68
|
+
if (issue.code !== 'invalid_union') return []
|
|
69
|
+
// Choose one branch that would validate after dropping only added fields;
|
|
70
|
+
// never remove the known fields demanded by another union alternative.
|
|
71
|
+
const branches = issue.errors as unknown as readonly (readonly z.core.$ZodIssue[])[]
|
|
72
|
+
const branch = branches.find((errors) => errors.every(onlyAddedFields))
|
|
73
|
+
return branch ? removableKeys(branch, path) : []
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
function onlyAddedFields(issue: z.core.$ZodIssue): boolean {
|
|
77
|
+
return (
|
|
78
|
+
issue.code === 'unrecognized_keys' ||
|
|
79
|
+
(issue.code === 'invalid_union' &&
|
|
80
|
+
(issue.errors as unknown as readonly (readonly z.core.$ZodIssue[])[]).some((errors) =>
|
|
81
|
+
errors.every(onlyAddedFields),
|
|
82
|
+
))
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
export function decodeStoredEvent(event: StoredEvent): AbEvent | RepositoryEvent | null {
|
|
86
|
+
const schemas = event.repo === undefined ? eventPayloadSchemas : repositoryEventPayloadSchemas
|
|
87
|
+
const schema = Object.hasOwn(schemas, event.type)
|
|
88
|
+
? schemas[event.type as keyof typeof schemas]
|
|
89
|
+
: undefined
|
|
90
|
+
const result = schema
|
|
91
|
+
? ({ ...event, payload: projectPayload(schema, event.payload) } as AbEvent | RepositoryEvent)
|
|
92
|
+
: null
|
|
93
|
+
return result
|
|
94
|
+
}
|
|
95
|
+
export function projectEvents<E>(events: readonly E[]): readonly E[] {
|
|
96
|
+
return events.flatMap((event) => {
|
|
97
|
+
// Session and already-adapted selector rows are a separate vocabulary.
|
|
98
|
+
if (
|
|
99
|
+
!event ||
|
|
100
|
+
typeof event !== 'object' ||
|
|
101
|
+
!('payload' in event) ||
|
|
102
|
+
!('actor' in event) ||
|
|
103
|
+
(!('build' in event) && !('repo' in event))
|
|
104
|
+
)
|
|
105
|
+
return [event]
|
|
106
|
+
const known = decodeStoredEvent(event as unknown as StoredEvent)
|
|
107
|
+
return known === null ? [] : [known as E]
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
export interface CompatibilityState {
|
|
111
|
+
unknownFacts: number
|
|
112
|
+
decisiveFacts: number
|
|
113
|
+
lastSeq: number
|
|
114
|
+
decisiveBoundary: number
|
|
115
|
+
types: string[]
|
|
116
|
+
writerVersions: string[]
|
|
117
|
+
legacyVersionUnavailable: boolean
|
|
118
|
+
decisiveTypes: string[]
|
|
119
|
+
decisiveWriterVersions: string[]
|
|
120
|
+
decisiveLegacyVersionUnavailable: boolean
|
|
121
|
+
}
|
|
122
|
+
export function initialCompatibility(): CompatibilityState {
|
|
123
|
+
return {
|
|
124
|
+
unknownFacts: 0,
|
|
125
|
+
decisiveFacts: 0,
|
|
126
|
+
lastSeq: 0,
|
|
127
|
+
decisiveBoundary: 0,
|
|
128
|
+
types: [],
|
|
129
|
+
writerVersions: [],
|
|
130
|
+
legacyVersionUnavailable: false,
|
|
131
|
+
decisiveTypes: [],
|
|
132
|
+
decisiveWriterVersions: [],
|
|
133
|
+
decisiveLegacyVersionUnavailable: false,
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export function advanceCompatibility(
|
|
137
|
+
state: CompatibilityState,
|
|
138
|
+
events: readonly StoredEvent[],
|
|
139
|
+
): void {
|
|
140
|
+
for (const event of events) {
|
|
141
|
+
if (decodeStoredEvent(event) !== null) continue
|
|
142
|
+
state.lastSeq = Math.max(state.lastSeq, event.seq)
|
|
143
|
+
state.unknownFacts++
|
|
144
|
+
const metadata =
|
|
145
|
+
event.compatibility === undefined
|
|
146
|
+
? undefined
|
|
147
|
+
: compatibilityMetadataSchema.parse(event.compatibility)
|
|
148
|
+
if (!state.types.includes(event.type)) state.types.push(event.type)
|
|
149
|
+
if (metadata && !state.writerVersions.includes(metadata.writerVersion))
|
|
150
|
+
state.writerVersions.push(metadata.writerVersion)
|
|
151
|
+
if (!metadata) state.legacyVersionUnavailable = true
|
|
152
|
+
if (metadata?.classification !== 'advisory') {
|
|
153
|
+
if (!state.decisiveTypes.includes(event.type)) state.decisiveTypes.push(event.type)
|
|
154
|
+
if (metadata && !state.decisiveWriterVersions.includes(metadata.writerVersion))
|
|
155
|
+
state.decisiveWriterVersions.push(metadata.writerVersion)
|
|
156
|
+
if (!metadata) state.decisiveLegacyVersionUnavailable = true
|
|
157
|
+
state.decisiveFacts++
|
|
158
|
+
state.decisiveBoundary = event.seq
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Selector folds also consume deliberately compact/adapted rows. Filter their
|
|
164
|
+
* vocabulary here; strict payload projection happens before adaptation at the
|
|
165
|
+
* persisted-read boundary and in the whole-build reduction. */
|
|
166
|
+
export function filterKnownEvents<E>(events: readonly E[]): readonly E[] {
|
|
167
|
+
return events.filter((event) => {
|
|
168
|
+
if (
|
|
169
|
+
!event ||
|
|
170
|
+
typeof event !== 'object' ||
|
|
171
|
+
!('type' in event) ||
|
|
172
|
+
(!('build' in event) && !('repo' in event))
|
|
173
|
+
)
|
|
174
|
+
return true
|
|
175
|
+
const schemas = 'repo' in event ? repositoryEventPayloadSchemas : eventPayloadSchemas
|
|
176
|
+
return typeof event.type === 'string' && Object.hasOwn(schemas, event.type)
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
/** Preserve opaque facts for compatibility-bearing folds after validating all
|
|
180
|
+
* known payloads, before any selector adapts or drops payload fields. */
|
|
181
|
+
export function projectStoredEvents<E extends StoredEvent>(events: readonly E[]): E[] {
|
|
182
|
+
return events.map((event) => (decodeStoredEvent(event) ?? event) as E)
|
|
183
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isAbsolute } from 'node:path'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
const nonblank = z.string().refine((value) => value.trim().length > 0, 'Expected a nonblank string')
|
|
5
|
+
const absolutePath = nonblank.refine(isAbsolute, 'Expected an absolute path')
|
|
6
|
+
export const nativeSessionHandleSchema = z.strictObject({
|
|
7
|
+
version: z.literal(1),
|
|
8
|
+
runner: nonblank,
|
|
9
|
+
nativeId: nonblank,
|
|
10
|
+
host: nonblank,
|
|
11
|
+
workspacePath: absolutePath,
|
|
12
|
+
statePath: absolutePath.optional(),
|
|
13
|
+
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nativeSessionHandleSchema } from './native-session'
|
|
1
2
|
/**
|
|
2
3
|
* The event vocabulary (SPEC §15.3), frozen as schemas — this closes open
|
|
3
4
|
* thread §18.1. It is simultaneously the store schema, the kernel's I/O, the
|
|
@@ -283,6 +284,13 @@ const reviewVerdictPayload = z.strictObject({
|
|
|
283
284
|
})
|
|
284
285
|
|
|
285
286
|
export const eventPayloadSchemas = {
|
|
287
|
+
'build.compatibility-deferred': z.strictObject({
|
|
288
|
+
boundary: z.number().int().positive(),
|
|
289
|
+
types: z.array(z.string().min(1)).min(1),
|
|
290
|
+
writerVersions: z.array(z.string().min(1)),
|
|
291
|
+
legacyVersionUnavailable: z.boolean(),
|
|
292
|
+
diagnostic: z.string().min(1),
|
|
293
|
+
}),
|
|
286
294
|
// ── Build lifecycle ────────────────────────────────────────────────────────
|
|
287
295
|
'build.created': z.strictObject({
|
|
288
296
|
ticket: ticketRefSchema,
|
|
@@ -313,6 +321,34 @@ export const eventPayloadSchemas = {
|
|
|
313
321
|
parent: z.string().min(1),
|
|
314
322
|
sha: z.string().min(1),
|
|
315
323
|
}),
|
|
324
|
+
'node.restack-requested': z
|
|
325
|
+
.strictObject({
|
|
326
|
+
id: z.string().min(1),
|
|
327
|
+
reason: z.enum(['operator', 'presence']),
|
|
328
|
+
branch: z.string().min(1),
|
|
329
|
+
parent: z.string().min(1),
|
|
330
|
+
dependent: ticketRefSchema.optional(),
|
|
331
|
+
identities: z.array(z.string()).optional(),
|
|
332
|
+
})
|
|
333
|
+
.refine(
|
|
334
|
+
(request) =>
|
|
335
|
+
request.reason !== 'presence' ||
|
|
336
|
+
(request.dependent !== undefined &&
|
|
337
|
+
request.identities !== undefined &&
|
|
338
|
+
request.identities.length > 0),
|
|
339
|
+
'presence demand requires a dependent ticket and nonempty identities',
|
|
340
|
+
),
|
|
341
|
+
'node.restack-satisfied': z.strictObject({
|
|
342
|
+
id: z.string().min(1),
|
|
343
|
+
parent: z.string().min(1),
|
|
344
|
+
outcome: z.enum(['covered', 'destination-changed']),
|
|
345
|
+
}),
|
|
346
|
+
'node.parent-distance': z.strictObject({
|
|
347
|
+
base: z.string().min(1),
|
|
348
|
+
parent: z.string().min(1),
|
|
349
|
+
branch: z.string().min(1),
|
|
350
|
+
count: z.number().int().nonnegative().nullable(),
|
|
351
|
+
}),
|
|
316
352
|
'node.parent-requested': parentChange,
|
|
317
353
|
'node.parent-accepted': parentChange,
|
|
318
354
|
'node.parent-pr-retargeted': z.strictObject({ id: z.string().min(1), base: z.string().min(1) }),
|
|
@@ -331,6 +367,7 @@ export const eventPayloadSchemas = {
|
|
|
331
367
|
'node.writer-reserved': z.strictObject({
|
|
332
368
|
id: z.string().min(1),
|
|
333
369
|
operation: z.enum(['restack', 'landing']),
|
|
370
|
+
requests: z.array(z.string().min(1)).optional(),
|
|
334
371
|
expected: z.string().min(1),
|
|
335
372
|
parent: z.string().min(1),
|
|
336
373
|
oldBase: z.string().min(1),
|
|
@@ -368,6 +405,7 @@ export const eventPayloadSchemas = {
|
|
|
368
405
|
dropReason: z.enum(['upstream-identity', 'upstream-commit']).optional(),
|
|
369
406
|
}),
|
|
370
407
|
'node.item-conflicted': z.strictObject({
|
|
408
|
+
files: z.array(z.string()).optional(),
|
|
371
409
|
id: z.string().min(1),
|
|
372
410
|
index: z.number().int().nonnegative(),
|
|
373
411
|
base: z.string().min(1),
|
|
@@ -393,6 +431,7 @@ export const eventPayloadSchemas = {
|
|
|
393
431
|
}),
|
|
394
432
|
'node.inventory': z.strictObject({
|
|
395
433
|
head: z.string().min(1),
|
|
434
|
+
base: z.string().min(1).optional(),
|
|
396
435
|
builds: z.array(z.string()),
|
|
397
436
|
contributions: z.array(z.string()).optional(),
|
|
398
437
|
foreign: z.array(z.string()),
|
|
@@ -402,6 +441,16 @@ export const eventPayloadSchemas = {
|
|
|
402
441
|
openChildren: z.array(z.string()),
|
|
403
442
|
diagnostics: z.array(z.string()),
|
|
404
443
|
contributions: z.array(z.string()),
|
|
444
|
+
children: z
|
|
445
|
+
.array(
|
|
446
|
+
z.strictObject({
|
|
447
|
+
source: z.string(),
|
|
448
|
+
id: z.string(),
|
|
449
|
+
title: z.string().optional(),
|
|
450
|
+
builds: z.array(z.string()).optional(),
|
|
451
|
+
}),
|
|
452
|
+
)
|
|
453
|
+
.optional(),
|
|
405
454
|
}),
|
|
406
455
|
'integration.prepared': z.strictObject({
|
|
407
456
|
id: z.string().min(1),
|
|
@@ -643,6 +692,22 @@ export const eventPayloadSchemas = {
|
|
|
643
692
|
'build.resume-requested': reasonOnly,
|
|
644
693
|
'build.abort-requested': reasonOnly,
|
|
645
694
|
'build.discard-requested': empty,
|
|
695
|
+
'build.janitor-attempt-failed': z.strictObject({
|
|
696
|
+
firstFailureAt: z.iso.datetime(),
|
|
697
|
+
attempt: z.number().int().positive(),
|
|
698
|
+
message: z.string().min(1),
|
|
699
|
+
nextAttemptAt: z.iso.datetime(),
|
|
700
|
+
}),
|
|
701
|
+
'build.janitor-failing': z.strictObject({ message: z.string().min(1) }),
|
|
702
|
+
'build.janitor-recovered': empty,
|
|
703
|
+
'landing.application-failed': z.strictObject({
|
|
704
|
+
candidate: landingCandidateSchema,
|
|
705
|
+
decisionSeq: z.number().int().positive(),
|
|
706
|
+
commandSeq: z.number().int().positive().optional(),
|
|
707
|
+
message: z.string().min(1),
|
|
708
|
+
attempt: z.number().int().positive(),
|
|
709
|
+
after: z.iso.datetime(),
|
|
710
|
+
}),
|
|
646
711
|
'landing.decided': landingDecision,
|
|
647
712
|
'build.hold-requested': empty,
|
|
648
713
|
'build.land-requested': z.strictObject({ decisionSeq: z.number().int().positive() }),
|
|
@@ -665,6 +730,7 @@ export const eventPayloadSchemas = {
|
|
|
665
730
|
decisionSeq: z.number().int().positive().optional(),
|
|
666
731
|
commandSeq: z.number().int().positive().optional(),
|
|
667
732
|
operation: z.string().min(1).optional(),
|
|
733
|
+
publicationHead: z.string().min(1).optional(),
|
|
668
734
|
}),
|
|
669
735
|
'build.auto-merge-requested': autoMergeCommand,
|
|
670
736
|
'build.auto-merge-cancelled': autoMergeCommand,
|
|
@@ -693,6 +759,18 @@ export const eventPayloadSchemas = {
|
|
|
693
759
|
|
|
694
760
|
// ── Sessions (every agent run is bracketed by these) ──────────────────────
|
|
695
761
|
'session.started': z.strictObject({
|
|
762
|
+
/** Write-ahead continuation intent; independent of native acceptance. */
|
|
763
|
+
continuation: z
|
|
764
|
+
.strictObject({
|
|
765
|
+
predecessor: z.string().min(1),
|
|
766
|
+
root: z.string().min(1),
|
|
767
|
+
handle: nativeSessionHandleSchema,
|
|
768
|
+
cause: z.enum(['shutdown', 'pause', 'runner-loss']),
|
|
769
|
+
activeMs: z.number().nonnegative(),
|
|
770
|
+
budgetMs: z.number().positive(),
|
|
771
|
+
})
|
|
772
|
+
.optional(),
|
|
773
|
+
budgetMs: z.number().positive().optional(),
|
|
696
774
|
session: z.string().min(1),
|
|
697
775
|
role: z.string().min(1),
|
|
698
776
|
runner: z.string().min(1),
|
|
@@ -707,10 +785,46 @@ export const eventPayloadSchemas = {
|
|
|
707
785
|
/** Present only when this target substituted for the preceding failed one. */
|
|
708
786
|
substitution: providerSubstitutionSchema.optional(),
|
|
709
787
|
}),
|
|
788
|
+
'session.suspended': z.strictObject({
|
|
789
|
+
session: z.string().min(1),
|
|
790
|
+
phase: phaseSchema,
|
|
791
|
+
round: round.optional(),
|
|
792
|
+
handle: nativeSessionHandleSchema.optional(),
|
|
793
|
+
cause: z.enum(['shutdown', 'pause']),
|
|
794
|
+
activeMs: z.number().nonnegative(),
|
|
795
|
+
transcript: artifactRefSchema,
|
|
796
|
+
usage: z
|
|
797
|
+
.strictObject({
|
|
798
|
+
inputTokens: z.number().int().nonnegative(),
|
|
799
|
+
outputTokens: z.number().int().nonnegative(),
|
|
800
|
+
turns: z.number().int().nonnegative(),
|
|
801
|
+
})
|
|
802
|
+
.optional(),
|
|
803
|
+
}),
|
|
804
|
+
'session.resumed': z.strictObject({
|
|
805
|
+
session: z.string().min(1),
|
|
806
|
+
predecessor: z.string().min(1),
|
|
807
|
+
root: z.string().min(1),
|
|
808
|
+
handle: nativeSessionHandleSchema,
|
|
809
|
+
cause: z.enum(['shutdown', 'pause', 'runner-loss']),
|
|
810
|
+
stale: z.boolean(),
|
|
811
|
+
}),
|
|
812
|
+
'session.resume-fallback': z.strictObject({
|
|
813
|
+
session: z.string().min(1),
|
|
814
|
+
stale: z.boolean().optional(),
|
|
815
|
+
reason: z.string().min(1),
|
|
816
|
+
}),
|
|
817
|
+
'session.native-handle-recorded': z.strictObject({
|
|
818
|
+
session: z.string().min(1),
|
|
819
|
+
phase: phaseSchema,
|
|
820
|
+
round: round.optional(),
|
|
821
|
+
handle: nativeSessionHandleSchema,
|
|
822
|
+
}),
|
|
710
823
|
'session.ended': z.union([
|
|
711
824
|
/** Ordinary completion retains the historical transcript-bearing shape. */
|
|
712
825
|
z.strictObject({
|
|
713
826
|
session: z.string().min(1),
|
|
827
|
+
activeMs: z.number().nonnegative().optional(),
|
|
714
828
|
transcript: artifactRefSchema,
|
|
715
829
|
usage: z.strictObject({
|
|
716
830
|
inputTokens: z.number().int().nonnegative(),
|
|
@@ -857,7 +971,11 @@ export const eventPayloadSchemas = {
|
|
|
857
971
|
}),
|
|
858
972
|
'target.moved': z.strictObject({ branch: z.string().min(1), sha: gitOid }),
|
|
859
973
|
'restack.prepared': leafRestackSchema,
|
|
860
|
-
'restack.replayed': z.strictObject({
|
|
974
|
+
'restack.replayed': z.strictObject({
|
|
975
|
+
id: z.string().min(1),
|
|
976
|
+
conflicted: z.boolean(),
|
|
977
|
+
files: z.array(z.string()).optional(),
|
|
978
|
+
}),
|
|
861
979
|
'restack.publish-intended': leafRestackSchema.extend({ headSha: gitOid }),
|
|
862
980
|
'restack.rewritten': leafRestackSchema.extend({
|
|
863
981
|
headSha: gitOid,
|
|
@@ -881,7 +999,11 @@ export const eventPayloadSchemas = {
|
|
|
881
999
|
request: z.number().int().positive(),
|
|
882
1000
|
actual: gitOid.nullable(),
|
|
883
1001
|
}),
|
|
884
|
-
'reconcile.replayed': z.strictObject({
|
|
1002
|
+
'reconcile.replayed': z.strictObject({
|
|
1003
|
+
id: z.string().min(1),
|
|
1004
|
+
conflicted: z.boolean(),
|
|
1005
|
+
files: z.array(z.string()).optional(),
|
|
1006
|
+
}),
|
|
885
1007
|
'reconcile.publish-intended': reconcileTransactionSchema.extend({
|
|
886
1008
|
headSha: gitOid,
|
|
887
1009
|
conflicted: z.boolean(),
|
|
@@ -931,6 +1053,30 @@ export const eventPayloadSchemas = {
|
|
|
931
1053
|
reviewRoundCeiling: z.number().int().positive().optional(),
|
|
932
1054
|
}),
|
|
933
1055
|
/** Infra failure — distinct from verdicts (a verdict is a fact, not a failure). */
|
|
1056
|
+
'session.build-read-failed': z.strictObject({
|
|
1057
|
+
session: z.string().min(1),
|
|
1058
|
+
phase: phaseSchema,
|
|
1059
|
+
round,
|
|
1060
|
+
operation: z.literal('context'),
|
|
1061
|
+
reason: z.literal('own-build-read'),
|
|
1062
|
+
diagnostic: z.string().trim().min(1),
|
|
1063
|
+
}),
|
|
1064
|
+
'phase.deferred': z.strictObject({
|
|
1065
|
+
session: z.string().min(1),
|
|
1066
|
+
phase: phaseSchema,
|
|
1067
|
+
round,
|
|
1068
|
+
reason: z.literal('own-build-read'),
|
|
1069
|
+
diagnostic: z.string().trim().min(1),
|
|
1070
|
+
}),
|
|
1071
|
+
'phase.deferral-escalated': z.strictObject({
|
|
1072
|
+
session: z.string().min(1),
|
|
1073
|
+
phase: phaseSchema,
|
|
1074
|
+
round,
|
|
1075
|
+
id: z.string().min(1),
|
|
1076
|
+
evidenceSeq: z.number().int().positive(),
|
|
1077
|
+
question: z.string().min(1),
|
|
1078
|
+
refs: z.array(z.string()),
|
|
1079
|
+
}),
|
|
934
1080
|
'phase.failed': z.strictObject({
|
|
935
1081
|
phase: phaseSchema,
|
|
936
1082
|
round: round.optional(),
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/** Exhaustive producer policy. New semantic control facts must be decisive. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
import type { EventType } from './payloads'
|
|
4
|
+
import type { RepositoryEventType } from './repository'
|
|
5
|
+
import { AUTOBUILD_VERSION } from '../store/remote/version'
|
|
6
|
+
export type FactClassification = 'advisory' | 'decisive'
|
|
7
|
+
export const compatibilityMetadataSchema = z.strictObject({
|
|
8
|
+
writerVersion: z.string().min(1),
|
|
9
|
+
classification: z.enum(['advisory', 'decisive']),
|
|
10
|
+
})
|
|
11
|
+
export type CompatibilityMetadata = z.infer<typeof compatibilityMetadataSchema>
|
|
12
|
+
export const buildEventPolicy = {
|
|
13
|
+
'build.compatibility-deferred': 'advisory',
|
|
14
|
+
'build.janitor-attempt-failed': 'decisive',
|
|
15
|
+
'build.janitor-recovered': 'decisive',
|
|
16
|
+
'build.janitor-failing': 'advisory',
|
|
17
|
+
'landing.application-failed': 'decisive',
|
|
18
|
+
'landing.decided': 'decisive',
|
|
19
|
+
'build.hold-requested': 'decisive',
|
|
20
|
+
'build.land-requested': 'decisive',
|
|
21
|
+
'landing.command-acknowledged': 'decisive',
|
|
22
|
+
'landing.native-enable-started': 'decisive',
|
|
23
|
+
'landing.forge-merged': 'decisive',
|
|
24
|
+
'landing.native-applied': 'decisive',
|
|
25
|
+
'target.moved': 'decisive',
|
|
26
|
+
'restack.prepared': 'decisive',
|
|
27
|
+
'restack.replayed': 'decisive',
|
|
28
|
+
'restack.publish-intended': 'decisive',
|
|
29
|
+
'restack.rewritten': 'decisive',
|
|
30
|
+
'restack.contended': 'decisive',
|
|
31
|
+
'restack.completed': 'decisive',
|
|
32
|
+
'integration.abandoned': 'decisive',
|
|
33
|
+
'integration.observed': 'decisive',
|
|
34
|
+
'integration.prepared': 'decisive',
|
|
35
|
+
'integration.landing-intended': 'decisive',
|
|
36
|
+
'integration.landed': 'decisive',
|
|
37
|
+
'integration.audited': 'decisive',
|
|
38
|
+
'node.restack-requested': 'decisive',
|
|
39
|
+
'node.restack-satisfied': 'decisive',
|
|
40
|
+
'node.parent-distance': 'advisory',
|
|
41
|
+
'node.parent-requested': 'decisive',
|
|
42
|
+
'node.parent-accepted': 'decisive',
|
|
43
|
+
'node.parent-pr-retargeted': 'decisive',
|
|
44
|
+
'node.parent-completed': 'decisive',
|
|
45
|
+
'node.parent-cancelled': 'decisive',
|
|
46
|
+
'node.parent-rejection-cleared': 'decisive',
|
|
47
|
+
'node.parent-rejected': 'decisive',
|
|
48
|
+
'node.opening': 'decisive',
|
|
49
|
+
'node.writer-reserved': 'decisive',
|
|
50
|
+
'node.item-prepared': 'decisive',
|
|
51
|
+
'node.item-replayed': 'decisive',
|
|
52
|
+
'node.item-conflicted': 'decisive',
|
|
53
|
+
'node.publish-intended': 'decisive',
|
|
54
|
+
'node.rewritten': 'decisive',
|
|
55
|
+
'node.writer-settled': 'decisive',
|
|
56
|
+
'node.contribution-recorded': 'decisive',
|
|
57
|
+
'node.inventory': 'decisive',
|
|
58
|
+
'node.opened': 'decisive',
|
|
59
|
+
'node.compared': 'decisive',
|
|
60
|
+
'pr.opened': 'decisive',
|
|
61
|
+
'build.created': 'decisive',
|
|
62
|
+
'build.completed': 'decisive',
|
|
63
|
+
'runner.attached': 'decisive',
|
|
64
|
+
'runner.setup-failed': 'decisive',
|
|
65
|
+
'workspace.provisioned': 'decisive',
|
|
66
|
+
'workspace.provision-started': 'decisive',
|
|
67
|
+
'workspace.released': 'decisive',
|
|
68
|
+
'execution.started': 'decisive',
|
|
69
|
+
'execution.ended': 'decisive',
|
|
70
|
+
'infrastructure.failed': 'decisive',
|
|
71
|
+
'infrastructure.cleanup-attempted': 'decisive',
|
|
72
|
+
'pr-summary.requested': 'decisive',
|
|
73
|
+
'pr-summary.attempted': 'advisory',
|
|
74
|
+
'pr-summary.result': 'advisory',
|
|
75
|
+
'pr-summary.settled': 'advisory',
|
|
76
|
+
'finalize.step-started': 'decisive',
|
|
77
|
+
'publication.requested': 'decisive',
|
|
78
|
+
'publication.lost': 'decisive',
|
|
79
|
+
'abort.remote-branch-deleted': 'decisive',
|
|
80
|
+
'abort.local-branch-deleted': 'decisive',
|
|
81
|
+
'abort.ticket-returned': 'decisive',
|
|
82
|
+
'dispatch.failed': 'decisive',
|
|
83
|
+
'dispatch.comment-posted': 'advisory',
|
|
84
|
+
'build.pause-requested': 'decisive',
|
|
85
|
+
'build.resume-requested': 'decisive',
|
|
86
|
+
'build.abort-requested': 'decisive',
|
|
87
|
+
'build.discard-requested': 'decisive',
|
|
88
|
+
'build.auto-merge-requested': 'decisive',
|
|
89
|
+
'build.auto-merge-cancelled': 'decisive',
|
|
90
|
+
'build.auto-merge-default-observed': 'decisive',
|
|
91
|
+
'build.paused': 'decisive',
|
|
92
|
+
'build.resumed': 'decisive',
|
|
93
|
+
'build.aborted': 'decisive',
|
|
94
|
+
'spec.imported': 'decisive',
|
|
95
|
+
'spec.authored': 'decisive',
|
|
96
|
+
'spec.revised': 'decisive',
|
|
97
|
+
'session.suspended': 'decisive',
|
|
98
|
+
'session.resumed': 'decisive',
|
|
99
|
+
'session.resume-fallback': 'advisory',
|
|
100
|
+
'session.started': 'decisive',
|
|
101
|
+
'session.native-handle-recorded': 'advisory',
|
|
102
|
+
'session.ended': 'decisive',
|
|
103
|
+
'plan.started': 'decisive',
|
|
104
|
+
'plan.completed': 'decisive',
|
|
105
|
+
'plan-review.started': 'decisive',
|
|
106
|
+
'plan-review.verdict': 'decisive',
|
|
107
|
+
'implement.started': 'decisive',
|
|
108
|
+
'implement.completed': 'decisive',
|
|
109
|
+
'code-review.started': 'decisive',
|
|
110
|
+
'code-review.verdict': 'decisive',
|
|
111
|
+
'verify.reconcile-policy-captured': 'decisive',
|
|
112
|
+
'verify.started': 'decisive',
|
|
113
|
+
'verify.completed': 'decisive',
|
|
114
|
+
'finalize.started': 'decisive',
|
|
115
|
+
'finalize.completed': 'decisive',
|
|
116
|
+
'finalize.step-completed': 'decisive',
|
|
117
|
+
'pr-attachment.designated': 'decisive',
|
|
118
|
+
'pr-attachment.hosted': 'decisive',
|
|
119
|
+
'pr-attachment.reclaimed': 'decisive',
|
|
120
|
+
'pr-attachment.reclaim-failed': 'advisory',
|
|
121
|
+
'pr.auto-merge-enabled': 'decisive',
|
|
122
|
+
'pr.auto-merge-disabled': 'decisive',
|
|
123
|
+
'pr.merged': 'decisive',
|
|
124
|
+
'pr.closed': 'decisive',
|
|
125
|
+
'pr.conflicted': 'decisive',
|
|
126
|
+
'reconcile.progress-checked': 'decisive',
|
|
127
|
+
'reconcile.started': 'decisive',
|
|
128
|
+
'reconcile.prepared': 'decisive',
|
|
129
|
+
'reconcile.contended': 'decisive',
|
|
130
|
+
'reconcile.replayed': 'decisive',
|
|
131
|
+
'reconcile.publish-intended': 'decisive',
|
|
132
|
+
'reconcile.rewritten': 'decisive',
|
|
133
|
+
'reconcile.completed': 'decisive',
|
|
134
|
+
'observation.recorded': 'advisory',
|
|
135
|
+
'escalation.raised': 'decisive',
|
|
136
|
+
'escalation.answered': 'decisive',
|
|
137
|
+
'phase.failed': 'decisive',
|
|
138
|
+
'session.build-read-failed': 'decisive',
|
|
139
|
+
'phase.deferred': 'decisive',
|
|
140
|
+
'phase.deferral-escalated': 'decisive',
|
|
141
|
+
} satisfies Record<EventType, FactClassification>
|
|
142
|
+
export const repositoryEventPolicy = {
|
|
143
|
+
'change-presence.observed': 'decisive',
|
|
144
|
+
'harvest.pause-requested': 'decisive',
|
|
145
|
+
'harvest.resume-requested': 'decisive',
|
|
146
|
+
'harvest.paused': 'decisive',
|
|
147
|
+
'harvest.resumed': 'decisive',
|
|
148
|
+
'harvest.recovery-requested': 'decisive',
|
|
149
|
+
'harvest.recovery-exhausted': 'decisive',
|
|
150
|
+
'harvest.started': 'decisive',
|
|
151
|
+
'harvest.execution.authorized': 'decisive',
|
|
152
|
+
'harvest.execution.ended': 'decisive',
|
|
153
|
+
'harvest.execution.started': 'decisive',
|
|
154
|
+
'harvest.execution.released': 'decisive',
|
|
155
|
+
'harvest.step.started': 'decisive',
|
|
156
|
+
'harvest.step.completed': 'decisive',
|
|
157
|
+
'harvest.session.started': 'decisive',
|
|
158
|
+
'harvest.session.ended': 'decisive',
|
|
159
|
+
'harvest.proposals.submitted': 'decisive',
|
|
160
|
+
'harvest.review.verdict': 'decisive',
|
|
161
|
+
'harvest.proposal.id-reserved': 'decisive',
|
|
162
|
+
'harvest.proposal.filed': 'decisive',
|
|
163
|
+
'harvest.completed': 'decisive',
|
|
164
|
+
'harvest.escalated': 'decisive',
|
|
165
|
+
'harvest.failed': 'decisive',
|
|
166
|
+
'orchestrator.sandbox.provisioned': 'decisive',
|
|
167
|
+
'orchestrator.sandbox.resumed': 'decisive',
|
|
168
|
+
'orchestrator.sandbox.activity': 'advisory',
|
|
169
|
+
'orchestrator.sandbox.stopped': 'decisive',
|
|
170
|
+
'orchestrator.sandbox.released': 'decisive',
|
|
171
|
+
'orchestrator.sandbox.reset': 'decisive',
|
|
172
|
+
'orchestrator.sandbox.published': 'decisive',
|
|
173
|
+
'orchestrator.sandbox.publish-failed': 'decisive',
|
|
174
|
+
'dispatcher.run-started': 'decisive',
|
|
175
|
+
'dispatcher.stop-requested': 'decisive',
|
|
176
|
+
'dispatcher.run-stopped': 'decisive',
|
|
177
|
+
'dispatcher.tick-yielded': 'advisory',
|
|
178
|
+
'dispatcher.config-rejected': 'advisory',
|
|
179
|
+
'dispatcher.forge-readiness-failed': 'advisory',
|
|
180
|
+
'dispatcher.config-publication-failed': 'advisory',
|
|
181
|
+
'dispatcher.tick-started': 'decisive',
|
|
182
|
+
'dispatcher.tick-completed': 'advisory',
|
|
183
|
+
'dispatcher.ticket-scan-completed': 'advisory',
|
|
184
|
+
'dispatcher.ticket-source-dependency-limited': 'decisive',
|
|
185
|
+
'dispatcher.forge-degraded': 'decisive',
|
|
186
|
+
'dispatcher.forge-recovered': 'decisive',
|
|
187
|
+
'dispatcher.ticket-source-degraded': 'decisive',
|
|
188
|
+
'dispatcher.ticket-source-recovered': 'decisive',
|
|
189
|
+
'dispatcher.tick-failed': 'decisive',
|
|
190
|
+
'dispatcher.runner-settled': 'decisive',
|
|
191
|
+
'dispatcher.harvest-runner-failed': 'decisive',
|
|
192
|
+
'dispatcher.upgrade-available': 'advisory',
|
|
193
|
+
'dispatcher.operator-reported': 'advisory',
|
|
194
|
+
'dispatcher.config-reloaded': 'decisive',
|
|
195
|
+
'dispatcher.intake-set': 'decisive',
|
|
196
|
+
'dispatcher.pause-set': 'decisive',
|
|
197
|
+
'dispatcher.auto-merge-default-set': 'decisive',
|
|
198
|
+
} satisfies Record<RepositoryEventType, FactClassification>
|
|
199
|
+
|
|
200
|
+
export function stampCompatibility(
|
|
201
|
+
classification: FactClassification,
|
|
202
|
+
supplied?: unknown,
|
|
203
|
+
): CompatibilityMetadata {
|
|
204
|
+
if (supplied === undefined) return { writerVersion: AUTOBUILD_VERSION, classification }
|
|
205
|
+
const metadata = compatibilityMetadataSchema.parse(supplied)
|
|
206
|
+
if (metadata.classification !== classification)
|
|
207
|
+
throw new Error('event compatibility classification disagrees with catalog')
|
|
208
|
+
return metadata
|
|
209
|
+
}
|