@defrex/autobuild 0.14.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 +4 -2
- package/SPEC.md +654 -98
- package/docs/architecture.md +226 -5
- package/docs/assets/headline-wide.png +0 -0
- package/docs/configuration.md +112 -12
- package/docs/hosted-service.md +18 -0
- 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 +19 -8
- package/docs/remote-store-protocol.md +30 -7
- 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 +3 -3
- package/packages/core/src/cli/attention.ts +25 -2
- package/packages/core/src/cli/build-control.ts +65 -41
- package/packages/core/src/cli/context.ts +54 -2
- 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 +142 -18
- 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 +156 -109
- package/packages/core/src/cli/dispatch.ts +250 -136
- package/packages/core/src/cli/dispatcher-liveness.ts +15 -2
- package/packages/core/src/cli/help.ts +49 -32
- 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 +49 -15
- package/packages/core/src/cli/mcp.ts +9 -0
- package/packages/core/src/cli/publication-settlement.ts +168 -2
- package/packages/core/src/cli/repository-status.ts +11 -0
- package/packages/core/src/cli/status.ts +72 -5
- 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 +98 -79
- package/packages/core/src/cli/ticket-editor.ts +10 -3
- package/packages/core/src/cli/ticket.ts +113 -18
- 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 +115 -19
- package/packages/core/src/cli/watch.ts +51 -12
- package/packages/core/src/config/landing.ts +22 -0
- package/packages/core/src/config/live.ts +1 -0
- 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 +31 -0
- package/packages/core/src/integration/harness.ts +10 -0
- package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +1030 -239
- package/packages/core/src/kernel/auto-merge-default.ts +1 -0
- package/packages/core/src/kernel/auto-merge.ts +12 -3
- 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/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 +11 -0
- 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.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 +70 -3
- 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 +16 -0
- package/packages/core/src/kernel/reducer.ts +121 -6
- package/packages/core/src/kernel/snapshot-parent.ts +33 -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 +6 -0
- package/packages/core/src/operator/index.ts +4 -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 +3 -1
- package/packages/core/src/operator/registry.ts +48 -19
- package/packages/core/src/operator/requests.ts +1 -8
- package/packages/core/src/operator/tickets.ts +55 -9
- 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-runner.ts +530 -23
- package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
- package/packages/core/src/processes/dispatcher.ts +2145 -203
- package/packages/core/src/processes/execution-no-progress.ts +46 -1
- package/packages/core/src/processes/publication-state.ts +30 -5
- package/packages/core/src/processes/repo-view.ts +21 -2
- package/packages/core/src/store/build-scope.ts +18 -0
- package/packages/core/src/store/contract.ts +658 -0
- package/packages/core/src/store/digest.ts +52 -4
- package/packages/core/src/store/local/schema.ts +25 -13
- package/packages/core/src/store/local/store.ts +117 -1
- package/packages/core/src/store/memory.ts +62 -1
- package/packages/core/src/store/phase-session.ts +17 -0
- package/packages/core/src/store/reduced-reads.ts +2 -1
- package/packages/core/src/store/reducer-value-shapes.json +10707 -6440
- package/packages/core/src/store/remote/client.ts +44 -0
- package/packages/core/src/store/remote/compatibility.ts +19 -9
- package/packages/core/src/store/remote/protocol.ts +11 -0
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/store/session-handle.ts +15 -0
- package/packages/core/src/store/subscribe.ts +1 -1
- package/packages/core/src/store/types.ts +32 -4
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/reduced-read-budget.ts +48 -8
- package/packages/core/src/testing/refresh-scheduler.ts +32 -0
- package/skills/guide/SKILL.md +110 -61
- 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 +12 -5
- package/skills/guide/references/plugin-authoring.md +34 -0
- package/skills/guide/references/remote-store-protocol.md +30 -7
- 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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { validateEventWrite, type AbEvent, type EventWrite } from '../../events/catalog'
|
|
2
|
+
import { DISPATCHER, KERNEL } from '../../events/envelope'
|
|
3
|
+
|
|
4
|
+
/** A complete multi-item transaction, including a stable-identity drop and a
|
|
5
|
+
* foreign conflict, for every persisted reducer's prefix/shape coverage. */
|
|
6
|
+
export function nodeRestackLog(): AbEvent[] {
|
|
7
|
+
const parent = 'b'.repeat(40)
|
|
8
|
+
const expected = 'a'.repeat(40)
|
|
9
|
+
const head = 'c'.repeat(40)
|
|
10
|
+
const writes: EventWrite[] = [
|
|
11
|
+
{
|
|
12
|
+
actor: DISPATCHER,
|
|
13
|
+
type: 'build.created',
|
|
14
|
+
payload: {
|
|
15
|
+
repo: 'repo',
|
|
16
|
+
ticket: { source: 'file', id: 'node' },
|
|
17
|
+
baseBranch: 'main',
|
|
18
|
+
kind: 'node',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{ actor: DISPATCHER, type: 'node.opened', payload: { sha: 'd'.repeat(40) } },
|
|
22
|
+
{
|
|
23
|
+
actor: KERNEL,
|
|
24
|
+
type: 'node.writer-reserved',
|
|
25
|
+
payload: {
|
|
26
|
+
id: 'node-tx',
|
|
27
|
+
operation: 'restack',
|
|
28
|
+
expected,
|
|
29
|
+
parent,
|
|
30
|
+
oldBase: 'd'.repeat(40),
|
|
31
|
+
archive: `refs/autobuild/archive/node/${expected}`,
|
|
32
|
+
changes: [
|
|
33
|
+
{ sha: 'e'.repeat(40), build: 'source' },
|
|
34
|
+
{ sha: 'f'.repeat(40), mainline: 1 },
|
|
35
|
+
],
|
|
36
|
+
upstreamBuilds: ['source'],
|
|
37
|
+
merges: [{ sha: 'f'.repeat(40), parent, identities: ['source'], missing: [] }],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
actor: KERNEL,
|
|
42
|
+
type: 'node.item-prepared',
|
|
43
|
+
payload: { id: 'node-tx', index: 0, base: parent },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
actor: KERNEL,
|
|
47
|
+
type: 'node.item-replayed',
|
|
48
|
+
payload: {
|
|
49
|
+
id: 'node-tx',
|
|
50
|
+
index: 0,
|
|
51
|
+
base: parent,
|
|
52
|
+
head: parent,
|
|
53
|
+
dropped: true,
|
|
54
|
+
dropReason: 'upstream-identity',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
actor: KERNEL,
|
|
59
|
+
type: 'node.item-prepared',
|
|
60
|
+
payload: { id: 'node-tx', index: 1, base: parent },
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
actor: KERNEL,
|
|
64
|
+
type: 'node.item-conflicted',
|
|
65
|
+
payload: { id: 'node-tx', index: 1, base: parent },
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
actor: KERNEL,
|
|
69
|
+
type: 'node.item-replayed',
|
|
70
|
+
payload: { id: 'node-tx', index: 1, base: parent, head, dropped: false },
|
|
71
|
+
},
|
|
72
|
+
{ actor: KERNEL, type: 'node.publish-intended', payload: { id: 'node-tx', head } },
|
|
73
|
+
{ actor: KERNEL, type: 'node.rewritten', payload: { id: 'node-tx', previous: expected, head } },
|
|
74
|
+
{
|
|
75
|
+
actor: KERNEL,
|
|
76
|
+
type: 'node.inventory',
|
|
77
|
+
payload: { head, builds: ['source'], foreign: [head] },
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
actor: KERNEL,
|
|
81
|
+
type: 'node.writer-settled',
|
|
82
|
+
payload: { id: 'node-tx', outcome: 'completed' },
|
|
83
|
+
},
|
|
84
|
+
]
|
|
85
|
+
return writes.map(
|
|
86
|
+
(write, index) =>
|
|
87
|
+
({
|
|
88
|
+
...validateEventWrite(write),
|
|
89
|
+
build: 'node',
|
|
90
|
+
seq: index + 1,
|
|
91
|
+
ts: '2026-10-17T00:00:00Z',
|
|
92
|
+
}) as AbEvent,
|
|
93
|
+
)
|
|
94
|
+
}
|
|
@@ -170,6 +170,17 @@ export function randomStatusJournal(seed: number, length: number): RepositoryEve
|
|
|
170
170
|
}),
|
|
171
171
|
() => ({ type: 'dispatcher.tick-failed', payload: { run, error: 'e' } }),
|
|
172
172
|
() => ({ type: 'dispatcher.tick-started', payload: { run } }),
|
|
173
|
+
() => ({
|
|
174
|
+
type: 'dispatcher.forge-readiness-failed',
|
|
175
|
+
payload: {
|
|
176
|
+
run,
|
|
177
|
+
forge: 'github',
|
|
178
|
+
rootBranch: 'main',
|
|
179
|
+
check: 'squash',
|
|
180
|
+
detail: 'Squash merging disabled',
|
|
181
|
+
remediation: 'Enable squash merging',
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
173
184
|
() => ({ type: 'dispatcher.config-rejected', payload: { run, error: 'bad' } }),
|
|
174
185
|
() => ({
|
|
175
186
|
type: 'dispatcher.operator-reported',
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { BuildState } from './reducer'
|
|
2
|
+
import type { TicketSource, TicketListing } from '../ports/types'
|
|
3
|
+
import type { BuildStore, BuildRecord } from '../store/types'
|
|
4
|
+
import { readBuildFacts } from '../store/reduced-reads'
|
|
5
|
+
import { DISPATCHER } from '../events/envelope'
|
|
6
|
+
import type { EventPayload } from '../events/payloads'
|
|
7
|
+
|
|
8
|
+
/** One exhaustive source sample shared by every node in a dispatcher pass.
|
|
9
|
+
* Scheduling may be cached; publication always requests a sample from this pass. */
|
|
10
|
+
export interface IntegrationObservationInputs {
|
|
11
|
+
listing: TicketListing
|
|
12
|
+
builds: { record: BuildRecord; state: BuildState }[]
|
|
13
|
+
}
|
|
14
|
+
export async function integrationObservationInputs(
|
|
15
|
+
store: BuildStore,
|
|
16
|
+
tickets: TicketSource,
|
|
17
|
+
repo: string,
|
|
18
|
+
): Promise<IntegrationObservationInputs> {
|
|
19
|
+
if (!tickets.integrationTree || !tickets.listAll)
|
|
20
|
+
throw new Error('ticket source cannot establish exhaustive integration completeness')
|
|
21
|
+
const listing = await tickets.listAll()
|
|
22
|
+
const builds = []
|
|
23
|
+
for (const record of await store.listBuildsForRepo(repo))
|
|
24
|
+
builds.push({ record, state: (await readBuildFacts(store, record.slug)).value.state })
|
|
25
|
+
return { listing, builds }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A failed or partial enumeration cannot authorize verification or publication. */
|
|
29
|
+
export async function observeIntegration(
|
|
30
|
+
store: BuildStore,
|
|
31
|
+
tickets: TicketSource,
|
|
32
|
+
slug: string,
|
|
33
|
+
inputs?: () => Promise<IntegrationObservationInputs>,
|
|
34
|
+
): Promise<EventPayload<'integration.observed'>> {
|
|
35
|
+
const record = await store.getBuild(slug)
|
|
36
|
+
const state = (await readBuildFacts(store, slug)).value.state
|
|
37
|
+
const observation: EventPayload<'integration.observed'> = {
|
|
38
|
+
openChildren: [],
|
|
39
|
+
diagnostics: [],
|
|
40
|
+
contributions: [...(state.integration?.observation?.contributions ?? [])],
|
|
41
|
+
}
|
|
42
|
+
const children = new Set<string>()
|
|
43
|
+
try {
|
|
44
|
+
if (!record?.ticket || !tickets.integrationTree || !tickets.listAll)
|
|
45
|
+
throw new Error('ticket source cannot establish exhaustive integration completeness')
|
|
46
|
+
if (record.ticket.source !== tickets.name)
|
|
47
|
+
throw new Error('configured ticket source differs from the frozen node source')
|
|
48
|
+
const { listing, builds } = await (inputs
|
|
49
|
+
? inputs()
|
|
50
|
+
: integrationObservationInputs(store, tickets, record.repo))
|
|
51
|
+
observation.diagnostics.push(...listing.diagnostics)
|
|
52
|
+
for (const ticket of listing.tickets)
|
|
53
|
+
if (ticket.target === record.ticket.id && !ticket.resolved) children.add(ticket.ref.id)
|
|
54
|
+
// Frozen claims survive edits to the source ticket's target.
|
|
55
|
+
for (const { record: build, state: child } of builds) {
|
|
56
|
+
if (child.target?.build === slug && child.status !== 'done' && child.status !== 'aborted')
|
|
57
|
+
children.add(build.ticket?.id ?? build.slug)
|
|
58
|
+
if (
|
|
59
|
+
[child.nodeRestack?.parentRequest, child.nodeRestack?.parentChange].some(
|
|
60
|
+
(move) => move && (move.old.target?.build === slug || move.next.target?.build === slug),
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
children.add(build.ticket?.id ?? build.slug)
|
|
64
|
+
if (child.target?.build === slug && child.prState === 'merged')
|
|
65
|
+
observation.contributions.push(build.slug)
|
|
66
|
+
}
|
|
67
|
+
observation.contributions.push(...(state.nodeRestack?.inventory?.contributions ?? []))
|
|
68
|
+
} catch (error) {
|
|
69
|
+
observation.diagnostics.push(error instanceof Error ? error.message : String(error))
|
|
70
|
+
}
|
|
71
|
+
observation.openChildren = [...children].sort()
|
|
72
|
+
observation.diagnostics.sort()
|
|
73
|
+
observation.contributions = [...new Set(observation.contributions)].sort()
|
|
74
|
+
if (JSON.stringify(observation) !== JSON.stringify(state.integration?.observation))
|
|
75
|
+
await store.append(slug, {
|
|
76
|
+
actor: DISPATCHER,
|
|
77
|
+
type: 'integration.observed',
|
|
78
|
+
payload: observation,
|
|
79
|
+
})
|
|
80
|
+
return observation
|
|
81
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { snapshotParent } from './snapshot-parent'
|
|
2
|
+
import { buildTrailers } from './build-identity'
|
|
3
|
+
import { KERNEL, DISPATCHER } from '../events/envelope'
|
|
4
|
+
import type { Forge } from '../ports/types'
|
|
5
|
+
import type { Exec } from '../ports/workspace/git-worktree'
|
|
6
|
+
import type { BuildStore } from '../store/types'
|
|
7
|
+
import { readBuildFacts } from '../store/reduced-reads'
|
|
8
|
+
import { inspectIntegrationStack } from './integration-stack'
|
|
9
|
+
import { acknowledgeNodeLanding } from './node-landing'
|
|
10
|
+
|
|
11
|
+
export interface IntegrationLandingDeps {
|
|
12
|
+
store: BuildStore
|
|
13
|
+
forge: Forge
|
|
14
|
+
exec: Exec
|
|
15
|
+
workspacePath: string
|
|
16
|
+
slug: string
|
|
17
|
+
branch: string
|
|
18
|
+
destination: string
|
|
19
|
+
pr: number
|
|
20
|
+
holder: string
|
|
21
|
+
id: string
|
|
22
|
+
commandSeq?: number
|
|
23
|
+
decisionSeq?: number
|
|
24
|
+
head: string
|
|
25
|
+
parent: string
|
|
26
|
+
cycle: string
|
|
27
|
+
eligible: () => Promise<boolean>
|
|
28
|
+
}
|
|
29
|
+
/** The source-owned reservation protects root publication across lease loss. */
|
|
30
|
+
export async function landIntegrationRoot(deps: IntegrationLandingDeps): Promise<void> {
|
|
31
|
+
const { store, forge, slug, workspacePath, exec } = deps
|
|
32
|
+
if (!forge.rewrite || !forge.inspectLandingPr) return
|
|
33
|
+
if (!(await store.claimNodeWriter(slug, deps.holder, 60_000))) return
|
|
34
|
+
const authority = async () => {
|
|
35
|
+
if (!(await store.renewNodeWriter(slug, deps.holder)))
|
|
36
|
+
throw new Error('integration writer lease lost')
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
let state = (await readBuildFacts(store, slug)).value.state
|
|
40
|
+
if (
|
|
41
|
+
state.integration?.landing ||
|
|
42
|
+
state.nodeRestack?.parentRequest ||
|
|
43
|
+
state.nodeRestack?.parentChange
|
|
44
|
+
)
|
|
45
|
+
return
|
|
46
|
+
const existing = state.integration?.intent
|
|
47
|
+
let landed: string | undefined
|
|
48
|
+
if (existing) {
|
|
49
|
+
// Readback precedes controls: a completed write must survive revocation.
|
|
50
|
+
const pr = await forge.getPrState(workspacePath, deps.pr)
|
|
51
|
+
if (pr.state === 'merged' && pr.headSha === existing.head) landed = pr.sha
|
|
52
|
+
if (forge.name === 'local-git') {
|
|
53
|
+
const actual = await snapshotParent(
|
|
54
|
+
deps,
|
|
55
|
+
deps.destination,
|
|
56
|
+
`refs/autobuild/reconcile/${slug}/readback`,
|
|
57
|
+
)
|
|
58
|
+
const contains = await exec(['git', 'merge-base', '--is-ancestor', existing.head, actual], {
|
|
59
|
+
cwd: workspacePath,
|
|
60
|
+
})
|
|
61
|
+
if (contains.exitCode === 0) landed = existing.head
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const abandon = async (reason: string) => {
|
|
65
|
+
const pending = (await readBuildFacts(store, slug)).value.state.integration?.intent
|
|
66
|
+
if (pending)
|
|
67
|
+
await store.append(slug, {
|
|
68
|
+
actor: KERNEL,
|
|
69
|
+
type: 'integration.abandoned',
|
|
70
|
+
payload: { id: pending.id, reason },
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
if (!landed) {
|
|
74
|
+
if (!(await deps.eligible())) {
|
|
75
|
+
await abandon('Eligibility changed before publication')
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
const cancelled = await forge.setAutoMerge(workspacePath, deps.pr, false)
|
|
79
|
+
if (cancelled.kind !== 'applied') return
|
|
80
|
+
const pr = await forge.inspectLandingPr(workspacePath, deps.pr)
|
|
81
|
+
if (
|
|
82
|
+
!pr.open ||
|
|
83
|
+
pr.base !== deps.destination ||
|
|
84
|
+
pr.head !== deps.branch ||
|
|
85
|
+
pr.headSha !== deps.head
|
|
86
|
+
)
|
|
87
|
+
return
|
|
88
|
+
const parent = await snapshotParent(
|
|
89
|
+
deps,
|
|
90
|
+
deps.destination,
|
|
91
|
+
`refs/autobuild/reconcile/${slug}/parent`,
|
|
92
|
+
)
|
|
93
|
+
const head = await forge.rewrite.snapshot({
|
|
94
|
+
workspacePath,
|
|
95
|
+
branch: deps.branch,
|
|
96
|
+
destinationRef: `refs/autobuild/reconcile/${slug}/head`,
|
|
97
|
+
})
|
|
98
|
+
if (parent !== deps.parent || head !== deps.head) {
|
|
99
|
+
await abandon('Parent or head moved')
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
await inspectIntegrationStack(exec, workspacePath, parent, head)
|
|
103
|
+
const local = forge.name === 'local-git'
|
|
104
|
+
if (!local && !forge.mergeLinearStack) return // Never substitute squash.
|
|
105
|
+
const gate = local ? await forge.inspectLandingGate?.(deps.destination) : undefined
|
|
106
|
+
if (local && (!forge.rewrite.fastForward || gate?.kind !== 'proved-ungated')) return
|
|
107
|
+
const freshness = local
|
|
108
|
+
? { fenced: true, evidence: ['Exact parent compare-and-swap fast-forward'] }
|
|
109
|
+
: ((await forge.inspectMergeFreshness?.(deps.destination)) ?? {
|
|
110
|
+
fenced: false,
|
|
111
|
+
evidence: ['Freshness enforcement unavailable'],
|
|
112
|
+
})
|
|
113
|
+
await authority()
|
|
114
|
+
await forge.rewrite.archive({
|
|
115
|
+
workspacePath,
|
|
116
|
+
ref: `refs/autobuild/archive/${slug}/${head}`,
|
|
117
|
+
sha: head,
|
|
118
|
+
})
|
|
119
|
+
if (!existing) {
|
|
120
|
+
await store.append(slug, {
|
|
121
|
+
actor: KERNEL,
|
|
122
|
+
type: 'integration.landing-intended',
|
|
123
|
+
payload: {
|
|
124
|
+
id: deps.id,
|
|
125
|
+
cycle: deps.cycle,
|
|
126
|
+
head,
|
|
127
|
+
parent,
|
|
128
|
+
...(deps.commandSeq === undefined ? {} : { commandSeq: deps.commandSeq }),
|
|
129
|
+
...(deps.decisionSeq === undefined ? {} : { decisionSeq: deps.decisionSeq }),
|
|
130
|
+
...freshness,
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
} else if (
|
|
134
|
+
existing.head !== head ||
|
|
135
|
+
existing.parent !== parent ||
|
|
136
|
+
existing.commandSeq !== deps.commandSeq
|
|
137
|
+
)
|
|
138
|
+
return
|
|
139
|
+
if (!(await deps.eligible())) {
|
|
140
|
+
await abandon('Eligibility changed before publication')
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
await authority()
|
|
144
|
+
// This is the final external read before the merge request. GitHub's
|
|
145
|
+
// endpoint fences the head only; its remaining race is audited below.
|
|
146
|
+
const current = await snapshotParent(
|
|
147
|
+
deps,
|
|
148
|
+
deps.destination,
|
|
149
|
+
`refs/autobuild/reconcile/${slug}/fresh`,
|
|
150
|
+
)
|
|
151
|
+
if (current !== parent) {
|
|
152
|
+
const pending = (await readBuildFacts(store, slug)).value.state.integration?.intent
|
|
153
|
+
if (pending)
|
|
154
|
+
await store.append(slug, {
|
|
155
|
+
actor: KERNEL,
|
|
156
|
+
type: 'integration.abandoned',
|
|
157
|
+
payload: { id: pending.id, reason: 'Parent moved before publication' },
|
|
158
|
+
})
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
if (local) {
|
|
162
|
+
const result = await forge.rewrite.fastForward!({
|
|
163
|
+
workspacePath,
|
|
164
|
+
branch: deps.destination,
|
|
165
|
+
expected: parent,
|
|
166
|
+
sha: head,
|
|
167
|
+
})
|
|
168
|
+
if (result.kind !== 'published') return
|
|
169
|
+
landed = head
|
|
170
|
+
} else {
|
|
171
|
+
landed = await forge.mergeLinearStack!(workspacePath, deps.pr, head)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
await authority()
|
|
175
|
+
state = (await readBuildFacts(store, slug)).value.state
|
|
176
|
+
const intent = state.integration!.intent!
|
|
177
|
+
await store.append(slug, {
|
|
178
|
+
actor: DISPATCHER,
|
|
179
|
+
type: 'integration.landed',
|
|
180
|
+
payload: {
|
|
181
|
+
operation: intent.id,
|
|
182
|
+
head: intent.head,
|
|
183
|
+
landed,
|
|
184
|
+
provenance: 'kernel',
|
|
185
|
+
verified: true,
|
|
186
|
+
fenced: intent.fenced,
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
await store.append(slug, {
|
|
190
|
+
actor: DISPATCHER,
|
|
191
|
+
type: 'pr.merged',
|
|
192
|
+
payload: { sha: landed, buildTrailerPresent: true },
|
|
193
|
+
})
|
|
194
|
+
await acknowledgeNodeLanding(forge, workspacePath, deps.pr, landed)
|
|
195
|
+
} finally {
|
|
196
|
+
await store.releaseNodeWriter(slug, deps.holder)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Audit immutable merge-result commits, including after build completion. */
|
|
201
|
+
export async function auditIntegrationLanding(
|
|
202
|
+
deps: Pick<IntegrationLandingDeps, 'store' | 'forge' | 'exec' | 'workspacePath' | 'slug' | 'id'>,
|
|
203
|
+
): Promise<void> {
|
|
204
|
+
const state = (await readBuildFacts(deps.store, deps.slug)).value.state
|
|
205
|
+
const landing = state.integration?.landing
|
|
206
|
+
if (!landing?.operation || state.integration?.audit || !deps.forge.rewrite) return
|
|
207
|
+
const trees: string[] = []
|
|
208
|
+
for (const sha of [landing.head, landing.landed]) {
|
|
209
|
+
const present = await deps.exec(['git', 'cat-file', '-e', `${sha}^{commit}`], {
|
|
210
|
+
cwd: deps.workspacePath,
|
|
211
|
+
})
|
|
212
|
+
if (present.exitCode !== 0) {
|
|
213
|
+
const fetched = await deps.exec(['git', 'fetch', '--no-tags', 'origin', sha], {
|
|
214
|
+
cwd: deps.workspacePath,
|
|
215
|
+
})
|
|
216
|
+
if (fetched.exitCode !== 0) throw new Error('integration audit commit unavailable')
|
|
217
|
+
}
|
|
218
|
+
const tree = await deps.exec(['git', 'rev-parse', `${sha}^{tree}`], { cwd: deps.workspacePath })
|
|
219
|
+
if (tree.exitCode !== 0) throw new Error('integration landing tree audit pending')
|
|
220
|
+
trees.push(tree.stdout.trim())
|
|
221
|
+
}
|
|
222
|
+
const intent = state.integration?.intent
|
|
223
|
+
const identities = intent
|
|
224
|
+
? await inspectIntegrationStack(deps.exec, deps.workspacePath, intent.parent, landing.head)
|
|
225
|
+
: []
|
|
226
|
+
const messages = intent
|
|
227
|
+
? await deps.exec(
|
|
228
|
+
['git', 'log', '--format=%B%x00', `${intent.parent}..${landing.landed}`, '--'],
|
|
229
|
+
{ cwd: deps.workspacePath },
|
|
230
|
+
)
|
|
231
|
+
: undefined
|
|
232
|
+
if (messages && messages.exitCode !== 0) throw new Error('landing identity audit pending')
|
|
233
|
+
const landedIdentities = messages
|
|
234
|
+
? messages.stdout.split('\0').flatMap((message) => buildTrailers(message))
|
|
235
|
+
: []
|
|
236
|
+
const missing = identities.filter(
|
|
237
|
+
(identity) => landedIdentities.filter((value) => value === identity).length !== 1,
|
|
238
|
+
)
|
|
239
|
+
if (trees[0] !== trees[1] || missing.length) {
|
|
240
|
+
const id = `integration-audit-${landing.operation}`
|
|
241
|
+
if (![...state.openEscalations, ...state.answeredEscalations].some((item) => item.id === id))
|
|
242
|
+
await deps.store.append(deps.slug, {
|
|
243
|
+
actor: KERNEL,
|
|
244
|
+
type: 'escalation.raised',
|
|
245
|
+
payload: {
|
|
246
|
+
id,
|
|
247
|
+
phase: 'verify:integration',
|
|
248
|
+
source: 'agent',
|
|
249
|
+
question: `Integration result requires attention: verified ${landing.head} (${trees[0]}), landed ${landing.landed} (${trees[1]}). Missing or duplicate identities: ${missing.join(', ') || 'none'}. The shared parent has not been rewritten.`,
|
|
250
|
+
},
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
await deps.store.append(deps.slug, {
|
|
254
|
+
actor: KERNEL,
|
|
255
|
+
type: 'integration.audited',
|
|
256
|
+
payload: {
|
|
257
|
+
operation: landing.operation,
|
|
258
|
+
verifiedTree: trees[0]!,
|
|
259
|
+
landedTree: trees[1]!,
|
|
260
|
+
identities,
|
|
261
|
+
},
|
|
262
|
+
})
|
|
263
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Exec } from '../ports/workspace/git-worktree'
|
|
2
|
+
import { buildTrailers } from './build-identity'
|
|
3
|
+
|
|
4
|
+
/** A node has no wrapper identity: every commit retains its contributing build. */
|
|
5
|
+
export async function inspectIntegrationStack(
|
|
6
|
+
exec: Exec,
|
|
7
|
+
cwd: string,
|
|
8
|
+
parent: string,
|
|
9
|
+
head: string,
|
|
10
|
+
): Promise<string[]> {
|
|
11
|
+
const ancestry = await exec(['git', 'merge-base', '--is-ancestor', parent, head], { cwd })
|
|
12
|
+
if (ancestry.exitCode !== 0)
|
|
13
|
+
throw new Error('integration stack is not a fast-forward of its verified parent')
|
|
14
|
+
const range = await exec(
|
|
15
|
+
['git', 'log', '--reverse', '--format=%H%x00%P%x00%B%x00', `${parent}..${head}`, '--'],
|
|
16
|
+
{ cwd },
|
|
17
|
+
)
|
|
18
|
+
if (range.exitCode !== 0) throw new Error('cannot inspect integration stack')
|
|
19
|
+
const fields = range.stdout.split('\0')
|
|
20
|
+
const builds: string[] = []
|
|
21
|
+
let previous = parent
|
|
22
|
+
for (let index = 0; index + 2 < fields.length; index += 3) {
|
|
23
|
+
const sha = fields[index]!.trim()
|
|
24
|
+
const parents = fields[index + 1]!.trim()
|
|
25
|
+
const identities = buildTrailers(fields[index + 2]!)
|
|
26
|
+
if (parents !== previous || identities.length !== 1 || builds.includes(identities[0]!))
|
|
27
|
+
throw new Error(
|
|
28
|
+
'integration stack requires a linear range with one unique build identity per commit',
|
|
29
|
+
)
|
|
30
|
+
builds.push(identities[0]!)
|
|
31
|
+
previous = sha
|
|
32
|
+
}
|
|
33
|
+
if (!builds.length || previous !== head)
|
|
34
|
+
throw new Error('integration stack has no complete owned range')
|
|
35
|
+
return builds
|
|
36
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { AbEvent } from '../events/catalog'
|
|
2
|
+
import type { EventPayload } from '../events/payloads'
|
|
3
|
+
import type { BuildState } from './reducer'
|
|
4
|
+
|
|
5
|
+
/** Exact immutable inputs, retained independently of disposable execution. */
|
|
6
|
+
export interface IntegrationState {
|
|
7
|
+
cycles?: (EventPayload<'integration.prepared'> & { seq: number })[]
|
|
8
|
+
observation?: EventPayload<'integration.observed'>
|
|
9
|
+
cycle?: EventPayload<'integration.prepared'> & { seq: number }
|
|
10
|
+
intent?: EventPayload<'integration.landing-intended'>
|
|
11
|
+
landing?: EventPayload<'integration.landed'>
|
|
12
|
+
audit?: EventPayload<'integration.audited'>
|
|
13
|
+
}
|
|
14
|
+
export function advanceIntegration(state: IntegrationState, event: AbEvent): void {
|
|
15
|
+
switch (event.type) {
|
|
16
|
+
case 'integration.observed':
|
|
17
|
+
state.observation = event.payload
|
|
18
|
+
break
|
|
19
|
+
case 'integration.prepared':
|
|
20
|
+
state.cycle = { ...event.payload, seq: event.seq }
|
|
21
|
+
state.cycles ??= []
|
|
22
|
+
state.cycles.push(state.cycle)
|
|
23
|
+
break
|
|
24
|
+
case 'integration.abandoned':
|
|
25
|
+
if (state.intent?.id === event.payload.id) delete state.intent
|
|
26
|
+
break
|
|
27
|
+
case 'integration.landing-intended':
|
|
28
|
+
state.intent = event.payload
|
|
29
|
+
break
|
|
30
|
+
case 'integration.landed':
|
|
31
|
+
state.landing = event.payload
|
|
32
|
+
break
|
|
33
|
+
case 'integration.audited':
|
|
34
|
+
state.audit = event.payload
|
|
35
|
+
break
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function integrationComplete(state: Pick<BuildState, 'integration'>): boolean {
|
|
39
|
+
const observation = state.integration?.observation
|
|
40
|
+
return (
|
|
41
|
+
!!observation &&
|
|
42
|
+
observation.openChildren.length === 0 &&
|
|
43
|
+
observation.diagnostics.length === 0 &&
|
|
44
|
+
observation.contributions.length > 0
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
export function integrationCurrent(state: BuildState): boolean {
|
|
48
|
+
const cycle = state.integration?.cycle
|
|
49
|
+
return (
|
|
50
|
+
!!cycle &&
|
|
51
|
+
integrationComplete(state) &&
|
|
52
|
+
!state.nodeRestack?.parentRequest &&
|
|
53
|
+
!state.nodeRestack?.parentChange &&
|
|
54
|
+
!state.nodeRestack?.active &&
|
|
55
|
+
state.nodeComparison?.headSha === cycle.head &&
|
|
56
|
+
state.nodeComparison?.parentSha === cycle.parent &&
|
|
57
|
+
(!state.nodeRestack?.observedParent || state.nodeRestack.observedParent.sha === cycle.parent) &&
|
|
58
|
+
state.nodeRestack?.contributionBase === cycle.parent
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function integrationConfig(config: import('../config/schema').Config): string {
|
|
63
|
+
return JSON.stringify({ verify: config.verify, commands: config.commands })
|
|
64
|
+
}
|
|
65
|
+
export function integrationFailed(state: BuildState): boolean {
|
|
66
|
+
const cycle = state.integration?.cycle
|
|
67
|
+
return (
|
|
68
|
+
!!cycle &&
|
|
69
|
+
state.nodeComparison?.headSha === cycle.head &&
|
|
70
|
+
state.nodeComparison?.parentSha === cycle.parent &&
|
|
71
|
+
state.verify.results.some(
|
|
72
|
+
(result) =>
|
|
73
|
+
result.seq > cycle!.seq && result.restackId === cycle!.id && result.outcome === 'fail',
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
export function integrationVerified(
|
|
78
|
+
state: BuildState,
|
|
79
|
+
config: import('../config/schema').Config,
|
|
80
|
+
): boolean {
|
|
81
|
+
const cycle = state.integration?.cycle
|
|
82
|
+
return (
|
|
83
|
+
integrationCurrent(state) &&
|
|
84
|
+
cycle!.config === integrationConfig(config) &&
|
|
85
|
+
!integrationFailed(state) &&
|
|
86
|
+
config.verify.steps.every((step) =>
|
|
87
|
+
state.verify.results.some(
|
|
88
|
+
(result) =>
|
|
89
|
+
result.seq > cycle!.seq &&
|
|
90
|
+
result.restackId === cycle!.id &&
|
|
91
|
+
result.headSha === cycle!.head &&
|
|
92
|
+
result.baseSha === cycle!.parent &&
|
|
93
|
+
result.step === step &&
|
|
94
|
+
(result.outcome === 'pass' || result.outcome === 'skipped'),
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function integrationHeadVerified(state: BuildState, head: string): boolean {
|
|
101
|
+
const cycles =
|
|
102
|
+
state.integration?.cycles ?? (state.integration?.cycle ? [state.integration.cycle] : [])
|
|
103
|
+
return cycles.some((cycle) => {
|
|
104
|
+
if (cycle.head !== head) return false
|
|
105
|
+
const selected = JSON.parse(cycle.config) as { verify: { steps: string[] } }
|
|
106
|
+
const receipts = state.verify.results.filter(
|
|
107
|
+
(result) =>
|
|
108
|
+
result.restackId === cycle.id && result.headSha === head && result.baseSha === cycle.parent,
|
|
109
|
+
)
|
|
110
|
+
return (
|
|
111
|
+
!receipts.some((result) => result.outcome === 'fail') &&
|
|
112
|
+
selected.verify.steps.every((step) =>
|
|
113
|
+
receipts.some(
|
|
114
|
+
(result) =>
|
|
115
|
+
result.step === step && (result.outcome === 'pass' || result.outcome === 'skipped'),
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Eligibility belongs to the current cycle. Historical same-head evidence
|
|
123
|
+
* remains available to landing audits, but cannot authorize a new parent. */
|
|
124
|
+
export function integrationCycleVerified(state: BuildState): boolean {
|
|
125
|
+
const cycle = state.integration?.cycle
|
|
126
|
+
if (!cycle) return false
|
|
127
|
+
return integrationHeadVerified(
|
|
128
|
+
{ ...state, integration: { ...state.integration, cycles: [cycle] } },
|
|
129
|
+
cycle.head,
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function integrationNeedsRunner(state: BuildState): boolean {
|
|
134
|
+
return integrationCurrent(state) && !integrationFailed(state) && !integrationCycleVerified(state)
|
|
135
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { LandingRule } from '../config/schema'
|
|
2
|
+
|
|
3
|
+
/** The frozen destination identity, never the source ticket's mutable parent. */
|
|
4
|
+
export type LandingTarget = { kind: 'root' } | { kind: 'node'; ticket: string }
|
|
5
|
+
export interface LandingPolicyInput {
|
|
6
|
+
from: 'leaf' | 'node'
|
|
7
|
+
into: LandingTarget
|
|
8
|
+
labels: readonly string[]
|
|
9
|
+
}
|
|
10
|
+
export interface LandingPolicyMatch {
|
|
11
|
+
mode: 'auto' | 'consent'
|
|
12
|
+
/** Zero-based position and complete rule as sampled at readiness. */
|
|
13
|
+
rule: { index: number; snapshot: LandingRule } | { default: true }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function evaluateLandingPolicy(
|
|
17
|
+
rules: readonly LandingRule[],
|
|
18
|
+
input: LandingPolicyInput,
|
|
19
|
+
): LandingPolicyMatch {
|
|
20
|
+
for (const [index, rule] of rules.entries()) {
|
|
21
|
+
if (rule.from !== undefined && rule.from !== input.from) continue
|
|
22
|
+
if (rule.label !== undefined && !input.labels.includes(rule.label)) continue
|
|
23
|
+
if (rule.into !== undefined) {
|
|
24
|
+
if (rule.into === 'root') {
|
|
25
|
+
if (input.into.kind !== 'root') continue
|
|
26
|
+
} else if (rule.into === 'node') {
|
|
27
|
+
if (input.into.kind !== 'node') continue
|
|
28
|
+
} else if (input.into.kind !== 'node' || rule.into !== input.into.ticket) continue
|
|
29
|
+
}
|
|
30
|
+
return { mode: rule.mode, rule: { index, snapshot: { ...rule } } }
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
mode: input.from === 'leaf' ? 'auto' : 'consent',
|
|
34
|
+
rule: { default: true },
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Policy decisions and native application receipts bind to this exact
|
|
39
|
+
* readiness candidate. Operator consent instead binds to the landing. */
|
|
40
|
+
export interface LandingCandidate {
|
|
41
|
+
head: string
|
|
42
|
+
parent: string
|
|
43
|
+
cycle: string
|
|
44
|
+
}
|
|
45
|
+
export function landingCandidateId(candidate: LandingCandidate): string {
|
|
46
|
+
return JSON.stringify([candidate.head, candidate.parent, candidate.cycle])
|
|
47
|
+
}
|