@kungfu-tech/buildchain 4.0.1 → 4.0.2-alpha.2

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 (50) hide show
  1. package/architecture/agent-change-map.md +7 -5
  2. package/architecture/ci-lane-change-budget.json +76 -8
  3. package/architecture/internal-capabilities.json +4 -1
  4. package/architecture/maintainability-debt.json +45 -119
  5. package/architecture/maintainability-policy.json +13 -8
  6. package/architecture/release-tail-contract-inventory.json +4 -4
  7. package/architecture/v3-core-mechanism-inventory.json +2 -0
  8. package/architecture/v3-v4-live-capability-inventory.json +17 -17
  9. package/architecture/v4-release-invocation-fixtures.json +119 -0
  10. package/architecture/v4-release-topology.json +238 -0
  11. package/contracts/buildchain-v2-residuals-v1.json +0 -9
  12. package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
  13. package/contracts/v4-release-invocation-v1.schema.json +86 -0
  14. package/dist/site/buildchain-contract.json +9 -9
  15. package/dist/site/buildchain-site.json +9 -9
  16. package/dist/site/kfd-claims.json +9 -7
  17. package/dist/site/kfd-upstream-aggregate.json +1 -1
  18. package/dist/site/manual-registry.json +1 -1
  19. package/dist/site/node-api-registry.json +3 -3
  20. package/dist/site/page-registry.json +4 -4
  21. package/dist/site/public-surface-audit.json +23 -10
  22. package/dist/site/publication-authority-registry.json +2 -3
  23. package/dist/site/publication-registry.json +4 -4
  24. package/dist/site/site-manifest.json +5 -5
  25. package/dist/site/workflow-registry.json +19 -11
  26. package/docs/dev-delivery-warrant.md +21 -0
  27. package/docs/node-api-reference.md +3 -3
  28. package/package.json +2 -2
  29. package/packages/core/dev-delivery-candidate-identity.js +45 -17
  30. package/packages/core/dev-delivery-provider-heartbeat.js +22 -6
  31. package/packages/core/dev-delivery-warrant-legacy-recovery.js +246 -0
  32. package/packages/core/dev-delivery-warrant-state.js +12 -28
  33. package/packages/core/v4-canonical-contracts.js +8 -0
  34. package/packages/core/v4-floating-consumer-policy.js +4 -1
  35. package/packages/core/v4-release-invocation.js +356 -0
  36. package/scripts/audit-publication-control-plane.mjs +0 -1
  37. package/scripts/check-inventory.mjs +27 -59
  38. package/scripts/check-maintainability.mjs +13 -5
  39. package/scripts/check-v3-v4-capability-inventory.mjs +3 -61
  40. package/scripts/check-v4-floating-consumer-policy-contract.mjs +10 -20
  41. package/scripts/check-v4-release-topology.mjs +237 -0
  42. package/scripts/dev-delivery-warrant-options.mjs +15 -4
  43. package/scripts/dev-delivery-warrant.mjs +29 -7
  44. package/scripts/generate-channel-promotion-workflow.mjs +12 -54
  45. package/scripts/v3-v4-capability-catalog.mjs +107 -0
  46. package/scripts/v4-declarative-promotion-admission.mjs +4 -1
  47. package/scripts/capture-package-release-propagation.mjs +0 -263
  48. package/scripts/publication-commit-evidence.mjs +0 -444
  49. package/scripts/publish-github-artifact-attestation-evidence.mjs +0 -201
  50. package/scripts/stage-github-artifact-attestation-inputs.mjs +0 -65
@@ -7,7 +7,7 @@
7
7
  "workflowCount": 77,
8
8
  "actionCount": 8,
9
9
  "sitePageCount": 84,
10
- "docCommandRefCount": 1049,
10
+ "docCommandRefCount": 1050,
11
11
  "failureCount": 0
12
12
  },
13
13
  "enumerated": {
@@ -934,7 +934,6 @@
934
934
  "reusable": true,
935
935
  "inputs": [
936
936
  "admission-json",
937
- "authority-job-id",
938
937
  "authority-workflow-path",
939
938
  "auto-admission",
940
939
  "auto-admission-kind",
@@ -972,7 +971,7 @@
972
971
  "target-ref",
973
972
  "used-nonces-json"
974
973
  ],
975
- "inputCount": 38,
974
+ "inputCount": 37,
976
975
  "secrets": [
977
976
  "BUILDCHAIN_GOVERNANCE_READ_TOKEN",
978
977
  "KUNGFU_GOVERNANCE_AUDITOR_APP_PRIVATE_KEY"
@@ -1151,14 +1150,17 @@
1151
1150
  "release-candidate-artifact",
1152
1151
  "release-candidate-recovery-receipt-artifact",
1153
1152
  "release-candidate-recovery-root",
1153
+ "release-invocation-root",
1154
1154
  "release-propagation-work-artifact",
1155
+ "release-receipt-root",
1155
1156
  "release-tail-declaration-root",
1156
1157
  "release-tail-receipt-roots-json",
1157
1158
  "release-tail-state-root",
1158
1159
  "release-tail-transaction-root",
1159
- "release-tail-transaction-state"
1160
+ "release-tail-transaction-state",
1161
+ "release-transaction-root"
1160
1162
  ],
1161
- "outputCount": 28
1163
+ "outputCount": 31
1162
1164
  },
1163
1165
  {
1164
1166
  "id": ".release-docker",
@@ -2731,14 +2733,17 @@
2731
2733
  "release-candidate-artifact",
2732
2734
  "release-candidate-recovery-receipt-artifact",
2733
2735
  "release-candidate-recovery-root",
2736
+ "release-invocation-root",
2734
2737
  "release-propagation-work-artifact",
2738
+ "release-receipt-root",
2735
2739
  "release-tail-declaration-root",
2736
2740
  "release-tail-receipt-roots-json",
2737
2741
  "release-tail-state-root",
2738
2742
  "release-tail-transaction-root",
2739
- "release-tail-transaction-state"
2743
+ "release-tail-transaction-state",
2744
+ "release-transaction-root"
2740
2745
  ],
2741
- "outputCount": 40
2746
+ "outputCount": 43
2742
2747
  },
2743
2748
  {
2744
2749
  "id": "release-governance-reconcile",
@@ -3302,12 +3307,15 @@
3302
3307
  "candidate-passport-path",
3303
3308
  "failure-after-capability",
3304
3309
  "publication-qualification-path",
3310
+ "publisher-workflow-sha",
3305
3311
  "repository",
3312
+ "runtime-commit",
3313
+ "runtime-tree",
3306
3314
  "stage-capsules-path",
3307
3315
  "state-path",
3308
3316
  "token"
3309
3317
  ],
3310
- "inputCount": 8
3318
+ "inputCount": 11
3311
3319
  },
3312
3320
  {
3313
3321
  "id": "validate-config",
@@ -4999,6 +5007,11 @@
4999
5007
  "path": "docs/dev-delivery-warrant.md",
5000
5008
  "command": "buildchain dev warrant cancel-queued"
5001
5009
  },
5010
+ {
5011
+ "id": "dev",
5012
+ "path": "docs/dev-delivery-warrant.md",
5013
+ "command": "buildchain dev warrant recover-legacy-terminal"
5014
+ },
5002
5015
  {
5003
5016
  "id": "dev",
5004
5017
  "path": "docs/dev-delivery-warrant.md",
@@ -8911,8 +8924,8 @@
8911
8924
  "workflowRegistryPath": "dist/site/workflow-registry.json",
8912
8925
  "pageRegistryPath": "dist/site/page-registry.json",
8913
8926
  "cliRegistryDigest": "fbc23073bbae240489a2f826b2c26daadc58e704050c5f8df366509f5c5a1c3e",
8914
- "workflowRegistryDigest": "90bcf16d6aef5528c10a7e78f21a89ab265ae2d4f8aedc15da9f6c4c2f0b3083",
8915
- "pageRegistryDigest": "82bd43842f419ff14cb2d1931a194647cf427fe3b18b6388efd5b50552c13351"
8927
+ "workflowRegistryDigest": "bb86cef4c0a6658ff1bf05aa33cd5ff5f119f8b3c3cee90e5aa2d911247b38e4",
8928
+ "pageRegistryDigest": "3a4b72100125de7e2fb37f2af4f66f131f22f5831db4203f8178e4295c89a1eb"
8916
8929
  },
8917
8930
  "comparison": {
8918
8931
  "missingCliRegistry": [],
@@ -803,8 +803,7 @@
803
803
  "path": ".github/workflows/.release-candidate-promote.yml",
804
804
  "signals": [
805
805
  "write-permission",
806
- "oidc",
807
- "environment"
806
+ "oidc"
808
807
  ],
809
808
  "classified": true
810
809
  },
@@ -1260,5 +1259,5 @@
1260
1259
  "classified": false
1261
1260
  }
1262
1261
  ],
1263
- "registryDigest": "4f60d125496eb73e47dc21ceafa340e5cd7c5fd840eabfa17044dbacedd97f5a"
1262
+ "registryDigest": "123c20ea9806ce8ba7b82545165b30ce08537eee64795c2de11f0cc3546a0844"
1264
1263
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-publication-release-registry",
4
- "generatedAt": "2026-08-28T20:22:42.731Z",
5
- "publishedAt": "2026-08-28T20:22:42.731Z",
4
+ "generatedAt": "2026-08-29T09:02:41.579Z",
5
+ "publishedAt": "2026-08-29T09:02:41.579Z",
6
6
  "reproducible": true,
7
7
  "timestampPolicy": "ci-injected",
8
8
  "deterministicInputs": [
@@ -19,7 +19,7 @@
19
19
  "declared Buildchain surface manifest contract"
20
20
  ],
21
21
  "sourceDateEpoch": "0",
22
- "sourceRevision": "9df599a42bebd6595ed92a598a569c40651d8c12",
22
+ "sourceRevision": "037d638ce54635606528d8fe3bb466983a5262dd",
23
23
  "timestampPolicyDetails": {
24
24
  "contract": "kungfu-buildchain-surface-timestamp-policy",
25
25
  "timestampFields": [
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "package": {
34
34
  "name": "@kungfu-tech/buildchain",
35
- "version": "4.0.1",
35
+ "version": "4.0.2-alpha.2",
36
36
  "versionSource": "package.json#version"
37
37
  },
38
38
  "sourceKind": "package-site-bundle",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-site-manifest",
4
- "generatedAt": "2026-08-28T20:22:42.731Z",
5
- "publishedAt": "2026-08-28T20:22:42.731Z",
4
+ "generatedAt": "2026-08-29T09:02:41.579Z",
5
+ "publishedAt": "2026-08-29T09:02:41.579Z",
6
6
  "reproducible": true,
7
7
  "timestampPolicy": "ci-injected",
8
8
  "deterministicInputs": [
@@ -19,7 +19,7 @@
19
19
  "declared Buildchain surface manifest contract"
20
20
  ],
21
21
  "sourceDateEpoch": "0",
22
- "sourceRevision": "9df599a42bebd6595ed92a598a569c40651d8c12",
22
+ "sourceRevision": "037d638ce54635606528d8fe3bb466983a5262dd",
23
23
  "timestampPolicyDetails": {
24
24
  "contract": "kungfu-buildchain-surface-timestamp-policy",
25
25
  "timestampFields": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "package": {
39
39
  "name": "@kungfu-tech/buildchain",
40
- "version": "4.0.1",
40
+ "version": "4.0.2-alpha.2",
41
41
  "versionSource": "package.json#version"
42
42
  },
43
43
  "entrypoint": "buildchain-site.json",
@@ -253,7 +253,7 @@
253
253
  "path": "docs/node-api-reference.md",
254
254
  "plane": "use",
255
255
  "exists": true,
256
- "digest": "sha256:e9683e04409d60ee1a4e60f89766c158586cf1eb91fc890f0b2660814f05dbdb"
256
+ "digest": "sha256:cf61043790140da9953b53522dec4f2c408ffae87ba69168f6625bf17f7063e1"
257
257
  },
258
258
  {
259
259
  "id": "build-facts",
@@ -398,7 +398,6 @@
398
398
  "reusable": true,
399
399
  "inputs": [
400
400
  "admission-json",
401
- "authority-job-id",
402
401
  "authority-workflow-path",
403
402
  "auto-admission",
404
403
  "auto-admission-kind",
@@ -436,7 +435,7 @@
436
435
  "target-ref",
437
436
  "used-nonces-json"
438
437
  ],
439
- "inputCount": 38,
438
+ "inputCount": 37,
440
439
  "secrets": [
441
440
  "BUILDCHAIN_GOVERNANCE_READ_TOKEN",
442
441
  "KUNGFU_GOVERNANCE_AUDITOR_APP_PRIVATE_KEY"
@@ -625,14 +624,17 @@
625
624
  "release-candidate-artifact",
626
625
  "release-candidate-recovery-receipt-artifact",
627
626
  "release-candidate-recovery-root",
627
+ "release-invocation-root",
628
628
  "release-propagation-work-artifact",
629
+ "release-receipt-root",
629
630
  "release-tail-declaration-root",
630
631
  "release-tail-receipt-roots-json",
631
632
  "release-tail-state-root",
632
633
  "release-tail-transaction-root",
633
- "release-tail-transaction-state"
634
+ "release-tail-transaction-state",
635
+ "release-transaction-root"
634
636
  ],
635
- "outputCount": 28,
637
+ "outputCount": 31,
636
638
  "surface": "reusable-workflow",
637
639
  "capabilityGroup": "api-cli-reference",
638
640
  "status": "active",
@@ -2039,7 +2041,7 @@
2039
2041
  "status": "preview",
2040
2042
  "owner": "buildchain-workflows",
2041
2043
  "maturity": "preview",
2042
- "introducedVersion": "4.0.1",
2044
+ "introducedVersion": "4.0.2-alpha.2",
2043
2045
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2044
2046
  "deprecationReplacement": "",
2045
2047
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2060,7 +2062,7 @@
2060
2062
  "status": "preview",
2061
2063
  "owner": "buildchain-workflows",
2062
2064
  "maturity": "preview",
2063
- "introducedVersion": "4.0.1",
2065
+ "introducedVersion": "4.0.2-alpha.2",
2064
2066
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2065
2067
  "deprecationReplacement": "",
2066
2068
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2081,7 +2083,7 @@
2081
2083
  "status": "preview",
2082
2084
  "owner": "buildchain-workflows",
2083
2085
  "maturity": "preview",
2084
- "introducedVersion": "4.0.1",
2086
+ "introducedVersion": "4.0.2-alpha.2",
2085
2087
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2086
2088
  "deprecationReplacement": "",
2087
2089
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2131,7 +2133,7 @@
2131
2133
  "status": "preview",
2132
2134
  "owner": "buildchain-workflows",
2133
2135
  "maturity": "preview",
2134
- "introducedVersion": "4.0.1",
2136
+ "introducedVersion": "4.0.2-alpha.2",
2135
2137
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2136
2138
  "deprecationReplacement": "",
2137
2139
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2725,14 +2727,17 @@
2725
2727
  "release-candidate-artifact",
2726
2728
  "release-candidate-recovery-receipt-artifact",
2727
2729
  "release-candidate-recovery-root",
2730
+ "release-invocation-root",
2728
2731
  "release-propagation-work-artifact",
2732
+ "release-receipt-root",
2729
2733
  "release-tail-declaration-root",
2730
2734
  "release-tail-receipt-roots-json",
2731
2735
  "release-tail-state-root",
2732
2736
  "release-tail-transaction-root",
2733
- "release-tail-transaction-state"
2737
+ "release-tail-transaction-state",
2738
+ "release-transaction-root"
2734
2739
  ],
2735
- "outputCount": 40,
2740
+ "outputCount": 43,
2736
2741
  "surface": "release-governance",
2737
2742
  "capabilityGroup": "reusable-build",
2738
2743
  "status": "active",
@@ -3531,12 +3536,15 @@
3531
3536
  "candidate-passport-path",
3532
3537
  "failure-after-capability",
3533
3538
  "publication-qualification-path",
3539
+ "publisher-workflow-sha",
3534
3540
  "repository",
3541
+ "runtime-commit",
3542
+ "runtime-tree",
3535
3543
  "stage-capsules-path",
3536
3544
  "state-path",
3537
3545
  "token"
3538
3546
  ],
3539
- "inputCount": 8,
3547
+ "inputCount": 11,
3540
3548
  "capabilityGroup": "api-cli-reference",
3541
3549
  "status": "active",
3542
3550
  "owner": "buildchain-actions",
@@ -203,6 +203,27 @@ buildchain dev warrant cancel-queued --repository owner/repository \
203
203
  Warrant-scoped mutations require the exact fencing token and lease generation.
204
204
  `close` also requires a rooted terminal evidence object.
205
205
 
206
+ Legacy v3 queues that predate the native command contract can be observed but
207
+ cannot enter ordinary mutation paths. If every live legacy candidate has an
208
+ exact completed failed hosted run with zero nonterminal jobs, an operator may
209
+ atomically terminalize that complete live set:
210
+
211
+ ```sh
212
+ buildchain dev warrant recover-legacy-terminal \
213
+ --repository owner/repository --branch dev/v4/v4.0 \
214
+ --expected-old sha256:<current-state-root> \
215
+ --legacy-terminal-recovery legacy-terminal-recovery.json --execute
216
+ ```
217
+
218
+ The request must cover every live legacy native candidate exactly once and
219
+ bind each stored candidate, source workflow run, terminal provider result, and
220
+ content-addressed evidence object. Each evidence object carries the exact
221
+ provider job identities, attempts, conclusions, and completion timestamps; all
222
+ jobs must be terminal and at least one must have failed. The transition writes
223
+ one expected-old state update and requires the resulting queue to pass the
224
+ current strict native-proof contract. The recovery cannot qualify, merge,
225
+ requeue, or partially advance a legacy authority state.
226
+
206
227
  On the v4 line, `observe` also has an explicit `--read-mode v4` candidate. It requires retained exact semantic-diff qualification and source binding, invokes the effect-disabled Rust projection, retains parity evidence, and returns the existing observation shape. The default and rollback mode remains `v3`; mutation commands ignore the read switch. See [`v4-delivery-warrant-read-candidate.md`](v4-delivery-warrant-read-candidate.md).
207
228
 
208
229
  Expensive native commands must run through `dev-delivery-native-run.mjs` (or an
@@ -557,7 +557,7 @@ Target: `./packages/core/index.js`. Public symbols: 636.
557
557
  | `runLifecycleStage` | function: function runLifecycleStage({ cwd = process.cwd(), loadedConfig, name, stage, env: extraEnv, timeoutMinutes }) | { cwd = process.cwd(), loadedConfig, name, stage, env: extraEnv, timeoutMinutes } | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | may-write-or-invoke-external-actions | `import { runLifecycleStage } from "@kungfu-tech/buildchain";` | `packages/core/buildchain-config.js:1524` |
558
558
  | `RUNNER_PROVENANCE_CLASSES` | constant: const RUNNER_PROVENANCE_CLASSES | none | value | Import does not declare a throw contract. | none-on-import | `import { RUNNER_PROVENANCE_CLASSES } from "@kungfu-tech/buildchain";` | `packages/core/publication-authority.js:36` |
559
559
  | `RUNNER_PROVENANCE_CONTRACT` | constant: const RUNNER_PROVENANCE_CONTRACT | none | value | Import does not declare a throw contract. | none-on-import | `import { RUNNER_PROVENANCE_CONTRACT } from "@kungfu-tech/buildchain";` | `packages/core/publication-authority.js:14` |
560
- | `scanV4FloatingConsumerPolicy` | function: function scanV4FloatingConsumerPolicy({ root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {}) | { root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { scanV4FloatingConsumerPolicy } from "@kungfu-tech/buildchain";` | `packages/core/v4-floating-consumer-policy.js:429` |
560
+ | `scanV4FloatingConsumerPolicy` | function: function scanV4FloatingConsumerPolicy({ root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {}) | { root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { scanV4FloatingConsumerPolicy } from "@kungfu-tech/buildchain";` | `packages/core/v4-floating-consumer-policy.js:432` |
561
561
  | `scanV4RuntimeSelectorPersistence` | value: scanV4RuntimeSelectorPersistence | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { scanV4RuntimeSelectorPersistence } from "@kungfu-tech/buildchain";` | `packages/core/v4-runtime-ref-resume-authority.js:1` |
562
562
  | `schemas` | constant: const schemas | none | value | Import does not declare a throw contract. | none-on-import | `import { schemas } from "@kungfu-tech/buildchain";` | `packages/core/kfd.js:495` |
563
563
  | `sealArtifactVerificationReport` | function: function sealArtifactVerificationReport({ report, bindings, kfdAssessment, issuedAt, expiresAt, revocation, } = {}) | { report, bindings, kfdAssessment, issuedAt, expiresAt, revocation, } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { sealArtifactVerificationReport } from "@kungfu-tech/buildchain";` | `packages/core/artifact-verification-envelope.js:323` |
@@ -1246,7 +1246,7 @@ Target: `./packages/core/index.js`. Public symbols: 636.
1246
1246
  | `runLifecycleStage` | function: function runLifecycleStage({ cwd = process.cwd(), loadedConfig, name, stage, env: extraEnv, timeoutMinutes }) | { cwd = process.cwd(), loadedConfig, name, stage, env: extraEnv, timeoutMinutes } | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | may-write-or-invoke-external-actions | `import { runLifecycleStage } from "@kungfu-tech/buildchain/core";` | `packages/core/buildchain-config.js:1524` |
1247
1247
  | `RUNNER_PROVENANCE_CLASSES` | constant: const RUNNER_PROVENANCE_CLASSES | none | value | Import does not declare a throw contract. | none-on-import | `import { RUNNER_PROVENANCE_CLASSES } from "@kungfu-tech/buildchain/core";` | `packages/core/publication-authority.js:36` |
1248
1248
  | `RUNNER_PROVENANCE_CONTRACT` | constant: const RUNNER_PROVENANCE_CONTRACT | none | value | Import does not declare a throw contract. | none-on-import | `import { RUNNER_PROVENANCE_CONTRACT } from "@kungfu-tech/buildchain/core";` | `packages/core/publication-authority.js:14` |
1249
- | `scanV4FloatingConsumerPolicy` | function: function scanV4FloatingConsumerPolicy({ root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {}) | { root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { scanV4FloatingConsumerPolicy } from "@kungfu-tech/buildchain/core";` | `packages/core/v4-floating-consumer-policy.js:429` |
1249
+ | `scanV4FloatingConsumerPolicy` | function: function scanV4FloatingConsumerPolicy({ root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {}) | { root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { scanV4FloatingConsumerPolicy } from "@kungfu-tech/buildchain/core";` | `packages/core/v4-floating-consumer-policy.js:432` |
1250
1250
  | `scanV4RuntimeSelectorPersistence` | value: scanV4RuntimeSelectorPersistence | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { scanV4RuntimeSelectorPersistence } from "@kungfu-tech/buildchain/core";` | `packages/core/v4-runtime-ref-resume-authority.js:1` |
1251
1251
  | `schemas` | constant: const schemas | none | value | Import does not declare a throw contract. | none-on-import | `import { schemas } from "@kungfu-tech/buildchain/core";` | `packages/core/kfd.js:495` |
1252
1252
  | `sealArtifactVerificationReport` | function: function sealArtifactVerificationReport({ report, bindings, kfdAssessment, issuedAt, expiresAt, revocation, } = {}) | { report, bindings, kfdAssessment, issuedAt, expiresAt, revocation, } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { sealArtifactVerificationReport } from "@kungfu-tech/buildchain/core";` | `packages/core/artifact-verification-envelope.js:323` |
@@ -1979,7 +1979,7 @@ Target: `./packages/core/v4-floating-consumer-policy.js`. Public symbols: 10.
1979
1979
  | --- | --- | --- | --- | --- | --- | --- | --- |
1980
1980
  | `certifyV4FloatingConsumerPolicyReceipt` | function: function certifyV4FloatingConsumerPolicyReceipt(options = {}) | options = {} | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { certifyV4FloatingConsumerPolicyReceipt } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-evidence.js:202` |
1981
1981
  | `resolveV4FloatingConsumerPolicyAuthority` | function: function resolveV4FloatingConsumerPolicyAuthority({ runtimeRoot = defaultRuntimeRoot(), callerRoot = process.cwd(), stableLockPath = DEFAULT_STABLE_LOCK_PATH, alphaLockPath = DEFAULT_ALPHA_LOCK_PATH, } = {}) | { runtimeRoot = defaultRuntimeRoot(), callerRoot = process.cwd(), stableLockPath = DEFAULT_STABLE_LOCK_PATH, alphaLockPath = DEFAULT_ALPHA_LOCK_PATH, } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { resolveV4FloatingConsumerPolicyAuthority } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-policy.js:89` |
1982
- | `scanV4FloatingConsumerPolicy` | function: function scanV4FloatingConsumerPolicy({ root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {}) | { root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { scanV4FloatingConsumerPolicy } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-policy.js:429` |
1982
+ | `scanV4FloatingConsumerPolicy` | function: function scanV4FloatingConsumerPolicy({ root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {}) | { root = process.cwd(), invocationRoot = root, repository = "", sourceSha = "", invokedWorkflow = "", invocationSourcePath = "", expectedInvocationChannel = "", resolvedWorkflowSha = "", resolvedRuntimeSha = "", stableLockPath = ".buildchain/contract-lock.json", alphaLockPath = ".buildchain/alpha-contract-lock.json", policy, scannerRoot = "", } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { scanV4FloatingConsumerPolicy } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-policy.js:432` |
1983
1983
  | `V4_FLOATING_CONSUMER_CERTIFICATION` | constant: const V4_FLOATING_CONSUMER_CERTIFICATION | none | value | Import does not declare a throw contract. | none-on-import | `import { V4_FLOATING_CONSUMER_CERTIFICATION } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-evidence.js:7` |
1984
1984
  | `V4_FLOATING_CONSUMER_POLICY` | constant: const V4_FLOATING_CONSUMER_POLICY | none | value | Import does not declare a throw contract. | none-on-import | `import { V4_FLOATING_CONSUMER_POLICY } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-evidence.js:3` |
1985
1985
  | `V4_FLOATING_CONSUMER_RECEIPT` | constant: const V4_FLOATING_CONSUMER_RECEIPT | none | value | Import does not declare a throw contract. | none-on-import | `import { V4_FLOATING_CONSUMER_RECEIPT } from "@kungfu-tech/buildchain/v4-floating-consumer-policy";` | `packages/core/v4-floating-consumer-evidence.js:5` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungfu-tech/buildchain",
3
- "version": "4.0.1",
3
+ "version": "4.0.2-alpha.2",
4
4
  "private": false,
5
5
  "description": "Buildchain Release Passport, release governance, CLI toolkit, and site facts.",
6
6
  "repository": "https://github.com/kungfu-systems/buildchain",
@@ -156,7 +156,7 @@
156
156
  "scripts": {
157
157
  "precheck:static": "prettier --check architecture/decisions/0003-two-phase-delivery-warrant.md architecture/v4-delivery-authority-parity.json contracts/dev-delivery-authority-v2.schema.json dist/site/schemas/dev-delivery-authority-v2.schema.json docs/dev-delivery-qualification-landing-adr.md packages/core/dev-delivery-authority-candidate.js packages/core/dev-delivery-authority-evidence.js packages/core/dev-delivery-authority-landing.js packages/core/dev-delivery-authority-observation.js packages/core/dev-delivery-authority-qualification.js packages/core/dev-delivery-authority-settlement.js packages/core/dev-delivery-authority-state.js packages/core/dev-delivery-execution-failure.js packages/core/dev-delivery-execution-transfer.js packages/core/dev-delivery-landing-readback.js packages/core/dev-delivery-landing-terminal-evidence.js packages/core/dev-delivery-landing-testing-port.js packages/core/dev-delivery-native-execution.js packages/core/dev-delivery-native-proof.js packages/core/dev-delivery-process-boundary.js packages/core/dev-delivery-warrant-qualification.js packages/core/dev-delivery-warrant-state.js scripts/dev-delivery-authority-command-adapters.mjs scripts/dev-delivery-authority-provider.mjs scripts/dev-delivery-authority.mjs scripts/dev-delivery-native-run.mjs scripts/dev-delivery-process-boundary.mjs scripts/dev-delivery-two-phase-resume.mjs scripts/dev-delivery-two-phase.mjs scripts/dev-delivery-warrant-options.mjs scripts/dev-delivery-warrant-store.mjs templates/native-dev-delivery.yml",
158
158
  "operator:windows-jit": "bash scripts/aws-windows-jit-operator.sh",
159
- "check": "pnpm run check:static && node scripts/check-ci-lane-change-budget.mjs && node scripts/check-v4-public-dogfood-contract.mjs && node scripts/check-v4-floating-consumer-policy-contract.mjs && pnpm run check:v4-bridge && pnpm run check:v4-contracts && node scripts/check-maintainability.mjs && node scripts/check-internal-architecture.mjs && node scripts/generate-agent-change-map.mjs && node scripts/check-inventory.mjs && node scripts/check-core-mechanism-inventory.mjs && node scripts/check-v4-runtime-semantic-closure.mjs && node scripts/check-v3-v4-capability-inventory.mjs && node scripts/check-release-tail-contract.mjs && node scripts/v4-publication-rehearsal-fixture.mjs --check && node scripts/v4-architecture.mjs validate && node scripts/v4-warrant-shadow-plan.mjs validate && pnpm run check:site && pnpm run check:workflows && pnpm run test:unit && pnpm run check:golden-path && node scripts/check-action-bundles.mjs",
159
+ "check": "pnpm run check:static && node scripts/check-ci-lane-change-budget.mjs && node scripts/check-v4-public-dogfood-contract.mjs && node scripts/check-v4-floating-consumer-policy-contract.mjs && node scripts/check-v4-release-topology.mjs && pnpm run check:v4-bridge && pnpm run check:v4-contracts && node scripts/check-maintainability.mjs && node scripts/check-internal-architecture.mjs && node scripts/generate-agent-change-map.mjs && node scripts/check-inventory.mjs && node scripts/check-core-mechanism-inventory.mjs && node scripts/check-v4-runtime-semantic-closure.mjs && node scripts/check-v3-v4-capability-inventory.mjs && node scripts/check-release-tail-contract.mjs && node scripts/v4-publication-rehearsal-fixture.mjs --check && node scripts/v4-architecture.mjs validate && node scripts/v4-warrant-shadow-plan.mjs validate && pnpm run check:site && pnpm run check:workflows && pnpm run test:unit && pnpm run check:golden-path && node scripts/check-action-bundles.mjs",
160
160
  "check:static": "node scripts/check-javascript-syntax.mjs && prettier --check architecture/*.json contracts/release-tail-provider-bindings-v1.schema.json contracts/v4-canonical-contracts-v1.schema.json contracts/v4-compatibility-facts-v1.schema.json contracts/v4-delivery-warrant-semantic-diff-report-v1.schema.json contracts/v4-delivery-warrant-trace-v1.schema.json contracts/v4-floating-consumer-policy-receipt-v1.schema.json contracts/v4-runtime-ref-resume-authority-v1.schema.json contracts/v4-tail-reseal-v1.schema.json contracts/v4-host-contract-v1.schema.json contracts/v4-provider-operation-journal-v1.schema.json contracts/v4-release-activation-shadow-v1.schema.json contracts/v4-stable-publication-fence-v1.schema.json contracts/v4-partial-mutation-recovery-v1.schema.json contracts/v4-stage-capsule-v1.schema.json contracts/v4-stage-capsule-store-v1.schema.json contracts/v4-stage-capsule-resume-v1.schema.json contracts/release-tail-capabilities-v1.schema.json contracts/fixtures/release-tail-capabilities-v1/*.json contracts/fixtures/v4-delivery-warrant-trace-v1/*.json contracts/fixtures/v4-floating-consumer-policy-v1/*.json contracts/fixtures/v4-runtime-ref-resume-authority-v1/*.json contracts/fixtures/v4-tail-reseal-v1/*.json contracts/fixtures/v4-compatibility-facts-v1/*.json contracts/fixtures/v4-provider-operation-journal-v1/*.json contracts/fixtures/v4-provider-readback-idempotency-v1/*.json contracts/fixtures/v4-release-activation-shadow-v1/*.json contracts/fixtures/v4-stable-publication-fence-v1/*.json contracts/fixtures/v4-partial-mutation-recovery-v1/*.json contracts/fixtures/v4-stage-capsule-v1/*.json contracts/fixtures/v4-stage-capsule-store-v1/*.json contracts/fixtures/v4-stage-capsule-resume-v1/*.json bin/internal/command-registry.mjs bin/internal/compatibility-facts-cli.mjs packages/core/v4-canonical-contracts.js packages/core/kungfu-temporal-fact.js packages/core/buildchain-compatibility-fact.js packages/core/buildchain-compatibility-authority.js packages/core/buildchain-compatibility-proof.js packages/core/v4-floating-consumer-evidence.js packages/core/v4-floating-consumer-policy.js packages/core/v4-floating-consumer-release-passport.js packages/core/v4-runtime-ref-resume-authority.js packages/core/v4-tail-reseal-contract.js packages/core/v4-tail-reseal-github.js packages/core/v4-tail-reseal-receipt.js packages/core/v4-tail-reseal.js packages/core/v4-runtime-selector-persistence.js packages/core/v4-provider-operation-journal.js packages/core/v4-provider-readback-idempotency.js packages/core/v4-release-activation-shadow.js packages/core/v4-stable-publication-fence.js packages/core/v4-partial-mutation-recovery-qualification.js packages/core/v4-stage-capsule.js packages/core/v4-stage-capsule-store.js packages/core/v4-stage-capsule-local-store.js packages/core/v4-platform-stage-checkpoints.js packages/core/v4-stage-capsule-resume-planner.js packages/core/v4-stage-capsule-qualification.js packages/core/v4-stage-capsule-qualification-campaign.js packages/core/v4-delivery-warrant-fixture-runner.js packages/core/v4-delivery-warrant-read-candidate.js packages/core/v4-delivery-warrant-semantic-diff-gate.js packages/core/v4-delivery-warrant-shadow-adapter.js scripts/authorize-promotion-runtime-override.cjs scripts/check-core-mechanism-inventory.mjs scripts/check-v4-runtime-semantic-closure.mjs scripts/check-release-tail-contract.mjs scripts/check-javascript-syntax.mjs scripts/check-maintainability.mjs scripts/dev-pr-prequeue-guard.mjs scripts/check-v4-public-dogfood-contract.mjs scripts/maintainability-metrics.mjs scripts/maintainability-domain-metrics.mjs scripts/maintainability-governance.mjs scripts/generate-agent-change-map.mjs scripts/public-reference.mjs scripts/site-reference-registry.mjs scripts/generate-public-reference.mjs scripts/v4-architecture.mjs scripts/v4-bridge-bootstrap.mjs scripts/v4-bridge-evidence.mjs scripts/v4-consumer-policy.mjs scripts/v4-host-adapter.mjs scripts/v4-platform-stage-checkpoint-rehearsal.mjs scripts/v4-stage-capsule-resume-rehearsal.mjs scripts/v4-stage-capsule-qualification.mjs scripts/v4-tail-reseal-macos-rehearsal.mjs scripts/v4-tail-reseal.mjs scripts/v4-warrant-shadow-plan.mjs scripts/verify-golden-path.mjs tests/authorize-promotion-runtime-override.test.mjs tests/command-registry.test.mjs tests/core-mechanism-inventory.test.mjs tests/release-tail-contract.test.mjs tests/maintainability.test.mjs tests/maintainability-governance.test.mjs tests/promotion-responsibilities.test.mjs tests/public-reference.test.mjs tests/v4-architecture.test.mjs tests/v4-bridge.test.mjs tests/v4-canonical-contracts.test.mjs tests/v4-delivery-warrant-fixture-runner.test.mjs tests/v4-delivery-warrant-read-candidate.test.mjs tests/v4-floating-consumer-policy.test.mjs tests/v4-runtime-ref-resume-authority.test.mjs tests/v4-runtime-semantic-closure.test.mjs tests/v4-tail-reseal.test.mjs tests/v4-tail-reseal-parity.test.mjs tests/v4-compatibility-facts.test.mjs tests/v4-platform-stage-checkpoints.test.mjs tests/v4-provider-operation-journal.test.mjs tests/v4-provider-readback-idempotency.test.mjs tests/v4-public-dogfood-contract.test.mjs tests/v4-release-activation-shadow.test.mjs tests/v4-stable-publication-fence.test.mjs tests/v4-partial-mutation-recovery-qualification.test.mjs tests/v4-stage-capsule.test.mjs tests/v4-stage-capsule-store.test.mjs tests/v4-stage-capsule-resume-planner.test.mjs tests/v4-stage-capsule-qualification.test.mjs tests/v4-warrant-shadow-plan.test.mjs",
161
161
  "check:v4-bridge": "cargo fmt --manifest-path crates/buildchain-v4-bridge/Cargo.toml -- --check && cargo clippy --locked --manifest-path crates/buildchain-v4-bridge/Cargo.toml -- -D warnings && cargo test --locked --manifest-path crates/buildchain-v4-bridge/Cargo.toml",
162
162
  "check:v4-contracts": "cargo fmt --manifest-path crates/buildchain-v4-contracts/Cargo.toml -- --check && cargo clippy --locked --manifest-path crates/buildchain-v4-contracts/Cargo.toml -- -D warnings && cargo test --locked --manifest-path crates/buildchain-v4-contracts/Cargo.toml && node --test tests/v4-canonical-contracts.test.mjs tests/v4-delivery-warrant-fixture-runner.test.mjs tests/v4-delivery-warrant-read-candidate.test.mjs tests/v4-floating-consumer-policy-contract.test.mjs tests/v4-floating-consumer-policy.test.mjs tests/v4-runtime-ref-resume-authority.test.mjs tests/v4-tail-reseal.test.mjs tests/v4-tail-reseal-parity.test.mjs tests/v4-compatibility-facts.test.mjs tests/v4-publication-rehearsal.test.mjs tests/v4-platform-stage-checkpoints.test.mjs tests/v4-provider-operation-journal.test.mjs tests/v4-provider-readback-idempotency.test.mjs tests/v4-public-dogfood-contract.test.mjs tests/v4-release-activation-shadow.test.mjs tests/v4-stable-publication-fence.test.mjs tests/v4-partial-mutation-recovery-qualification.test.mjs tests/v4-stage-capsule.test.mjs tests/v4-stage-capsule-store.test.mjs tests/v4-stage-capsule-resume-planner.test.mjs tests/v4-stage-capsule-qualification.test.mjs",
@@ -4,8 +4,39 @@ import {
4
4
  devDeliveryPositiveInteger as positiveInteger,
5
5
  devDeliveryText as text,
6
6
  } from "./dev-delivery-common.js";
7
-
8
7
  export const CHAINED_ATTEMPT_IDENTITY = "chained-attempt-v2";
8
+ const terminalBeforeChainCutover = (candidate, terminalStates) =>
9
+ terminalStates.has(candidate.status) &&
10
+ candidate.enqueuedAt < "2026-08-05T14:42:34.000Z";
11
+ const UNCHAINED_SUCCESSOR =
12
+ "same-PR successor must chain the latest durable predecessor";
13
+ export const EXACT_DEV_DELIVERY_PROOF_FIELDS = Object.freeze([
14
+ "sourcePatchRoot",
15
+ "sourceProofRoot",
16
+ "planRoot",
17
+ "closureRoot",
18
+ "dependencyRoot",
19
+ "toolchainRoot",
20
+ "environmentRoot",
21
+ "sourceWorkflowRunId",
22
+ ]);
23
+
24
+ export function matchesExactDevDeliveryCandidate(existing, attempted) {
25
+ return (
26
+ existing.sourceHead === attempted.sourceHead &&
27
+ EXACT_DEV_DELIVERY_PROOF_FIELDS.every(
28
+ (field) => existing[field] === attempted[field],
29
+ ) &&
30
+ JSON.stringify(existing.affectedPaths || []) ===
31
+ JSON.stringify(attempted.affectedPaths || []) &&
32
+ JSON.stringify(existing.shardEvidenceRoots || []) ===
33
+ JSON.stringify(attempted.shardEvidenceRoots || []) &&
34
+ existing.nativeCommandContract?.commandRoot ===
35
+ attempted.nativeCommandContract?.commandRoot &&
36
+ existing.releaseBlockerPriority?.claimRoot ===
37
+ attempted.releaseBlockerPriority?.claimRoot
38
+ );
39
+ }
9
40
 
10
41
  export function createDevDeliveryCandidateIdentity(
11
42
  input,
@@ -47,27 +78,24 @@ export function validateDevDeliveryCandidateChain(candidates, terminalStates) {
47
78
  const latestByPullRequest = new Map();
48
79
  for (const candidate of candidates) {
49
80
  const latest = latestByPullRequest.get(candidate.pullRequestNumber);
50
- if (latest && candidate.identitySemantics !== CHAINED_ATTEMPT_IDENTITY) {
51
- throw new Error(
52
- "same-PR successor must chain the latest durable predecessor",
53
- );
81
+ if (
82
+ latest &&
83
+ candidate.identitySemantics !== CHAINED_ATTEMPT_IDENTITY &&
84
+ (!terminalBeforeChainCutover(latest, terminalStates) ||
85
+ !terminalBeforeChainCutover(candidate, terminalStates))
86
+ ) {
87
+ throw new Error(UNCHAINED_SUCCESSOR);
54
88
  }
55
89
  if (candidate.identitySemantics === CHAINED_ATTEMPT_IDENTITY) {
56
90
  const predecessor = precedingCandidates.get(
57
91
  candidate.predecessorCandidateId,
58
92
  );
59
- if (!predecessor)
60
- throw new Error(
61
- "chained candidate predecessor must appear earlier in the queue",
62
- );
63
- if (predecessor.pullRequestNumber !== candidate.pullRequestNumber) {
64
- throw new Error(
65
- "chained candidate predecessor must belong to the same pull request",
66
- );
67
- }
68
- if (!terminalStates.has(predecessor.status)) {
69
- throw new Error("chained candidate predecessor must be terminal");
70
- }
93
+ // prettier-ignore
94
+ if (!predecessor) throw new Error("chained candidate predecessor must appear earlier in the queue");
95
+ // prettier-ignore
96
+ if (predecessor.pullRequestNumber !== candidate.pullRequestNumber) throw new Error("chained candidate predecessor must belong to the same pull request");
97
+ // prettier-ignore
98
+ if (!terminalStates.has(predecessor.status)) throw new Error("chained candidate predecessor must be terminal");
71
99
  if (latest?.candidateId !== predecessor.candidateId) {
72
100
  throw new Error(
73
101
  "chained candidate must bind the latest durable predecessor",
@@ -138,14 +138,21 @@ function terminal(jobInput) {
138
138
  function heartbeatEntry(result, previousStateRoot) {
139
139
  const warrant = selectedWarrant(result);
140
140
  const receipt = result.receipt;
141
+ const expectedOldStateRoot = receipt?.expectedOldStateRoot;
142
+ const recovery = result.concurrencyRecovery;
143
+ const rebased = expectedOldStateRoot !== previousStateRoot;
141
144
  if (
142
145
  receipt?.action !== "heartbeat" ||
143
- result.before?.stateRoot !== previousStateRoot ||
144
- receipt.expectedOldStateRoot !== previousStateRoot ||
146
+ result.before?.stateRoot !== expectedOldStateRoot ||
145
147
  result.after?.stateRoot !== receipt.nextStateRoot ||
146
148
  result.observation?.stateRoot !== receipt.nextStateRoot ||
147
149
  warrant?.fencingToken !== receipt.fencingToken ||
148
- warrant?.generation !== receipt.leaseGeneration
150
+ warrant?.generation !== receipt.leaseGeneration ||
151
+ (rebased &&
152
+ (recovery?.action !== "heartbeat-state-root-rebased" ||
153
+ recovery.requestedStateRoot !== previousStateRoot ||
154
+ recovery.observedStateRoot !== expectedOldStateRoot)) ||
155
+ (!rebased && recovery)
149
156
  ) {
150
157
  throw new Error(
151
158
  "durable provider heartbeat transition is not root-continuous",
@@ -155,8 +162,10 @@ function heartbeatEntry(result, previousStateRoot) {
155
162
  throw new Error("durable provider heartbeat receipt root drift");
156
163
  }
157
164
  return {
158
- expectedOldStateRoot: receipt.expectedOldStateRoot,
165
+ previousStateRoot,
166
+ expectedOldStateRoot,
159
167
  nextStateRoot: receipt.nextStateRoot,
168
+ concurrencyRecovery: recovery || null,
160
169
  receipt,
161
170
  receiptRoot: result.receiptRoot,
162
171
  heartbeatAt: timestamp(warrant.heartbeatAt, "durable heartbeatAt"),
@@ -274,13 +283,20 @@ function verifyHeartbeatContinuity(receipt, initial) {
274
283
  let previousRoot = initial.stateRoot;
275
284
  let previousTime = Date.parse(receipt.initialHeartbeatAt);
276
285
  for (const entry of receipt.heartbeats) {
286
+ const rebased = entry.expectedOldStateRoot !== previousRoot;
287
+ const recovery = entry.concurrencyRecovery;
277
288
  if (
278
- entry.expectedOldStateRoot !== previousRoot ||
289
+ entry.previousStateRoot !== previousRoot ||
279
290
  devDeliveryContentRoot(entry.receipt) !== entry.receiptRoot ||
280
291
  entry.receipt.expectedOldStateRoot !== entry.expectedOldStateRoot ||
281
292
  entry.receipt.nextStateRoot !== entry.nextStateRoot ||
282
293
  entry.receipt.fencingToken !== initial.fencingToken ||
283
- entry.receipt.leaseGeneration !== initial.generation
294
+ entry.receipt.leaseGeneration !== initial.generation ||
295
+ (rebased &&
296
+ (recovery?.action !== "heartbeat-state-root-rebased" ||
297
+ recovery.requestedStateRoot !== previousRoot ||
298
+ recovery.observedStateRoot !== entry.expectedOldStateRoot)) ||
299
+ (!rebased && recovery)
284
300
  ) {
285
301
  throw new Error("provider heartbeat root continuity mismatch");
286
302
  }