@defrex/autobuild 1.4.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SPEC.md +512 -101
- package/bin/ab-dispatch-kernel.ts +1 -0
- package/docs/accounts.md +9 -0
- package/docs/agent-runtimes.md +1 -0
- package/docs/answering-blocked-builds.md +7 -3
- package/docs/architecture.md +313 -130
- package/docs/assets/headline-wide.png +0 -0
- package/docs/build-store.md +33 -3
- package/docs/cli.md +2 -1
- package/docs/configuration-overview.md +9 -0
- package/docs/configuration.md +217 -106
- package/docs/dispatcher-hosting.md +19 -3
- package/docs/dispatcher.md +11 -6
- package/docs/glossary.md +1 -1
- package/docs/integration-overview.md +2 -2
- package/docs/integration-tree.md +91 -28
- package/docs/merge-policy.md +28 -9
- package/docs/operating.md +1 -1
- package/docs/operator-api.md +57 -20
- package/docs/operator-surfaces.md +1 -1
- package/docs/plugin-authoring.md +89 -8
- package/docs/remote-store-protocol.md +39 -11
- package/docs/remote-ticket-protocol.md +126 -12
- package/docs/restacking.md +24 -6
- package/docs/seams.md +2 -2
- package/docs/setup.md +19 -13
- package/docs/spec-standard.md +2 -1
- package/docs/ticket-dependencies.md +26 -8
- package/docs/ticket-migration.md +70 -7
- package/docs/ticket-sources.md +82 -5
- package/docs/tickets.md +34 -2
- package/docs/troubleshooting.md +3 -3
- package/docs/verification.md +5 -5
- package/docs/website.md +8 -0
- package/docs/workspaces.md +1 -1
- package/package.json +4 -3
- package/packages/core/src/accounts/hosted-readiness.ts +21 -0
- package/packages/core/src/cli/attention.ts +3 -0
- package/packages/core/src/cli/build-control.ts +36 -12
- package/packages/core/src/cli/connect.ts +9 -18
- package/packages/core/src/cli/context.ts +44 -0
- package/packages/core/src/cli/dashboard/configuration.ts +11 -0
- package/packages/core/src/cli/dashboard/model.ts +51 -11
- package/packages/core/src/cli/dashboard/poll.ts +14 -0
- package/packages/core/src/cli/dashboard/queue.ts +21 -0
- package/packages/core/src/cli/dashboard/render.ts +43 -22
- package/packages/core/src/cli/dispatch-frontend.ts +63 -30
- package/packages/core/src/cli/dispatch-mode.ts +35 -16
- package/packages/core/src/cli/dispatch-preflight.ts +4 -1
- package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
- package/packages/core/src/cli/dispatch-tickets.ts +47 -0
- package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
- package/packages/core/src/cli/dispatch.ts +522 -145
- package/packages/core/src/cli/help.ts +63 -24
- package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
- package/packages/core/src/cli/init-readiness-remote.ts +16 -3
- package/packages/core/src/cli/init-validation.ts +144 -42
- package/packages/core/src/cli/issue-links.ts +67 -0
- package/packages/core/src/cli/main.ts +32 -15
- package/packages/core/src/cli/pr-summary-publication.ts +38 -7
- package/packages/core/src/cli/publication-settlement.ts +36 -24
- package/packages/core/src/cli/repo-lease.ts +225 -0
- package/packages/core/src/cli/repository-status.ts +203 -49
- package/packages/core/src/cli/status.ts +42 -4
- package/packages/core/src/cli/terminals.ts +37 -2
- package/packages/core/src/cli/ticket-editor.ts +20 -6
- package/packages/core/src/cli/ticket.ts +264 -46
- package/packages/core/src/cli/triage-count-sampler.ts +59 -0
- package/packages/core/src/cli/wait.ts +4 -1
- package/packages/core/src/cli/watch.ts +19 -4
- package/packages/core/src/config/live.ts +45 -4
- package/packages/core/src/config/load.ts +9 -0
- package/packages/core/src/config/pipeline-source.ts +6 -2
- package/packages/core/src/config/ready-assignee.ts +86 -0
- package/packages/core/src/config/schema.ts +202 -38
- package/packages/core/src/distribution-packaging.ts +1 -1
- package/packages/core/src/events/catalog.ts +7 -0
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/payloads.ts +85 -0
- package/packages/core/src/events/policy.ts +10 -0
- package/packages/core/src/events/repository.ts +93 -28
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +237 -230
- package/packages/core/src/kernel/build-identity.ts +12 -0
- package/packages/core/src/kernel/change-presence.ts +139 -6
- package/packages/core/src/kernel/dispatch-capacity.ts +189 -19
- package/packages/core/src/kernel/dispatch-status.ts +10 -1
- package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
- package/packages/core/src/kernel/engine.ts +17 -8
- package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
- package/packages/core/src/kernel/generators/build-log.ts +9 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
- package/packages/core/src/kernel/harvest.ts +4 -1
- package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
- package/packages/core/src/kernel/integration-completeness.ts +104 -17
- package/packages/core/src/kernel/integration-landing.ts +17 -0
- package/packages/core/src/kernel/integration-state.ts +17 -0
- package/packages/core/src/kernel/issue-keywords.ts +202 -0
- package/packages/core/src/kernel/janitor-failure.ts +96 -5
- package/packages/core/src/kernel/kernel-git.ts +87 -0
- package/packages/core/src/kernel/landing-readiness.ts +25 -17
- package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
- package/packages/core/src/kernel/log-index.ts +1 -1
- package/packages/core/src/kernel/node-issue-links.ts +142 -0
- package/packages/core/src/kernel/node-landing.ts +2 -1
- package/packages/core/src/kernel/node-parent.ts +6 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
- package/packages/core/src/kernel/pr-summary.ts +24 -0
- package/packages/core/src/kernel/read-deferrals.ts +75 -12
- package/packages/core/src/kernel/read-facts.ts +32 -1
- package/packages/core/src/kernel/reconcile-restack.ts +1 -1
- package/packages/core/src/kernel/reducer-registry.ts +37 -2
- package/packages/core/src/kernel/reducer.ts +147 -5
- package/packages/core/src/kernel/ticket-preparation.ts +16 -0
- package/packages/core/src/kernel/verify-budget.ts +43 -0
- package/packages/core/src/operator/index.ts +3 -1
- package/packages/core/src/operator/presentation.ts +3 -0
- package/packages/core/src/operator/protocol.ts +38 -2
- package/packages/core/src/operator/query.ts +69 -29
- package/packages/core/src/operator/registry.ts +47 -26
- package/packages/core/src/operator/tickets.ts +77 -10
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/plugins/manifest.ts +1 -1
- package/packages/core/src/plugins/registry.ts +1 -0
- package/packages/core/src/ports/forge/contract.ts +69 -0
- package/packages/core/src/ports/forge/create.ts +5 -0
- package/packages/core/src/ports/forge/fake.ts +184 -3
- package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
- package/packages/core/src/ports/forge/github.ts +175 -38
- package/packages/core/src/ports/forge/local-git.ts +14 -0
- package/packages/core/src/ports/forge/readiness.ts +10 -0
- package/packages/core/src/ports/forge-failure.ts +43 -0
- package/packages/core/src/ports/runner/claude.ts +7 -1
- package/packages/core/src/ports/runner/codex.ts +7 -2
- package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
- package/packages/core/src/ports/runner/pi.ts +7 -1
- package/packages/core/src/ports/runner/runtime.ts +3 -0
- package/packages/core/src/ports/runner/start-prompt.ts +37 -0
- package/packages/core/src/ports/tickets/contract.ts +320 -7
- package/packages/core/src/ports/tickets/create.ts +89 -20
- package/packages/core/src/ports/tickets/fake.ts +18 -0
- package/packages/core/src/ports/tickets/file-codec.ts +20 -0
- package/packages/core/src/ports/tickets/file.ts +43 -1
- package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
- package/packages/core/src/ports/tickets/github-issues.ts +431 -0
- package/packages/core/src/ports/tickets/github-validators.ts +194 -0
- package/packages/core/src/ports/tickets/github.ts +2029 -0
- package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
- package/packages/core/src/ports/tickets/issue-links.ts +86 -0
- package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
- package/packages/core/src/ports/tickets/linear.ts +66 -6
- package/packages/core/src/ports/tickets/migration.ts +290 -68
- package/packages/core/src/ports/tickets/operations.ts +98 -12
- package/packages/core/src/ports/tickets/priority.ts +55 -0
- package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
- package/packages/core/src/ports/tickets/remote.ts +188 -13
- package/packages/core/src/ports/tickets/revision.ts +22 -1
- package/packages/core/src/ports/tickets/states.ts +43 -0
- package/packages/core/src/ports/tickets/tree.ts +58 -12
- package/packages/core/src/ports/tickets/update.ts +12 -2
- package/packages/core/src/ports/types.ts +194 -9
- package/packages/core/src/ports/workspace/commit-preservation.ts +163 -25
- package/packages/core/src/ports/workspace/git-worktree.ts +6 -2
- package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +121 -27
- package/packages/core/src/processes/build-runner.ts +101 -22
- package/packages/core/src/processes/dispatcher.ts +1046 -372
- package/packages/core/src/processes/execution-no-progress.ts +7 -0
- package/packages/core/src/processes/harvest-child.ts +4 -2
- package/packages/core/src/processes/harvest-execution-state.ts +104 -0
- package/packages/core/src/processes/harvest-runner.ts +263 -25
- package/packages/core/src/processes/harvest.ts +5 -8
- package/packages/core/src/processes/tick-publication.ts +12 -2
- package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
- package/packages/core/src/processes/workspace-preservation.ts +36 -1
- package/packages/core/src/runtime-identity.ts +10 -2
- package/packages/core/src/scenarios/harness.ts +149 -35
- package/packages/core/src/store/adapter.ts +7 -1
- package/packages/core/src/store/contract.ts +83 -2
- package/packages/core/src/store/digest.ts +32 -1
- package/packages/core/src/store/reduced-reads.ts +10 -0
- package/packages/core/src/store/reducer-value-shapes.json +4471 -3427
- package/packages/core/src/store/remote/protocol.ts +2 -0
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
- package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/store/types.ts +5 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
- package/packages/core/src/testing/index.ts +18 -1
- package/packages/core/src/testing/presence-history.ts +79 -0
- package/packages/core/src/testing/reduced-read-budget.ts +1424 -33
- package/packages/core/src/testing/upgrade-generations.ts +77 -0
- package/skills/code-review/SKILL.md +4 -3
- package/skills/finalize/SKILL.md +18 -2
- package/skills/guide/SKILL.md +417 -143
- package/skills/guide/references/accounts.md +9 -0
- package/skills/guide/references/integration-tree.md +91 -28
- package/skills/guide/references/merge-policy.md +28 -9
- package/skills/guide/references/operator-api.md +57 -20
- package/skills/guide/references/plugin-authoring.md +89 -8
- package/skills/guide/references/remote-store-protocol.md +39 -11
- package/skills/guide/references/remote-ticket-protocol.md +126 -12
- package/skills/guide/references/restacking.md +24 -6
- package/skills/guide/references/setup.md +19 -13
- package/skills/guide/references/spec-standard.md +2 -1
- package/skills/guide/references/ticket-dependencies.md +26 -8
- package/skills/guide/references/ticket-migration.md +70 -7
- package/skills/harvest-review/SKILL.md +4 -3
- package/skills/implement/SKILL.md +20 -1
- package/skills/operate/SKILL.md +149 -35
- package/skills/plan/SKILL.md +1 -1
- package/skills/reconcile/SKILL.md +5 -4
- package/skills/spec/SKILL.md +15 -2
- package/skills/tickets/SKILL.md +116 -37
- package/templates/autobuild.toml +5 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -465,6 +465,7 @@ export async function abWait(opts: AbWaitOpts): Promise<number> {
|
|
|
465
465
|
condition === 'consent' ||
|
|
466
466
|
(condition === 'attention' &&
|
|
467
467
|
event.type !== 'phase.deferral-escalated' &&
|
|
468
|
+
event.type !== 'build.janitor-escalated' &&
|
|
468
469
|
event.type !== 'escalation.raised')
|
|
469
470
|
? consentReady(seed, now())
|
|
470
471
|
: null
|
|
@@ -472,7 +473,8 @@ export async function abWait(opts: AbWaitOpts): Promise<number> {
|
|
|
472
473
|
consent ??
|
|
473
474
|
(condition === 'attention' &&
|
|
474
475
|
event.type !== 'escalation.raised' &&
|
|
475
|
-
event.type !== 'phase.deferral-escalated'
|
|
476
|
+
event.type !== 'phase.deferral-escalated' &&
|
|
477
|
+
event.type !== 'build.janitor-escalated'
|
|
476
478
|
? mergeDecisionFromFacts(state, seed.deferral, now())
|
|
477
479
|
: null)
|
|
478
480
|
if (consent) deliveredAttention.add(consentIdentity(event.build, consent.position))
|
|
@@ -512,6 +514,7 @@ export async function abWait(opts: AbWaitOpts): Promise<number> {
|
|
|
512
514
|
if (
|
|
513
515
|
event.type === 'escalation.raised' ||
|
|
514
516
|
event.type === 'phase.deferral-escalated' ||
|
|
517
|
+
event.type === 'build.janitor-escalated' ||
|
|
515
518
|
event.type === 'integration.landed' ||
|
|
516
519
|
event.type === 'integration.verification-failed' ||
|
|
517
520
|
event.type === 'node.item-conflicted' ||
|
|
@@ -6,6 +6,7 @@ import { randomUUID } from 'node:crypto'
|
|
|
6
6
|
import { OPERATOR_HEARTBEAT_MS, operatorIdentitySchema } from '../store/operator-presence'
|
|
7
7
|
import { consentReady, consentIdentity, type ConsentReady } from './attention'
|
|
8
8
|
import { formatReadinessFailure } from '../ports/forge/readiness'
|
|
9
|
+
import { abandonedPreparationDiagnostic } from '../kernel/ticket-preparation'
|
|
9
10
|
import { readDispatchUpgrade, readBuildDigests } from '../store/reduced-reads'
|
|
10
11
|
import { readBuildStreamSeed, readRepositoryAttention } from '../store/reduced-reads'
|
|
11
12
|
import { buildStreamSeedReducer, type BuildStreamSeed } from '../kernel/read-facts'
|
|
@@ -112,6 +113,7 @@ const TERMINAL_STATUSES: readonly BuildStatus[] = ['done', 'aborted']
|
|
|
112
113
|
export const BUILD_ATTENTION_EVENTS = [
|
|
113
114
|
'target.rewritten',
|
|
114
115
|
'build.janitor-failing',
|
|
116
|
+
'build.janitor-escalated',
|
|
115
117
|
'build.compatibility-deferred',
|
|
116
118
|
'escalation.raised',
|
|
117
119
|
'phase.deferral-escalated',
|
|
@@ -457,7 +459,12 @@ export function summarizeEvent(event: AbEvent | RepositoryEvent, state: BuildSta
|
|
|
457
459
|
return `Account credentials recovered: ${JSON.stringify(event.payload.name)}`
|
|
458
460
|
case 'dispatcher.forge-recovered':
|
|
459
461
|
return `Forge recovered: ${event.payload.forge}`
|
|
462
|
+
case 'dispatcher.kernel-git-unavailable':
|
|
463
|
+
return `Kernel Git unavailable (${event.payload.executable}): ${singleLine(event.payload.detail)}`
|
|
464
|
+
case 'dispatcher.kernel-git-recovered':
|
|
465
|
+
return `Kernel Git recovered (${event.payload.executable})`
|
|
460
466
|
case 'phase.deferral-escalated':
|
|
467
|
+
case 'build.janitor-escalated':
|
|
461
468
|
case 'escalation.raised':
|
|
462
469
|
return `${event.payload.id}: ${singleLine(event.payload.question)}`
|
|
463
470
|
case 'build.compatibility-deferred':
|
|
@@ -516,13 +523,21 @@ export function summarizeEvent(event: AbEvent | RepositoryEvent, state: BuildSta
|
|
|
516
523
|
return `dispatcher config rejected: ${singleLine(event.payload.error)}`
|
|
517
524
|
case 'dispatcher.harvest-runner-failed':
|
|
518
525
|
return `harvest runner failed: ${singleLine(event.payload.error)}`
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
526
|
+
case 'ticket-preparation.resolved':
|
|
527
|
+
if (event.payload.outcome === 'abandoned') {
|
|
528
|
+
return singleLine(abandonedPreparationDiagnostic(event.payload, event.payload.reason))
|
|
529
|
+
}
|
|
530
|
+
return summarizePayload(event.payload)
|
|
531
|
+
default:
|
|
532
|
+
return summarizePayload(event.payload)
|
|
523
533
|
}
|
|
524
534
|
}
|
|
525
535
|
|
|
536
|
+
function summarizePayload(payload: unknown): string {
|
|
537
|
+
const compact = singleLine(JSON.stringify(payload))
|
|
538
|
+
return compact.length > SUMMARY_MAX ? `${compact.slice(0, SUMMARY_MAX - 1)}…` : compact
|
|
539
|
+
}
|
|
540
|
+
|
|
526
541
|
/** The human form: one line, timestamp first, no ANSI anywhere. */
|
|
527
542
|
export function renderWatchLine(
|
|
528
543
|
event: AbEvent | RepositoryEvent,
|
|
@@ -42,6 +42,8 @@ export const CONFIG_RELOAD_CLASSIFICATION = {
|
|
|
42
42
|
createState: 'restart',
|
|
43
43
|
triageState: 'hot',
|
|
44
44
|
proposalState: 'hot',
|
|
45
|
+
backlogState: 'hot',
|
|
46
|
+
rejectedState: 'hot',
|
|
45
47
|
dir: 'restart',
|
|
46
48
|
},
|
|
47
49
|
} as const satisfies {
|
|
@@ -148,8 +150,20 @@ export interface ConfigSnapshot {
|
|
|
148
150
|
|
|
149
151
|
export type ConfigReloadOutcome =
|
|
150
152
|
| { kind: 'unchanged' }
|
|
151
|
-
| {
|
|
152
|
-
|
|
153
|
+
| {
|
|
154
|
+
kind: 'rejected'
|
|
155
|
+
error: string
|
|
156
|
+
notify: boolean
|
|
157
|
+
/** Deprecation lines of a candidate that parsed but failed validation
|
|
158
|
+
* afterwards; non-empty only on the first evaluation of that content. */
|
|
159
|
+
deprecations?: readonly string[]
|
|
160
|
+
}
|
|
161
|
+
| {
|
|
162
|
+
kind: 'publication-failed'
|
|
163
|
+
error: string
|
|
164
|
+
/** As for `rejected`: non-empty only on first evaluation of the content. */
|
|
165
|
+
deprecations: readonly string[]
|
|
166
|
+
}
|
|
153
167
|
| {
|
|
154
168
|
kind: 'adopted'
|
|
155
169
|
snapshot: ConfigSnapshot
|
|
@@ -169,11 +183,18 @@ export type ConfigReloadPublisher = (input: {
|
|
|
169
183
|
* Process-local owner of the dispatcher's effective config. A candidate is
|
|
170
184
|
* published only after parsing, eager route validation, and durable journal
|
|
171
185
|
* publication all succeed. Callers capture `current()` once per boundary.
|
|
186
|
+
*
|
|
187
|
+
* Parsing never writes: deprecation lines are collected. `deprecations()`
|
|
188
|
+
* holds the accepted content's lines, and a candidate that parses but is not
|
|
189
|
+
* adopted returns its lines on the outcome once per distinct content, so a
|
|
190
|
+
* re-evaluated pending file stays quiet on later ticks.
|
|
172
191
|
*/
|
|
173
192
|
export class LiveConfig {
|
|
174
193
|
private snapshot: ConfigSnapshot
|
|
175
194
|
private acceptedContent: string
|
|
176
195
|
private rejectedContent: string | undefined
|
|
196
|
+
private acceptedDeprecations: readonly string[]
|
|
197
|
+
private noticedCandidate: string | undefined
|
|
177
198
|
|
|
178
199
|
constructor(
|
|
179
200
|
private readonly source: string,
|
|
@@ -181,8 +202,14 @@ export class LiveConfig {
|
|
|
181
202
|
startupContent: string,
|
|
182
203
|
private readonly runtimes: RuntimeRegistry,
|
|
183
204
|
private readonly publish: ConfigReloadPublisher,
|
|
205
|
+
startupDeprecations: readonly string[] = [],
|
|
206
|
+
/** A synchronous, request-free check of a composed reload against the
|
|
207
|
+
* running process (for example the ticket source's capabilities); a
|
|
208
|
+
* throw rejects the reload and keeps the previous snapshot. */
|
|
209
|
+
private readonly validate?: (config: Config) => void,
|
|
184
210
|
) {
|
|
185
211
|
this.acceptedContent = startupContent
|
|
212
|
+
this.acceptedDeprecations = startupDeprecations
|
|
186
213
|
this.snapshot = {
|
|
187
214
|
config: startup,
|
|
188
215
|
resolver: createRuntimeResolver(
|
|
@@ -199,6 +226,11 @@ export class LiveConfig {
|
|
|
199
226
|
return this.snapshot
|
|
200
227
|
}
|
|
201
228
|
|
|
229
|
+
/** Deprecation lines of the accepted content (startup or last adoption). */
|
|
230
|
+
deprecations(): readonly string[] {
|
|
231
|
+
return this.acceptedDeprecations
|
|
232
|
+
}
|
|
233
|
+
|
|
202
234
|
async refreshFromDisk(): Promise<ConfigReloadOutcome> {
|
|
203
235
|
return this.refreshFrom(() => Bun.file(this.source).text())
|
|
204
236
|
}
|
|
@@ -234,12 +266,14 @@ export class LiveConfig {
|
|
|
234
266
|
async refresh(content: string): Promise<ConfigReloadOutcome> {
|
|
235
267
|
if (content === this.acceptedContent) {
|
|
236
268
|
this.rejectedContent = undefined
|
|
269
|
+
this.noticedCandidate = undefined
|
|
237
270
|
return { kind: 'unchanged' }
|
|
238
271
|
}
|
|
239
272
|
|
|
240
273
|
let candidate: Config
|
|
274
|
+
const deprecations: string[] = []
|
|
241
275
|
try {
|
|
242
|
-
candidate = parseConfig(content, this.source)
|
|
276
|
+
candidate = parseConfig(content, this.source, (line) => deprecations.push(line))
|
|
243
277
|
} catch (error) {
|
|
244
278
|
const message = error instanceof Error ? error.message : String(error)
|
|
245
279
|
const notify = this.rejectedContent !== content
|
|
@@ -247,9 +281,13 @@ export class LiveConfig {
|
|
|
247
281
|
return { kind: 'rejected', error: message, notify }
|
|
248
282
|
}
|
|
249
283
|
|
|
284
|
+
const candidateDeprecations = this.noticedCandidate === content ? [] : deprecations
|
|
285
|
+
this.noticedCandidate = content
|
|
286
|
+
|
|
250
287
|
const config = composeReloadedConfig(this.startup, candidate)
|
|
251
288
|
let resolver: RuntimeResolver
|
|
252
289
|
try {
|
|
290
|
+
this.validate?.(config)
|
|
253
291
|
for (const [name, account] of Object.entries(this.snapshot.config.accounts)) {
|
|
254
292
|
if (account.kind === 'chatgpt-subscription' && !same(account, config.accounts[name]))
|
|
255
293
|
throw new Error(
|
|
@@ -266,7 +304,7 @@ export class LiveConfig {
|
|
|
266
304
|
const message = error instanceof Error ? error.message : String(error)
|
|
267
305
|
const notify = this.rejectedContent !== content
|
|
268
306
|
this.rejectedContent = content
|
|
269
|
-
return { kind: 'rejected', error: message, notify }
|
|
307
|
+
return { kind: 'rejected', error: message, notify, deprecations: candidateDeprecations }
|
|
270
308
|
}
|
|
271
309
|
|
|
272
310
|
const restartRequired = restartRequiredChanges(this.startup, candidate)
|
|
@@ -277,11 +315,14 @@ export class LiveConfig {
|
|
|
277
315
|
return {
|
|
278
316
|
kind: 'publication-failed',
|
|
279
317
|
error: error instanceof Error ? error.message : String(error),
|
|
318
|
+
deprecations: candidateDeprecations,
|
|
280
319
|
}
|
|
281
320
|
}
|
|
282
321
|
|
|
283
322
|
this.acceptedContent = content
|
|
323
|
+
this.acceptedDeprecations = deprecations
|
|
284
324
|
this.rejectedContent = undefined
|
|
325
|
+
this.noticedCandidate = undefined
|
|
285
326
|
this.snapshot = {
|
|
286
327
|
config,
|
|
287
328
|
resolver,
|
|
@@ -70,6 +70,15 @@ function describeIssue(issue: z.core.$ZodIssue): string {
|
|
|
70
70
|
return ` ${formatPath(path)}: ${message}`
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Parse and validate autobuild.toml text. Deprecated spellings are reported
|
|
75
|
+
* through `warn` after validation succeeds; invalid text throws first. The
|
|
76
|
+
* `console.error` default suits explicit one-shot reads (scoped CLI commands,
|
|
77
|
+
* `ab init`, `ab upgrade`). Recurring or internal callers — the dispatcher and
|
|
78
|
+
* pipeline-source resolution — pass their own sink, a collector or a no-op, so
|
|
79
|
+
* a deprecation is reported once per startup or changed file instead of per
|
|
80
|
+
* phase launch.
|
|
81
|
+
*/
|
|
73
82
|
export function parseConfig(
|
|
74
83
|
tomlText: string,
|
|
75
84
|
source = 'autobuild.toml',
|
|
@@ -170,7 +170,10 @@ function parsePipeline(
|
|
|
170
170
|
try {
|
|
171
171
|
return {
|
|
172
172
|
meta: commit === undefined ? { ref } : { ref, commit },
|
|
173
|
-
|
|
173
|
+
// Merge policy is dispatcher-owned (composeBuildConfig), so a branch's
|
|
174
|
+
// deprecated spelling is not reported per launch; the dispatcher reports
|
|
175
|
+
// its own config's deprecations at startup and reload.
|
|
176
|
+
config: parseConfig(content, `autobuild.toml@${label}`, () => {}),
|
|
174
177
|
}
|
|
175
178
|
} catch (error) {
|
|
176
179
|
onFailure({
|
|
@@ -412,6 +415,7 @@ export async function readVerifyPipeline(
|
|
|
412
415
|
committed.split(/\s+/)[2] === working
|
|
413
416
|
? { ref: 'branch-head', commit: head }
|
|
414
417
|
: { ref: 'worktree-dirty' },
|
|
415
|
-
|
|
418
|
+
// Dispatcher-owned keys are not read from here; see parsePipeline.
|
|
419
|
+
config: parseConfig(content, `autobuild.toml@${head}`, () => {}),
|
|
416
420
|
}
|
|
417
421
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `[tickets].readyAssignee` is a ticket-source capability. A source opts in
|
|
3
|
+
* with `readyAssignee = true` on the constructed `TicketSource`; parse time
|
|
4
|
+
* can only check the builtins, because plugins load after config parse, so the
|
|
5
|
+
* registry-aware seams (`createTicketSource` and `LiveConfig` reloads) enforce
|
|
6
|
+
* the declaration for every source. The value forms below are the builtins'
|
|
7
|
+
* own rules; a plugin source enforces its own.
|
|
8
|
+
*/
|
|
9
|
+
import type { TicketSource } from '../ports/types'
|
|
10
|
+
import type { TicketsConfig } from './schema'
|
|
11
|
+
|
|
12
|
+
export interface ReadyAssigneeForm {
|
|
13
|
+
accepts(value: string): boolean
|
|
14
|
+
message: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Linear: `"me"` (the owner of LINEAR_API_KEY) or a user's email. */
|
|
18
|
+
export const LINEAR_READY_ASSIGNEE: ReadyAssigneeForm = {
|
|
19
|
+
accepts: (s) => s === 'me' || (s === s.trim() && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)),
|
|
20
|
+
message:
|
|
21
|
+
'[tickets].readyAssignee must be "me" (the owner of the API key) or a user email address (e.g. "person@example.com")',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* GitHub: `"me"` (the owner of the GitHub credential) or a login. A personal
|
|
26
|
+
* login is alphanumerics and dashes; an Enterprise Managed User login is the
|
|
27
|
+
* normalized base, `_`, and a 3–8 character alphanumeric shortcode; either is
|
|
28
|
+
* at most 39 characters (docs.github.com, "Username considerations for
|
|
29
|
+
* external authentication"). The base is deliberately permissive about dash
|
|
30
|
+
* placement, since older accounts predate the normalization rules; `ab init
|
|
31
|
+
* --validate` proves the user can actually be assigned.
|
|
32
|
+
*/
|
|
33
|
+
export const GITHUB_READY_ASSIGNEE: ReadyAssigneeForm = {
|
|
34
|
+
accepts: (s) =>
|
|
35
|
+
s === 'me' || (s.length <= 39 && /^[A-Za-z0-9][A-Za-z0-9-]*(?:_[A-Za-z0-9]{3,8})?$/.test(s)),
|
|
36
|
+
message:
|
|
37
|
+
'[tickets].readyAssignee must be "me" (the owner of the GitHub credential) or a GitHub username (e.g. "octocat", or a managed user\'s "mona_acme") for source = "github"',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function readyAssigneeUnsupported(source: string, plugin?: string): string {
|
|
41
|
+
const from = plugin !== undefined ? ` from plugin "${plugin}"` : ''
|
|
42
|
+
return `[tickets].readyAssignee: ticket source "${source}"${from} cannot filter ready tickets by assignee — remove readyAssignee (selected source: "${source}")`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Refuse `readyAssignee` for a constructed source that does not declare it. */
|
|
46
|
+
export function assertReadyAssigneeSupported(
|
|
47
|
+
tickets: TicketsConfig,
|
|
48
|
+
source: TicketSource,
|
|
49
|
+
plugin?: string,
|
|
50
|
+
): void {
|
|
51
|
+
if (tickets.readyAssignee !== undefined && source.readyAssignee !== true)
|
|
52
|
+
throw new Error(readyAssigneeUnsupported(tickets.source, plugin))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The reload check: synchronous and request-free, because `LiveConfig`
|
|
57
|
+
* refreshes at the head of a dispatcher tick. It decides from what
|
|
58
|
+
* `prepareReadyAssignee` resolved at startup.
|
|
59
|
+
*/
|
|
60
|
+
export function assertReadyAssigneeAccepted(tickets: TicketsConfig, source: TicketSource): void {
|
|
61
|
+
assertReadyAssigneeSupported(tickets, source)
|
|
62
|
+
if (tickets.readyAssignee === undefined) return
|
|
63
|
+
const refusal = source.readyAssigneeRefusal?.(tickets.readyAssignee)
|
|
64
|
+
if (refusal !== undefined) throw new Error(refusal)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Dispatcher startup, before the loop: prepare whatever a later `"me"` needs,
|
|
69
|
+
* whether or not `readyAssignee` is set, so no tick ever resolves it. A
|
|
70
|
+
* preparation failure fails startup only when the configuration needs it.
|
|
71
|
+
*/
|
|
72
|
+
export async function prepareReadyAssigneeForDispatch(
|
|
73
|
+
source: TicketSource,
|
|
74
|
+
tickets: TicketsConfig,
|
|
75
|
+
warn: (message: string) => void,
|
|
76
|
+
): Promise<void> {
|
|
77
|
+
try {
|
|
78
|
+
await source.prepareReadyAssignee?.()
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (tickets.readyAssignee !== undefined) throw error
|
|
81
|
+
warn(
|
|
82
|
+
`ticket source "${source.name}" could not prepare readyAssignee: ${error instanceof Error ? error.message : String(error)}`,
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
assertReadyAssigneeAccepted(tickets, source)
|
|
86
|
+
}
|