@kungfu-tech/buildchain 4.1.3-alpha.1 → 4.1.3-alpha.3
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/architecture/action-taxonomy.json +24 -0
- package/architecture/agent-change-map.md +256 -2
- package/architecture/ci-lane-change-budget.json +374 -0
- package/architecture/decisions/0005-minimal-consumer-contract.md +122 -0
- package/architecture/decisions/0006-business-attempt-journal.md +89 -0
- package/architecture/decisions/0007-hosted-pipeline-controller.md +106 -0
- package/architecture/decisions/0008-pipeline-product-publication.md +99 -0
- package/architecture/decisions/0009-pipeline-version-preparation.md +186 -0
- package/architecture/internal-capabilities.json +361 -2
- package/architecture/maintainability-debt.json +6 -4
- package/architecture/maintainability-policy.json +8 -8
- package/architecture/minimal-consumer-migration.json +7567 -0
- package/architecture/product-upstreams.json +20 -0
- package/architecture/release-topology.json +282 -11
- package/architecture/universal-workflow-bootstrap.json +12 -0
- package/architecture/universal-workflow-capability-policy.json +1 -1
- package/architecture/workflow-taxonomy.json +66 -0
- package/dist/readers/business-attempt.cjs +809 -0
- package/dist/site/buildchain-contract.json +7 -5
- package/dist/site/buildchain-site.json +18 -13
- package/dist/site/capability-registry.json +3 -3
- package/dist/site/kfd-claims.json +385 -10
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +1 -1
- package/dist/site/node-api-registry.json +21 -21
- package/dist/site/page-registry.json +13 -8
- package/dist/site/public-surface-audit.json +258 -7
- package/dist/site/publication-authority-registry.json +141 -1
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/site-manifest.json +5 -5
- package/dist/site/workflow-registry.json +522 -7
- package/docs/node-api-reference.md +39 -39
- package/docs/runtime-entry.md +45 -5
- package/docs/workflow-catalog.md +6 -0
- package/package.json +4 -3
- package/packages/core/build/standalone/build.js +7 -1
- package/packages/core/consumer/buildchain-config.js +2 -21
- package/packages/core/consumer/contract/entries.js +85 -0
- package/packages/core/consumer/contract/examples.js +96 -0
- package/packages/core/consumer/contract/identity.js +65 -0
- package/packages/core/consumer/contract/inspection.js +45 -0
- package/packages/core/consumer/contract/plan.js +146 -0
- package/packages/core/consumer/contract/products.js +119 -0
- package/packages/core/consumer/contract/reader.js +47 -0
- package/packages/core/consumer/contract/shape.js +46 -0
- package/packages/core/dev-delivery/candidate/admission.js +9 -5
- package/packages/core/dev-delivery/candidate/reservation.js +11 -0
- package/packages/core/dev-delivery/candidate/source-paths.js +12 -4
- package/packages/core/dev-delivery/commands/project-cut-merge-queue-admission.mjs +47 -20
- package/packages/core/dev-delivery/native/actions.js +7 -1
- package/packages/core/dev-delivery/native/heartbeat-action.js +16 -0
- package/packages/core/dev-delivery/native/heartbeat.js +6 -4
- package/packages/core/dev-delivery/queue/landing-action.js +5 -0
- package/packages/core/governance/buildchain-publication-authority.js +6 -0
- package/packages/core/paper/operations/bootstrap.js +2 -0
- package/packages/core/paper/paper-npm-bootstrap.js +2 -2
- package/packages/core/providers/github/attempt-index.js +60 -0
- package/packages/core/providers/github/attempt-journal.js +154 -0
- package/packages/core/providers/github/discussions/materials.js +7 -2
- package/packages/core/providers/github/pipeline-checkout.js +49 -0
- package/packages/core/providers/github/pipeline-entry-runs.js +203 -0
- package/packages/core/providers/github/pipeline-events.js +52 -0
- package/packages/core/providers/github/pipeline-integration.js +95 -0
- package/packages/core/providers/github/pipeline-policy.js +213 -0
- package/packages/core/providers/github/pipeline-product-payload.js +50 -0
- package/packages/core/providers/github/pipeline-product-release.js +191 -0
- package/packages/core/providers/github/pipeline-publication-artifacts.js +153 -0
- package/packages/core/providers/github/pipeline-release-evidence.js +111 -0
- package/packages/core/providers/github/pipeline-run-entry.js +86 -0
- package/packages/core/providers/github/pipeline-runs.js +132 -0
- package/packages/core/providers/github/pipeline-source.js +178 -0
- package/packages/core/providers/github/pipeline-stable-source.js +354 -0
- package/packages/core/providers/github/pipeline-version-artifacts.js +91 -0
- package/packages/core/providers/github/pipeline-version-readback.js +117 -0
- package/packages/core/providers/github/pipeline-version.js +199 -0
- package/packages/core/providers/github/pipeline-worker.js +108 -0
- package/packages/core/publication/candidate/registry-hydration.js +2 -2
- package/packages/core/publication/npm/pack-preview.js +2 -2
- package/packages/core/publication/npm/pack-result.js +31 -0
- package/packages/core/publication/npm/package.js +3 -6
- package/packages/core/publication/npm/pipeline-channel.js +87 -0
- package/packages/core/publication/npm/pipeline-provider.js +109 -0
- package/packages/core/publication/npm/registry.js +12 -9
- package/packages/core/publication/pipeline/actions.js +116 -0
- package/packages/core/publication/pipeline/apply.js +188 -0
- package/packages/core/publication/pipeline/build-segments.js +107 -0
- package/packages/core/publication/pipeline/capsules.js +89 -0
- package/packages/core/publication/pipeline/context.js +39 -0
- package/packages/core/publication/pipeline/development-anchor.js +91 -0
- package/packages/core/publication/pipeline/development-current.js +63 -0
- package/packages/core/publication/pipeline/development-pr.js +112 -0
- package/packages/core/publication/pipeline/development-proof.js +76 -0
- package/packages/core/publication/pipeline/development-transition.js +112 -0
- package/packages/core/publication/pipeline/distribution.js +124 -0
- package/packages/core/publication/pipeline/documents.js +192 -0
- package/packages/core/publication/pipeline/effects.js +162 -0
- package/packages/core/publication/pipeline/files.js +66 -0
- package/packages/core/publication/pipeline/imported-materials.js +32 -0
- package/packages/core/publication/pipeline/journal.js +110 -0
- package/packages/core/publication/pipeline/next-development.js +117 -0
- package/packages/core/publication/pipeline/pack.js +157 -0
- package/packages/core/publication/pipeline/package-policy.js +22 -0
- package/packages/core/publication/pipeline/plan.js +136 -0
- package/packages/core/publication/pipeline/prepare.js +139 -0
- package/packages/core/publication/pipeline/qualification.js +175 -0
- package/packages/core/publication/pipeline/qualify.js +104 -0
- package/packages/core/publication/pipeline/recovery-admission.js +122 -0
- package/packages/core/publication/pipeline/recovery-build-download.js +80 -0
- package/packages/core/publication/pipeline/recovery-build-plan.js +122 -0
- package/packages/core/publication/pipeline/recovery-build-readback.js +68 -0
- package/packages/core/publication/pipeline/recovery-capsules.js +54 -0
- package/packages/core/publication/pipeline/recovery-import.js +80 -0
- package/packages/core/publication/pipeline/recovery-inspection.js +218 -0
- package/packages/core/publication/pipeline/recovery-materials.js +104 -0
- package/packages/core/publication/pipeline/recovery-plan.js +46 -0
- package/packages/core/publication/pipeline/recovery-prepare.js +73 -0
- package/packages/core/publication/pipeline/recovery-qualification.js +128 -0
- package/packages/core/publication/pipeline/recovery-readback.js +56 -0
- package/packages/core/publication/pipeline/recovery-signing.js +58 -0
- package/packages/core/publication/pipeline/sealed-products.js +79 -0
- package/packages/core/publication/pipeline/settle.js +43 -0
- package/packages/core/publication/pipeline/signing.js +140 -0
- package/packages/core/publication/pipeline/source-plan.js +83 -0
- package/packages/core/publication/pipeline/stable-entry.js +215 -0
- package/packages/core/publication/pipeline/stable-products.js +317 -0
- package/packages/core/publication/pipeline/stable-wait.js +170 -0
- package/packages/core/publication/pipeline/stable.js +82 -0
- package/packages/core/publication/pipeline/version-actions.js +93 -0
- package/packages/core/publication/pipeline/version-build.js +130 -0
- package/packages/core/publication/pipeline/version-context.js +143 -0
- package/packages/core/publication/pipeline/version-material.js +36 -0
- package/packages/core/publication/pipeline/version-preparation.js +69 -0
- package/packages/core/publication/pipeline/version-regeneration.js +162 -0
- package/packages/core/publication/pipeline/version-source-guard.js +69 -0
- package/packages/core/publication/pipeline/version.js +81 -0
- package/packages/core/publication/pipeline/worker.js +72 -0
- package/packages/core/publication/publication-reproducibility.js +2 -2
- package/packages/core/release/promote-candidate/product-provider-adapters.js +4 -3
- package/packages/core/release/promote-ref/internal/npm-existing-evidence.js +2 -1
- package/packages/core/release/promote-ref/internal/publish-command.js +16 -5
- package/packages/core/release/stable-release-gate.js +11 -0
- package/packages/core/runtime/buildchain-domain.wasm +0 -0
- package/packages/core/runtime/domain-wasm-artifact.js +2 -2
- package/packages/core/runtime/entry/actions.js +27 -25
- package/packages/core/runtime/entry/attempt.js +25 -0
- package/packages/core/runtime/entry/selection.js +14 -0
- package/packages/core/runtime/entry/source.js +62 -0
- package/packages/core/workflow/attempt/identity.js +170 -0
- package/packages/core/workflow/attempt/journal.js +87 -0
- package/packages/core/workflow/attempt/materials.js +72 -0
- package/packages/core/workflow/attempt/reader-entry.js +12 -0
- package/packages/core/workflow/attempt/reader.js +149 -0
- package/packages/core/workflow/attempt/records.js +153 -0
- package/packages/core/workflow/attempt/store.js +75 -0
- package/packages/core/workflow/commands/pipeline-build.mjs +23 -0
- package/packages/core/workflow/pipeline/action-output.js +11 -0
- package/packages/core/workflow/pipeline/actions.js +75 -0
- package/packages/core/workflow/pipeline/build-control.js +140 -0
- package/packages/core/workflow/pipeline/build-evidence.js +92 -0
- package/packages/core/workflow/pipeline/build-qualification.js +145 -0
- package/packages/core/workflow/pipeline/build-result.js +69 -0
- package/packages/core/workflow/pipeline/build.js +142 -0
- package/packages/core/workflow/pipeline/cancellation.js +169 -0
- package/packages/core/workflow/pipeline/channel-control.js +127 -0
- package/packages/core/workflow/pipeline/controller.js +133 -0
- package/packages/core/workflow/pipeline/delivery-control.js +204 -0
- package/packages/core/workflow/pipeline/delivery-observation.js +118 -0
- package/packages/core/workflow/pipeline/delivery-request.js +198 -0
- package/packages/core/workflow/pipeline/events.js +84 -0
- package/packages/core/workflow/pipeline/fence.js +42 -0
- package/packages/core/workflow/pipeline/group-control.js +56 -0
- package/packages/core/workflow/pipeline/guard-build.js +37 -0
- package/packages/core/workflow/pipeline/guard.js +156 -0
- package/packages/core/workflow/pipeline/host.js +114 -0
- package/packages/core/workflow/pipeline/materials.js +58 -0
- package/packages/core/workflow/pipeline/notifications.js +36 -0
- package/packages/core/workflow/pipeline/parent-notification.js +27 -0
- package/packages/core/workflow/pipeline/platforms.js +21 -0
- package/packages/core/workflow/pipeline/progress.js +108 -0
- package/packages/core/workflow/pipeline/projection.js +20 -0
- package/packages/core/workflow/pipeline/reconcile.js +194 -0
- package/packages/core/workflow/pipeline/recovery-action.js +30 -0
- package/packages/core/workflow/pipeline/recovery-admission.js +122 -0
- package/packages/core/workflow/pipeline/recovery-build-control.js +95 -0
- package/packages/core/workflow/pipeline/recovery-build-evidence.js +71 -0
- package/packages/core/workflow/pipeline/recovery-build.js +121 -0
- package/packages/core/workflow/pipeline/recovery-controller.js +91 -0
- package/packages/core/workflow/pipeline/recovery-integration.js +66 -0
- package/packages/core/workflow/pipeline/recovery-merge-proof.js +90 -0
- package/packages/core/workflow/pipeline/recovery-ownership-settlement.js +150 -0
- package/packages/core/workflow/pipeline/recovery-ownership.js +91 -0
- package/packages/core/workflow/pipeline/recovery-plan.js +126 -0
- package/packages/core/workflow/pipeline/recovery-runtime.js +68 -0
- package/packages/core/workflow/pipeline/recovery-session.js +129 -0
- package/packages/core/workflow/pipeline/recovery-transition.js +135 -0
- package/packages/core/workflow/pipeline/recovery-unrecorded-build.js +74 -0
- package/packages/core/workflow/pipeline/runtime-source.js +111 -0
- package/packages/core/workflow/pipeline/selection.js +106 -0
- package/packages/core/workflow/pipeline/session.js +72 -0
- package/packages/core/workflow/pipeline/settlement.js +137 -0
- package/packages/core/workflow/pipeline/wake.js +38 -0
- package/packages/core/workflow/pipeline/web-status.js +108 -0
- package/scripts/build-release-discussion-reader.mjs +11 -7
- package/scripts/check-pipeline-publication-topology.mjs +48 -0
- package/scripts/check-release-topology.mjs +7 -1
- package/scripts/generate-minimal-consumer-contract.mjs +155 -0
- package/scripts/generate-site-bundle.mjs +1 -1
- package/scripts/verify-golden-path.mjs +5 -1
- package/scripts/verify-standalone-product.mjs +42 -0
- package/templates/minimal-consumer/binary/.buildchain/buildchain.toml +45 -0
- package/templates/minimal-consumer/binary/.github/workflows/buildchain-recover.yml +30 -0
- package/templates/minimal-consumer/binary/.github/workflows/buildchain.yml +28 -0
- package/templates/minimal-consumer/binary/package.json +6 -0
- package/templates/minimal-consumer/binary/src/build.mjs +5 -0
- package/templates/minimal-consumer/binary/src/hello.c +2 -0
- package/templates/minimal-consumer/binary/src/verify.mjs +3 -0
- package/templates/minimal-consumer/npm/.buildchain/buildchain.toml +46 -0
- package/templates/minimal-consumer/npm/.github/workflows/buildchain-recover.yml +30 -0
- package/templates/minimal-consumer/npm/.github/workflows/buildchain.yml +28 -0
- package/templates/minimal-consumer/npm/package.json +6 -0
- package/templates/minimal-consumer/npm/src/build.mjs +5 -0
- package/templates/minimal-consumer/npm/src/verify.mjs +3 -0
- package/templates/minimal-consumer/paper/.buildchain/buildchain.toml +45 -0
- package/templates/minimal-consumer/paper/.github/workflows/buildchain-recover.yml +30 -0
- package/templates/minimal-consumer/paper/.github/workflows/buildchain.yml +28 -0
- package/templates/minimal-consumer/paper/package.json +6 -0
- package/templates/minimal-consumer/paper/src/build.mjs +12 -0
- package/templates/minimal-consumer/paper/src/verify.mjs +3 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { recordDigest } from "../../release/discussion/envelope.js";
|
|
2
|
+
import { readPipelineCaller } from "../../providers/github/pipeline-run-entry.js";
|
|
3
|
+
import { RECOVERY_ENTRY } from "../../consumer/contract/entries.js";
|
|
4
|
+
|
|
5
|
+
export async function recoveryExecution(host, definitionSha) {
|
|
6
|
+
const { run } = await host.runs.read(host.runId, host.runAttempt);
|
|
7
|
+
const definitions = (run.referenced_workflows || []).filter((item) =>
|
|
8
|
+
item.path?.startsWith(`kungfu-systems/buildchain/${RECOVERY_ENTRY}@`),
|
|
9
|
+
);
|
|
10
|
+
if (
|
|
11
|
+
run.event !== "workflow_dispatch" ||
|
|
12
|
+
run.status !== "in_progress" ||
|
|
13
|
+
run.repository?.full_name !== host.repository ||
|
|
14
|
+
run.head_repository?.full_name !== host.repository ||
|
|
15
|
+
run.path?.split("@")[0] !== ".github/workflows/buildchain-recover.yml" ||
|
|
16
|
+
definitions.length !== 1 ||
|
|
17
|
+
definitions[0].sha !== definitionSha ||
|
|
18
|
+
!/^[0-9a-f]{40}$/u.test(definitionSha || "")
|
|
19
|
+
)
|
|
20
|
+
throw new Error(
|
|
21
|
+
"Recovery must execute the exact canonical entry from the same consumer repository",
|
|
22
|
+
);
|
|
23
|
+
const channel = definitions[0].path
|
|
24
|
+
.split("@")
|
|
25
|
+
.at(-1)
|
|
26
|
+
.replace(/^refs\/tags\//u, "");
|
|
27
|
+
if (!["v4", "v4-alpha"].includes(channel))
|
|
28
|
+
throw new Error("Recovery entry must be a published floating channel");
|
|
29
|
+
return {
|
|
30
|
+
run,
|
|
31
|
+
channel,
|
|
32
|
+
entry: {
|
|
33
|
+
repository: "kungfu-systems/buildchain",
|
|
34
|
+
workflow: RECOVERY_ENTRY,
|
|
35
|
+
sha: definitionSha,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function admitRecoverySource(session, execution, host) {
|
|
41
|
+
const current = session.observed.history.at(-1);
|
|
42
|
+
const original = current.generation.source;
|
|
43
|
+
const source = await host.source.source(original.commit, original.configPath);
|
|
44
|
+
if (
|
|
45
|
+
recordDigest(source.identity) !== recordDigest(original) ||
|
|
46
|
+
host.selection.source?.sha !== original.commit ||
|
|
47
|
+
host.selection.source?.repository !== host.repository
|
|
48
|
+
)
|
|
49
|
+
throw new Error(
|
|
50
|
+
"Recovery source, config or selected runtime source changed",
|
|
51
|
+
);
|
|
52
|
+
const caller = await readPipelineCaller(
|
|
53
|
+
execution.run,
|
|
54
|
+
original.configPath,
|
|
55
|
+
host.request,
|
|
56
|
+
host.repository,
|
|
57
|
+
);
|
|
58
|
+
const admission = await host.source.observeIntent(
|
|
59
|
+
session.intent,
|
|
60
|
+
current.generation,
|
|
61
|
+
{ "config-path": original.configPath },
|
|
62
|
+
);
|
|
63
|
+
if (
|
|
64
|
+
!admission.live.source ||
|
|
65
|
+
recordDigest(admission.live.source) !== recordDigest(original) ||
|
|
66
|
+
admission.live.targetBranch !== session.intent.source.targetBranch ||
|
|
67
|
+
(!admission.live.merged &&
|
|
68
|
+
(admission.live.state !== "open" ||
|
|
69
|
+
admission.live.routeEnabled === false ||
|
|
70
|
+
admission.live.baseCommit !== current.generation.baseCommit))
|
|
71
|
+
)
|
|
72
|
+
throw new Error(
|
|
73
|
+
"Selected source was closed, superseded or rebased; use its current admitted attempt",
|
|
74
|
+
);
|
|
75
|
+
return {
|
|
76
|
+
source,
|
|
77
|
+
admission,
|
|
78
|
+
caller,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function recoveryPredecessorRuns(session, host) {
|
|
83
|
+
const current = session.observed.history.at(-1);
|
|
84
|
+
const keys = [
|
|
85
|
+
...new Map(
|
|
86
|
+
current.runs.map((writer) => [
|
|
87
|
+
`${writer.runId}:${writer.runAttempt}`,
|
|
88
|
+
writer,
|
|
89
|
+
]),
|
|
90
|
+
).values(),
|
|
91
|
+
];
|
|
92
|
+
if (keys.length > 100)
|
|
93
|
+
throw new Error("Recovery predecessor run inventory exceeds its bound");
|
|
94
|
+
const observations = [];
|
|
95
|
+
for (const writer of keys) {
|
|
96
|
+
if (
|
|
97
|
+
Number(writer.runId) === host.runId &&
|
|
98
|
+
Number(writer.runAttempt) === host.runAttempt
|
|
99
|
+
)
|
|
100
|
+
throw new Error("Recovery cannot replace its own live execution");
|
|
101
|
+
const { run } = await host.runs.read(
|
|
102
|
+
Number(writer.runId),
|
|
103
|
+
Number(writer.runAttempt),
|
|
104
|
+
);
|
|
105
|
+
if (
|
|
106
|
+
run.repository?.full_name !== host.repository ||
|
|
107
|
+
run.head_repository?.full_name !== host.repository
|
|
108
|
+
)
|
|
109
|
+
throw new Error(
|
|
110
|
+
"Recovery predecessor execution crossed a repository or fork boundary",
|
|
111
|
+
);
|
|
112
|
+
observations.push(run);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
schema: "buildchain.pipeline-recovery-executions/v1",
|
|
116
|
+
predecessor: current.identity.id,
|
|
117
|
+
runs: observations,
|
|
118
|
+
terminal: observations.every(
|
|
119
|
+
(run) => run.status === "completed" && run.conclusion,
|
|
120
|
+
),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { object } from "../../consumer/contract/shape.js";
|
|
2
|
+
import { recordDigest } from "../../release/discussion/envelope.js";
|
|
3
|
+
import { resumePipelineSession } from "./session.js";
|
|
4
|
+
import { recoveryBuildEvidence } from "./recovery-build-evidence.js";
|
|
5
|
+
import { qualifyPipelineBuild } from "./build-qualification.js";
|
|
6
|
+
import { retainPipelineBuildResult } from "./build-result.js";
|
|
7
|
+
|
|
8
|
+
export const RECOVERY_BUILD_CONTEXT =
|
|
9
|
+
"buildchain.pipeline-recovery-build-context/v1";
|
|
10
|
+
|
|
11
|
+
export async function beginRecoveryBuild(session, host) {
|
|
12
|
+
session.observed = await session.journal.read();
|
|
13
|
+
const { plan, build } = await recoveryBuildEvidence(session, host);
|
|
14
|
+
const observed = session.observed;
|
|
15
|
+
const previous = observed.phases.build;
|
|
16
|
+
if (
|
|
17
|
+
previous &&
|
|
18
|
+
(previous.payload.writer.runId !== String(host.runId) ||
|
|
19
|
+
previous.payload.writer.runAttempt !== String(host.runAttempt))
|
|
20
|
+
)
|
|
21
|
+
return null;
|
|
22
|
+
await session.progress.progress({
|
|
23
|
+
attempt: observed.attempt,
|
|
24
|
+
phase: "build",
|
|
25
|
+
state: "running",
|
|
26
|
+
eventKey: `build-start:${host.runId}:${host.runAttempt}`,
|
|
27
|
+
expectedHead: observed.head,
|
|
28
|
+
reason: build.reason,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
schema: RECOVERY_BUILD_CONTEXT,
|
|
32
|
+
attempt: observed.attempt,
|
|
33
|
+
generation: observed.generation,
|
|
34
|
+
source: build.source,
|
|
35
|
+
runId: host.runId,
|
|
36
|
+
runAttempt: host.runAttempt,
|
|
37
|
+
platforms: build.scheduled,
|
|
38
|
+
recoveryPlanRoot: plan.root,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function recordRecoveryBuild(context, host) {
|
|
43
|
+
object(context, [
|
|
44
|
+
"schema",
|
|
45
|
+
"attempt",
|
|
46
|
+
"generation",
|
|
47
|
+
"source",
|
|
48
|
+
"runId",
|
|
49
|
+
"runAttempt",
|
|
50
|
+
"platforms",
|
|
51
|
+
"recoveryPlanRoot",
|
|
52
|
+
]);
|
|
53
|
+
if (
|
|
54
|
+
context.schema !== RECOVERY_BUILD_CONTEXT ||
|
|
55
|
+
context.runId !== host.runId ||
|
|
56
|
+
context.runAttempt !== host.runAttempt
|
|
57
|
+
)
|
|
58
|
+
throw new Error("Recovery build callback belongs to another execution");
|
|
59
|
+
const session = await resumePipelineSession(
|
|
60
|
+
{ ...host, attempt: context.attempt },
|
|
61
|
+
host,
|
|
62
|
+
);
|
|
63
|
+
const { plan, build } = await recoveryBuildEvidence(session, host);
|
|
64
|
+
const writer = session.observed.phases.build?.payload.writer;
|
|
65
|
+
if (
|
|
66
|
+
context.generation !== session.observed.generation ||
|
|
67
|
+
context.recoveryPlanRoot !== plan.root ||
|
|
68
|
+
recordDigest(context.source) !== recordDigest(build.source) ||
|
|
69
|
+
recordDigest(context.platforms) !== recordDigest(build.scheduled) ||
|
|
70
|
+
writer?.runId !== String(host.runId) ||
|
|
71
|
+
writer?.runAttempt !== String(host.runAttempt)
|
|
72
|
+
)
|
|
73
|
+
throw new Error(
|
|
74
|
+
"Recovery build callback changed its reserved work or admission",
|
|
75
|
+
);
|
|
76
|
+
const segments = structuredClone(build.segments);
|
|
77
|
+
if (build.scheduled.length) {
|
|
78
|
+
const platforms = build.scheduled.map((item) => item.platform);
|
|
79
|
+
const readback = await host.runs.build(
|
|
80
|
+
host.runId,
|
|
81
|
+
host.runAttempt,
|
|
82
|
+
build.source,
|
|
83
|
+
platforms,
|
|
84
|
+
);
|
|
85
|
+
segments.push({ readback, platforms, runtime: host.runtime });
|
|
86
|
+
}
|
|
87
|
+
const result = qualifyPipelineBuild({
|
|
88
|
+
source: build.source,
|
|
89
|
+
platforms: build.platforms.map((item) => item.platform),
|
|
90
|
+
segments,
|
|
91
|
+
runId: host.runId,
|
|
92
|
+
runAttempt: host.runAttempt,
|
|
93
|
+
});
|
|
94
|
+
return retainPipelineBuildResult(context, result, session, host);
|
|
95
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { recordDigest } from "../../release/discussion/envelope.js";
|
|
2
|
+
import { retainedRecoveryEvidence } from "./recovery-session.js";
|
|
3
|
+
import { pipelinePlatforms } from "./platforms.js";
|
|
4
|
+
import { buildReadbackPlatforms } from "./build-qualification.js";
|
|
5
|
+
import { qualifyRecoveryRuntime } from "./recovery-runtime.js";
|
|
6
|
+
|
|
7
|
+
export async function recoveryBuildEvidence(session, host) {
|
|
8
|
+
const { plan, evidence } = await retainedRecoveryEvidence(session, host);
|
|
9
|
+
const build = evidence.build;
|
|
10
|
+
if (!build) throw new Error("Recovery admission has no qualified build plan");
|
|
11
|
+
const { root, ...body } = build;
|
|
12
|
+
const current = session.observed.history.at(-1);
|
|
13
|
+
const source = await host.source.source(
|
|
14
|
+
current.generation.source.commit,
|
|
15
|
+
current.generation.source.configPath,
|
|
16
|
+
);
|
|
17
|
+
if (
|
|
18
|
+
root !== recordDigest(body) ||
|
|
19
|
+
body.schema !== "buildchain.pipeline-recovery-build/v1" ||
|
|
20
|
+
body.predecessor !== plan.predecessor ||
|
|
21
|
+
recordDigest(body.source) !== recordDigest(current.generation.source) ||
|
|
22
|
+
recordDigest(source.identity) !== recordDigest(body.source) ||
|
|
23
|
+
recordDigest(pipelinePlatforms(source.plan)) !==
|
|
24
|
+
recordDigest(body.platforms) ||
|
|
25
|
+
recordDigest(host.runtime) !== recordDigest(plan.runtime)
|
|
26
|
+
)
|
|
27
|
+
throw new Error(
|
|
28
|
+
"Recovery build plan changed its source, platform inventory or executor",
|
|
29
|
+
);
|
|
30
|
+
const selected = new Set();
|
|
31
|
+
for (const segment of build.segments) {
|
|
32
|
+
const old = segment.readback;
|
|
33
|
+
const inventory = buildReadbackPlatforms(old);
|
|
34
|
+
const fresh = await host.runs.build(
|
|
35
|
+
old.runId,
|
|
36
|
+
old.runAttempt,
|
|
37
|
+
build.source,
|
|
38
|
+
inventory,
|
|
39
|
+
);
|
|
40
|
+
const runtime = await qualifyRecoveryRuntime(
|
|
41
|
+
segment.runtime,
|
|
42
|
+
host.runtime,
|
|
43
|
+
"build",
|
|
44
|
+
host.request,
|
|
45
|
+
);
|
|
46
|
+
if (recordDigest(fresh) !== recordDigest(old) || !runtime.compatible)
|
|
47
|
+
throw new Error(
|
|
48
|
+
"Recovered platform changed during execution requalification",
|
|
49
|
+
);
|
|
50
|
+
for (const platform of segment.platforms) {
|
|
51
|
+
const job = old.jobs[inventory.indexOf(platform)];
|
|
52
|
+
if (
|
|
53
|
+
selected.has(platform) ||
|
|
54
|
+
job?.status !== "completed" ||
|
|
55
|
+
job.conclusion !== "success"
|
|
56
|
+
)
|
|
57
|
+
throw new Error(
|
|
58
|
+
"Recovery cannot reuse duplicate or unsuccessful platform results",
|
|
59
|
+
);
|
|
60
|
+
selected.add(platform);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (
|
|
64
|
+
recordDigest(build.scheduled) !==
|
|
65
|
+
recordDigest(build.platforms.filter((item) => !selected.has(item.platform)))
|
|
66
|
+
)
|
|
67
|
+
throw new Error(
|
|
68
|
+
"Recovery scheduling differs from the qualified remaining platform set",
|
|
69
|
+
);
|
|
70
|
+
return { plan, build };
|
|
71
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { recordDigest } from "../../release/discussion/envelope.js";
|
|
2
|
+
import { pipelinePlatforms } from "./platforms.js";
|
|
3
|
+
import { qualifyRecoveryRuntime } from "./recovery-runtime.js";
|
|
4
|
+
import { unrecordedRecoveryBuild } from "./recovery-unrecorded-build.js";
|
|
5
|
+
import {
|
|
6
|
+
PIPELINE_BUILD_QUALIFICATION,
|
|
7
|
+
buildReadbackPlatforms,
|
|
8
|
+
verifyPipelineBuildQualification,
|
|
9
|
+
qualifyPipelineBuild,
|
|
10
|
+
} from "./build-qualification.js";
|
|
11
|
+
|
|
12
|
+
async function retainedSegments(session, source, platforms, host) {
|
|
13
|
+
const phase = session.observed.history.at(-1).phases.build;
|
|
14
|
+
const references = (phase?.payload.materials || []).filter(
|
|
15
|
+
(item) =>
|
|
16
|
+
item.id.startsWith("build/provider-") ||
|
|
17
|
+
item.id.startsWith("build/qualified-"),
|
|
18
|
+
);
|
|
19
|
+
if (!references.length && phase?.payload.state !== "success")
|
|
20
|
+
return unrecordedRecoveryBuild(session, source, platforms, host);
|
|
21
|
+
if (references.length !== 1)
|
|
22
|
+
throw new Error(
|
|
23
|
+
"Recovery cannot qualify the unique retained build receipt",
|
|
24
|
+
);
|
|
25
|
+
const value = await host.materialStore(session).read(references[0]);
|
|
26
|
+
if (value.schema === PIPELINE_BUILD_QUALIFICATION) {
|
|
27
|
+
await verifyPipelineBuildQualification(value, source, platforms, host.runs);
|
|
28
|
+
return value.segments;
|
|
29
|
+
}
|
|
30
|
+
const inventory = buildReadbackPlatforms(value);
|
|
31
|
+
if (
|
|
32
|
+
recordDigest(value.source) !== recordDigest(source) ||
|
|
33
|
+
recordDigest([...inventory].sort()) !== recordDigest([...platforms].sort())
|
|
34
|
+
)
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Recovery build receipt changed its original platform inventory",
|
|
37
|
+
);
|
|
38
|
+
const fresh = await host.runs.build(
|
|
39
|
+
value.runId,
|
|
40
|
+
value.runAttempt,
|
|
41
|
+
source,
|
|
42
|
+
inventory,
|
|
43
|
+
);
|
|
44
|
+
if (recordDigest(fresh) !== recordDigest(value))
|
|
45
|
+
throw new Error("Recovery build receipt changed during provider readback");
|
|
46
|
+
const segments = [{ readback: value, platforms, runtime: phase.runtime }];
|
|
47
|
+
qualifyPipelineBuild({
|
|
48
|
+
source,
|
|
49
|
+
platforms,
|
|
50
|
+
segments,
|
|
51
|
+
runId: value.runId,
|
|
52
|
+
runAttempt: value.runAttempt,
|
|
53
|
+
});
|
|
54
|
+
return segments;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Every retained segment is independently observed, even when its old overall
|
|
58
|
+
// workflow failed elsewhere. Only successful jobs with an unchanged execution
|
|
59
|
+
// implementation qualify for reuse. Missing evidence is not invented.
|
|
60
|
+
export async function qualifyRecoveryBuild(session, admission, host) {
|
|
61
|
+
const source = session.observed.history.at(-1).generation.source;
|
|
62
|
+
if (recordDigest(admission.identity) !== recordDigest(source))
|
|
63
|
+
throw new Error("Recovery build admission changed its exact source");
|
|
64
|
+
const platforms = pipelinePlatforms(admission.plan);
|
|
65
|
+
const prior = await retainedSegments(
|
|
66
|
+
session,
|
|
67
|
+
source,
|
|
68
|
+
platforms.map((item) => item.platform),
|
|
69
|
+
host,
|
|
70
|
+
);
|
|
71
|
+
const segments = [],
|
|
72
|
+
runtimes = [],
|
|
73
|
+
selected = new Set();
|
|
74
|
+
for (const segment of prior) {
|
|
75
|
+
const runtime = await qualifyRecoveryRuntime(
|
|
76
|
+
segment.runtime,
|
|
77
|
+
host.runtime,
|
|
78
|
+
"build",
|
|
79
|
+
host.request,
|
|
80
|
+
);
|
|
81
|
+
runtimes.push(runtime);
|
|
82
|
+
const inventory = buildReadbackPlatforms(segment.readback);
|
|
83
|
+
const reusable = segment.platforms.filter((platform) => {
|
|
84
|
+
const job = segment.readback.jobs[inventory.indexOf(platform)];
|
|
85
|
+
return (
|
|
86
|
+
runtime.compatible &&
|
|
87
|
+
job.status === "completed" &&
|
|
88
|
+
job.conclusion === "success"
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
if (reusable.length) {
|
|
92
|
+
for (const platform of reusable) {
|
|
93
|
+
if (
|
|
94
|
+
selected.has(platform) ||
|
|
95
|
+
!platforms.some((item) => item.platform === platform)
|
|
96
|
+
)
|
|
97
|
+
throw new Error(
|
|
98
|
+
"Recovery build has duplicate or undeclared retained platforms",
|
|
99
|
+
);
|
|
100
|
+
selected.add(platform);
|
|
101
|
+
}
|
|
102
|
+
segments.push({ ...segment, platforms: reusable });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const body = {
|
|
106
|
+
schema: "buildchain.pipeline-recovery-build/v1",
|
|
107
|
+
predecessor: session.observed.attempt,
|
|
108
|
+
predecessorHead: session.observed.head,
|
|
109
|
+
source,
|
|
110
|
+
platforms,
|
|
111
|
+
scheduled: platforms.filter((item) => !selected.has(item.platform)),
|
|
112
|
+
segments,
|
|
113
|
+
runtimes,
|
|
114
|
+
reason: !prior.length
|
|
115
|
+
? "No retained product result; execute declared platforms"
|
|
116
|
+
: runtimes.some((item) => !item.compatible)
|
|
117
|
+
? "Changed stage implementation requires affected platform execution"
|
|
118
|
+
: "Reuse independently verified successful platforms; execute only missing results",
|
|
119
|
+
};
|
|
120
|
+
return { ...body, root: recordDigest(body) };
|
|
121
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
recoveryExecution,
|
|
3
|
+
admitRecoverySource,
|
|
4
|
+
recoveryPredecessorRuns,
|
|
5
|
+
} from "./recovery-admission.js";
|
|
6
|
+
import {
|
|
7
|
+
selectRecoveryAttempt,
|
|
8
|
+
openRecoveryAttempt,
|
|
9
|
+
retainedRecoveryPlan,
|
|
10
|
+
} from "./recovery-session.js";
|
|
11
|
+
import { qualifyRecoveryBuild } from "./recovery-build.js";
|
|
12
|
+
import { observeRecoveryOwnership } from "./recovery-ownership.js";
|
|
13
|
+
import {
|
|
14
|
+
terminateRecoveryPredecessor,
|
|
15
|
+
recoveryNodePlan,
|
|
16
|
+
replayRecoveryAdmission,
|
|
17
|
+
} from "./recovery-transition.js";
|
|
18
|
+
import { qualifyRecoveryIntegration } from "./recovery-integration.js";
|
|
19
|
+
import { beginRecoveryBuild } from "./recovery-build-control.js";
|
|
20
|
+
|
|
21
|
+
async function duplicateRecovery(session, host) {
|
|
22
|
+
await retainedRecoveryPlan(session, host);
|
|
23
|
+
// Root CAS can commit before the immutable lookup index acknowledgement.
|
|
24
|
+
await host.index.retain(session.intent, session.observed.attempt);
|
|
25
|
+
await host.project(session);
|
|
26
|
+
return {
|
|
27
|
+
operation: "wait",
|
|
28
|
+
attempt: session.observed.attempt,
|
|
29
|
+
reason: `Recovery already selected this successor (${session.observed.status}); any further recovery must select its exact attempt`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function controlPipelineRecovery(attempt, definitionSha, host) {
|
|
34
|
+
const execution = await recoveryExecution(host, definitionSha);
|
|
35
|
+
let session = await selectRecoveryAttempt(attempt, host, execution.entry);
|
|
36
|
+
if (session.duplicate) return duplicateRecovery(session, host);
|
|
37
|
+
const admitted = await admitRecoverySource(session, execution, host);
|
|
38
|
+
const executions = await recoveryPredecessorRuns(session, host);
|
|
39
|
+
if (!executions.terminal) {
|
|
40
|
+
await host.project(session);
|
|
41
|
+
return {
|
|
42
|
+
operation: "wait",
|
|
43
|
+
attempt,
|
|
44
|
+
reason:
|
|
45
|
+
"Predecessor provider executions are still active; wait for completion or cancel their actual runs before recovery",
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const build = await qualifyRecoveryBuild(session, admitted.source, host);
|
|
49
|
+
// Post-merge recovery must qualify the retained publication transaction before
|
|
50
|
+
// opening a successor. Its adapter preserves signed bytes and completed effects.
|
|
51
|
+
const integration = admitted.admission.live.merged
|
|
52
|
+
? await qualifyRecoveryIntegration(session, admitted.admission, host)
|
|
53
|
+
: null;
|
|
54
|
+
const publication =
|
|
55
|
+
admitted.admission.live.merged &&
|
|
56
|
+
session.intent.expectedNodes.includes("publish")
|
|
57
|
+
? await host.recoverPublication(session, admitted, execution)
|
|
58
|
+
: null;
|
|
59
|
+
const ownership = await observeRecoveryOwnership(session, executions, host);
|
|
60
|
+
session = await terminateRecoveryPredecessor(
|
|
61
|
+
session,
|
|
62
|
+
executions,
|
|
63
|
+
ownership,
|
|
64
|
+
host,
|
|
65
|
+
);
|
|
66
|
+
const evidence = {
|
|
67
|
+
admitted,
|
|
68
|
+
executions,
|
|
69
|
+
ownership,
|
|
70
|
+
build,
|
|
71
|
+
publication,
|
|
72
|
+
integration,
|
|
73
|
+
};
|
|
74
|
+
const plan = recoveryNodePlan(session, evidence, execution.entry, host);
|
|
75
|
+
session = await openRecoveryAttempt(session, plan, host, evidence);
|
|
76
|
+
await replayRecoveryAdmission(session, host);
|
|
77
|
+
const context = await beginRecoveryBuild(session, host);
|
|
78
|
+
await host.project(session);
|
|
79
|
+
if (!context)
|
|
80
|
+
return {
|
|
81
|
+
operation: "wait",
|
|
82
|
+
attempt: session.observed.attempt,
|
|
83
|
+
reason: "Recovery build already has an execution owner",
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
operation: context.platforms.length ? "build" : "qualify-build",
|
|
87
|
+
context,
|
|
88
|
+
attempt: context.attempt,
|
|
89
|
+
reason: build.reason,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { recordDigest } from "../../release/discussion/envelope.js";
|
|
2
|
+
import { settleRecoveryOwnership } from "./recovery-ownership-settlement.js";
|
|
3
|
+
import { retainedRecoveryEvidence } from "./recovery-session.js";
|
|
4
|
+
|
|
5
|
+
export async function qualifyRecoveryIntegration(session, admission, host) {
|
|
6
|
+
const current = {
|
|
7
|
+
...session.observed.history.at(-1),
|
|
8
|
+
intent: session.intent,
|
|
9
|
+
};
|
|
10
|
+
const integration = await host.integration.observe(current);
|
|
11
|
+
const review = await host.policy.observeMerged(
|
|
12
|
+
current,
|
|
13
|
+
admission.protectedPlan.review,
|
|
14
|
+
integration,
|
|
15
|
+
);
|
|
16
|
+
if (!review.review || !review.checksPassing)
|
|
17
|
+
throw new Error(
|
|
18
|
+
"Recovery of protected integration requires current exact review and required checks",
|
|
19
|
+
);
|
|
20
|
+
return { integration, review };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function replayPhase(session, phase, value, host) {
|
|
24
|
+
const observed = await session.journal.read();
|
|
25
|
+
const old = observed.phases[phase];
|
|
26
|
+
if (old?.payload.state === "success") return;
|
|
27
|
+
const root = recordDigest(value);
|
|
28
|
+
const reference = await host
|
|
29
|
+
.materialStore(session)
|
|
30
|
+
.retain(`recovery/${phase}-${root.slice(7)}`, value, "provider-readback");
|
|
31
|
+
await session.progress.progress({
|
|
32
|
+
attempt: observed.attempt,
|
|
33
|
+
phase,
|
|
34
|
+
state: "success",
|
|
35
|
+
eventKey: `recovery-${phase}:${root}`,
|
|
36
|
+
materials: [reference],
|
|
37
|
+
expectedHead: observed.head,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function replayRecoveryIntegration(session, host) {
|
|
42
|
+
session.observed = await session.journal.read();
|
|
43
|
+
const { evidence } = await retainedRecoveryEvidence(session, host);
|
|
44
|
+
if (!evidence.admitted.admission.live.merged) return;
|
|
45
|
+
const qualified = await qualifyRecoveryIntegration(
|
|
46
|
+
session,
|
|
47
|
+
evidence.admitted.admission,
|
|
48
|
+
host,
|
|
49
|
+
);
|
|
50
|
+
await replayPhase(session, "review", qualified.review, host);
|
|
51
|
+
if (session.intent.expectedNodes.includes("warrant")) {
|
|
52
|
+
const ownership = await settleRecoveryOwnership(session, qualified, host);
|
|
53
|
+
await replayPhase(
|
|
54
|
+
session,
|
|
55
|
+
"warrant",
|
|
56
|
+
{
|
|
57
|
+
schema: "buildchain.pipeline-recovery-merged-warrant/v1",
|
|
58
|
+
candidate: ownership.candidate,
|
|
59
|
+
proof: ownership.proof,
|
|
60
|
+
predecessor: evidence.ownership.ownerAttempt,
|
|
61
|
+
},
|
|
62
|
+
host,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
await replayPhase(session, "merge", qualified.integration, host);
|
|
66
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createIntegrationDeliveryProof,
|
|
3
|
+
verifyIntegrationDeliveryProof,
|
|
4
|
+
} from "../../dev-delivery/dev-delivery-warrant.js";
|
|
5
|
+
import { recoveryOwnerSession } from "./recovery-ownership.js";
|
|
6
|
+
|
|
7
|
+
export function verifyRecoveryMergeProof(
|
|
8
|
+
proof,
|
|
9
|
+
candidate,
|
|
10
|
+
integration,
|
|
11
|
+
session,
|
|
12
|
+
) {
|
|
13
|
+
if (
|
|
14
|
+
!verifyIntegrationDeliveryProof(proof, {
|
|
15
|
+
repository: session.intent.repository,
|
|
16
|
+
protectedBase: session.intent.source.targetBranch,
|
|
17
|
+
sourceProofRoot: candidate.sourceProofRoot,
|
|
18
|
+
warrantCandidateId: candidate.candidateId,
|
|
19
|
+
currentBase: integration.mergeCommit,
|
|
20
|
+
replayTree: integration.mergeTree,
|
|
21
|
+
mergeGroupHead: integration.mergeCommit,
|
|
22
|
+
mergeGroupTree: integration.mergeTree,
|
|
23
|
+
}).ok
|
|
24
|
+
)
|
|
25
|
+
throw new Error(
|
|
26
|
+
"Recovery merged Warrant has no exact original integration proof",
|
|
27
|
+
);
|
|
28
|
+
return proof;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function retainedRecoveryMergeProof(
|
|
32
|
+
session,
|
|
33
|
+
candidate,
|
|
34
|
+
integration,
|
|
35
|
+
host,
|
|
36
|
+
) {
|
|
37
|
+
let count = 0;
|
|
38
|
+
for (const owner of [...session.observed.history].reverse()) {
|
|
39
|
+
const store = host.materialStore(recoveryOwnerSession(session, owner));
|
|
40
|
+
for (const reference of owner.events
|
|
41
|
+
.flatMap((event) => event.payload.materials)
|
|
42
|
+
.filter(
|
|
43
|
+
(item) =>
|
|
44
|
+
item.id ===
|
|
45
|
+
`merge/proof-${candidate.terminal.evidenceRoot.slice(7)}` ||
|
|
46
|
+
item.id.startsWith("recovery/ownership-request/"),
|
|
47
|
+
)) {
|
|
48
|
+
if (++count > 100)
|
|
49
|
+
throw new Error(
|
|
50
|
+
"Recovery integration proof inventory exceeds its bound",
|
|
51
|
+
);
|
|
52
|
+
const value = await store.read(reference);
|
|
53
|
+
const proof = reference.id.startsWith("merge/proof-")
|
|
54
|
+
? value
|
|
55
|
+
: value.proof;
|
|
56
|
+
if (proof?.proofRoot === candidate.terminal.evidenceRoot)
|
|
57
|
+
return verifyRecoveryMergeProof(proof, candidate, integration, session);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
throw new Error(
|
|
61
|
+
"Merged predecessor lost its retained pre-effect integration proof",
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function createRecoveryMergeProof(
|
|
66
|
+
session,
|
|
67
|
+
queue,
|
|
68
|
+
candidate,
|
|
69
|
+
integration,
|
|
70
|
+
) {
|
|
71
|
+
if (
|
|
72
|
+
queue.activeWarrant?.candidateId !== candidate.candidateId ||
|
|
73
|
+
queue.activeWarrant.phase !== "qualified"
|
|
74
|
+
)
|
|
75
|
+
throw new Error(
|
|
76
|
+
"Merged recovery requires the original qualified active Warrant",
|
|
77
|
+
);
|
|
78
|
+
return createIntegrationDeliveryProof({
|
|
79
|
+
repository: session.intent.repository,
|
|
80
|
+
protectedBase: session.intent.source.targetBranch,
|
|
81
|
+
sourceProofRoot: candidate.sourceProofRoot,
|
|
82
|
+
warrant: queue.activeWarrant,
|
|
83
|
+
currentBase: integration.mergeCommit,
|
|
84
|
+
replayTree: integration.mergeTree,
|
|
85
|
+
mergeGroupHead: integration.mergeCommit,
|
|
86
|
+
mergeGroupTree: integration.mergeTree,
|
|
87
|
+
requiredContextRoots: [integration.build.root, integration.root],
|
|
88
|
+
verifiedAt: new Date().toISOString(),
|
|
89
|
+
});
|
|
90
|
+
}
|