@defrex/autobuild 1.4.1 → 1.5.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 +440 -95
- 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 +2 -1
- package/docs/architecture.md +290 -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 +166 -101
- package/docs/dispatcher-hosting.md +19 -3
- package/docs/dispatcher.md +9 -4
- package/docs/integration-overview.md +2 -2
- package/docs/integration-tree.md +91 -28
- package/docs/merge-policy.md +28 -9
- package/docs/operator-api.md +43 -18
- package/docs/operator-surfaces.md +1 -1
- package/docs/plugin-authoring.md +85 -8
- package/docs/remote-store-protocol.md +25 -7
- package/docs/remote-ticket-protocol.md +126 -12
- package/docs/restacking.md +20 -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 +2 -2
- package/docs/verification.md +5 -5
- package/docs/website.md +8 -0
- package/docs/workspaces.md +1 -1
- package/package.json +5 -4
- package/packages/core/src/accounts/hosted-readiness.ts +21 -0
- package/packages/core/src/cli/attention.ts +1 -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 +40 -10
- package/packages/core/src/cli/dashboard/queue.ts +21 -0
- package/packages/core/src/cli/dashboard/render.ts +40 -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-repository-feed.ts +40 -11
- package/packages/core/src/cli/dispatch.ts +154 -47
- package/packages/core/src/cli/help.ts +59 -22
- 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/repository-status.ts +201 -49
- package/packages/core/src/cli/status.ts +41 -3
- 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/watch.ts +4 -0
- 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 +164 -36
- package/packages/core/src/distribution-packaging.ts +1 -1
- package/packages/core/src/events/catalog.ts +5 -0
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/payloads.ts +70 -0
- package/packages/core/src/events/policy.ts +8 -0
- package/packages/core/src/events/repository.ts +91 -28
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +41 -0
- 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 +80 -14
- 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 +4 -2
- package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -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/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 +11 -0
- 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/log-index.ts +1 -1
- package/packages/core/src/kernel/node-issue-links.ts +142 -0
- 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 +31 -1
- package/packages/core/src/kernel/reducer.ts +90 -2
- package/packages/core/src/kernel/ticket-preparation.ts +12 -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 +66 -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 +72 -17
- 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 -11
- package/packages/core/src/ports/workspace/commit-preservation.ts +135 -13
- package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +132 -27
- package/packages/core/src/processes/build-runner.ts +99 -21
- package/packages/core/src/processes/dispatcher.ts +1080 -533
- package/packages/core/src/processes/execution-no-progress.ts +5 -0
- package/packages/core/src/processes/harvest-runner.ts +17 -8
- 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 +37 -2
- package/packages/core/src/runtime-identity.ts +10 -2
- package/packages/core/src/scenarios/harness.ts +4 -0
- 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/reducer-value-shapes.json +4187 -3391
- 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/index.ts +2 -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 +1197 -31
- 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 +382 -139
- 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 +43 -18
- package/skills/guide/references/plugin-authoring.md +85 -8
- package/skills/guide/references/remote-store-protocol.md +25 -7
- package/skills/guide/references/remote-ticket-protocol.md +126 -12
- package/skills/guide/references/restacking.md +20 -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 +103 -28
- 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 +114 -37
- package/templates/autobuild.toml +5 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -2,29 +2,80 @@ import { readTicketMigrations, resolveTicketRef, type TicketMigrations } from '.
|
|
|
2
2
|
import type { BuildState } from './reducer'
|
|
3
3
|
import type { TicketSource, TicketListing } from '../ports/types'
|
|
4
4
|
import type { BuildStore, BuildRecord } from '../store/types'
|
|
5
|
-
import { readBuildFacts } from '../store/reduced-reads'
|
|
5
|
+
import { readBuildDigests, readBuildFacts } from '../store/reduced-reads'
|
|
6
|
+
import { digestNodeTargets } from '../store/digest'
|
|
6
7
|
import { DISPATCHER } from '../events/envelope'
|
|
7
8
|
import type { EventPayload } from '../events/payloads'
|
|
9
|
+
import { contributedIssueLinks } from './node-issue-links'
|
|
10
|
+
import { holdsState } from '../ports/tickets/lifecycle'
|
|
8
11
|
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
12
|
+
/** The pass's source sample: either one exhaustive listing shared by every
|
|
13
|
+
* node, or, when the source lists one node's targeting tickets, a per-node
|
|
14
|
+
* targeted listing memoized for the pass. Scheduling may be cached;
|
|
15
|
+
* publication always requests a sample from this pass. */
|
|
11
16
|
export interface IntegrationObservationInputs {
|
|
12
17
|
migrations?: TicketMigrations
|
|
13
|
-
listing
|
|
14
|
-
|
|
18
|
+
listing?: TicketListing
|
|
19
|
+
targeting?: (nodeId: string) => Promise<TicketListing>
|
|
20
|
+
/** Every repository build with the node slugs its digest names, a superset
|
|
21
|
+
* of every node it targets or moves between. */
|
|
22
|
+
builds: { record: BuildRecord; nodeTargets: readonly string[] }[]
|
|
23
|
+
/** Current facts for one build; memoized for this sample. */
|
|
24
|
+
state: (slug: string) => Promise<BuildState>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function canEnumerate(tickets: TicketSource): boolean {
|
|
28
|
+
return !!tickets.integrationTree && (!!tickets.listAll || !!tickets.listTargeting)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** One targeted listing per node for the life of an inputs object; a failed
|
|
32
|
+
* read is forgotten so a later pass retries it. */
|
|
33
|
+
function memoizedTargeting(
|
|
34
|
+
tickets: TicketSource & { listTargeting: NonNullable<TicketSource['listTargeting']> },
|
|
35
|
+
): (nodeId: string) => Promise<TicketListing> {
|
|
36
|
+
// Captured once: the targeting decision is fixed for the pass, so a source
|
|
37
|
+
// that withdraws it later fails closed rather than falling back to listAll.
|
|
38
|
+
const list = tickets.listTargeting.bind(tickets)
|
|
39
|
+
const listings = new Map<string, Promise<TicketListing>>()
|
|
40
|
+
return (nodeId) => {
|
|
41
|
+
let listing = listings.get(nodeId)
|
|
42
|
+
if (listing === undefined) {
|
|
43
|
+
listing = list(nodeId)
|
|
44
|
+
listings.set(nodeId, listing)
|
|
45
|
+
listing.catch(() => listings.delete(nodeId))
|
|
46
|
+
}
|
|
47
|
+
return listing
|
|
48
|
+
}
|
|
15
49
|
}
|
|
16
50
|
export async function integrationObservationInputs(
|
|
17
51
|
store: BuildStore,
|
|
18
52
|
tickets: TicketSource,
|
|
19
53
|
repo: string,
|
|
20
54
|
): Promise<IntegrationObservationInputs> {
|
|
21
|
-
if (!tickets
|
|
55
|
+
if (!canEnumerate(tickets))
|
|
22
56
|
throw new Error('ticket source cannot establish exhaustive integration completeness')
|
|
23
|
-
const listing =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
const sample: Pick<IntegrationObservationInputs, 'listing' | 'targeting'> = tickets.listTargeting
|
|
58
|
+
? { targeting: memoizedTargeting(tickets as Parameters<typeof memoizedTargeting>[0]) }
|
|
59
|
+
: { listing: await tickets.listAll!() }
|
|
60
|
+
// Records before digests, so a concurrent create cannot break completeness.
|
|
61
|
+
const records = await store.listBuildsForRepo(repo)
|
|
62
|
+
const digests = await readBuildDigests(store, repo)
|
|
63
|
+
const builds = records.map((record) => {
|
|
64
|
+
const digest = digests.get(record.slug)
|
|
65
|
+
if (digest === undefined)
|
|
66
|
+
throw new Error(`build digest missing for ${record.slug}: the digest read broke completeness`)
|
|
67
|
+
return { record, nodeTargets: digestNodeTargets(digest) }
|
|
68
|
+
})
|
|
69
|
+
const states = new Map<string, Promise<BuildState>>()
|
|
70
|
+
const state = (slug: string) => {
|
|
71
|
+
let read = states.get(slug)
|
|
72
|
+
if (!read) {
|
|
73
|
+
read = readBuildFacts(store, slug).then((facts) => facts.value.state)
|
|
74
|
+
states.set(slug, read)
|
|
75
|
+
}
|
|
76
|
+
return read
|
|
77
|
+
}
|
|
78
|
+
return { ...sample, builds, state, migrations: await readTicketMigrations(store, repo) }
|
|
28
79
|
}
|
|
29
80
|
|
|
30
81
|
/** A failed or partial enumeration cannot authorize verification or publication. */
|
|
@@ -33,6 +84,11 @@ export async function observeIntegration(
|
|
|
33
84
|
tickets: TicketSource,
|
|
34
85
|
slug: string,
|
|
35
86
|
inputs?: () => Promise<IntegrationObservationInputs>,
|
|
87
|
+
/** The configured rejected role: a child ticket in it no longer keeps the
|
|
88
|
+
* node incomplete. Unset means no such role. `onFailure` reports an
|
|
89
|
+
* enumeration or observation failure that is recorded as a diagnostic, so a
|
|
90
|
+
* caller can tell it apart from incompleteness; it is never persisted. */
|
|
91
|
+
options: { rejectedState?: string; onFailure?: (error: unknown) => void } = {},
|
|
36
92
|
): Promise<EventPayload<'integration.observed'>> {
|
|
37
93
|
const record = await store.getBuild(slug)
|
|
38
94
|
const state = (await readBuildFacts(store, slug)).value.state
|
|
@@ -46,15 +102,27 @@ export async function observeIntegration(
|
|
|
46
102
|
observation.children = state.integration?.observation?.children
|
|
47
103
|
|
|
48
104
|
try {
|
|
49
|
-
if (!record?.ticket || !tickets
|
|
105
|
+
if (!record?.ticket || !canEnumerate(tickets))
|
|
50
106
|
throw new Error('ticket source cannot establish exhaustive integration completeness')
|
|
51
107
|
const {
|
|
52
|
-
listing,
|
|
108
|
+
listing: shared,
|
|
109
|
+
targeting,
|
|
53
110
|
builds,
|
|
111
|
+
state: facts,
|
|
54
112
|
migrations: supplied,
|
|
55
113
|
} = await (inputs ? inputs() : integrationObservationInputs(store, tickets, record.repo))
|
|
114
|
+
// Only builds whose digest names this node can relate to it; the rest
|
|
115
|
+
// never need a facts read.
|
|
116
|
+
const related = await Promise.all(
|
|
117
|
+
builds
|
|
118
|
+
.filter((build) => build.nodeTargets.includes(slug))
|
|
119
|
+
.map(async (build) => ({ record: build.record, state: await facts(build.record.slug) })),
|
|
120
|
+
)
|
|
56
121
|
const migrations = supplied ?? (await readTicketMigrations(store, record.repo))
|
|
57
122
|
const nodeRef = resolveTicketRef(migrations, record.ticket, tickets.name, slug)
|
|
123
|
+
const listing = shared ?? (await targeting?.(nodeRef.id))
|
|
124
|
+
if (listing === undefined)
|
|
125
|
+
throw new Error('ticket source cannot establish exhaustive integration completeness')
|
|
58
126
|
observation.membershipSource = tickets.name
|
|
59
127
|
const current = (build: BuildRecord) =>
|
|
60
128
|
build.ticket
|
|
@@ -62,11 +130,26 @@ export async function observeIntegration(
|
|
|
62
130
|
: undefined
|
|
63
131
|
observation.diagnostics.push(...listing.diagnostics)
|
|
64
132
|
for (const ticket of listing.tickets)
|
|
65
|
-
if (
|
|
133
|
+
if (
|
|
134
|
+
ticket.target === nodeRef.id &&
|
|
135
|
+
!ticket.resolved &&
|
|
136
|
+
!holdsState(ticket.state, options.rejectedState)
|
|
137
|
+
)
|
|
138
|
+
children.add(ticket.ref.id)
|
|
66
139
|
// Frozen claims survive edits to the source ticket's target.
|
|
67
|
-
for (const { record: build, state: child } of
|
|
140
|
+
for (const { record: build, state: child } of related) {
|
|
68
141
|
if (child.target?.build === slug && child.status !== 'done' && child.status !== 'aborted')
|
|
69
142
|
children.add(current(build)?.id ?? build.slug)
|
|
143
|
+
// A merged contribution whose links the node has not recorded stays open
|
|
144
|
+
// until its merge or abort cleanup appends them, however its ticket moved.
|
|
145
|
+
if (
|
|
146
|
+
child.target?.build === slug &&
|
|
147
|
+
child.prState === 'merged' &&
|
|
148
|
+
child.outcome === undefined &&
|
|
149
|
+
!state.nodeIssueLinks?.builds.includes(build.slug) &&
|
|
150
|
+
contributedIssueLinks(child).length > 0
|
|
151
|
+
)
|
|
152
|
+
children.add(current(build)?.id ?? build.slug)
|
|
70
153
|
if (
|
|
71
154
|
[child.nodeRestack?.parentRequest, child.nodeRestack?.parentChange].some(
|
|
72
155
|
(move) => move && (move.old.target?.build === slug || move.next.target?.build === slug),
|
|
@@ -118,7 +201,7 @@ export async function observeIntegration(
|
|
|
118
201
|
for (const { record: build } of builds)
|
|
119
202
|
if (
|
|
120
203
|
(build.ticket?.source === tickets.name ||
|
|
121
|
-
|
|
204
|
+
related.some(
|
|
122
205
|
(entry) =>
|
|
123
206
|
entry.record.slug === build.slug &&
|
|
124
207
|
(entry.state.target?.build === slug ||
|
|
@@ -131,7 +214,7 @@ export async function observeIntegration(
|
|
|
131
214
|
current(build)?.id ?? build.slug,
|
|
132
215
|
build.ticket?.title,
|
|
133
216
|
)
|
|
134
|
-
for (const { record: build, state: child } of
|
|
217
|
+
for (const { record: build, state: child } of related) {
|
|
135
218
|
if (
|
|
136
219
|
!build.ticket ||
|
|
137
220
|
child.target?.build !== slug ||
|
|
@@ -150,6 +233,9 @@ export async function observeIntegration(
|
|
|
150
233
|
const entry = display.get(JSON.stringify([ref.source, ref.id]))
|
|
151
234
|
if (entry) entry.claims = [...new Set([...(entry.claims ?? []), build.slug])].sort()
|
|
152
235
|
}
|
|
236
|
+
// A targeted listing holds only current children, so a contribution whose
|
|
237
|
+
// ticket has since moved keeps its previous or build title. Display only:
|
|
238
|
+
// membership above does not depend on it.
|
|
153
239
|
for (const ticket of listing.tickets)
|
|
154
240
|
if (
|
|
155
241
|
(ticket.ref.source === tickets.name && children.has(ticket.ref.id)) ||
|
|
@@ -166,6 +252,7 @@ export async function observeIntegration(
|
|
|
166
252
|
)
|
|
167
253
|
} catch (error) {
|
|
168
254
|
observation.diagnostics.push(error instanceof Error ? error.message : String(error))
|
|
255
|
+
options.onFailure?.(error)
|
|
169
256
|
}
|
|
170
257
|
observation.openChildren = [...children].sort()
|
|
171
258
|
observation.diagnostics.sort()
|
|
@@ -8,6 +8,7 @@ import type { BuildStore } from '../store/types'
|
|
|
8
8
|
import { readBuildFacts } from '../store/reduced-reads'
|
|
9
9
|
import { inspectIntegrationStack } from './integration-stack'
|
|
10
10
|
import { acknowledgeNodeLanding } from './node-landing'
|
|
11
|
+
import { nodeIssueLinksForForge, nodeIssueLinksPublished } from './node-issue-links'
|
|
11
12
|
|
|
12
13
|
export interface IntegrationLandingDeps {
|
|
13
14
|
store: BuildStore
|
|
@@ -100,6 +101,22 @@ export async function landIntegrationRoot(deps: IntegrationLandingDeps): Promise
|
|
|
100
101
|
return
|
|
101
102
|
}
|
|
102
103
|
await inspectIntegrationStack(exec, workspacePath, parent, head)
|
|
104
|
+
// Refresh the PR body to the final set (own links and children's
|
|
105
|
+
// union) and confirm the readback before any merge request, even when
|
|
106
|
+
// the published fact matches, so landing closes every fully resolved
|
|
107
|
+
// issue. A failure throws first.
|
|
108
|
+
state = (await readBuildFacts(store, slug)).value.state
|
|
109
|
+
const issueLinks = nodeIssueLinksForForge(state, forge)
|
|
110
|
+
if (issueLinks) {
|
|
111
|
+
await authority()
|
|
112
|
+
await forge.updatePrIssueLinks!(workspacePath, deps.pr, issueLinks)
|
|
113
|
+
if (!nodeIssueLinksPublished(state, deps.pr, issueLinks))
|
|
114
|
+
await store.append(slug, {
|
|
115
|
+
actor: KERNEL,
|
|
116
|
+
type: 'node.issue-links-published',
|
|
117
|
+
payload: { pr: deps.pr, issueLinks },
|
|
118
|
+
})
|
|
119
|
+
}
|
|
103
120
|
const local = forge.name === 'local-git'
|
|
104
121
|
if (!local && !forge.mergeLinearStack) return // Never substitute squash.
|
|
105
122
|
const gate = local ? await forge.inspectLandingGate?.(deps.destination) : undefined
|
|
@@ -170,6 +170,23 @@ export function integrationCycleVerified(state: BuildState): boolean {
|
|
|
170
170
|
)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/** Durable facts that rule out preparing or admitting integration verification. */
|
|
174
|
+
export function integrationAdmissible(state: BuildState): boolean {
|
|
175
|
+
return !(
|
|
176
|
+
state.targetRewrite ||
|
|
177
|
+
state.status === 'paused' ||
|
|
178
|
+
state.status === 'done' ||
|
|
179
|
+
state.status === 'aborted' ||
|
|
180
|
+
state.pendingCommands.length ||
|
|
181
|
+
state.openEscalations.length ||
|
|
182
|
+
state.prState === 'merged' ||
|
|
183
|
+
state.prState === 'closed' ||
|
|
184
|
+
state.integration?.intent ||
|
|
185
|
+
state.nodeRestack?.parentRequest ||
|
|
186
|
+
state.nodeRestack?.parentChange
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
173
190
|
export function integrationNeedsRunner(state: BuildState): boolean {
|
|
174
191
|
return integrationCurrent(state) && !integrationFailed(state) && !integrationCycleVerified(state)
|
|
175
192
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forge issue keywords for a build's frozen issue links (SPEC "Forge issue
|
|
3
|
+
* links"). One pure module owns the text rules so the PR title and body, the
|
|
4
|
+
* landed commit message and every identity comparison compose identically:
|
|
5
|
+
*
|
|
6
|
+
* - each linked issue gets one canonical `Closes #N` or `Refs #N` line;
|
|
7
|
+
* - a closing keyword aimed at a `refs` issue is rewritten to `refs`, wherever
|
|
8
|
+
* it appears, so prose cannot close what the build only partly resolves;
|
|
9
|
+
* - the keyword paragraph sits before a terminal git trailer block, never
|
|
10
|
+
* inside it, so `Autobuild-Build` and co-author parsing stay intact.
|
|
11
|
+
*
|
|
12
|
+
* With no links every function returns its input unchanged.
|
|
13
|
+
*/
|
|
14
|
+
import type { Forge, IssueLink } from '../ports/types'
|
|
15
|
+
import { splitTrailerBlock, withBuildTrailer } from './build-identity'
|
|
16
|
+
|
|
17
|
+
export interface IssueKeywordOptions {
|
|
18
|
+
/** `owner/name` of the forge repository. Qualified references
|
|
19
|
+
* (`owner/name#N`, issue URLs) count only for this repository. */
|
|
20
|
+
repository?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** GitHub's closing keywords ("Linking a pull request to an issue"). */
|
|
24
|
+
const CLOSING = 'close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved'
|
|
25
|
+
const MENTION = 'refs?|references'
|
|
26
|
+
const SEPARATOR = String.raw`(?:[ \t]*:[ \t]*|[ \t]+)`
|
|
27
|
+
|
|
28
|
+
function escapeRegExp(text: string): string {
|
|
29
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** One issue reference in any form GitHub resolves to this repository. */
|
|
33
|
+
function referenceSource(repository: string | undefined): string {
|
|
34
|
+
const local = String.raw`#\d+|GH-\d+`
|
|
35
|
+
if (repository === undefined) return local
|
|
36
|
+
const repo = repository.split('/').map(escapeRegExp).join('/')
|
|
37
|
+
return [
|
|
38
|
+
String.raw`(?:https?://)?(?:www\.)?github\.com/${repo}/issues/\d+`,
|
|
39
|
+
String.raw`${repo}#\d+`,
|
|
40
|
+
local,
|
|
41
|
+
].join('|')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function referencedIssue(reference: string): number {
|
|
45
|
+
return Number(/(\d+)$/.exec(reference)![1])
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** `Closes #820`, `Refs #824`, one per link, ascending by issue number. */
|
|
49
|
+
export function issueKeywordLines(links: readonly IssueLink[]): string[] {
|
|
50
|
+
return [...links]
|
|
51
|
+
.sort((a, b) => a.issue - b.issue)
|
|
52
|
+
.map((link) => `${link.intent === 'closes' ? 'Closes' : 'Refs'} #${link.issue}`)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Rewrite every closing keyword whose reference names a linked `refs` issue to
|
|
57
|
+
* `refs`, keeping the separator and the reference as written. Each
|
|
58
|
+
* keyword–reference pair stands alone: `Fixes #1, fixes #824` rewrites only
|
|
59
|
+
* the second. Other repositories, unlinked numbers and `closes` issues are
|
|
60
|
+
* untouched.
|
|
61
|
+
*/
|
|
62
|
+
export function neutralizeClosingReferences(
|
|
63
|
+
text: string,
|
|
64
|
+
links: readonly IssueLink[],
|
|
65
|
+
options: IssueKeywordOptions = {},
|
|
66
|
+
): string {
|
|
67
|
+
const refs = new Set(links.filter((link) => link.intent === 'refs').map((link) => link.issue))
|
|
68
|
+
if (refs.size === 0) return text
|
|
69
|
+
const pattern = new RegExp(
|
|
70
|
+
String.raw`\b(${CLOSING})(${SEPARATOR})(${referenceSource(options.repository)})(?!\w)`,
|
|
71
|
+
'gi',
|
|
72
|
+
)
|
|
73
|
+
return text.replace(pattern, (whole, keyword: string, separator: string, reference: string) => {
|
|
74
|
+
if (!refs.has(referencedIssue(reference))) return whole
|
|
75
|
+
const replacement = keyword[0] === keyword[0]!.toUpperCase() ? 'Refs' : 'refs'
|
|
76
|
+
return `${replacement}${separator}${reference}`
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** A line that is only a keyword and a reference to a linked issue. */
|
|
81
|
+
function isLinkedKeywordLine(line: string, linked: ReadonlySet<number>, source: RegExp): boolean {
|
|
82
|
+
const match = source.exec(line)
|
|
83
|
+
return match !== null && linked.has(referencedIssue(match[2]!))
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Neutralize, drop whole lines that only restate a linked issue, and append
|
|
88
|
+
* the canonical keyword paragraph. With `trailers` (the default) a terminal
|
|
89
|
+
* git trailer block stays last and the paragraph goes before it; a PR body
|
|
90
|
+
* passes `trailers: false` so it ends with the lines. Idempotent.
|
|
91
|
+
*/
|
|
92
|
+
export function withIssueKeywords(
|
|
93
|
+
text: string,
|
|
94
|
+
links: readonly IssueLink[],
|
|
95
|
+
options: IssueKeywordOptions & { trailers?: boolean; includesSubject?: boolean } = {},
|
|
96
|
+
): string {
|
|
97
|
+
if (links.length === 0) return text
|
|
98
|
+
const neutral = neutralizeClosingReferences(text, links, options)
|
|
99
|
+
const { body, trailers } =
|
|
100
|
+
options.trailers === false
|
|
101
|
+
? { body: neutral, trailers: '' }
|
|
102
|
+
: splitTrailerBlock(neutral, { includesSubject: options.includesSubject === true })
|
|
103
|
+
const linked = new Set(links.map((link) => link.issue))
|
|
104
|
+
const line = new RegExp(
|
|
105
|
+
String.raw`^[ \t]*(${CLOSING}|${MENTION})${SEPARATOR}(${referenceSource(options.repository)})[ \t]*\.?\r?$`,
|
|
106
|
+
'i',
|
|
107
|
+
)
|
|
108
|
+
const keep = (part: string): string =>
|
|
109
|
+
part
|
|
110
|
+
.split('\n')
|
|
111
|
+
.filter((entry) => !isLinkedKeywordLine(entry, linked, line))
|
|
112
|
+
.join('\n')
|
|
113
|
+
.replace(/\s+$/, '')
|
|
114
|
+
const prose = keep(body)
|
|
115
|
+
const tail = keep(trailers)
|
|
116
|
+
const block = issueKeywordLines(links).join('\n')
|
|
117
|
+
const composed = `${prose === '' ? '' : `${prose}\n\n`}${block}${tail === '' ? '' : `\n\n${tail}`}`
|
|
118
|
+
return /\n$/.test(text) ? `${composed}\n` : composed
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** The landed commit message: keyword paragraph, then the build trailer
|
|
122
|
+
* block. With no links this is exactly `withBuildTrailer`. */
|
|
123
|
+
export function landingMessage(
|
|
124
|
+
message: string,
|
|
125
|
+
slug: string,
|
|
126
|
+
links: readonly IssueLink[],
|
|
127
|
+
options: IssueKeywordOptions & { includesSubject?: boolean } = {},
|
|
128
|
+
): string {
|
|
129
|
+
return withBuildTrailer(
|
|
130
|
+
withIssueKeywords(message, links, options),
|
|
131
|
+
slug,
|
|
132
|
+
options.includesSubject === true ? { includesSubject: true } : {},
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** A leaf's own keywords reach the default branch only when it is aimed at
|
|
137
|
+
* the configured base, through a forge whose merges close issues. This gates
|
|
138
|
+
* the landing call and a base-aimed leaf's PR. Nodes and node-target leaves
|
|
139
|
+
* carry links upward instead (`kernel/node-issue-links`), a root node's PR
|
|
140
|
+
* body emits the node's set, and a node-target leaf's PR gets refs-only lines
|
|
141
|
+
* from `prIssueLinksForForge`. */
|
|
142
|
+
export function emitsIssueKeywords(
|
|
143
|
+
state: {
|
|
144
|
+
kind?: 'work' | 'node'
|
|
145
|
+
target?: unknown
|
|
146
|
+
issueLinks: readonly IssueLink[]
|
|
147
|
+
},
|
|
148
|
+
forge: Pick<Forge, 'closesIssues'>,
|
|
149
|
+
): boolean {
|
|
150
|
+
return (
|
|
151
|
+
forge.closesIssues === true &&
|
|
152
|
+
state.kind !== 'node' &&
|
|
153
|
+
state.target === undefined &&
|
|
154
|
+
state.issueLinks.length > 0
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** The `{issue, intent}` projection a forge's landing call receives, when it
|
|
159
|
+
* should. Always `{}` for a node-target leaf: a commit landed into a node
|
|
160
|
+
* carries no keyword lines. */
|
|
161
|
+
export function issueLinksForForge(
|
|
162
|
+
state: Parameters<typeof emitsIssueKeywords>[0],
|
|
163
|
+
forge: Pick<Forge, 'closesIssues'>,
|
|
164
|
+
): { issueLinks: IssueLink[] } | Record<string, never> {
|
|
165
|
+
return emitsIssueKeywords(state, forge)
|
|
166
|
+
? { issueLinks: state.issueLinks.map(({ issue, intent }) => ({ issue, intent })) }
|
|
167
|
+
: {}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** The `{issue, intent}` projection a leaf's PR receives when it opens. A
|
|
171
|
+
* leaf aimed at the configured base gets its sealed links unchanged. A leaf
|
|
172
|
+
* aimed at a node gets every link as `refs`, so each issue shows the PR
|
|
173
|
+
* without the PR closing it; the closing lines land in the root node's PR. */
|
|
174
|
+
export function prIssueLinksForForge(
|
|
175
|
+
state: Parameters<typeof emitsIssueKeywords>[0],
|
|
176
|
+
forge: Pick<Forge, 'closesIssues'>,
|
|
177
|
+
): { issueLinks: IssueLink[] } | Record<string, never> {
|
|
178
|
+
if (forge.closesIssues !== true || state.kind === 'node' || state.issueLinks.length === 0)
|
|
179
|
+
return {}
|
|
180
|
+
const nested = state.target !== undefined
|
|
181
|
+
return {
|
|
182
|
+
issueLinks: state.issueLinks.map(({ issue, intent }) => ({
|
|
183
|
+
issue,
|
|
184
|
+
intent: nested ? ('refs' as const) : intent,
|
|
185
|
+
})),
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Human form with downgrade provenance, e.g.
|
|
190
|
+
* `closes #820, refs #824 (downgraded from closes: only the API half)`. */
|
|
191
|
+
export function describeIssueLinks(
|
|
192
|
+
links: ReadonlyArray<IssueLink & { downgrade?: { reason: string } }>,
|
|
193
|
+
): string {
|
|
194
|
+
return links
|
|
195
|
+
.map(
|
|
196
|
+
(link) =>
|
|
197
|
+
`${link.intent} #${link.issue}${
|
|
198
|
+
link.downgrade !== undefined ? ` (downgraded from closes: ${link.downgrade.reason})` : ''
|
|
199
|
+
}`,
|
|
200
|
+
)
|
|
201
|
+
.join(', ')
|
|
202
|
+
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { BuildState } from './reducer'
|
|
2
2
|
import type { BuildStore } from '../store/types'
|
|
3
3
|
import { DISPATCHER } from '../events/envelope'
|
|
4
|
+
import { isForgeFailure } from '../ports/forge-failure'
|
|
5
|
+
import { ForgeRequestDeferred } from '../ports/forge-request-context'
|
|
6
|
+
|
|
7
|
+
/** Repository-level scheduling signals: not a janitor failure, never aged as one. */
|
|
8
|
+
export function janitorDeferral(error: unknown): boolean {
|
|
9
|
+
return (
|
|
10
|
+
error instanceof ForgeRequestDeferred ||
|
|
11
|
+
(isForgeFailure(error) && error.details.kind === 'rate-limited')
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
export async function recordJanitorFailure(
|
|
5
16
|
store: BuildStore,
|
|
6
17
|
slug: string,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { RepositoryEvent, RepositoryEventPayload } from '../events/repository'
|
|
2
|
+
import { ForgeRequestDeferred } from '../ports/forge-request-context'
|
|
3
|
+
import { defineReducer } from './incremental'
|
|
4
|
+
|
|
5
|
+
/** Longest detail a `dispatcher.kernel-git-unavailable` event carries. */
|
|
6
|
+
export const KERNEL_GIT_DETAIL_LIMIT = 1_000
|
|
7
|
+
|
|
8
|
+
/** The dispatcher could not run Git for kernel-side node work (snapshot,
|
|
9
|
+
* restack, presence, landing). It is a repository condition, not a node
|
|
10
|
+
* failure: callers that already treat `ForgeRequestDeferred` as "retry next
|
|
11
|
+
* tick" defer the node without recording a failed janitor attempt. */
|
|
12
|
+
export class KernelGitUnavailable extends ForgeRequestDeferred {
|
|
13
|
+
constructor(
|
|
14
|
+
readonly executable: string,
|
|
15
|
+
readonly detail: string,
|
|
16
|
+
) {
|
|
17
|
+
super(`kernel Git unavailable (${executable}): ${detail}`)
|
|
18
|
+
this.name = 'KernelGitUnavailable'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Why Git itself could not run, or `undefined` for an ordinary Git failure
|
|
23
|
+
* (a bad ref, a network error, a non-zero exit from a working Git). Both Bun's
|
|
24
|
+
* spawn errors and loader failures of a shipped Git are recognized; the forge's
|
|
25
|
+
* credentialed exec re-wraps errors, so only the message is inspected. */
|
|
26
|
+
export function kernelGitUnavailableDetail(input: {
|
|
27
|
+
error?: unknown
|
|
28
|
+
result?: { exitCode: number; stderr: string }
|
|
29
|
+
}): string | undefined {
|
|
30
|
+
if (input.error !== undefined) {
|
|
31
|
+
const message = input.error instanceof Error ? input.error.message : String(input.error)
|
|
32
|
+
if (
|
|
33
|
+
/Executable not found in \$PATH/.test(message) ||
|
|
34
|
+
(/\b(?:ENOENT|EACCES)\b/.test(message) && /posix_spawn|spawn/.test(message)) ||
|
|
35
|
+
loaderFailure(message)
|
|
36
|
+
)
|
|
37
|
+
return bounded(message)
|
|
38
|
+
return undefined
|
|
39
|
+
}
|
|
40
|
+
const result = input.result
|
|
41
|
+
if (result === undefined || result.exitCode === 0) return undefined
|
|
42
|
+
if (result.exitCode === 126 || result.exitCode === 127 || loaderFailure(result.stderr))
|
|
43
|
+
return bounded(result.stderr.trim() || `git exited with status ${result.exitCode}`)
|
|
44
|
+
return undefined
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function loaderFailure(text: string): boolean {
|
|
48
|
+
return (
|
|
49
|
+
text.includes('error while loading shared libraries') ||
|
|
50
|
+
/version [`']GLIBC_[^'`]*['`] not found/.test(text)
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function bounded(text: string): string {
|
|
55
|
+
const trimmed = text.trim() || 'git could not be executed'
|
|
56
|
+
return trimmed.length > KERNEL_GIT_DETAIL_LIMIT
|
|
57
|
+
? `${trimmed.slice(0, KERNEL_GIT_DETAIL_LIMIT - 1)}…`
|
|
58
|
+
: trimmed
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type KernelGitCondition = RepositoryEventPayload<'dispatcher.kernel-git-unavailable'> & {
|
|
62
|
+
since: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The active "kernel Git unavailable" repository condition. One durable
|
|
66
|
+
* event opens it and one closes it, so a fresh dispatcher process (a hosted
|
|
67
|
+
* invocation) sees the outage without re-reporting it. */
|
|
68
|
+
export const kernelGitHealthReducer = defineReducer<
|
|
69
|
+
{ active?: KernelGitCondition },
|
|
70
|
+
RepositoryEvent,
|
|
71
|
+
KernelGitCondition | undefined
|
|
72
|
+
>({
|
|
73
|
+
version: 1,
|
|
74
|
+
initial: () => ({}),
|
|
75
|
+
fold(acc, events) {
|
|
76
|
+
for (const event of events) {
|
|
77
|
+
if (event.type === 'dispatcher.kernel-git-unavailable')
|
|
78
|
+
acc.active = { ...event.payload, since: event.ts }
|
|
79
|
+
if (
|
|
80
|
+
event.type === 'dispatcher.kernel-git-recovered' &&
|
|
81
|
+
acc.active?.executable === event.payload.executable
|
|
82
|
+
)
|
|
83
|
+
delete acc.active
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
finish: (acc) => (acc.active === undefined ? undefined : { ...acc.active }),
|
|
87
|
+
})
|
|
@@ -9,25 +9,33 @@ import {
|
|
|
9
9
|
|
|
10
10
|
/** The deterministic part of land's guard. Live completeness and CAS remain at the write boundary. */
|
|
11
11
|
export function landPreconditions(state: BuildState, restack: LeafRestackState): boolean {
|
|
12
|
+
return landRefusalReason(state, restack) === undefined
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Why land's deterministic guard refuses, naming the first unmet clause, or
|
|
16
|
+
* undefined when it passes. */
|
|
17
|
+
export function landRefusalReason(
|
|
18
|
+
state: BuildState,
|
|
19
|
+
restack: LeafRestackState,
|
|
20
|
+
): string | undefined {
|
|
12
21
|
const decision = state.landing?.decision
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
state.kind !== 'node' &&
|
|
25
|
-
restack.target &&
|
|
26
|
-
restack.target.sha !== decision.candidate.parent
|
|
27
|
-
) &&
|
|
28
|
-
!restack.active &&
|
|
29
|
-
!state.nodeRestack?.active
|
|
22
|
+
if (!decision) return 'no merge candidate has been decided yet'
|
|
23
|
+
if (state.kind === 'node' && !integrationCycleCurrent(state))
|
|
24
|
+
return "the node's integration cycle is not current"
|
|
25
|
+
if (state.status === 'paused') return 'the build is paused'
|
|
26
|
+
if (state.currentPhase) return `phase ${state.currentPhase} is still running`
|
|
27
|
+
if (state.openEscalations.length) return 'the build has open escalations to answer'
|
|
28
|
+
if (state.pendingCommands.length) return 'earlier controls are awaiting acknowledgement'
|
|
29
|
+
if (state.prState !== 'open') return `the pull request is ${state.prState ?? 'not open'}`
|
|
30
|
+
if (
|
|
31
|
+
(state.kind === 'node' ? state.integration?.cycle?.head : state.pr?.headSha) !==
|
|
32
|
+
decision.candidate.head
|
|
30
33
|
)
|
|
34
|
+
return "the merge candidate's head is stale"
|
|
35
|
+
if (state.kind !== 'node' && restack.target && restack.target.sha !== decision.candidate.parent)
|
|
36
|
+
return "the merge candidate's base is stale"
|
|
37
|
+
if (restack.active || state.nodeRestack?.active) return 'a restack is in progress'
|
|
38
|
+
return undefined
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
/** Read eligibility is deliberately stricter than a command's historical acceptance guard. */
|