@defrex/autobuild 0.13.0 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/SPEC.md +673 -99
- package/bin/ab-dispatch-kernel.ts +4 -6
- package/docs/architecture.md +322 -75
- package/docs/assets/headline-wide.png +0 -0
- package/docs/configuration.md +112 -12
- package/docs/hosted-service.md +20 -2
- package/docs/integration-tree.md +117 -0
- package/docs/landing-policy.md +150 -0
- package/docs/mcp.md +24 -0
- package/docs/migration-1.0.md +68 -0
- package/docs/operator-api.md +20 -9
- package/docs/remote-store-protocol.md +114 -9
- package/docs/remote-ticket-protocol.md +26 -5
- package/docs/restacking.md +79 -0
- package/docs/setup.md +49 -6
- package/docs/ticket-dependencies.md +69 -0
- package/docs/ticket-migration.md +8 -0
- package/package.json +4 -3
- package/packages/core/src/cli/attention.ts +40 -163
- package/packages/core/src/cli/build-control.ts +75 -55
- package/packages/core/src/cli/bulk-control.ts +3 -2
- package/packages/core/src/cli/context.ts +68 -78
- package/packages/core/src/cli/dashboard/actions.ts +6 -3
- package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
- package/packages/core/src/cli/dashboard/live.ts +5 -0
- package/packages/core/src/cli/dashboard/model.ts +178 -40
- package/packages/core/src/cli/dashboard/poll.ts +15 -9
- package/packages/core/src/cli/dashboard/refresh.ts +176 -0
- package/packages/core/src/cli/dashboard/render.ts +78 -28
- package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
- package/packages/core/src/cli/dashboard/selection.ts +7 -1
- package/packages/core/src/cli/dashboard/tree.ts +107 -0
- package/packages/core/src/cli/dispatch-frontend.ts +173 -169
- package/packages/core/src/cli/dispatch-process.ts +14 -7
- package/packages/core/src/cli/dispatch-repository-feed.ts +196 -0
- package/packages/core/src/cli/dispatch.ts +397 -214
- package/packages/core/src/cli/dispatcher-liveness.ts +41 -21
- package/packages/core/src/cli/harvest.ts +71 -39
- package/packages/core/src/cli/help.ts +49 -32
- package/packages/core/src/cli/historical-build-state.ts +27 -0
- package/packages/core/src/cli/init-validation.ts +43 -2
- package/packages/core/src/cli/keyboard.ts +6 -0
- package/packages/core/src/cli/landings.ts +18 -0
- package/packages/core/src/cli/main.ts +52 -18
- package/packages/core/src/cli/mcp.ts +9 -0
- package/packages/core/src/cli/pr-attachments.ts +10 -13
- package/packages/core/src/cli/pr-summary-publication.ts +27 -60
- package/packages/core/src/cli/pr-summary.ts +43 -13
- package/packages/core/src/cli/publication-settlement.ts +177 -21
- package/packages/core/src/cli/repository-status.ts +49 -2
- package/packages/core/src/cli/status.ts +133 -36
- package/packages/core/src/cli/terminal-restore.ts +54 -0
- package/packages/core/src/cli/terminal.ts +16 -2
- package/packages/core/src/cli/terminals.ts +121 -219
- package/packages/core/src/cli/ticket-editor.ts +10 -3
- package/packages/core/src/cli/ticket.ts +115 -20
- package/packages/core/src/cli/upgrade-commit.ts +4 -0
- package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
- package/packages/core/src/cli/upgrade-landing.ts +69 -0
- package/packages/core/src/cli/upgrade.ts +16 -0
- package/packages/core/src/cli/wait.ts +194 -91
- package/packages/core/src/cli/watch.ts +111 -109
- package/packages/core/src/config/landing.ts +22 -0
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/pipeline-source.ts +4 -3
- package/packages/core/src/config/schema.ts +3 -0
- package/packages/core/src/events/catalog.ts +48 -3
- package/packages/core/src/events/payloads.ts +295 -6
- package/packages/core/src/events/repository.ts +38 -3
- package/packages/core/src/integration/harness.ts +11 -2
- package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +3330 -119
- package/packages/core/src/kernel/auto-merge-default.ts +1 -0
- package/packages/core/src/kernel/auto-merge.ts +29 -4
- package/packages/core/src/kernel/build-identity.ts +94 -0
- package/packages/core/src/kernel/change-presence.ts +179 -0
- package/packages/core/src/kernel/dispatch-status.ts +17 -1
- package/packages/core/src/kernel/dispatcher-liveness.ts +10 -4
- package/packages/core/src/kernel/engine.ts +89 -2
- package/packages/core/src/kernel/generators/build-log.ts +23 -0
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +25 -3
- package/packages/core/src/kernel/harvest.ts +25 -23
- package/packages/core/src/kernel/integration-completeness.ts +81 -0
- package/packages/core/src/kernel/integration-landing.ts +263 -0
- package/packages/core/src/kernel/integration-stack.ts +36 -0
- package/packages/core/src/kernel/integration-state.ts +135 -0
- package/packages/core/src/kernel/landing-policy.ts +47 -0
- package/packages/core/src/kernel/landing-publication.ts +41 -0
- package/packages/core/src/kernel/landing-readiness.ts +67 -0
- package/packages/core/src/kernel/landing-state.ts +96 -0
- package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
- package/packages/core/src/kernel/log-index-value.ts +38 -0
- package/packages/core/src/kernel/log-index.ts +35 -5
- package/packages/core/src/kernel/node-landing.ts +439 -0
- package/packages/core/src/kernel/node-parent.ts +184 -0
- package/packages/core/src/kernel/node-restack-state.ts +191 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
- package/packages/core/src/kernel/node-restack.ts +274 -0
- package/packages/core/src/kernel/read-facts.ts +704 -0
- package/packages/core/src/kernel/reconcile-head.ts +51 -0
- package/packages/core/src/kernel/reconcile-restack.ts +560 -0
- package/packages/core/src/kernel/reducer-registry.ts +153 -3
- package/packages/core/src/kernel/reducer.ts +121 -6
- package/packages/core/src/kernel/repository-attention.ts +179 -0
- package/packages/core/src/kernel/service-facts.ts +135 -0
- package/packages/core/src/kernel/snapshot-parent.ts +33 -0
- package/packages/core/src/kernel/terminal-guard.ts +133 -0
- package/packages/core/src/ontology.ts +9 -1
- package/packages/core/src/operator/annotations.ts +12 -0
- package/packages/core/src/operator/control.ts +11 -6
- package/packages/core/src/operator/index.ts +6 -0
- package/packages/core/src/operator/landings.ts +35 -0
- package/packages/core/src/operator/presentation.ts +1 -0
- package/packages/core/src/operator/protocol.ts +12 -3
- package/packages/core/src/operator/query.ts +40 -21
- package/packages/core/src/operator/read-view.ts +4 -13
- package/packages/core/src/operator/registry.ts +48 -19
- package/packages/core/src/operator/requests.ts +3 -22
- package/packages/core/src/operator/sandbox.ts +10 -9
- package/packages/core/src/operator/tickets.ts +57 -11
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/ports/forge/contract.ts +91 -3
- package/packages/core/src/ports/forge/fake.ts +142 -4
- package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
- package/packages/core/src/ports/forge/github-readiness.ts +421 -0
- package/packages/core/src/ports/forge/github.ts +631 -35
- package/packages/core/src/ports/forge/local-git.ts +119 -5
- package/packages/core/src/ports/forge/readiness.ts +99 -0
- package/packages/core/src/ports/tickets/contract.ts +41 -0
- package/packages/core/src/ports/tickets/create.ts +8 -1
- package/packages/core/src/ports/tickets/fake.ts +32 -1
- package/packages/core/src/ports/tickets/file-codec.ts +7 -0
- package/packages/core/src/ports/tickets/file.ts +18 -1
- package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
- package/packages/core/src/ports/tickets/linear.ts +124 -4
- package/packages/core/src/ports/tickets/migration.ts +25 -1
- package/packages/core/src/ports/tickets/operations.ts +7 -2
- package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
- package/packages/core/src/ports/tickets/remote.ts +10 -1
- package/packages/core/src/ports/tickets/revision.ts +3 -1
- package/packages/core/src/ports/tickets/tree.ts +148 -0
- package/packages/core/src/ports/tickets/update.ts +15 -2
- package/packages/core/src/ports/types.ts +135 -5
- package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
- package/packages/core/src/processes/build-child.ts +6 -6
- package/packages/core/src/processes/build-runner.ts +586 -87
- package/packages/core/src/processes/dispatch-failure-budget.ts +5 -4
- package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
- package/packages/core/src/processes/dispatcher.ts +2239 -357
- package/packages/core/src/processes/execution-no-progress.ts +46 -1
- package/packages/core/src/processes/harvest-execution-state.ts +15 -9
- package/packages/core/src/processes/harvest-runner.ts +34 -70
- package/packages/core/src/processes/harvest.ts +38 -15
- package/packages/core/src/processes/infrastructure-failure-budget.ts +13 -15
- package/packages/core/src/processes/orchestrator-tick.ts +2 -2
- package/packages/core/src/processes/publication-loss.ts +35 -21
- package/packages/core/src/processes/publication-state.ts +30 -5
- package/packages/core/src/processes/repo-view.ts +244 -1130
- package/packages/core/src/processes/tick-publication.ts +110 -0
- package/packages/core/src/store/adapter.ts +23 -0
- package/packages/core/src/store/build-scope.ts +35 -0
- package/packages/core/src/store/contract.ts +909 -0
- package/packages/core/src/store/digest.ts +52 -4
- package/packages/core/src/store/local/schema.ts +26 -13
- package/packages/core/src/store/local/store.ts +296 -55
- package/packages/core/src/store/memory.ts +181 -30
- package/packages/core/src/store/phase-session.ts +34 -0
- package/packages/core/src/store/reduced-reads.ts +240 -0
- package/packages/core/src/store/reducer-value-shapes.json +18323 -0
- package/packages/core/src/store/reducer-value-validation.ts +96 -0
- package/packages/core/src/store/reducer-values.ts +145 -0
- package/packages/core/src/store/remote/client.ts +85 -0
- package/packages/core/src/store/remote/compatibility.ts +21 -9
- package/packages/core/src/store/remote/index.ts +19 -0
- package/packages/core/src/store/remote/protocol.ts +27 -0
- package/packages/core/src/store/remote/version.ts +3 -1
- package/packages/core/src/store/repo-state-events.ts +3 -1
- package/packages/core/src/store/repo-tick.ts +72 -0
- package/packages/core/src/store/session-handle.ts +34 -0
- package/packages/core/src/store/snapshots.ts +10 -0
- package/packages/core/src/store/subscribe.ts +1 -1
- package/packages/core/src/store/ticket-assets.ts +4 -4
- package/packages/core/src/store/types.ts +71 -6
- package/packages/core/src/testing/dispatch-read-budget.ts +215 -0
- package/packages/core/src/testing/index.ts +10 -0
- package/packages/core/src/testing/reduced-read-budget.ts +502 -0
- package/packages/core/src/testing/refresh-scheduler.ts +32 -0
- package/skills/guide/SKILL.md +116 -62
- package/skills/guide/references/integration-tree.md +117 -0
- package/skills/guide/references/landing-policy.md +150 -0
- package/skills/guide/references/migration-1.0.md +68 -0
- package/skills/guide/references/operator-api.md +13 -6
- package/skills/guide/references/plugin-authoring.md +34 -0
- package/skills/guide/references/remote-store-protocol.md +114 -9
- package/skills/guide/references/remote-ticket-protocol.md +26 -5
- package/skills/guide/references/restacking.md +79 -0
- package/skills/guide/references/setup.md +49 -6
- package/skills/guide/references/ticket-dependencies.md +69 -0
- package/skills/guide/references/ticket-migration.md +8 -0
- package/skills/operate/SKILL.md +55 -5
- package/skills/reconcile/SKILL.md +55 -48
- package/skills/spec/SKILL.md +67 -1
- package/skills/tickets/SKILL.md +55 -2
- package/templates/autobuild.toml +3 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/** Small semantic projections used by stateless service requests. */
|
|
2
|
+
import type { AbEvent } from '../events/catalog'
|
|
3
|
+
import type { RepositoryEvent } from '../events/repository'
|
|
4
|
+
import type { ArtifactRef } from '../ontology'
|
|
5
|
+
import { defineReducer } from './incremental'
|
|
6
|
+
|
|
7
|
+
export const effectiveConfigReducer = defineReducer<
|
|
8
|
+
{ run?: string; reference?: ArtifactRef },
|
|
9
|
+
RepositoryEvent,
|
|
10
|
+
{ run?: string; reference?: ArtifactRef }
|
|
11
|
+
>({
|
|
12
|
+
version: 1,
|
|
13
|
+
initial: () => ({}),
|
|
14
|
+
fold(acc, events) {
|
|
15
|
+
for (const event of events) {
|
|
16
|
+
if (event.type === 'dispatcher.run-started') {
|
|
17
|
+
acc.run = event.payload.run
|
|
18
|
+
acc.reference = event.payload.effectiveConfig
|
|
19
|
+
} else if (
|
|
20
|
+
event.type === 'dispatcher.config-reloaded' &&
|
|
21
|
+
event.payload.run === acc.run &&
|
|
22
|
+
event.payload.effectiveConfig !== undefined
|
|
23
|
+
) {
|
|
24
|
+
acc.reference = event.payload.effectiveConfig
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
finish: (acc) => ({ ...acc }),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export function delegationFactKey(id: string): string {
|
|
32
|
+
return `id:${id}`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface EndingFact {
|
|
36
|
+
seq: number
|
|
37
|
+
at: string
|
|
38
|
+
}
|
|
39
|
+
export interface SessionFacts {
|
|
40
|
+
starts: number[]
|
|
41
|
+
endings: EndingFact[]
|
|
42
|
+
}
|
|
43
|
+
export interface BuildDelegationFacts {
|
|
44
|
+
lastSeq: number
|
|
45
|
+
sessions: Record<string, SessionFacts>
|
|
46
|
+
terminals: EndingFact[]
|
|
47
|
+
}
|
|
48
|
+
export interface HarvestDelegationFacts {
|
|
49
|
+
lastSeq: number
|
|
50
|
+
runs: Record<string, true>
|
|
51
|
+
sessions: Record<string, Record<string, SessionFacts>>
|
|
52
|
+
authorizations: Record<string, Record<string, { seq: number; leaseHolder: string }>>
|
|
53
|
+
releases: Record<string, string[]>
|
|
54
|
+
endings: Record<string, EndingFact[]>
|
|
55
|
+
}
|
|
56
|
+
/** Only lifecycle facts are retained. Contiguous canonical logs make every seq
|
|
57
|
+
* from 1 through lastSeq a valid anchor without one entry per dispatcher tick. */
|
|
58
|
+
export const buildDelegationReducer = defineReducer<
|
|
59
|
+
BuildDelegationFacts,
|
|
60
|
+
AbEvent,
|
|
61
|
+
BuildDelegationFacts
|
|
62
|
+
>({
|
|
63
|
+
version: 1,
|
|
64
|
+
initial: () => ({ lastSeq: 0, sessions: {}, terminals: [] }),
|
|
65
|
+
fold(acc, events) {
|
|
66
|
+
for (const event of events) {
|
|
67
|
+
acc.lastSeq = event.seq
|
|
68
|
+
if (event.type === 'session.started' || event.type === 'session.ended') {
|
|
69
|
+
const key = delegationFactKey(event.payload.session)
|
|
70
|
+
acc.sessions[key] ??= { starts: [], endings: [] }
|
|
71
|
+
const session = acc.sessions[key]!
|
|
72
|
+
if (event.type === 'session.started') session.starts.push(event.seq)
|
|
73
|
+
else session.endings.push({ seq: event.seq, at: event.ts })
|
|
74
|
+
} else if (event.type === 'build.completed' || event.type === 'build.aborted')
|
|
75
|
+
acc.terminals.push({ seq: event.seq, at: event.ts })
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
finish: (acc) => structuredClone(acc),
|
|
79
|
+
})
|
|
80
|
+
export const harvestDelegationReducer = defineReducer<
|
|
81
|
+
HarvestDelegationFacts,
|
|
82
|
+
RepositoryEvent,
|
|
83
|
+
HarvestDelegationFacts
|
|
84
|
+
>({
|
|
85
|
+
version: 1,
|
|
86
|
+
initial: () => ({
|
|
87
|
+
lastSeq: 0,
|
|
88
|
+
runs: {},
|
|
89
|
+
sessions: {},
|
|
90
|
+
authorizations: {},
|
|
91
|
+
releases: {},
|
|
92
|
+
endings: {},
|
|
93
|
+
}),
|
|
94
|
+
fold(acc, events) {
|
|
95
|
+
for (const event of events) {
|
|
96
|
+
acc.lastSeq = event.seq
|
|
97
|
+
if (event.type === 'harvest.started') acc.runs[delegationFactKey(event.payload.run)] = true
|
|
98
|
+
if (event.type === 'harvest.execution.authorized') {
|
|
99
|
+
const key = delegationFactKey(event.payload.run)
|
|
100
|
+
acc.authorizations[key] ??= {}
|
|
101
|
+
const run = acc.authorizations[key]!
|
|
102
|
+
run[delegationFactKey(event.payload.execution)] ??= {
|
|
103
|
+
seq: event.seq,
|
|
104
|
+
leaseHolder: event.payload.leaseHolder,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (event.type === 'harvest.session.started' || event.type === 'harvest.session.ended') {
|
|
108
|
+
const runKey = delegationFactKey(event.payload.run)
|
|
109
|
+
acc.sessions[runKey] ??= {}
|
|
110
|
+
const run = acc.sessions[runKey]!
|
|
111
|
+
const sessionKey = delegationFactKey(event.payload.session)
|
|
112
|
+
run[sessionKey] ??= { starts: [], endings: [] }
|
|
113
|
+
const session = run[sessionKey]!
|
|
114
|
+
if (event.type === 'harvest.session.started') session.starts.push(event.seq)
|
|
115
|
+
else session.endings.push({ seq: event.seq, at: event.ts })
|
|
116
|
+
}
|
|
117
|
+
if (event.type === 'harvest.execution.released' || event.type === 'harvest.execution.ended') {
|
|
118
|
+
const key = delegationFactKey(event.payload.execution)
|
|
119
|
+
acc.releases[key] ??= []
|
|
120
|
+
acc.releases[key]!.push(event.ts)
|
|
121
|
+
}
|
|
122
|
+
if (
|
|
123
|
+
event.type === 'harvest.completed' ||
|
|
124
|
+
event.type === 'harvest.escalated' ||
|
|
125
|
+
event.type === 'harvest.recovery-exhausted' ||
|
|
126
|
+
(event.type === 'harvest.failed' && !event.payload.willRetry)
|
|
127
|
+
) {
|
|
128
|
+
const key = delegationFactKey(event.payload.run)
|
|
129
|
+
acc.endings[key] ??= []
|
|
130
|
+
acc.endings[key]!.push({ seq: event.seq, at: event.ts })
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
finish: (acc) => structuredClone(acc),
|
|
135
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RestackDeps } from './reconcile-restack'
|
|
2
|
+
import { isValidGitBranchName } from './origin'
|
|
3
|
+
|
|
4
|
+
export async function snapshotParent(
|
|
5
|
+
deps: Pick<RestackDeps, 'forge' | 'exec' | 'workspacePath'>,
|
|
6
|
+
base: string,
|
|
7
|
+
destinationRef: string,
|
|
8
|
+
) {
|
|
9
|
+
const input = { workspacePath: deps.workspacePath, base, destinationRef }
|
|
10
|
+
if (deps.forge.snapshotBase) return deps.forge.snapshotBase(input)
|
|
11
|
+
if (!isValidGitBranchName(base)) throw new Error('invalid node parent branch')
|
|
12
|
+
// Like leaf target snapshots, Git-transport forges fetch into a private ref.
|
|
13
|
+
// The dispatcher supplies the forge's credentialed kernel execution seam.
|
|
14
|
+
const fetched = await deps.exec(
|
|
15
|
+
[
|
|
16
|
+
'git',
|
|
17
|
+
'fetch',
|
|
18
|
+
'--no-tags',
|
|
19
|
+
'--no-write-fetch-head',
|
|
20
|
+
'--refmap=',
|
|
21
|
+
'origin',
|
|
22
|
+
`+refs/heads/${base}:${destinationRef}`,
|
|
23
|
+
],
|
|
24
|
+
{ cwd: deps.workspacePath },
|
|
25
|
+
)
|
|
26
|
+
if (fetched.exitCode !== 0) throw new Error(fetched.stderr)
|
|
27
|
+
const head = await deps.exec(['git', 'rev-parse', '--verify', `${destinationRef}^{commit}`], {
|
|
28
|
+
cwd: deps.workspacePath,
|
|
29
|
+
})
|
|
30
|
+
if (head.exitCode !== 0 || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(head.stdout.trim()))
|
|
31
|
+
throw new Error('node parent snapshot did not resolve to a commit')
|
|
32
|
+
return head.stdout.trim()
|
|
33
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { AbEvent } from '../events/catalog'
|
|
2
|
+
import type { Phase } from '../ontology'
|
|
3
|
+
import { isVerifyPhase, verifyStep } from '../ontology'
|
|
4
|
+
import { phaseSpecFor } from './phases'
|
|
5
|
+
import { defineReducer } from './incremental'
|
|
6
|
+
type CliEnv = { phase: Phase; round: number; session: string }
|
|
7
|
+
interface TerminalGuardAcc {
|
|
8
|
+
reconcileAttempt: number
|
|
9
|
+
sessionStartedSeq?: number
|
|
10
|
+
permanent?: { seq: number; diagnostic: string }
|
|
11
|
+
completion?: { seq: number; diagnostic: string }
|
|
12
|
+
}
|
|
13
|
+
export function terminalGuardReducer(env: CliEnv) {
|
|
14
|
+
const spec = phaseSpecFor(env.phase)
|
|
15
|
+
return defineReducer<TerminalGuardAcc, AbEvent, { diagnostic?: string }>({
|
|
16
|
+
version: 1,
|
|
17
|
+
initial: () => ({ reconcileAttempt: 0 }),
|
|
18
|
+
fold(acc, events) {
|
|
19
|
+
for (const event of events) {
|
|
20
|
+
if (event.type === 'spec.revised' && (isVerifyPhase(env.phase) || env.phase === 'finalize'))
|
|
21
|
+
delete acc.completion
|
|
22
|
+
if (event.type === 'reconcile.started') acc.reconcileAttempt = event.payload.attempt
|
|
23
|
+
if (event.type === 'session.started' && event.payload.session === env.session)
|
|
24
|
+
acc.sessionStartedSeq = event.seq
|
|
25
|
+
try {
|
|
26
|
+
checkEvent(event, env, acc.reconcileAttempt, acc.sessionStartedSeq)
|
|
27
|
+
} catch (error) {
|
|
28
|
+
const key = event.type === spec.terminalEvent ? 'completion' : 'permanent'
|
|
29
|
+
acc[key] ??= { seq: event.seq, diagnostic: (error as Error).message }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
finish(acc) {
|
|
34
|
+
const first = [acc.permanent, acc.completion]
|
|
35
|
+
.filter((item) => item !== undefined)
|
|
36
|
+
.sort((a, b) => a.seq - b.seq)[0]
|
|
37
|
+
return first ? { diagnostic: first.diagnostic } : {}
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
function checkEvent(
|
|
42
|
+
event: AbEvent,
|
|
43
|
+
env: CliEnv,
|
|
44
|
+
reconcileAttempt: number,
|
|
45
|
+
sessionStartedSeq?: number,
|
|
46
|
+
): void {
|
|
47
|
+
const spec = phaseSpecFor(env.phase)
|
|
48
|
+
const restartSeq = 0
|
|
49
|
+
if (event.type === 'session.ended' && event.payload.session === env.session) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`terminal rejected (D5): session "${env.session}" already ended ` +
|
|
52
|
+
`(session.ended at seq ${event.seq}) — a session that ended without ` +
|
|
53
|
+
'a terminal was failed and retried; only the live retry may complete ' +
|
|
54
|
+
'this phase round (§8.4).',
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
if (
|
|
58
|
+
sessionStartedSeq !== undefined &&
|
|
59
|
+
event.type === 'phase.failed' &&
|
|
60
|
+
event.payload.phase === env.phase &&
|
|
61
|
+
event.payload.round === env.round &&
|
|
62
|
+
event.seq > sessionStartedSeq
|
|
63
|
+
) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`terminal rejected (D5): ${env.phase}@${env.round} already failed after ` +
|
|
66
|
+
`this session started (phase.failed at seq ${event.seq}) — the retry ` +
|
|
67
|
+
'session owns this round now (§8.4).',
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
if (
|
|
71
|
+
event.type === 'escalation.raised' &&
|
|
72
|
+
event.actor.kind === 'agent' &&
|
|
73
|
+
event.actor.session === env.session
|
|
74
|
+
) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
`second terminal call rejected (D5): this session already escalated — ` +
|
|
77
|
+
`escalation.raised "${event.payload.id}" at seq ${event.seq}. ` +
|
|
78
|
+
'Every phase ends with exactly one terminal command (§8.4).',
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
if (
|
|
82
|
+
event.type === 'publication.requested' &&
|
|
83
|
+
event.actor.kind === 'agent' &&
|
|
84
|
+
event.actor.session === env.session &&
|
|
85
|
+
((env.phase === 'implement' &&
|
|
86
|
+
event.payload.operation === 'implement' &&
|
|
87
|
+
event.payload.round === env.round) ||
|
|
88
|
+
(env.phase === 'reconcile' && event.payload.operation === 'reconcile') ||
|
|
89
|
+
(env.phase === 'finalize' && event.payload.operation === 'finalize'))
|
|
90
|
+
) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`second terminal call rejected (D5): ${event.type} for ` +
|
|
93
|
+
`${env.phase}@${env.round} already recorded at seq ${event.seq}. ` +
|
|
94
|
+
'Remote publication is pending; do not run ab done again (§8.4).',
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
if (event.type !== spec.terminalEvent) return
|
|
98
|
+
if (
|
|
99
|
+
(event.type === 'verify.completed' || event.type === 'finalize.completed') &&
|
|
100
|
+
event.seq <= restartSeq
|
|
101
|
+
) {
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
if (!terminalMatchesRound(event, env, reconcileAttempt)) return
|
|
105
|
+
throw new Error(
|
|
106
|
+
`second terminal call rejected (D5): ${event.type} for ` +
|
|
107
|
+
`${env.phase}@${env.round} already recorded at seq ${event.seq}. ` +
|
|
108
|
+
'Every phase ends with exactly one terminal command (§8.4).',
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
function terminalMatchesRound(event: AbEvent, env: CliEnv, reconcileAttempt: number): boolean {
|
|
112
|
+
switch (event.type) {
|
|
113
|
+
case 'plan.completed':
|
|
114
|
+
case 'plan-review.verdict':
|
|
115
|
+
case 'implement.completed':
|
|
116
|
+
case 'code-review.verdict':
|
|
117
|
+
return event.payload.round === env.round
|
|
118
|
+
case 'verify.completed':
|
|
119
|
+
return (
|
|
120
|
+
isVerifyPhase(env.phase) &&
|
|
121
|
+
event.payload.step === verifyStep(env.phase) &&
|
|
122
|
+
event.payload.attempt === env.round
|
|
123
|
+
)
|
|
124
|
+
case 'finalize.completed':
|
|
125
|
+
// finalize runs once per build (§5) — any prior completion counts.
|
|
126
|
+
return true
|
|
127
|
+
case 'reconcile.completed':
|
|
128
|
+
// No started event before it → conservative match (total over any log).
|
|
129
|
+
return reconcileAttempt === env.round || reconcileAttempt === 0
|
|
130
|
+
default:
|
|
131
|
+
return false
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -245,7 +245,15 @@ export const buildOutcomeSchema = z.enum(['merged', 'closed-unmerged', 'abandone
|
|
|
245
245
|
export type BuildOutcome = z.infer<typeof buildOutcomeSchema>
|
|
246
246
|
|
|
247
247
|
/** Derived status — a reduction of events, never stored (SPEC §15.5). */
|
|
248
|
-
export const BUILD_STATUSES = [
|
|
248
|
+
export const BUILD_STATUSES = [
|
|
249
|
+
'queued',
|
|
250
|
+
'running',
|
|
251
|
+
'collecting',
|
|
252
|
+
'paused',
|
|
253
|
+
'blocked',
|
|
254
|
+
'done',
|
|
255
|
+
'aborted',
|
|
256
|
+
] as const
|
|
249
257
|
export type BuildStatus = (typeof BUILD_STATUSES)[number]
|
|
250
258
|
|
|
251
259
|
export const commitRangeSchema = z.strictObject({
|
|
@@ -26,6 +26,18 @@ export interface ToolAnnotationsTableEntry {
|
|
|
26
26
|
|
|
27
27
|
/** The exact version-one tool names; the registry's closed table must match. */
|
|
28
28
|
export const OPERATOR_TOOL_ANNOTATIONS = {
|
|
29
|
+
'landings.list': {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
destructiveHint: false,
|
|
32
|
+
idempotentHint: true,
|
|
33
|
+
approval: 'never',
|
|
34
|
+
},
|
|
35
|
+
'tickets.tree': {
|
|
36
|
+
readOnlyHint: true,
|
|
37
|
+
destructiveHint: false,
|
|
38
|
+
idempotentHint: true,
|
|
39
|
+
approval: 'never',
|
|
40
|
+
},
|
|
29
41
|
'builds.list': {
|
|
30
42
|
readOnlyHint: true,
|
|
31
43
|
destructiveHint: false,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { readRepositoryFacts } from '../store/reduced-reads'
|
|
1
2
|
import { humanActor, type Via } from '../events/envelope'
|
|
2
3
|
import type { RepositoryEventEnvelope } from '../events/repository'
|
|
3
|
-
import { reduceDispatchSettings } from '../kernel/dispatch-settings'
|
|
4
|
-
import { reduceHarvest } from '../kernel/harvest'
|
|
5
4
|
import type { BuildStore } from '../store/types'
|
|
6
5
|
import { projectHarvest, type HarvestRunAction } from '../cli/dashboard/model'
|
|
7
6
|
|
|
8
7
|
export class OperatorControlError extends Error {
|
|
9
8
|
constructor(
|
|
10
9
|
readonly code:
|
|
10
|
+
| 'retired-setting'
|
|
11
11
|
| 'stale-harvest-run'
|
|
12
12
|
| 'harvest-paused'
|
|
13
13
|
| 'harvest-pending'
|
|
@@ -34,6 +34,11 @@ export async function setRepositorySetting(opts: {
|
|
|
34
34
|
* journal; optional so the operator API (which has no run) is unchanged. */
|
|
35
35
|
run?: string
|
|
36
36
|
}): Promise<{ enabled: boolean; event: RepositoryEventEnvelope }> {
|
|
37
|
+
if (opts.setting === 'auto-merge-default')
|
|
38
|
+
throw new OperatorControlError(
|
|
39
|
+
'retired-setting',
|
|
40
|
+
'Auto-merge default is retired; configure [[landing]] rules in autobuild.toml',
|
|
41
|
+
)
|
|
37
42
|
await opts.store.ensureRepo(opts.repo)
|
|
38
43
|
const payload = {
|
|
39
44
|
enabled: opts.enabled,
|
|
@@ -65,7 +70,7 @@ export async function toggleRepositorySetting(opts: {
|
|
|
65
70
|
}): Promise<{ enabled: boolean; event: RepositoryEventEnvelope }> {
|
|
66
71
|
await opts.store.ensureRepo(opts.repo)
|
|
67
72
|
// Bounded read (AUT-489): the settings reducer consumes durable types only.
|
|
68
|
-
const settings =
|
|
73
|
+
const settings = (await readRepositoryFacts(opts.store, opts.repo)).value.settings
|
|
69
74
|
const enabled = opts.setting === 'intake' ? !settings.intake : !settings.defaultAutoMerge
|
|
70
75
|
return setRepositorySetting({ ...opts, enabled })
|
|
71
76
|
}
|
|
@@ -78,7 +83,7 @@ export async function toggleHarvestGate(opts: {
|
|
|
78
83
|
}): Promise<{ command: 'pause' | 'resume'; event: RepositoryEventEnvelope }> {
|
|
79
84
|
await opts.store.ensureRepo(opts.repo)
|
|
80
85
|
// Bounded read (AUT-489): the harvest reducer consumes durable types only.
|
|
81
|
-
const state =
|
|
86
|
+
const state = (await readRepositoryFacts(opts.store, opts.repo)).value.harvest
|
|
82
87
|
const pending = state.pendingCommands.at(-1)
|
|
83
88
|
const requestedPaused = pending === undefined ? state.paused : pending.command === 'pause'
|
|
84
89
|
const command = requestedPaused ? 'resume' : 'pause'
|
|
@@ -101,8 +106,8 @@ export async function controlHarvestRun(opts: {
|
|
|
101
106
|
await opts.store.ensureRepo(opts.repo)
|
|
102
107
|
// Bounded read (AUT-489): the harvest reducer and the dashboard harvest
|
|
103
108
|
// projection consume durable types only.
|
|
104
|
-
const events = await opts.store
|
|
105
|
-
const state =
|
|
109
|
+
const events = (await readRepositoryFacts(opts.store, opts.repo)).value
|
|
110
|
+
const state = events.harvest
|
|
106
111
|
const projected = projectHarvest(events)
|
|
107
112
|
if (projected === undefined || projected.run !== opts.run) {
|
|
108
113
|
throw new OperatorControlError(
|
|
@@ -92,6 +92,7 @@ export type {
|
|
|
92
92
|
OperatorTicketQueue,
|
|
93
93
|
} from './tickets'
|
|
94
94
|
export {
|
|
95
|
+
openOperatorTickets,
|
|
95
96
|
prepareOperatorTicketAssets,
|
|
96
97
|
listOperatorTicketStates,
|
|
97
98
|
createOperatorTicketState,
|
|
@@ -137,3 +138,8 @@ export {
|
|
|
137
138
|
} from './query'
|
|
138
139
|
|
|
139
140
|
export { ticketStateCreateRequestSchema } from './protocol'
|
|
141
|
+
|
|
142
|
+
export { readBuildFacts } from '../store/reduced-reads'
|
|
143
|
+
|
|
144
|
+
export { listOperatorLandings } from './landings'
|
|
145
|
+
export { readTicketTree, getOperatorTicketTree } from './tickets'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BUILD_EFFECTIVE_CONFIG_ARTIFACT,
|
|
3
|
+
parseEffectiveBuildConfig,
|
|
4
|
+
} from '../processes/build-execution-state'
|
|
5
|
+
import type { BuildStore } from '../store/types'
|
|
6
|
+
import { readBuildDigests } from '../store/reduced-reads'
|
|
7
|
+
import { withOperatorView } from './read-view'
|
|
8
|
+
import { projectTree, type ConsentQueueEntry } from '../cli/dashboard/tree'
|
|
9
|
+
|
|
10
|
+
/** Stored readiness only; land reobserves live completeness at its mutation boundary. */
|
|
11
|
+
export async function listOperatorLandings(opts: {
|
|
12
|
+
store: BuildStore
|
|
13
|
+
repo: string
|
|
14
|
+
}): Promise<ConsentQueueEntry[]> {
|
|
15
|
+
return withOperatorView(opts.store, opts.repo, 'builds', async (view) => {
|
|
16
|
+
const records = await view.listBuilds()
|
|
17
|
+
const digests = await readBuildDigests(view, opts.repo)
|
|
18
|
+
const entries: ConsentQueueEntry[] = []
|
|
19
|
+
for (const record of records) {
|
|
20
|
+
if (record.repo !== opts.repo) continue
|
|
21
|
+
const digest = digests.get(record.slug)
|
|
22
|
+
if (!digest)
|
|
23
|
+
throw new Error(`getRepoBuildDigests is missing an entry for build "${record.slug}"`)
|
|
24
|
+
if (digest.terminal !== undefined) continue
|
|
25
|
+
const facts = await view.buildFacts(record.slug)
|
|
26
|
+
const artifact = facts.state.landing?.decision
|
|
27
|
+
? await view.getArtifact(record.slug, BUILD_EFFECTIVE_CONFIG_ARTIFACT)
|
|
28
|
+
: null
|
|
29
|
+
const expected = artifact ? parseEffectiveBuildConfig(artifact).verify.steps : undefined
|
|
30
|
+
const tree = projectTree(record, facts.state, facts.log.restack, expected)
|
|
31
|
+
if (tree.consent) entries.push({ slug: record.slug, ...tree })
|
|
32
|
+
}
|
|
33
|
+
return entries.sort((a, b) => a.slug.localeCompare(b.slug))
|
|
34
|
+
})
|
|
35
|
+
}
|
|
@@ -8,8 +8,8 @@ export const buildControlRequestSchema = z.discriminatedUnion('action', [
|
|
|
8
8
|
z.strictObject({ action: z.literal('resume') }),
|
|
9
9
|
z.strictObject({ action: z.literal('abort') }),
|
|
10
10
|
z.strictObject({ action: z.literal('discard') }),
|
|
11
|
-
z.strictObject({ action: z.literal('
|
|
12
|
-
z.strictObject({ action: z.literal('
|
|
11
|
+
z.strictObject({ action: z.literal('land') }),
|
|
12
|
+
z.strictObject({ action: z.literal('hold') }),
|
|
13
13
|
])
|
|
14
14
|
export type OperatorBuildControlRequest = z.infer<typeof buildControlRequestSchema>
|
|
15
15
|
|
|
@@ -49,6 +49,8 @@ export const harvestControlRequestSchema = z.discriminatedUnion('action', [
|
|
|
49
49
|
])
|
|
50
50
|
|
|
51
51
|
export const ticketCreateRequestSchema = z.strictObject({
|
|
52
|
+
kind: z.enum(['work', 'node']).optional(),
|
|
53
|
+
target: z.string().trim().min(1).nullable().optional(),
|
|
52
54
|
title: z.string(),
|
|
53
55
|
body: z.string(),
|
|
54
56
|
labels: z.array(z.string()).optional(),
|
|
@@ -61,13 +63,20 @@ const expectedRevisionSchema = z
|
|
|
61
63
|
.optional()
|
|
62
64
|
export const ticketUpdateRequestSchema = z
|
|
63
65
|
.strictObject({
|
|
66
|
+
kind: z.enum(['work', 'node']).optional(),
|
|
67
|
+
target: z.string().trim().min(1).nullable().optional(),
|
|
64
68
|
expectedRevision: expectedRevisionSchema,
|
|
65
69
|
title: z.string().optional(),
|
|
66
70
|
body: z.string().optional(),
|
|
67
71
|
labels: z.array(z.string()).optional(),
|
|
68
72
|
})
|
|
69
73
|
.refine(
|
|
70
|
-
(value) =>
|
|
74
|
+
(value) =>
|
|
75
|
+
value.title !== undefined ||
|
|
76
|
+
value.body !== undefined ||
|
|
77
|
+
value.labels !== undefined ||
|
|
78
|
+
value.kind !== undefined ||
|
|
79
|
+
value.target !== undefined,
|
|
71
80
|
'update must name at least one field',
|
|
72
81
|
)
|
|
73
82
|
export const ticketMoveRequestSchema = z.strictObject({
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { forgeReadinessWarnings } from '../kernel/dispatch-status'
|
|
2
|
+
import { readBuildDigests } from '../store/reduced-reads'
|
|
3
|
+
import {
|
|
4
|
+
readBuildFacts,
|
|
5
|
+
readRepositoryFacts,
|
|
6
|
+
type RepositoryReadFacts,
|
|
7
|
+
} from '../store/reduced-reads'
|
|
1
8
|
import { readDispatcherLiveness } from '../cli/dispatcher-liveness'
|
|
2
9
|
import { composeBuildConfig } from '../config/live'
|
|
3
10
|
import type { PipelineSourceMeta } from '../config/pipeline-source'
|
|
@@ -9,26 +16,25 @@ import {
|
|
|
9
16
|
} from '../processes/build-execution-state'
|
|
10
17
|
import type { Artifact } from '../store/types'
|
|
11
18
|
import {
|
|
12
|
-
|
|
19
|
+
detailFromFacts,
|
|
13
20
|
statusFilter,
|
|
14
21
|
summarizeFrom,
|
|
15
22
|
type BuildDetail,
|
|
16
23
|
type BuildSummary,
|
|
17
24
|
} from '../cli/status'
|
|
18
|
-
import {
|
|
25
|
+
import { repositoryStatusFromFacts, type RepositoryStatus } from '../cli/repository-status'
|
|
19
26
|
import { projectHarvestStatus, type HarvestStatusView } from '../cli/harvest'
|
|
20
27
|
import {
|
|
21
28
|
buildDashboardFromProjected,
|
|
22
29
|
effectiveStatus,
|
|
23
|
-
projectBuild,
|
|
24
30
|
projectBuildFromFacts,
|
|
25
31
|
type DashboardBuild,
|
|
26
32
|
type DashboardModel,
|
|
27
33
|
} from '../cli/dashboard/model'
|
|
28
|
-
import {
|
|
34
|
+
import type { BuildState } from '../kernel/reducer'
|
|
29
35
|
import { DISPATCHER_EFFECTIVE_CONFIG_ARTIFACT } from '../store/retention'
|
|
30
36
|
import { reduceDispatchStatus } from '../kernel/dispatch-status'
|
|
31
|
-
import {
|
|
37
|
+
import { unclaimedObservationCount } from '../processes/harvest'
|
|
32
38
|
import type { RepoViewStore } from '../processes/repo-view'
|
|
33
39
|
import { withOperatorView } from './read-view'
|
|
34
40
|
import type { RepositoryEvent } from '../events/repository'
|
|
@@ -74,7 +80,7 @@ async function listFromView(
|
|
|
74
80
|
// finished builds accumulate. The `--all` scope includes terminal statuses,
|
|
75
81
|
// so it takes no digest read and skips nothing; its terminal builds are
|
|
76
82
|
// restored from the reducer snapshots the dispatcher leaves at settlement.
|
|
77
|
-
const digests = opts.scope === 'all' ? undefined : await view
|
|
83
|
+
const digests = opts.scope === 'all' ? undefined : await readBuildDigests(view, opts.repo)
|
|
78
84
|
const output: BuildSummary[] = []
|
|
79
85
|
for (const record of records) {
|
|
80
86
|
if (record.repo !== opts.repo) continue
|
|
@@ -114,14 +120,19 @@ export async function effectiveConfig(
|
|
|
114
120
|
repo: string,
|
|
115
121
|
/** The bounded journal, when the caller already holds it (a repository
|
|
116
122
|
* view); otherwise it is read from the store. */
|
|
117
|
-
journal?:
|
|
123
|
+
journal?: RepositoryReadFacts,
|
|
118
124
|
): Promise<{
|
|
119
125
|
config: Config
|
|
120
|
-
repositoryEvents:
|
|
126
|
+
repositoryEvents: RepositoryReadFacts
|
|
121
127
|
status: ReturnType<typeof reduceDispatchStatus>
|
|
122
128
|
}> {
|
|
123
|
-
const repositoryEvents = journal ?? (await
|
|
124
|
-
const status =
|
|
129
|
+
const repositoryEvents = journal ?? (await readRepositoryFacts(store, repo)).value
|
|
130
|
+
const status = repositoryEvents.status
|
|
131
|
+
if (status?.effectiveConfig === undefined)
|
|
132
|
+
throw new OperatorQueryError(
|
|
133
|
+
'effective-config-unavailable',
|
|
134
|
+
`effective config unavailable for repository "${repo}"${repositoryEvents.config.run === undefined ? ': no dispatcher run is recorded' : ''}`,
|
|
135
|
+
)
|
|
125
136
|
const ref = status.effectiveConfig!
|
|
126
137
|
const artifact = await store.getRepoArtifact(repo, ref.kind, ref.rev)
|
|
127
138
|
if (artifact === null) {
|
|
@@ -258,19 +269,19 @@ export async function getOperatorBuild(opts: {
|
|
|
258
269
|
now: Date
|
|
259
270
|
}): Promise<OperatorBuildView> {
|
|
260
271
|
const record = await requireBuild(opts.store, opts.repo, opts.slug)
|
|
261
|
-
const
|
|
262
|
-
const state =
|
|
272
|
+
const facts = (await readBuildFacts(opts.store, opts.slug)).value
|
|
273
|
+
const state = facts.state
|
|
263
274
|
const { config } = await effectiveConfig(opts.store, opts.repo)
|
|
264
275
|
let dashboardRow: DashboardBuild | null = null
|
|
265
276
|
if (!projectsNoDashboardRow(state)) {
|
|
266
277
|
const pinned = await readPinnedConfig(opts.store, opts.slug, config)
|
|
267
|
-
const row =
|
|
278
|
+
const row = projectBuildFromFacts(record, state, facts, config, undefined, pinned.config)
|
|
268
279
|
// Implied by the gate; kept as an explicit check (not an assertion) so the
|
|
269
280
|
// code never lies if `effectiveStatus` and `projectBuild` ever drift.
|
|
270
281
|
if (row !== null) dashboardRow = decorateWithPinnedMeta(row, pinned)
|
|
271
282
|
}
|
|
272
283
|
return {
|
|
273
|
-
detail:
|
|
284
|
+
detail: detailFromFacts(record, facts, opts.now),
|
|
274
285
|
dashboardRow,
|
|
275
286
|
}
|
|
276
287
|
}
|
|
@@ -281,8 +292,12 @@ export async function getRepositoryStatus(
|
|
|
281
292
|
now = new Date(),
|
|
282
293
|
): Promise<RepositoryStatus> {
|
|
283
294
|
return withOperatorView(store, repo, 'journal', async (view) => {
|
|
284
|
-
const { dispatcher } = await readDispatcherLiveness(store, repo, now
|
|
285
|
-
return
|
|
295
|
+
const { dispatcher } = await readDispatcherLiveness(store, repo, now)
|
|
296
|
+
return repositoryStatusFromFacts(
|
|
297
|
+
repo,
|
|
298
|
+
(await readRepositoryFacts(view, repo)).value,
|
|
299
|
+
dispatcher,
|
|
300
|
+
)
|
|
286
301
|
})
|
|
287
302
|
}
|
|
288
303
|
|
|
@@ -291,7 +306,7 @@ export async function getHarvestStatus(
|
|
|
291
306
|
repo: string,
|
|
292
307
|
): Promise<HarvestStatusView> {
|
|
293
308
|
return withOperatorView(store, repo, 'journal', async (view) =>
|
|
294
|
-
projectHarvestStatus(repo, view.
|
|
309
|
+
projectHarvestStatus(repo, view.repositoryFacts()),
|
|
295
310
|
)
|
|
296
311
|
}
|
|
297
312
|
|
|
@@ -321,7 +336,7 @@ async function dashboardFromView(
|
|
|
321
336
|
const { config, repositoryEvents, status } = await effectiveConfig(
|
|
322
337
|
view,
|
|
323
338
|
opts.repo,
|
|
324
|
-
view.
|
|
339
|
+
view.repositoryFacts(),
|
|
325
340
|
)
|
|
326
341
|
const records = await view.listBuilds()
|
|
327
342
|
// One digest read covers every build of the repository (AUT-487): the
|
|
@@ -330,7 +345,7 @@ async function dashboardFromView(
|
|
|
330
345
|
// builds accumulate. Row-rendering builds derive from the repository view's
|
|
331
346
|
// reducer snapshots plus a delta read (AUT-650); every snapshot is a cache
|
|
332
347
|
// the event log regenerates, so the response equals a full replay's.
|
|
333
|
-
const digests = await view
|
|
348
|
+
const digests = await readBuildDigests(view, opts.repo)
|
|
334
349
|
const projected: DashboardBuild[] = []
|
|
335
350
|
let activeCount = 0
|
|
336
351
|
for (const record of records) {
|
|
@@ -345,7 +360,7 @@ async function dashboardFromView(
|
|
|
345
360
|
// Reduced status is `done`/`aborted` exactly when a terminal fact exists,
|
|
346
361
|
// so `terminal === undefined` is exactly the old active test — no history
|
|
347
362
|
// read needed for the count.
|
|
348
|
-
if (digest.terminal === undefined) activeCount += 1
|
|
363
|
+
if (digest.terminal === undefined && digest.kind !== 'node') activeCount += 1
|
|
349
364
|
if (digest.terminal === 'done') continue
|
|
350
365
|
// Both query surfaces share the `projectsNoDashboardRow` gate (AUT-486
|
|
351
366
|
// snapshot, AUT-496 detail query): a build that projects no row —
|
|
@@ -372,9 +387,13 @@ async function dashboardFromView(
|
|
|
372
387
|
// `effectiveConfig` already returned — no per-build history reads (AUT-487).
|
|
373
388
|
// The pure core writes nothing — a snapshot performs no store writes and
|
|
374
389
|
// never creates or locks the repository record.
|
|
375
|
-
const observationCount = unclaimedObservationCount({
|
|
390
|
+
const observationCount = unclaimedObservationCount({
|
|
391
|
+
digests,
|
|
392
|
+
harvestEvents: repositoryEvents.harvest,
|
|
393
|
+
})
|
|
376
394
|
const warningLines = [
|
|
377
395
|
...status.roleWarnings,
|
|
396
|
+
...forgeReadinessWarnings(status),
|
|
378
397
|
...(status.warningNotice !== undefined ? [status.warningNotice] : []),
|
|
379
398
|
]
|
|
380
399
|
const model = buildDashboardFromProjected(
|