@defrex/autobuild 1.7.0 → 1.8.1
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 +316 -47
- package/docs/answering-blocked-builds.md +44 -3
- package/docs/architecture.md +62 -7
- package/docs/cli.md +1 -0
- package/docs/configuration-overview.md +1 -1
- package/docs/configuration.md +49 -9
- package/docs/dispatcher.md +1 -1
- 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 +26 -5
- package/docs/operator-surfaces.md +10 -0
- package/docs/plugin-authoring.md +1 -1
- package/docs/remote-store-protocol.md +9 -1
- package/docs/restacking.md +23 -4
- package/docs/ticket-dependencies.md +9 -4
- package/docs/tickets.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/package.json +3 -3
- package/packages/core/src/cli/attention.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/help.ts +69 -7
- 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/status.ts +178 -12
- package/packages/core/src/cli/terminals.ts +197 -4
- package/packages/core/src/cli/wait.ts +1 -0
- package/packages/core/src/cli/watch.ts +71 -0
- package/packages/core/src/config/landing.ts +12 -0
- package/packages/core/src/config/path-selectors.ts +68 -0
- package/packages/core/src/config/schema.ts +40 -58
- package/packages/core/src/events/catalog.ts +17 -3
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/head-paths-limits.ts +25 -0
- package/packages/core/src/events/payloads.ts +315 -20
- package/packages/core/src/events/policy.ts +21 -0
- package/packages/core/src/events/repository.ts +30 -1
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +247 -6
- 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/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-base.ts +34 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +22 -2
- package/packages/core/src/kernel/log-index.ts +27 -1
- 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 +28 -1
- package/packages/core/src/kernel/reducer-registry.ts +22 -1
- package/packages/core/src/kernel/reducer.ts +316 -17
- 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 +12 -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 +15 -2
- package/packages/core/src/operator/registry.ts +97 -5
- package/packages/core/src/operator/repository-events.ts +67 -0
- package/packages/core/src/ports/tickets/fake.ts +5 -0
- package/packages/core/src/ports/types.ts +3 -2
- package/packages/core/src/processes/build-execution-state.ts +30 -1
- package/packages/core/src/processes/build-runner.ts +150 -18
- package/packages/core/src/processes/dispatcher.ts +739 -97
- package/packages/core/src/processes/execution-no-progress.ts +22 -2
- 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/store/digest.ts +41 -2
- package/packages/core/src/store/reduced-reads.ts +4 -1
- package/packages/core/src/store/reducer-value-shapes.json +10108 -8432
- package/packages/core/src/store/remote/client.ts +28 -2
- package/packages/core/src/store/remote/protocol.ts +11 -1
- package/packages/core/src/store/remote/released-clients.json +22 -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 +2 -0
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/store/types.ts +16 -0
- package/packages/core/src/testing/reduced-read-budget.ts +347 -0
- package/skills/code-review/SKILL.md +8 -0
- package/skills/finalize/SKILL.md +4 -0
- package/skills/guide/SKILL.md +125 -26
- 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 +26 -5
- package/skills/guide/references/plugin-authoring.md +1 -1
- package/skills/guide/references/remote-store-protocol.md +9 -1
- package/skills/guide/references/restacking.md +23 -4
- package/skills/guide/references/ticket-dependencies.md +9 -4
- package/skills/implement/SKILL.md +15 -1
- package/skills/operate/SKILL.md +104 -13
- 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 +5 -4
- package/templates/hosted-service/package.json +2 -2
|
@@ -65,6 +65,14 @@ import {
|
|
|
65
65
|
type PersistenceObservation,
|
|
66
66
|
} from './attention'
|
|
67
67
|
import type { BuildState, PrLifecycle } from '../kernel/reducer'
|
|
68
|
+
import {
|
|
69
|
+
ticketWaitStatus,
|
|
70
|
+
waitEndedText,
|
|
71
|
+
waitingOnLine,
|
|
72
|
+
waitRefusedText,
|
|
73
|
+
waitRequestedText,
|
|
74
|
+
type TicketWaitStatus,
|
|
75
|
+
} from '../kernel/ticket-wait'
|
|
68
76
|
import { buildReducer } from '../kernel/reducer'
|
|
69
77
|
import type { BuildOutcome, BuildStatus, Phase } from '../ontology'
|
|
70
78
|
import type { Exec } from '../ports/workspace/git-worktree'
|
|
@@ -120,6 +128,7 @@ export const BUILD_ATTENTION_EVENTS = [
|
|
|
120
128
|
'integration.landed',
|
|
121
129
|
'integration.verification-failed',
|
|
122
130
|
'node.item-conflicted',
|
|
131
|
+
'landing.consent-revoked',
|
|
123
132
|
] as const satisfies readonly EventType[]
|
|
124
133
|
|
|
125
134
|
// ── Glob compilation and matching ────────────────────────────────────────────
|
|
@@ -317,6 +326,8 @@ export interface WatchRecordState {
|
|
|
317
326
|
pr: { number: number; url: string; headSha: string } | null
|
|
318
327
|
prState: PrLifecycle | null
|
|
319
328
|
outcome: BuildOutcome | null
|
|
329
|
+
/** The ticket wait while requested, open, or ended and not yet resumed. */
|
|
330
|
+
wait?: TicketWaitStatus
|
|
320
331
|
}
|
|
321
332
|
|
|
322
333
|
/** Lease-expiry evidence is an observation, never a fabricated journal event. */
|
|
@@ -382,6 +393,7 @@ export interface WatchRecord {
|
|
|
382
393
|
}
|
|
383
394
|
|
|
384
395
|
function projectState(state: BuildState): WatchRecordState {
|
|
396
|
+
const wait = ticketWaitStatus(state)
|
|
385
397
|
return {
|
|
386
398
|
status: state.status,
|
|
387
399
|
phase: state.phase ?? null,
|
|
@@ -403,6 +415,7 @@ function projectState(state: BuildState): WatchRecordState {
|
|
|
403
415
|
pr: state.pr ?? null,
|
|
404
416
|
prState: state.prState ?? null,
|
|
405
417
|
outcome: state.outcome ?? null,
|
|
418
|
+
...(wait !== undefined ? { wait } : {}),
|
|
406
419
|
}
|
|
407
420
|
}
|
|
408
421
|
|
|
@@ -441,6 +454,13 @@ const SUMMARY_MAX = 200
|
|
|
441
454
|
*/
|
|
442
455
|
export function summarizeEvent(event: AbEvent | RepositoryEvent, state: BuildState | null): string {
|
|
443
456
|
switch (event.type) {
|
|
457
|
+
case 'landing.consent-revoked': {
|
|
458
|
+
const p = event.payload
|
|
459
|
+
const more = p.paths.total - p.paths.preview.length
|
|
460
|
+
return singleLine(
|
|
461
|
+
`Merge consent revoked for ${event.build}: reconcile edited files protected by merge[${p.rule.index}] (${p.paths.preview.join(', ')}${more > 0 ? `, +${more} more` : ''}); head ${p.previousHead} → ${p.head}; re-review and run ab merge ${event.build}`,
|
|
462
|
+
)
|
|
463
|
+
}
|
|
444
464
|
case 'target.rewritten':
|
|
445
465
|
return `Upstream rewrite on ${event.payload.branch}: ${event.payload.previousSha} → ${event.payload.sha}; automatic adoption withheld`
|
|
446
466
|
case 'verify.cancelled':
|
|
@@ -461,6 +481,16 @@ export function summarizeEvent(event: AbEvent | RepositoryEvent, state: BuildSta
|
|
|
461
481
|
return `Forge recovered: ${event.payload.forge}`
|
|
462
482
|
case 'forge.credential-limited':
|
|
463
483
|
return `Forge request limited for ${event.payload.process} (${event.payload.credential}${event.payload.missingCredential ? `: ${singleLine(event.payload.missingCredential)}` : ''}); reset ${event.payload.resetAt}; dispatcher forge work continues`
|
|
484
|
+
case 'ticket.handed-back': {
|
|
485
|
+
const p = event.payload
|
|
486
|
+
const details = [
|
|
487
|
+
`${p.cause}${p.build !== undefined ? ` of build ${p.build}` : ''}`,
|
|
488
|
+
...(p.requested !== undefined ? [`requested ${p.requested}`] : []),
|
|
489
|
+
...(p.missing !== undefined ? [`missing: ${p.missing.join('; ')}`] : []),
|
|
490
|
+
...(p.reason !== undefined ? [`reason: ${p.reason}`] : []),
|
|
491
|
+
]
|
|
492
|
+
return singleLine(`ticket ${p.ticket.id} handed back to ${p.state} (${details.join('; ')})`)
|
|
493
|
+
}
|
|
464
494
|
case 'dispatcher.kernel-git-unavailable':
|
|
465
495
|
return `Kernel Git unavailable (${event.payload.executable}): ${singleLine(event.payload.detail)}`
|
|
466
496
|
case 'dispatcher.kernel-git-recovered':
|
|
@@ -471,6 +501,47 @@ export function summarizeEvent(event: AbEvent | RepositoryEvent, state: BuildSta
|
|
|
471
501
|
return `${event.payload.id}: ${singleLine(event.payload.question)}`
|
|
472
502
|
case 'build.compatibility-deferred':
|
|
473
503
|
return event.payload.diagnostic
|
|
504
|
+
case 'wait.requested':
|
|
505
|
+
return singleLine(waitRequestedText(event.payload.tickets, event.payload.reason))
|
|
506
|
+
case 'wait.refused':
|
|
507
|
+
return singleLine(
|
|
508
|
+
waitRefusedText(event.payload.tickets, event.payload.cause, event.payload.message),
|
|
509
|
+
)
|
|
510
|
+
case 'wait.entered':
|
|
511
|
+
return singleLine(
|
|
512
|
+
waitingOnLine(
|
|
513
|
+
event.payload.tickets.map((ticket) => ticket.id),
|
|
514
|
+
event.payload.reason,
|
|
515
|
+
),
|
|
516
|
+
)
|
|
517
|
+
case 'wait.ended':
|
|
518
|
+
return singleLine(
|
|
519
|
+
waitEndedText(
|
|
520
|
+
{
|
|
521
|
+
id: event.payload.id,
|
|
522
|
+
tickets:
|
|
523
|
+
state?.wait?.id === event.payload.id
|
|
524
|
+
? state.wait.tickets.map((ticket) => ticket.id)
|
|
525
|
+
: undefined,
|
|
526
|
+
},
|
|
527
|
+
event.payload.cause,
|
|
528
|
+
event.payload.message,
|
|
529
|
+
),
|
|
530
|
+
)
|
|
531
|
+
case 'escalation.answered': {
|
|
532
|
+
// An operator answer to a wait's escalation is how that wait usually
|
|
533
|
+
// ends; the post-event state says whether this answer ended it.
|
|
534
|
+
const wait = state?.wait
|
|
535
|
+
if (wait?.escalation === event.payload.id && wait.ended?.seq === event.seq)
|
|
536
|
+
return singleLine(
|
|
537
|
+
waitEndedText(
|
|
538
|
+
{ id: wait.id, tickets: wait.tickets.map((ticket) => ticket.id) },
|
|
539
|
+
'operator',
|
|
540
|
+
event.payload.answer,
|
|
541
|
+
),
|
|
542
|
+
)
|
|
543
|
+
return summarizePayload(event.payload)
|
|
544
|
+
}
|
|
474
545
|
case 'phase.failed':
|
|
475
546
|
return `${event.payload.phase}${
|
|
476
547
|
event.payload.round !== undefined ? ` r${event.payload.round}` : ''
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
import { documentFields } from './reference-metadata'
|
|
3
|
+
import { pathSelectorSchema } from './path-selectors'
|
|
3
4
|
|
|
4
5
|
/** Ordered dispatcher-owned policy; omitted predicates are wildcards. */
|
|
5
6
|
export const landingRuleSchema = z.strictObject({
|
|
@@ -18,6 +19,14 @@ export const landingRuleSchema = z.strictObject({
|
|
|
18
19
|
'label must be nonblank (labels match exactly, including case)',
|
|
19
20
|
)
|
|
20
21
|
.optional(),
|
|
22
|
+
paths: z
|
|
23
|
+
.array(pathSelectorSchema)
|
|
24
|
+
.min(1, 'paths must contain at least one repository-relative glob')
|
|
25
|
+
.optional(),
|
|
26
|
+
within: z
|
|
27
|
+
.array(pathSelectorSchema)
|
|
28
|
+
.min(1, 'within must contain at least one repository-relative glob')
|
|
29
|
+
.optional(),
|
|
21
30
|
mode: z.enum(['auto', 'consent']),
|
|
22
31
|
})
|
|
23
32
|
export type LandingRule = z.infer<typeof landingRuleSchema>
|
|
@@ -26,5 +35,8 @@ documentFields(landingRuleSchema, {
|
|
|
26
35
|
into: 'Optional destination: `root`, any `node`, or an exact frozen destination node ticket id.',
|
|
27
36
|
from: 'Restrict this rule to one source build kind; omission matches all kinds.',
|
|
28
37
|
label: 'Optional exact, case-sensitive label on the source ticket. Blank labels are invalid.',
|
|
38
|
+
paths:
|
|
39
|
+
'Match when at least one changed path matches a selector. Same glob grammar and case sensitivity as `[verify.<step>].paths`.',
|
|
40
|
+
within: 'Match when every changed path matches a selector and at least one path changed.',
|
|
29
41
|
mode: 'Choose automatic merge or require recorded consent.',
|
|
30
42
|
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { documentSchema } from './reference-metadata'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The intentionally small path-selector grammar (§16.1): positive,
|
|
6
|
+
* repository-relative globs with literal characters, `*`, `?`, and `**` only
|
|
7
|
+
* as a complete path segment. Reject every ambiguous/unsafe form at config
|
|
8
|
+
* load rather than allowing a typo to become a never-running safety gate.
|
|
9
|
+
*/
|
|
10
|
+
export function pathSelectorError(pattern: string): string | undefined {
|
|
11
|
+
if (pattern.length === 0) return 'path selectors must be nonempty'
|
|
12
|
+
if (pattern.includes('\0')) return 'path selectors must not contain NUL bytes'
|
|
13
|
+
if (pattern.startsWith('/') || /^[A-Za-z]:\//.test(pattern)) {
|
|
14
|
+
return 'path selectors must be repository-relative, not absolute'
|
|
15
|
+
}
|
|
16
|
+
if (pattern.includes('\\')) {
|
|
17
|
+
return 'path selectors use Git-style "/" separators; backslashes and escapes are unsupported'
|
|
18
|
+
}
|
|
19
|
+
if (pattern.startsWith('!')) {
|
|
20
|
+
return 'path selectors are positive globs; negation is unsupported'
|
|
21
|
+
}
|
|
22
|
+
if (/[[\]{}]/.test(pattern)) {
|
|
23
|
+
return 'path selectors support only literal characters, *, ?, and whole-segment **; character classes and brace expansion are unsupported'
|
|
24
|
+
}
|
|
25
|
+
if (/[?*+@!]\(/.test(pattern)) {
|
|
26
|
+
return 'path selectors support only literal characters, *, ?, and whole-segment **; extglobs are unsupported'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const segments = pattern.split('/')
|
|
30
|
+
if (segments.some((segment) => segment.length === 0)) {
|
|
31
|
+
return 'path selectors must not contain empty path segments'
|
|
32
|
+
}
|
|
33
|
+
if (segments.some((segment) => segment === '.' || segment === '..')) {
|
|
34
|
+
return 'path selectors must not contain "." or ".." traversal segments'
|
|
35
|
+
}
|
|
36
|
+
if (segments.some((segment) => segment.includes('**') && segment !== '**')) {
|
|
37
|
+
return 'the ** wildcard must occupy a complete path segment'
|
|
38
|
+
}
|
|
39
|
+
return undefined
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const pathSelectorSchema = z.string().superRefine((pattern, ctx) => {
|
|
43
|
+
const message = pathSelectorError(pattern)
|
|
44
|
+
if (message !== undefined) ctx.addIssue({ code: 'custom', message })
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
documentSchema(pathSelectorSchema, {
|
|
48
|
+
constraints:
|
|
49
|
+
'Positive repository-relative globs with literal characters, *, ?, and whole-segment ** only. No NUL, absolute paths, backslashes, negation, empty or traversal segments, character classes, brace expansion or extglobs.',
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Compile validated selectors into one any-match predicate. Fail-closed for
|
|
54
|
+
* direct callers: Bun.Glob is never asked to interpret syntax outside the
|
|
55
|
+
* documented subset. Matching is case-sensitive.
|
|
56
|
+
*/
|
|
57
|
+
export function compilePathSelectors(
|
|
58
|
+
selectors: readonly string[],
|
|
59
|
+
describe: (selector: string, error: string) => string = (selector, error) =>
|
|
60
|
+
`invalid path selector ${JSON.stringify(selector)}: ${error}`,
|
|
61
|
+
): (path: string) => boolean {
|
|
62
|
+
for (const selector of selectors) {
|
|
63
|
+
const error = pathSelectorError(selector)
|
|
64
|
+
if (error !== undefined) throw new Error(describe(selector, error))
|
|
65
|
+
}
|
|
66
|
+
const globs = selectors.map((selector) => new Bun.Glob(selector))
|
|
67
|
+
return (path) => globs.some((glob) => glob.match(path))
|
|
68
|
+
}
|
|
@@ -16,6 +16,7 @@ import { isSafeStepName } from '../context-directory'
|
|
|
16
16
|
import { z } from 'zod'
|
|
17
17
|
import { documentSchema, documentFields } from './reference-metadata'
|
|
18
18
|
import { landingRuleSchema } from './landing'
|
|
19
|
+
import { pathSelectorSchema } from './path-selectors'
|
|
19
20
|
export { landingRuleSchema, type LandingRule } from './landing'
|
|
20
21
|
import { normalizeServiceURL } from '../connection'
|
|
21
22
|
import { holdsState, ticketLifecycle } from '../ports/tickets/lifecycle'
|
|
@@ -441,67 +442,28 @@ export const BUILTIN_WORKSPACE_PROVIDER_CONFIG: ReadonlyMap<
|
|
|
441
442
|
|
|
442
443
|
export const commandsSchema = openMap(
|
|
443
444
|
'[commands]',
|
|
444
|
-
documentSchema(z.string().min(1), {
|
|
445
|
+
documentSchema(z.string().min(1), {
|
|
446
|
+
description: 'Named deterministic shell command.',
|
|
447
|
+
}),
|
|
445
448
|
)
|
|
446
449
|
export type Commands = z.infer<typeof commandsSchema>
|
|
447
450
|
|
|
448
451
|
// ── [verify.<step>] ──────────────────────────────────────────────────────────
|
|
449
452
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
* load rather than allowing a typo to become a never-running safety gate.
|
|
455
|
-
*/
|
|
456
|
-
export function verifyPathGlobError(pattern: string): string | undefined {
|
|
457
|
-
if (pattern.length === 0) return 'path selectors must be nonempty'
|
|
458
|
-
if (pattern.includes('\0')) return 'path selectors must not contain NUL bytes'
|
|
459
|
-
if (pattern.startsWith('/') || /^[A-Za-z]:\//.test(pattern)) {
|
|
460
|
-
return 'path selectors must be repository-relative, not absolute'
|
|
461
|
-
}
|
|
462
|
-
if (pattern.includes('\\')) {
|
|
463
|
-
return 'path selectors use Git-style "/" separators; backslashes and escapes are unsupported'
|
|
464
|
-
}
|
|
465
|
-
if (pattern.startsWith('!')) {
|
|
466
|
-
return 'path selectors are positive globs; negation is unsupported'
|
|
467
|
-
}
|
|
468
|
-
if (/[[\]{}]/.test(pattern)) {
|
|
469
|
-
return 'path selectors support only literal characters, *, ?, and whole-segment **; character classes and brace expansion are unsupported'
|
|
470
|
-
}
|
|
471
|
-
if (/[?*+@!]\(/.test(pattern)) {
|
|
472
|
-
return 'path selectors support only literal characters, *, ?, and whole-segment **; extglobs are unsupported'
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
const segments = pattern.split('/')
|
|
476
|
-
if (segments.some((segment) => segment.length === 0)) {
|
|
477
|
-
return 'path selectors must not contain empty path segments'
|
|
478
|
-
}
|
|
479
|
-
if (segments.some((segment) => segment === '.' || segment === '..')) {
|
|
480
|
-
return 'path selectors must not contain "." or ".." traversal segments'
|
|
481
|
-
}
|
|
482
|
-
if (segments.some((segment) => segment.includes('**') && segment !== '**')) {
|
|
483
|
-
return 'the ** wildcard must occupy a complete path segment'
|
|
484
|
-
}
|
|
485
|
-
return undefined
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
export const verifyPathGlobSchema = z.string().superRefine((pattern, ctx) => {
|
|
489
|
-
const message = verifyPathGlobError(pattern)
|
|
490
|
-
if (message !== undefined) ctx.addIssue({ code: 'custom', message })
|
|
491
|
-
})
|
|
492
|
-
|
|
493
|
-
documentSchema(verifyPathGlobSchema, {
|
|
494
|
-
constraints:
|
|
495
|
-
'Positive repository-relative globs with literal characters, *, ?, and whole-segment ** only. No NUL, absolute paths, backslashes, negation, empty or traversal segments, character classes, brace expansion or extglobs.',
|
|
496
|
-
})
|
|
453
|
+
export {
|
|
454
|
+
pathSelectorError as verifyPathGlobError,
|
|
455
|
+
pathSelectorSchema as verifyPathGlobSchema,
|
|
456
|
+
} from './path-selectors'
|
|
497
457
|
|
|
498
458
|
const verifyApplicabilityShape = {
|
|
499
459
|
/** Absence preserves historical serialized configuration identity. */
|
|
500
|
-
failFast: documentSchema(z.boolean().optional(), {
|
|
460
|
+
failFast: documentSchema(z.boolean().optional(), {
|
|
461
|
+
default: 'false (omission is preserved)',
|
|
462
|
+
}),
|
|
501
463
|
afterReconcile: z.boolean().optional(),
|
|
502
464
|
/** Any-match positive path selectors; absent means unconditional. */
|
|
503
465
|
paths: z
|
|
504
|
-
.array(
|
|
466
|
+
.array(pathSelectorSchema)
|
|
505
467
|
.min(1, 'paths must contain at least one repository-relative glob')
|
|
506
468
|
.optional(),
|
|
507
469
|
/** Explicit mandatory-gate guard: true takes precedence over paths and a
|
|
@@ -585,7 +547,9 @@ export const verifySectionSchema = stepSection(
|
|
|
585
547
|
stepConfigs,
|
|
586
548
|
afterReconcile,
|
|
587
549
|
...(entries.some(Array.isArray)
|
|
588
|
-
? {
|
|
550
|
+
? {
|
|
551
|
+
stages: entries.map((entry) => (typeof entry === 'string' ? [entry] : entry)),
|
|
552
|
+
}
|
|
589
553
|
: {}),
|
|
590
554
|
}),
|
|
591
555
|
true,
|
|
@@ -1015,7 +979,8 @@ documentFields(ticketsInputSchema, {
|
|
|
1015
979
|
claimedState: 'Workflow state entered when a ticket is claimed.',
|
|
1016
980
|
doneState: 'Project completion state and merged-ticket transition.',
|
|
1017
981
|
createState: 'Default state for newly created tickets when `ab ticket create` omits `--state`.',
|
|
1018
|
-
triageState:
|
|
982
|
+
triageState:
|
|
983
|
+
'State used for spec-gate bounces, aborts (unless `ab abort --to ready` with a ticket that meets the spec standard), and closed-unmerged PRs.',
|
|
1019
984
|
proposalState:
|
|
1020
985
|
'State harvest files its synthesized proposals into. Setting it to `readyState` waives the human grooming gate, not dependency eligibility.',
|
|
1021
986
|
backlogState:
|
|
@@ -1035,7 +1000,9 @@ documentSchema(ticketsInputSchema.shape.readyState, {
|
|
|
1035
1000
|
documentSchema(ticketsInputSchema.shape.teamKey, {
|
|
1036
1001
|
required: 'Required for linear and hosted; forbidden for file and github; optional for plugins.',
|
|
1037
1002
|
})
|
|
1038
|
-
documentSchema(ticketsInputSchema.shape.claimedState, {
|
|
1003
|
+
documentSchema(ticketsInputSchema.shape.claimedState, {
|
|
1004
|
+
constraints: 'Forbidden for file.',
|
|
1005
|
+
})
|
|
1039
1006
|
documentSchema(ticketsInputSchema.shape.dir, {
|
|
1040
1007
|
constraints: 'Forbidden for linear, hosted and github.',
|
|
1041
1008
|
})
|
|
@@ -1104,7 +1071,10 @@ const DISPATCHER_ROLES = [
|
|
|
1104
1071
|
* never claims from, moves into, or files proposals into them, whatever the
|
|
1105
1072
|
* other lifecycle names say, and the two may not share a state. */
|
|
1106
1073
|
function refuseOptionalRoleOverlap(tickets: TicketsConfig, ctx: z.RefinementCtx): void {
|
|
1107
|
-
const names = ticketLifecycle({
|
|
1074
|
+
const names = ticketLifecycle({
|
|
1075
|
+
...tickets,
|
|
1076
|
+
readyState: tickets.readyState ?? 'ready',
|
|
1077
|
+
})
|
|
1108
1078
|
// The file source ignores claimedState and doneState: claims always move
|
|
1109
1079
|
// into doing and completion is Done. Check the states it actually uses as
|
|
1110
1080
|
// well as the configured spellings.
|
|
@@ -1140,7 +1110,11 @@ export const ticketsSchema = ticketsInputSchema
|
|
|
1140
1110
|
try {
|
|
1141
1111
|
normalizeServiceURL(tickets.url, 'tickets.url')
|
|
1142
1112
|
} catch (error) {
|
|
1143
|
-
ctx.addIssue({
|
|
1113
|
+
ctx.addIssue({
|
|
1114
|
+
code: 'custom',
|
|
1115
|
+
path: ['url'],
|
|
1116
|
+
message: (error as Error).message,
|
|
1117
|
+
})
|
|
1144
1118
|
}
|
|
1145
1119
|
}
|
|
1146
1120
|
if (!['hosted', 'github'].includes(tickets.source) && tickets.readyState === undefined)
|
|
@@ -1289,7 +1263,7 @@ documentFields(configRootSchema, {
|
|
|
1289
1263
|
upgrade: 'Automatic dispatcher runtime target checks and adoption.',
|
|
1290
1264
|
baseBranch: 'Branch used to cut builds, target PRs, and merge during reconciliation.',
|
|
1291
1265
|
capacity:
|
|
1292
|
-
'Builds running work at once for this repository. A build that finished its pipeline holds no slot while it waits for a merge decision;
|
|
1266
|
+
'Builds running work at once for this repository. A build that finished its pipeline holds no slot while it waits for a merge decision, nor does a build waiting on other tickets; either is admitted ahead of new claims when it must run again. Other unfinished paused and blocked work retains slots. Node reconcile and verification exclude their own blocked/paused descendants at admission; new claims use total occupancy. See [integration capacity](integration-tree.md).',
|
|
1293
1267
|
ticketScanIntervalSeconds:
|
|
1294
1268
|
'Ticket-source ready scan cadence; tick spacing is the effective minimum.',
|
|
1295
1269
|
forge:
|
|
@@ -1416,7 +1390,11 @@ export const configSchema = normalizedConfigSchema.superRefine((config, ctx) =>
|
|
|
1416
1390
|
`${label(role)}${index ? ` alternate[${index - 1}]` : ''}`,
|
|
1417
1391
|
)
|
|
1418
1392
|
} catch (error) {
|
|
1419
|
-
ctx.addIssue({
|
|
1393
|
+
ctx.addIssue({
|
|
1394
|
+
code: 'custom',
|
|
1395
|
+
path: path(role),
|
|
1396
|
+
message: (error as Error).message,
|
|
1397
|
+
})
|
|
1420
1398
|
}
|
|
1421
1399
|
})
|
|
1422
1400
|
}
|
|
@@ -1674,7 +1652,11 @@ export const configSchema = normalizedConfigSchema.superRefine((config, ctx) =>
|
|
|
1674
1652
|
assignee === assignee.trim() &&
|
|
1675
1653
|
!form.accepts(assignee)
|
|
1676
1654
|
) {
|
|
1677
|
-
ctx.addIssue({
|
|
1655
|
+
ctx.addIssue({
|
|
1656
|
+
code: 'custom',
|
|
1657
|
+
path: ['tickets', 'readyAssignee'],
|
|
1658
|
+
message: form.message,
|
|
1659
|
+
})
|
|
1678
1660
|
}
|
|
1679
1661
|
}
|
|
1680
1662
|
// createAssignee is the `assignees` capability, checked the same way.
|
|
@@ -50,6 +50,8 @@ export const allowedActorKinds: Record<EventType, readonly ActorKind[]> = {
|
|
|
50
50
|
'build.janitor-escalated': ['dispatcher'],
|
|
51
51
|
'landing.application-failed': ['dispatcher', 'kernel'],
|
|
52
52
|
'landing.decided': ['dispatcher', 'kernel'],
|
|
53
|
+
'landing.deferred': ['dispatcher'],
|
|
54
|
+
'landing.consent-revoked': ['kernel'],
|
|
53
55
|
'build.hold-requested': ['human'],
|
|
54
56
|
'build.land-requested': ['human'],
|
|
55
57
|
'landing.command-acknowledged': ['dispatcher', 'kernel'],
|
|
@@ -61,12 +63,14 @@ export const allowedActorKinds: Record<EventType, readonly ActorKind[]> = {
|
|
|
61
63
|
'target.rewritten': ['dispatcher', 'kernel'],
|
|
62
64
|
'target.rewrite-cleared': ['dispatcher', 'kernel'],
|
|
63
65
|
'target.moved': ['dispatcher', 'kernel'],
|
|
66
|
+
'head.paths-recorded': ['kernel', 'dispatcher'],
|
|
64
67
|
'restack.prepared': ['kernel', 'dispatcher'],
|
|
65
68
|
'restack.replayed': ['kernel', 'dispatcher'],
|
|
66
69
|
'restack.publish-intended': ['kernel', 'dispatcher'],
|
|
67
70
|
'restack.rewritten': ['kernel', 'dispatcher'],
|
|
68
71
|
'restack.contended': ['kernel', 'dispatcher'],
|
|
69
72
|
'restack.completed': ['kernel', 'dispatcher'],
|
|
73
|
+
'restack.advanced': ['kernel'],
|
|
70
74
|
'integration.abandoned': ['kernel', 'dispatcher'],
|
|
71
75
|
'integration.observed': ['kernel', 'dispatcher'],
|
|
72
76
|
'integration.prepared': ['kernel', 'dispatcher'],
|
|
@@ -135,6 +139,7 @@ export const allowedActorKinds: Record<EventType, readonly ActorKind[]> = {
|
|
|
135
139
|
'abort.remote-branch-deleted': ['dispatcher'],
|
|
136
140
|
'abort.local-branch-deleted': ['dispatcher'],
|
|
137
141
|
'abort.ticket-returned': ['dispatcher'],
|
|
142
|
+
'build.ticket-returned': ['dispatcher'],
|
|
138
143
|
'dispatch.failed': ['dispatcher'],
|
|
139
144
|
'dispatch.comment-posted': ['dispatcher'],
|
|
140
145
|
|
|
@@ -197,6 +202,7 @@ export const allowedActorKinds: Record<EventType, readonly ActorKind[]> = {
|
|
|
197
202
|
'reconcile.publish-intended': ['kernel'],
|
|
198
203
|
'reconcile.rewritten': ['kernel', 'dispatcher'],
|
|
199
204
|
'reconcile.completed': ['agent', 'dispatcher', 'kernel'],
|
|
205
|
+
'reconcile.superseded': ['kernel'],
|
|
200
206
|
|
|
201
207
|
'issue-link.downgraded': ['agent'],
|
|
202
208
|
'issue-links.sealed': ['kernel'],
|
|
@@ -211,6 +217,11 @@ export const allowedActorKinds: Record<EventType, readonly ActorKind[]> = {
|
|
|
211
217
|
'session.build-read-recovered': ['kernel'],
|
|
212
218
|
'phase.deferred': ['kernel'],
|
|
213
219
|
'phase.deferral-escalated': ['kernel'],
|
|
220
|
+
'wait.requested': ['agent'],
|
|
221
|
+
'wait.refused': ['dispatcher'],
|
|
222
|
+
'wait.entered': ['dispatcher'],
|
|
223
|
+
'wait.ended': ['dispatcher', 'kernel', 'human'],
|
|
224
|
+
'wait.published': ['dispatcher'],
|
|
214
225
|
}
|
|
215
226
|
|
|
216
227
|
/**
|
|
@@ -279,10 +290,11 @@ export function validateEventWrite(input: {
|
|
|
279
290
|
(escalation.policyCause !== 'infrastructure-failure-limit' &&
|
|
280
291
|
escalation.policyCause !== 'dispatch-failure-limit' &&
|
|
281
292
|
escalation.policyCause !== 'execution-no-progress' &&
|
|
282
|
-
escalation.policyCause !== 'publication-retry-limit'
|
|
293
|
+
escalation.policyCause !== 'publication-retry-limit' &&
|
|
294
|
+
escalation.policyCause !== 'wait-unresolvable'))
|
|
283
295
|
) {
|
|
284
296
|
throw new EventValidationError(
|
|
285
|
-
'invalid dispatcher escalation: only policy/infrastructure-failure-limit or policy/dispatch-failure-limit or policy/execution-no-progress or policy/publication-retry-limit may be raised outside the kernel',
|
|
297
|
+
'invalid dispatcher escalation: only policy/infrastructure-failure-limit or policy/dispatch-failure-limit or policy/execution-no-progress or policy/publication-retry-limit or policy/wait-unresolvable may be raised outside the kernel',
|
|
286
298
|
)
|
|
287
299
|
}
|
|
288
300
|
if (escalation.source === 'policy' && escalation.policyCause === undefined) {
|
|
@@ -299,7 +311,9 @@ export function validateEventWrite(input: {
|
|
|
299
311
|
return {
|
|
300
312
|
...(input.compatibility === undefined
|
|
301
313
|
? {}
|
|
302
|
-
: {
|
|
314
|
+
: {
|
|
315
|
+
compatibility: stampCompatibility(buildEventPolicy[input.type], input.compatibility),
|
|
316
|
+
}),
|
|
303
317
|
actor,
|
|
304
318
|
type: input.type,
|
|
305
319
|
payload: payloadResult.data,
|
|
@@ -27,7 +27,8 @@ export interface StoredEvent {
|
|
|
27
27
|
// Revision 4 retains the optional effective prompt in session projections.
|
|
28
28
|
// Revision 5 retains the optional preparation creation key.
|
|
29
29
|
// Revision 6 retains the optional role profile on build creation and session starts.
|
|
30
|
-
|
|
30
|
+
// Revision 7 retains the optional abort destination and hand-back report fields.
|
|
31
|
+
export const READ_DECODER_REVISION = 7
|
|
31
32
|
export function catalogIdentity(
|
|
32
33
|
build: Record<string, string> = buildEventPolicy,
|
|
33
34
|
repository: Record<string, string> = repositoryEventPolicy,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Bounds of the `head.paths-recorded` summary. A leaf module so the payload
|
|
2
|
+
* schema and `kernel/head-paths.ts` share them without an import cycle. */
|
|
3
|
+
|
|
4
|
+
/** The most changed (or resolution) paths an event or build state carries.
|
|
5
|
+
* The complete sets live in the `head-paths` artifact. */
|
|
6
|
+
export const HEAD_PATHS_PREVIEW = 100
|
|
7
|
+
|
|
8
|
+
/** The most matched paths a `landing.decided` event carries for a merge rule
|
|
9
|
+
* with path predicates; the exact total travels beside them. */
|
|
10
|
+
export const LANDING_MATCHED_PATHS_PREVIEW = 20
|
|
11
|
+
|
|
12
|
+
/** The most per-head summaries build state keeps, newest last. */
|
|
13
|
+
export const HEAD_PATHS_RECORDS = 4
|
|
14
|
+
|
|
15
|
+
/** The build artifact kind holding a head's complete path sets. */
|
|
16
|
+
export const HEAD_PATHS_ARTIFACT = 'head-paths'
|
|
17
|
+
|
|
18
|
+
export const HEAD_PATHS_SOURCES = [
|
|
19
|
+
'finalize',
|
|
20
|
+
'finalize-step',
|
|
21
|
+
'restack',
|
|
22
|
+
'reconcile',
|
|
23
|
+
'node-rewrite',
|
|
24
|
+
'integration',
|
|
25
|
+
] as const
|