@kungfu-tech/buildchain 4.0.1-alpha.2 → 4.0.1-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.
Files changed (75) hide show
  1. package/architecture/decisions/0003-two-phase-delivery-warrant.md +152 -0
  2. package/architecture/internal-capabilities.json +94 -0
  3. package/architecture/maintainability-policy.json +75 -8
  4. package/architecture/v3-core-mechanism-inventory.json +2 -0
  5. package/architecture/v4-delivery-authority-parity.json +250 -0
  6. package/architecture/v4-delivery-warrant-shadow-fixtures.json +29 -6
  7. package/bin/buildchain.mjs +9 -1
  8. package/contracts/dev-delivery-authority-v2.schema.json +662 -0
  9. package/dist/site/agent-index.json +1 -0
  10. package/dist/site/artifact-schemas.json +2 -0
  11. package/dist/site/buildchain-contract.json +89 -6
  12. package/dist/site/buildchain-site.json +169 -18
  13. package/dist/site/capability-registry.json +2 -2
  14. package/dist/site/cli-registry.json +46 -2
  15. package/dist/site/kfd-claims.json +43 -9
  16. package/dist/site/kfd-upstream-aggregate.json +1 -1
  17. package/dist/site/manual-registry.json +3 -3
  18. package/dist/site/node-api-registry.json +1694 -165
  19. package/dist/site/page-registry.json +162 -11
  20. package/dist/site/public-surface-audit.json +367 -7
  21. package/dist/site/publication-registry.json +4 -4
  22. package/dist/site/release-provenance.json +2 -0
  23. package/dist/site/schemas/dev-delivery-authority-v2.schema.json +662 -0
  24. package/dist/site/site-manifest.json +7 -7
  25. package/dist/site/workflow-registry.json +22 -6
  26. package/docs/MAP.md +1 -0
  27. package/docs/cli-reference.md +211 -13
  28. package/docs/dev-delivery-qualification-landing-adr.md +251 -0
  29. package/docs/dev-delivery-warrant.md +326 -38
  30. package/docs/node-api-reference.md +113 -53
  31. package/package.json +5 -1
  32. package/packages/core/buildchain-contract.js +3 -2
  33. package/packages/core/dev-delivery-authority-candidate.js +270 -0
  34. package/packages/core/dev-delivery-authority-evidence.js +146 -0
  35. package/packages/core/dev-delivery-authority-landing.js +461 -0
  36. package/packages/core/dev-delivery-authority-observation.js +48 -0
  37. package/packages/core/dev-delivery-authority-qualification.js +591 -0
  38. package/packages/core/dev-delivery-authority-settlement.js +213 -0
  39. package/packages/core/dev-delivery-authority-state.js +583 -0
  40. package/packages/core/dev-delivery-candidate-identity.js +13 -0
  41. package/packages/core/dev-delivery-contract-surface.js +76 -0
  42. package/packages/core/dev-delivery-execution-failure.js +133 -0
  43. package/packages/core/dev-delivery-execution-transfer.js +572 -0
  44. package/packages/core/dev-delivery-landing-admission-core.js +119 -0
  45. package/packages/core/dev-delivery-landing-readback.js +598 -0
  46. package/packages/core/dev-delivery-landing-terminal-evidence.js +271 -0
  47. package/packages/core/dev-delivery-landing-testing-port.js +6 -0
  48. package/packages/core/dev-delivery-native-execution.js +110 -0
  49. package/packages/core/dev-delivery-native-proof.js +546 -0
  50. package/packages/core/dev-delivery-process-boundary.js +551 -0
  51. package/packages/core/dev-delivery-provider-attempt.js +127 -0
  52. package/packages/core/dev-delivery-provider-heartbeat.js +370 -0
  53. package/packages/core/dev-delivery-warrant-cancellation.js +1 -0
  54. package/packages/core/dev-delivery-warrant-qualification.js +145 -0
  55. package/packages/core/dev-delivery-warrant-settlement.js +237 -36
  56. package/packages/core/dev-delivery-warrant-state.js +565 -0
  57. package/packages/core/dev-delivery-warrant.js +320 -368
  58. package/scripts/buildchain-cli-help.mjs +11 -2
  59. package/scripts/dev-delivery-authority-command-adapters.mjs +206 -0
  60. package/scripts/dev-delivery-authority-provider.mjs +28 -0
  61. package/scripts/dev-delivery-authority.mjs +490 -0
  62. package/scripts/dev-delivery-native-run.mjs +177 -0
  63. package/scripts/dev-delivery-process-boundary.mjs +260 -0
  64. package/scripts/dev-delivery-proof.mjs +67 -2
  65. package/scripts/dev-delivery-provider-heartbeat.mjs +215 -0
  66. package/scripts/dev-delivery-two-phase-resume.mjs +345 -0
  67. package/scripts/dev-delivery-two-phase.mjs +573 -0
  68. package/scripts/dev-delivery-warrant-options.mjs +266 -0
  69. package/scripts/dev-delivery-warrant-store.mjs +227 -0
  70. package/scripts/dev-delivery-warrant.mjs +227 -193
  71. package/scripts/dev-pr-delivery-warrant.mjs +10 -0
  72. package/scripts/generate-site-bundle.mjs +26 -4
  73. package/scripts/npm-publish-transaction.mjs +2 -2
  74. package/scripts/site-capability-metadata.mjs +12 -0
  75. package/templates/native-dev-delivery.yml +141 -0
@@ -0,0 +1,266 @@
1
+ export function flag(args, name, fallback = "") {
2
+ const index = args.indexOf(`--${name}`);
3
+ return index === -1 ? fallback : args[index + 1] || "";
4
+ }
5
+
6
+ export function hasFlag(args, name) {
7
+ return args.includes(`--${name}`);
8
+ }
9
+
10
+ export function devDeliveryCliOptions(args = [], environment = process.env) {
11
+ const [command = "", ...rest] = args;
12
+ return {
13
+ command,
14
+ repository: flag(rest, "repository", environment.GITHUB_REPOSITORY),
15
+ branch: flag(
16
+ rest,
17
+ "branch",
18
+ environment.BUILDCHAIN_DEV_DELIVERY_BRANCH || environment.GITHUB_BASE_REF,
19
+ ),
20
+ stateRef: flag(
21
+ rest,
22
+ "state-ref",
23
+ environment.BUILDCHAIN_DEV_DELIVERY_STATE_REF,
24
+ ),
25
+ expectedOldStateRoot: flag(
26
+ rest,
27
+ "expected-old",
28
+ environment.BUILDCHAIN_DEV_DELIVERY_EXPECTED_OLD,
29
+ ),
30
+ pullRequestNumber: flag(
31
+ rest,
32
+ "pull-request",
33
+ environment.BUILDCHAIN_DEV_DELIVERY_PR_NUMBER,
34
+ ),
35
+ candidateId: flag(
36
+ rest,
37
+ "candidate-id",
38
+ environment.BUILDCHAIN_DEV_DELIVERY_CANDIDATE_ID,
39
+ ),
40
+ sourceHead: flag(
41
+ rest,
42
+ "source-head",
43
+ environment.BUILDCHAIN_DEV_DELIVERY_SOURCE_HEAD,
44
+ ),
45
+ expectedSourceHead: flag(
46
+ rest,
47
+ "expected-source-head",
48
+ environment.BUILDCHAIN_DEV_DELIVERY_EXPECTED_SOURCE_HEAD,
49
+ ),
50
+ observedSourceHead: flag(
51
+ rest,
52
+ "observed-source-head",
53
+ environment.BUILDCHAIN_DEV_DELIVERY_OBSERVED_SOURCE_HEAD,
54
+ ),
55
+ assignmentRoot: flag(
56
+ rest,
57
+ "assignment-root",
58
+ environment.BUILDCHAIN_DEV_DELIVERY_ASSIGNMENT_ROOT,
59
+ ),
60
+ initiativeRoot: flag(
61
+ rest,
62
+ "initiative-root",
63
+ environment.BUILDCHAIN_DEV_DELIVERY_INITIATIVE_ROOT,
64
+ ),
65
+ sourceIdentityRoot: flag(
66
+ rest,
67
+ "source-identity-root",
68
+ environment.BUILDCHAIN_DEV_DELIVERY_SOURCE_IDENTITY_ROOT,
69
+ ),
70
+ sourcePatchRoot: flag(
71
+ rest,
72
+ "source-patch-root",
73
+ environment.BUILDCHAIN_DEV_DELIVERY_SOURCE_PATCH_ROOT,
74
+ ),
75
+ sourceProofRoot: flag(
76
+ rest,
77
+ "source-proof-root",
78
+ environment.BUILDCHAIN_DEV_DELIVERY_SOURCE_PROOF_ROOT,
79
+ ),
80
+ sourceWorkflowRunId: flag(
81
+ rest,
82
+ "source-workflow-run-id",
83
+ environment.BUILDCHAIN_DEV_DELIVERY_SOURCE_WORKFLOW_RUN_ID,
84
+ ),
85
+ affectedPaths: flag(
86
+ rest,
87
+ "affected-paths-json",
88
+ environment.BUILDCHAIN_DEV_DELIVERY_AFFECTED_PATHS || "[]",
89
+ ),
90
+ shardEvidenceRoots: flag(
91
+ rest,
92
+ "shard-evidence-roots-json",
93
+ environment.BUILDCHAIN_DEV_DELIVERY_SHARD_EVIDENCE_ROOTS || "[]",
94
+ ),
95
+ nativeCommand: flag(
96
+ rest,
97
+ "native-command",
98
+ environment.BUILDCHAIN_DEV_DELIVERY_NATIVE_COMMAND,
99
+ ),
100
+ nativeCommandRoot: flag(
101
+ rest,
102
+ "native-command-root",
103
+ environment.BUILDCHAIN_DEV_DELIVERY_NATIVE_COMMAND_ROOT,
104
+ ),
105
+ releaseBlockerPriority: flag(
106
+ rest,
107
+ "release-blocker-priority-json",
108
+ environment.BUILDCHAIN_DEV_DELIVERY_RELEASE_BLOCKER_PRIORITY,
109
+ ),
110
+ nativeProofPath: flag(
111
+ rest,
112
+ "native-proof",
113
+ environment.BUILDCHAIN_DEV_DELIVERY_NATIVE_PROOF,
114
+ ),
115
+ nativeReuseDecisionPath: flag(
116
+ rest,
117
+ "native-reuse-decision",
118
+ environment.BUILDCHAIN_DEV_DELIVERY_NATIVE_REUSE_DECISION,
119
+ ),
120
+ currentBase: flag(
121
+ rest,
122
+ "current-base",
123
+ environment.BUILDCHAIN_DEV_DELIVERY_CURRENT_BASE,
124
+ ),
125
+ changedPaths: flag(
126
+ rest,
127
+ "changed-paths-json",
128
+ environment.BUILDCHAIN_DEV_DELIVERY_CHANGED_PATHS || "[]",
129
+ ),
130
+ graphKnown: ["1", "true", "yes", "on"].includes(
131
+ flag(rest, "graph-known", environment.BUILDCHAIN_DEV_DELIVERY_GRAPH_KNOWN)
132
+ .trim()
133
+ .toLowerCase(),
134
+ ),
135
+ attributionComplete: ["1", "true", "yes", "on"].includes(
136
+ flag(
137
+ rest,
138
+ "attribution-complete",
139
+ environment.BUILDCHAIN_DEV_DELIVERY_ATTRIBUTION_COMPLETE,
140
+ )
141
+ .trim()
142
+ .toLowerCase(),
143
+ ),
144
+ renames: flag(
145
+ rest,
146
+ "renames-json",
147
+ environment.BUILDCHAIN_DEV_DELIVERY_RENAMES || "[]",
148
+ ),
149
+ planRoot: flag(
150
+ rest,
151
+ "plan-root",
152
+ environment.BUILDCHAIN_DEV_DELIVERY_PLAN_ROOT,
153
+ ),
154
+ closureRoot: flag(
155
+ rest,
156
+ "closure-root",
157
+ environment.BUILDCHAIN_DEV_DELIVERY_CLOSURE_ROOT,
158
+ ),
159
+ dependencyRoot: flag(
160
+ rest,
161
+ "dependency-root",
162
+ environment.BUILDCHAIN_DEV_DELIVERY_DEPENDENCY_ROOT,
163
+ ),
164
+ toolchainRoot: flag(
165
+ rest,
166
+ "toolchain-root",
167
+ environment.BUILDCHAIN_DEV_DELIVERY_TOOLCHAIN_ROOT,
168
+ ),
169
+ environmentRoot: flag(
170
+ rest,
171
+ "environment-root",
172
+ environment.BUILDCHAIN_DEV_DELIVERY_ENVIRONMENT_ROOT,
173
+ ),
174
+ deliveryClass: flag(
175
+ rest,
176
+ "delivery-class",
177
+ environment.BUILDCHAIN_DEV_DELIVERY_CLASS,
178
+ ),
179
+ priority: flag(
180
+ rest,
181
+ "priority",
182
+ environment.BUILDCHAIN_DEV_DELIVERY_PRIORITY || "ordinary",
183
+ ),
184
+ fencingToken: flag(
185
+ rest,
186
+ "fencing-token",
187
+ environment.BUILDCHAIN_DEV_DELIVERY_FENCING_TOKEN,
188
+ ),
189
+ leaseGeneration: flag(
190
+ rest,
191
+ "lease-generation",
192
+ environment.BUILDCHAIN_DEV_DELIVERY_LEASE_GENERATION,
193
+ ),
194
+ leaseSeconds: flag(
195
+ rest,
196
+ "lease-seconds",
197
+ environment.BUILDCHAIN_DEV_DELIVERY_LEASE_SECONDS,
198
+ ),
199
+ outcome: flag(rest, "outcome", environment.BUILDCHAIN_DEV_DELIVERY_OUTCOME),
200
+ eventAction: flag(
201
+ rest,
202
+ "event-action",
203
+ environment.BUILDCHAIN_DEV_DELIVERY_EVENT_ACTION,
204
+ ),
205
+ evidenceRoot: flag(
206
+ rest,
207
+ "evidence-root",
208
+ environment.BUILDCHAIN_DEV_DELIVERY_EVIDENCE_ROOT,
209
+ ),
210
+ transferRoot: flag(rest, "transfer-root"),
211
+ finalizerBoundaryRoot: flag(rest, "finalizer-boundary-root"),
212
+ nativeJobId: flag(rest, "native-job-id"),
213
+ sealJobId: flag(rest, "seal-job-id"),
214
+ reason: flag(rest, "reason", environment.BUILDCHAIN_DEV_DELIVERY_REASON),
215
+ readMode: flag(
216
+ rest,
217
+ "read-mode",
218
+ environment.BUILDCHAIN_V4_WARRANT_READ_MODE || "v3",
219
+ ),
220
+ readQualificationPath: flag(
221
+ rest,
222
+ "read-qualification",
223
+ environment.BUILDCHAIN_V4_WARRANT_READ_QUALIFICATION,
224
+ ),
225
+ readQualificationRoot: flag(
226
+ rest,
227
+ "read-qualification-root",
228
+ environment.BUILDCHAIN_V4_WARRANT_READ_QUALIFICATION_ROOT,
229
+ ),
230
+ readTypescriptRevision: flag(
231
+ rest,
232
+ "read-typescript-revision",
233
+ environment.BUILDCHAIN_V4_WARRANT_TYPESCRIPT_REVISION,
234
+ ),
235
+ readRustRevision: flag(
236
+ rest,
237
+ "read-rust-revision",
238
+ environment.BUILDCHAIN_V4_WARRANT_RUST_REVISION,
239
+ ),
240
+ readValidatorVersion: flag(
241
+ rest,
242
+ "read-validator-version",
243
+ environment.BUILDCHAIN_V4_WARRANT_VALIDATOR_VERSION,
244
+ ),
245
+ readTimeoutMs: flag(
246
+ rest,
247
+ "read-timeout-ms",
248
+ environment.BUILDCHAIN_V4_WARRANT_READ_TIMEOUT_MS || "5000",
249
+ ),
250
+ readEvidenceOutput: flag(
251
+ rest,
252
+ "read-evidence-output",
253
+ environment.BUILDCHAIN_V4_WARRANT_READ_EVIDENCE ||
254
+ ".buildchain/dev-delivery/v4-read-evidence.json",
255
+ ),
256
+ now: flag(rest, "now", environment.BUILDCHAIN_DEV_DELIVERY_NOW),
257
+ outputPath: flag(
258
+ rest,
259
+ "output",
260
+ environment.BUILDCHAIN_DEV_DELIVERY_OUTPUT ||
261
+ ".buildchain/dev-delivery/result.json",
262
+ ),
263
+ execute: hasFlag(rest, "execute"),
264
+ json: hasFlag(rest, "json"),
265
+ };
266
+ }
@@ -0,0 +1,227 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import {
3
+ createDevDeliveryQueue,
4
+ devDeliveryContentRoot,
5
+ normalizeDevDeliveryQueue,
6
+ } from "../packages/core/dev-delivery-warrant.js";
7
+ import { normalizeDevDeliveryAuthorityState } from "../packages/core/dev-delivery-authority-state.js";
8
+
9
+ const STATE_PATH = "queue.json";
10
+
11
+ function text(value = "") {
12
+ return String(value ?? "").trim();
13
+ }
14
+
15
+ function exactSha(value, label) {
16
+ const normalized = text(value).toLowerCase();
17
+ if (!/^[0-9a-f]{40}$/.test(normalized)) {
18
+ throw new Error(`${label} must be a 40-character Git SHA`);
19
+ }
20
+ return normalized;
21
+ }
22
+
23
+ function normalizeRepository(value) {
24
+ const normalized = text(value);
25
+ const match = normalized.match(/^([^/\s]+)\/([^/\s]+)$/);
26
+ if (!match) {
27
+ throw new Error(
28
+ `repository must be owner/repo, got ${normalized || "<empty>"}`,
29
+ );
30
+ }
31
+ return { owner: match[1], repo: match[2], fullName: normalized };
32
+ }
33
+
34
+ function encodeRef(ref) {
35
+ return ref.split("/").map(encodeURIComponent).join("/");
36
+ }
37
+
38
+ function decodeBlob(blob) {
39
+ if (blob.encoding !== "base64")
40
+ throw new Error(
41
+ `unsupported Git blob encoding ${blob.encoding || "<empty>"}`,
42
+ );
43
+ return Buffer.from(
44
+ String(blob.content || "").replace(/\s+/g, ""),
45
+ "base64",
46
+ ).toString("utf8");
47
+ }
48
+
49
+ function validateStoredState(queue) {
50
+ const body = structuredClone(queue || {});
51
+ const embeddedStateRoot = body.stateRoot;
52
+ delete body.stateRoot;
53
+ if (embeddedStateRoot !== devDeliveryContentRoot(body)) {
54
+ throw new Error("dev delivery persisted stateRoot drift");
55
+ }
56
+ if (
57
+ queue?.contract === "kungfu-buildchain-dev-delivery-authority" &&
58
+ Number(queue?.schemaVersion) === 2
59
+ ) {
60
+ normalizeDevDeliveryAuthorityState(queue);
61
+ } else {
62
+ normalizeDevDeliveryQueue(queue);
63
+ }
64
+ return queue;
65
+ }
66
+
67
+ export class GitHubDevDeliveryStore {
68
+ constructor({
69
+ repository,
70
+ token,
71
+ apiUrl = "https://api.github.com",
72
+ fetchImpl = globalThis.fetch,
73
+ createInitialState = createDevDeliveryQueue,
74
+ } = {}) {
75
+ this.repository = normalizeRepository(repository);
76
+ if (!fetchImpl) throw new Error("fetch is required");
77
+ if (!token)
78
+ throw new Error(
79
+ "GITHUB_TOKEN is required for the GitHub dev delivery store",
80
+ );
81
+ this.token = token;
82
+ this.apiUrl = apiUrl.replace(/\/+$/, "");
83
+ this.fetch = fetchImpl;
84
+ this.createInitialState = createInitialState;
85
+ }
86
+
87
+ async request(method, requestPath, body) {
88
+ const response = await this.fetch(`${this.apiUrl}${requestPath}`, {
89
+ method,
90
+ headers: {
91
+ accept: "application/vnd.github+json",
92
+ authorization: `Bearer ${this.token}`,
93
+ "content-type": "application/json",
94
+ "x-github-api-version": "2022-11-28",
95
+ },
96
+ body: body === undefined ? undefined : JSON.stringify(body),
97
+ });
98
+ const raw = await response.text();
99
+ const data = raw ? JSON.parse(raw) : null;
100
+ if (!response.ok) {
101
+ const error = new Error(
102
+ data?.message || raw || `${method} ${requestPath} failed`,
103
+ );
104
+ error.status = response.status;
105
+ error.data = data;
106
+ throw error;
107
+ }
108
+ return data;
109
+ }
110
+
111
+ async read({ stateRef, protectedBase, now }) {
112
+ let ref;
113
+ try {
114
+ ref = await this.request(
115
+ "GET",
116
+ `/repos/${this.repository.fullName}/git/ref/heads/${encodeRef(stateRef)}`,
117
+ );
118
+ } catch (error) {
119
+ if (error.status !== 404) throw error;
120
+ return {
121
+ exists: false,
122
+ commitSha: "",
123
+ queue: this.createInitialState({
124
+ repository: this.repository.fullName,
125
+ protectedBase,
126
+ now,
127
+ }),
128
+ };
129
+ }
130
+ const commitSha = exactSha(ref?.object?.sha, "state ref commit");
131
+ const readback = await this.readCommit(commitSha);
132
+ return { exists: true, ...readback };
133
+ }
134
+
135
+ async readCommit(commitShaInput) {
136
+ const commitSha = exactSha(commitShaInput, "state commit");
137
+ const commit = await this.request(
138
+ "GET",
139
+ `/repos/${this.repository.fullName}/git/commits/${commitSha}`,
140
+ );
141
+ const tree = await this.request(
142
+ "GET",
143
+ `/repos/${this.repository.fullName}/git/trees/${commit.tree?.sha}`,
144
+ );
145
+ const entry = (tree.tree || []).find(
146
+ (item) => item.path === STATE_PATH && item.type === "blob",
147
+ );
148
+ if (!entry?.sha)
149
+ throw new Error(`${commitSha} does not contain ${STATE_PATH}`);
150
+ const blob = await this.request(
151
+ "GET",
152
+ `/repos/${this.repository.fullName}/git/blobs/${entry.sha}`,
153
+ );
154
+ const bytes = decodeBlob(blob);
155
+ const queue = validateStoredState(JSON.parse(bytes));
156
+ return { commitSha, queue, bytes };
157
+ }
158
+
159
+ async write({
160
+ stateRef,
161
+ queue,
162
+ expectedCommitSha,
163
+ expectedStateRoot,
164
+ receiptRoot,
165
+ }) {
166
+ if (queue.stateRoot === expectedStateRoot)
167
+ throw new Error("state transition did not advance the queue root");
168
+ const parent = expectedCommitSha
169
+ ? exactSha(expectedCommitSha, "expected state commit")
170
+ : "";
171
+ validateStoredState(queue);
172
+ const expectedBytes = `${JSON.stringify(queue, null, 2)}\n`;
173
+ const blob = await this.request(
174
+ "POST",
175
+ `/repos/${this.repository.fullName}/git/blobs`,
176
+ {
177
+ content: expectedBytes,
178
+ encoding: "utf-8",
179
+ },
180
+ );
181
+ const tree = await this.request(
182
+ "POST",
183
+ `/repos/${this.repository.fullName}/git/trees`,
184
+ {
185
+ tree: [
186
+ { path: STATE_PATH, mode: "100644", type: "blob", sha: blob.sha },
187
+ ],
188
+ },
189
+ );
190
+ const commit = await this.request(
191
+ "POST",
192
+ `/repos/${this.repository.fullName}/git/commits`,
193
+ {
194
+ message: `chore(dev-delivery): advance Warrant queue ${receiptRoot.slice(0, 20)}`,
195
+ tree: tree.sha,
196
+ parents: parent ? [parent] : [],
197
+ },
198
+ );
199
+ if (expectedCommitSha) {
200
+ await this.request(
201
+ "PATCH",
202
+ `/repos/${this.repository.fullName}/git/refs/heads/${encodeRef(stateRef)}`,
203
+ { sha: commit.sha, force: false },
204
+ );
205
+ } else {
206
+ await this.request(
207
+ "POST",
208
+ `/repos/${this.repository.fullName}/git/refs`,
209
+ {
210
+ ref: `refs/heads/${stateRef}`,
211
+ sha: commit.sha,
212
+ },
213
+ );
214
+ }
215
+ const readback = await this.readCommit(commit.sha);
216
+ if (
217
+ readback.commitSha !== commit.sha ||
218
+ readback.bytes !== expectedBytes ||
219
+ !isDeepStrictEqual(readback.queue, queue)
220
+ ) {
221
+ throw new Error(
222
+ "dev delivery state commit readback mismatch after expected-old update",
223
+ );
224
+ }
225
+ return { commitSha: commit.sha, stateRoot: readback.queue.stateRoot };
226
+ }
227
+ }