@kungfu-tech/buildchain 4.0.1-alpha.3 → 4.0.1-alpha.4

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.
@@ -8417,8 +8417,8 @@
8417
8417
  "workflowRegistryPath": "dist/site/workflow-registry.json",
8418
8418
  "pageRegistryPath": "dist/site/page-registry.json",
8419
8419
  "cliRegistryDigest": "3632f0332f9c0e270a522a4af358482833974757d77ac40a2d7e2efe6a56cb28",
8420
- "workflowRegistryDigest": "f2c315d3df35fc3067cb98f626dfae8b5f4f400a6ce1d39a62e724072f52ae18",
8421
- "pageRegistryDigest": "d25d802e1298cc2867ea8c3b3fc4b483fc41cfe76084022c762c121f58a6b978"
8420
+ "workflowRegistryDigest": "91b72955489bf4a98fa0c3d3b8ef245e34acb5993e3a59c26caad214b004cfde",
8421
+ "pageRegistryDigest": "07068ff6f889aaae1bb0def76cc041b2e8c63092eebf728b245f3f9451e1ea24"
8422
8422
  },
8423
8423
  "comparison": {
8424
8424
  "missingCliRegistry": [],
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-publication-release-registry",
4
- "generatedAt": "2026-08-15T19:57:44.433Z",
5
- "publishedAt": "2026-08-15T19:57:44.433Z",
4
+ "generatedAt": "2026-08-16T00:38:02.716Z",
5
+ "publishedAt": "2026-08-16T00:38:02.716Z",
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": "cfc0256de1826e0e0ec4a4e55644c869f3286f91",
22
+ "sourceRevision": "e6b14caa6b3dd2af4ea2f6c480baf84006ed0131",
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-alpha.3",
35
+ "version": "4.0.1-alpha.4",
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-15T19:57:44.433Z",
5
- "publishedAt": "2026-08-15T19:57:44.433Z",
4
+ "generatedAt": "2026-08-16T00:38:02.716Z",
5
+ "publishedAt": "2026-08-16T00:38:02.716Z",
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": "cfc0256de1826e0e0ec4a4e55644c869f3286f91",
22
+ "sourceRevision": "e6b14caa6b3dd2af4ea2f6c480baf84006ed0131",
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-alpha.3",
40
+ "version": "4.0.1-alpha.4",
41
41
  "versionSource": "package.json#version"
42
42
  },
43
43
  "entrypoint": "buildchain-site.json",
@@ -245,7 +245,7 @@
245
245
  "path": "docs/node-api-reference.md",
246
246
  "plane": "use",
247
247
  "exists": true,
248
- "digest": "sha256:8f0c42d4453003d9bff861392c890f557a54608662e1cc380ed9aaa6635df016"
248
+ "digest": "sha256:a409b078692ebb18ca7bb817ebd35c416cc6be3842f671c17d019c9aa32d0638"
249
249
  },
250
250
  {
251
251
  "id": "build-facts",
@@ -2006,7 +2006,7 @@
2006
2006
  "status": "preview",
2007
2007
  "owner": "buildchain-workflows",
2008
2008
  "maturity": "preview",
2009
- "introducedVersion": "4.0.1-alpha.3",
2009
+ "introducedVersion": "4.0.1-alpha.4",
2010
2010
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2011
2011
  "deprecationReplacement": "",
2012
2012
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2027,7 +2027,7 @@
2027
2027
  "status": "preview",
2028
2028
  "owner": "buildchain-workflows",
2029
2029
  "maturity": "preview",
2030
- "introducedVersion": "4.0.1-alpha.3",
2030
+ "introducedVersion": "4.0.1-alpha.4",
2031
2031
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2032
2032
  "deprecationReplacement": "",
2033
2033
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2048,7 +2048,7 @@
2048
2048
  "status": "preview",
2049
2049
  "owner": "buildchain-workflows",
2050
2050
  "maturity": "preview",
2051
- "introducedVersion": "4.0.1-alpha.3",
2051
+ "introducedVersion": "4.0.1-alpha.4",
2052
2052
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2053
2053
  "deprecationReplacement": "",
2054
2054
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -2098,7 +2098,7 @@
2098
2098
  "status": "preview",
2099
2099
  "owner": "buildchain-workflows",
2100
2100
  "maturity": "preview",
2101
- "introducedVersion": "4.0.1-alpha.3",
2101
+ "introducedVersion": "4.0.1-alpha.4",
2102
2102
  "compatibilityPromise": "preserved-through-the-v3-major-line",
2103
2103
  "deprecationReplacement": "",
2104
2104
  "sunsetCondition": "explicit-breaking-change-review-in-a-future-major-line",
@@ -383,8 +383,10 @@ The reusable `dev-pr-auto-merge.yml` supports three explicit rollout modes:
383
383
  The shipped Buildchain caller and native template configure this handoff path
384
384
  and accept the same complete input contract. A historical phase-less owner
385
385
  uses the distinct `legacy-phase-less-active-owner` command path. That path
386
- carries the exact queue state root, fencing token, generation, PR, head, and
387
- source-run binding, omits `environment-root`, `native-command`, and
386
+ carries the exact queue state root observed before its duplicate submission,
387
+ fencing token, generation, PR, head, and source-run binding. The submission
388
+ receipt proves that pre-transition root even though the queue transition
389
+ advances the current state root. The path omits `environment-root`, `native-command`, and
388
390
  `native-command-root`, and rejects readback drift. It therefore resumes the
389
391
  historical non-native authority without inventing a native command contract
390
392
  or upgrading the owner to native proof authority.
@@ -471,8 +473,10 @@ consumer workflow. It supports both explicit dispatch and the bounded wake
471
473
  event, calls the allowed floating `@v4-alpha` selector, explicitly passes the v4
472
474
  runtime ref that locks every delivery job to the same checkout, and keeps the
473
475
  native command in the consumer repository rather than inventing
474
- provider-specific shards. The reusable workflow defaults that explicit input
475
- to `v4-alpha`; an empty input or any v3 selector fails before the first runtime
476
+ provider-specific shards. Both callers explicitly bind the queue-admission
477
+ and active-lease status contexts so write/readback fencing uses the same exact
478
+ names. The reusable workflow defaults the explicit runtime input to
479
+ `v4-alpha`; an empty input or any v3 selector fails before the first runtime
476
480
  checkout.
477
481
 
478
482
  This mechanism schedules protected delivery only. It does not serialize local
@@ -1609,9 +1609,9 @@ Target: `./packages/core/dev-delivery-warrant.js`. Public symbols: 54.
1609
1609
 
1610
1610
  | Symbol | Kind and signature | Parameters | Return | Errors | Side effects | Example | Source |
1611
1611
  | --- | --- | --- | --- | --- | --- | --- | --- |
1612
- | `cancelQueuedDevDeliveryCandidate` | function: function cancelQueuedDevDeliveryCandidate(queueInput, input, options) | queueInput, input, options | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { cancelQueuedDevDeliveryCandidate } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:507` |
1612
+ | `cancelQueuedDevDeliveryCandidate` | function: function cancelQueuedDevDeliveryCandidate(queueInput, input, options) | queueInput, input, options | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { cancelQueuedDevDeliveryCandidate } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:508` |
1613
1613
  | `classifyDevDeliveryDelta` | function: function classifyDevDeliveryDelta({ proof, current = {} } = {}) | { proof, current = {} } = {} | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { classifyDevDeliveryDelta } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-proof.js:109` |
1614
- | `closeDevDeliveryWarrant` | function: function closeDevDeliveryWarrant(queueInput, warrant, { outcome, evidenceRoot, reason = "", providerFailureAuthority = null, now = new Date().toISOString(), } = {}) | queueInput, warrant, { outcome, evidenceRoot, reason = "", providerFailureAuthority = null, now = new Date().toISOString(), } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { closeDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:383` |
1614
+ | `closeDevDeliveryWarrant` | function: function closeDevDeliveryWarrant(queueInput, warrant, { outcome, evidenceRoot, reason = "", providerFailureAuthority = null, now = new Date().toISOString(), } = {}) | queueInput, warrant, { outcome, evidenceRoot, reason = "", providerFailureAuthority = null, now = new Date().toISOString(), } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { closeDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:384` |
1615
1615
  | `createDevDeliveryQueue` | value: createDevDeliveryQueue | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { createDevDeliveryQueue } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:1` |
1616
1616
  | `createIntegrationDeliveryProof` | function: function createIntegrationDeliveryProof(input = {}) | input = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { createIntegrationDeliveryProof } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-proof.js:241` |
1617
1617
  | `createNativeCommandContract` | value: createNativeCommandContract | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { createNativeCommandContract } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-native-proof.js:1` |
@@ -1646,14 +1646,14 @@ Target: `./packages/core/dev-delivery-warrant.js`. Public symbols: 54.
1646
1646
  | `NATIVE_QUALIFICATION_PROOF_SCHEMA` | constant: const NATIVE_QUALIFICATION_PROOF_SCHEMA | none | value | Import does not declare a throw contract. | none-on-import | `import { NATIVE_QUALIFICATION_PROOF_SCHEMA } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-native-proof.js:31` |
1647
1647
  | `normalizeDevDeliveryQueue` | value: normalizeDevDeliveryQueue | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { normalizeDevDeliveryQueue } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:1` |
1648
1648
  | `normalizeNativeCommandContract` | value: normalizeNativeCommandContract | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { normalizeNativeCommandContract } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-native-proof.js:1` |
1649
- | `observeDevDeliveryQueue` | function: function observeDevDeliveryQueue(queueInput, { now = new Date().toISOString() } = {}) | queueInput, { now = new Date().toISOString() } = {} | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { observeDevDeliveryQueue } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:516` |
1649
+ | `observeDevDeliveryQueue` | function: function observeDevDeliveryQueue(queueInput, { now = new Date().toISOString() } = {}) | queueInput, { now = new Date().toISOString() } = {} | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { observeDevDeliveryQueue } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:517` |
1650
1650
  | `PROJECT_CUT_REPLAY_PROOF_SCHEMA` | constant: const PROJECT_CUT_REPLAY_PROOF_SCHEMA | none | value | Import does not declare a throw contract. | none-on-import | `import { PROJECT_CUT_REPLAY_PROOF_SCHEMA } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-proof.js:5` |
1651
- | `qualifyDevDeliveryWarrant` | constant: const qualifyDevDeliveryWarrant | none | value | Import does not declare a throw contract. | none-on-import | `import { qualifyDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:379` |
1651
+ | `qualifyDevDeliveryWarrant` | constant: const qualifyDevDeliveryWarrant | none | value | Import does not declare a throw contract. | none-on-import | `import { qualifyDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:380` |
1652
1652
  | `rankDevDeliveryCandidates` | value: rankDevDeliveryCandidates | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { rankDevDeliveryCandidates } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:1` |
1653
- | `recoverExpiredDevDeliveryWarrant` | function: function recoverExpiredDevDeliveryWarrant(queueInput, { now = new Date().toISOString() } = {}) | queueInput, { now = new Date().toISOString() } = {} | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { recoverExpiredDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:300` |
1653
+ | `recoverExpiredDevDeliveryWarrant` | function: function recoverExpiredDevDeliveryWarrant(queueInput, { now = new Date().toISOString() } = {}) | queueInput, { now = new Date().toISOString() } = {} | unknown | Errors from called operations may propagate; no narrower throw contract is declared in source. | none-detected-by-static-source-scan | `import { recoverExpiredDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:301` |
1654
1654
  | `RELEASE_BLOCKER_PRIORITY_CLAIM_SCHEMA` | constant: const RELEASE_BLOCKER_PRIORITY_CLAIM_SCHEMA | none | value | Import does not declare a throw contract. | none-on-import | `import { RELEASE_BLOCKER_PRIORITY_CLAIM_SCHEMA } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/release-blocker-priority.js:15` |
1655
1655
  | `selectDevDeliveryWarrant` | function: function selectDevDeliveryWarrant(queueInput, { now = new Date().toISOString(), leaseSeconds } = {}) | queueInput, { now = new Date().toISOString(), leaseSeconds } = {} | unknown | May throw an Error on rejected input or failed operations; follow the linked source contract. | none-detected-by-static-source-scan | `import { selectDevDeliveryWarrant } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:95` |
1656
- | `settleDevDeliveryTerminalEvent` | constant: const settleDevDeliveryTerminalEvent | none | value | Import does not declare a throw contract. | none-on-import | `import { settleDevDeliveryTerminalEvent } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:510` |
1656
+ | `settleDevDeliveryTerminalEvent` | constant: const settleDevDeliveryTerminalEvent | none | value | Import does not declare a throw contract. | none-on-import | `import { settleDevDeliveryTerminalEvent } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:511` |
1657
1657
  | `SOURCE_QUALIFICATION_PROOF_SCHEMA` | constant: const SOURCE_QUALIFICATION_PROOF_SCHEMA | none | value | Import does not declare a throw contract. | none-on-import | `import { SOURCE_QUALIFICATION_PROOF_SCHEMA } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-proof.js:3` |
1658
1658
  | `SOURCE_QUALIFICATION_PROOF_V2_SCHEMA` | constant: const SOURCE_QUALIFICATION_PROOF_V2_SCHEMA | none | value | Import does not declare a throw contract. | none-on-import | `import { SOURCE_QUALIFICATION_PROOF_V2_SCHEMA } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-proof.js:4` |
1659
1659
  | `submitDevDeliveryCandidate` | value: submitDevDeliveryCandidate | none | unknown | No narrower error contract was mechanically discoverable. | unknown | `import { submitDevDeliveryCandidate } from "@kungfu-tech/buildchain/dev-delivery-warrant";` | `packages/core/dev-delivery-warrant.js:1` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungfu-tech/buildchain",
3
- "version": "4.0.1-alpha.3",
3
+ "version": "4.0.1-alpha.4",
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",
@@ -98,7 +98,6 @@ function assertHostedLinuxController(environment) {
98
98
  function hostedBoundary(procRoot, pid, command, readlinkSync) {
99
99
  if (
100
100
  command.length !== 4 ||
101
- !GITHUB_HOSTED_LINUX_WORKER.test(command[0] || "") ||
102
101
  command[1] !== "spawnclient" ||
103
102
  !/^\d+$/u.test(command[2] || "") ||
104
103
  !/^\d+$/u.test(command[3] || "")
@@ -109,7 +108,7 @@ function hostedBoundary(procRoot, pid, command, readlinkSync) {
109
108
  const executable = ancestryRead(readlinkSync, link);
110
109
  if (
111
110
  !GITHUB_HOSTED_LINUX_WORKER.test(executable) ||
112
- command[0] !== executable
111
+ !new Set([executable, path.posix.basename(executable)]).has(command[0])
113
112
  ) {
114
113
  throw new Error("credential ancestry found an untrusted Runner.Worker");
115
114
  }
@@ -246,11 +246,10 @@ function normalizeCandidate(input, expected) {
246
246
  "candidate shardEvidenceRoots",
247
247
  );
248
248
  }
249
- if (candidate.environmentRoot && !candidate.nativeCommandContract) {
250
- throw new Error(
251
- "native candidate requires an exact native command contract",
252
- );
253
- }
249
+ const { environmentRoot: env, nativeCommandContract: cmd } = candidate;
250
+ const native = candidate.deliveryClass !== "non-native-fast" || env || cmd;
251
+ if (native && (!env || !cmd) && !TERMINAL_STATES.has(status))
252
+ throw new Error("live native candidate requires exact native proof");
254
253
  if (Object.hasOwn(input, "releaseBlockerPriority"))
255
254
  candidate.releaseBlockerPriority = normalizeReleaseBlockerPriorityClaim(
256
255
  input.releaseBlockerPriority,
@@ -267,6 +267,7 @@ export function heartbeatDevDeliveryWarrant(
267
267
  "leaseSeconds",
268
268
  queue.policy.leaseSeconds,
269
269
  );
270
+ queue.activeWarrant.heartbeatAt = currentTime;
270
271
  queue.activeWarrant.expiresAt = new Date(
271
272
  Date.parse(currentTime) + effectiveLeaseSeconds * 1000,
272
273
  ).toISOString();
@@ -6,7 +6,6 @@ import { parseYamlUses } from "../packages/core/workflow-yaml-contract.js";
6
6
 
7
7
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
8
8
  const read = (relative) => fs.readFileSync(path.join(root, relative), "utf8");
9
-
10
9
  function fail(message) {
11
10
  throw new Error(`v4-floating-consumer-policy-contract: ${message}`);
12
11
  }
@@ -113,6 +112,7 @@ export function checkV4FloatingConsumerPolicyContract() {
113
112
  "Enforce v4 floating consumer policy",
114
113
  "Validate consumer package manager contract",
115
114
  ]);
115
+ if (!read(".github/workflows/.build.yml").includes("BUILDCHAIN_EXPECTED_INVOCATION_CHANNEL: ${{ inputs.buildchain-expected-channel }}")) fail("channel builds must disambiguate dual-channel caller invocations");
116
116
  assertTrustGatedJobs(read(".github/workflows/.build.yml"), [
117
117
  "resolve-source",
118
118
  "resolve-contract",
@@ -70,7 +70,7 @@ function normalizeOptions(options = {}) {
70
70
  allowedHeadPrefixes: splitList(options.allowedHeadPrefixes, DEFAULT_ALLOWED_HEAD_PREFIXES),
71
71
  requiredChecks: splitList(options.requiredChecks, DEFAULT_REQUIRED_CHECKS),
72
72
  queueAdmissionContext: String(options.queueAdmissionContext || "").trim(),
73
- activeLeaseContext: String(options.activeLeaseContext || "").trim(),
73
+ activeLeaseContext: String(options.activeLeaseContext || (choiceOption(options.warrantMode, VALID_WARRANT_MODES, "off", "delivery Warrant mode") === "required" ? "Queue family lease/exact" : "")).trim(),
74
74
  requireApproval: boolOption(options.requireApproval, true),
75
75
  sameRepositoryOnly: boolOption(options.sameRepositoryOnly, true),
76
76
  maxMerges: intOption(options.maxMerges, 1),
@@ -6,7 +6,11 @@ import fs from "node:fs";
6
6
  import {
7
7
  closeDevDeliveryWarrant,
8
8
  createDevDeliveryQueue,
9
+ createNativeCommandContract,
10
+ createNativeProofReuseDecision,
11
+ createNativeQualificationProof,
9
12
  createReleaseBlockerPriorityClaim,
13
+ qualifyDevDeliveryWarrant,
10
14
  selectDevDeliveryWarrant,
11
15
  submitDevDeliveryCandidate,
12
16
  } from "../packages/core/dev-delivery-warrant.js";
@@ -81,9 +85,12 @@ function branch(value, label) {
81
85
  return normalized;
82
86
  }
83
87
 
84
- function at(recordedAt, seconds) {
85
- return new Date(Date.parse(recordedAt) + seconds * 1000).toISOString();
86
- }
88
+ const at = (recordedAt, seconds) => new Date(Date.parse(recordedAt) + seconds * 1000).toISOString();
89
+
90
+ const normalizeFields = (input, fields, normalizer, prefix = "") =>
91
+ Object.fromEntries(fields.map((field) => [field, normalizer(input?.[field], `${prefix}${field}`)]));
92
+
93
+ const requireEvidence = (condition, message) => { if (!condition) throw new Error(message); };
87
94
 
88
95
  function normalizeDelivery(input, expected) {
89
96
  const delivery = {
@@ -92,59 +99,44 @@ function normalizeDelivery(input, expected) {
92
99
  "delivery.pullRequestNumber",
93
100
  ),
94
101
  baseBranch: branch(input?.baseBranch, "delivery.baseBranch"),
95
- headSha: sha(input?.headSha, "delivery.headSha"),
96
- headTreeSha: sha(input?.headTreeSha, "delivery.headTreeSha"),
97
- state: text(input?.state, "delivery.state"),
98
- reviewState: text(input?.reviewState, "delivery.reviewState"),
99
- reviewHeadSha: sha(input?.reviewHeadSha, "delivery.reviewHeadSha"),
100
- mergeSha: sha(input?.mergeSha, "delivery.mergeSha"),
101
- mergeTreeSha: sha(input?.mergeTreeSha, "delivery.mergeTreeSha"),
102
- ciHeadSha: sha(input?.ciHeadSha, "delivery.ciHeadSha"),
103
- ciConclusion: text(input?.ciConclusion, "delivery.ciConclusion"),
104
- reviewRoot: root(input?.reviewRoot, "delivery.reviewRoot"),
105
- ciRoot: root(input?.ciRoot, "delivery.ciRoot"),
106
- mergeRoot: root(input?.mergeRoot, "delivery.mergeRoot"),
107
- artifactRoot: root(input?.artifactRoot, "delivery.artifactRoot"),
108
- installedProductRoot: root(
109
- input?.installedProductRoot,
110
- "delivery.installedProductRoot",
102
+ ...normalizeFields(
103
+ input,
104
+ ["headSha", "headTreeSha", "reviewHeadSha", "mergeSha", "mergeTreeSha", "ciHeadSha"],
105
+ sha,
106
+ "delivery.",
107
+ ),
108
+ ...normalizeFields(input, ["state", "reviewState", "ciConclusion"], text, "delivery."),
109
+ ...normalizeFields(
110
+ input,
111
+ ["reviewRoot", "ciRoot", "mergeRoot", "artifactRoot", "installedProductRoot"],
112
+ root,
113
+ "delivery.",
111
114
  ),
112
115
  };
113
- if (delivery.baseBranch !== expected.sourceBranch) {
114
- throw new Error(
115
- "protected delivery base does not match the Release Cut source branch",
116
- );
117
- }
118
- if (
119
- delivery.state !== "MERGED" ||
120
- delivery.reviewState !== "APPROVED" ||
121
- delivery.ciConclusion !== "success"
122
- ) {
123
- throw new Error(
124
- "protected delivery is not merged, approved, and CI-successful",
125
- );
126
- }
127
- if (
128
- delivery.headSha !== expected.devLandingSha ||
129
- delivery.reviewHeadSha !== delivery.headSha
130
- ) {
131
- throw new Error(
132
- "protected delivery review does not bind the exact repaired head",
133
- );
134
- }
135
- if (
136
- delivery.headTreeSha !== expected.cutCandidateTreeSha ||
137
- delivery.mergeTreeSha !== delivery.headTreeSha
138
- ) {
139
- throw new Error(
140
- "protected delivery merge tree does not equal the repaired candidate tree",
141
- );
142
- }
143
- if (delivery.ciHeadSha !== delivery.mergeSha) {
144
- throw new Error(
145
- "protected delivery CI does not bind the merge-group result",
146
- );
147
- }
116
+ requireEvidence(
117
+ delivery.baseBranch === expected.sourceBranch,
118
+ "protected delivery base does not match the Release Cut source branch",
119
+ );
120
+ requireEvidence(
121
+ delivery.state === "MERGED" &&
122
+ delivery.reviewState === "APPROVED" &&
123
+ delivery.ciConclusion === "success",
124
+ "protected delivery is not merged, approved, and CI-successful",
125
+ );
126
+ requireEvidence(
127
+ delivery.headSha === expected.devLandingSha &&
128
+ delivery.reviewHeadSha === delivery.headSha,
129
+ "protected delivery review does not bind the exact repaired head",
130
+ );
131
+ requireEvidence(
132
+ delivery.headTreeSha === expected.cutCandidateTreeSha &&
133
+ delivery.mergeTreeSha === delivery.headTreeSha,
134
+ "protected delivery merge tree does not equal the repaired candidate tree",
135
+ );
136
+ requireEvidence(
137
+ delivery.ciHeadSha === delivery.mergeSha,
138
+ "protected delivery CI does not bind the merge-group result",
139
+ );
148
140
  return delivery;
149
141
  }
150
142
 
@@ -153,50 +145,32 @@ function normalizeInput(input = {}) {
153
145
  repository: repository(input.repository),
154
146
  sourceBranch: branch(input.sourceBranch, "sourceBranch"),
155
147
  targetBranch: branch(input.targetBranch, "targetBranch"),
156
- assignmentRoot: root(input.assignmentRoot, "assignmentRoot"),
157
- initiativeRoot: root(input.initiativeRoot, "initiativeRoot"),
158
- dependencyProofRoot: root(input.dependencyProofRoot, "dependencyProofRoot"),
159
- originDevSha: sha(input.originDevSha, "originDevSha"),
160
- candidateSha: sha(input.candidateSha, "candidateSha"),
161
- candidateTreeSha: sha(input.candidateTreeSha, "candidateTreeSha"),
162
- alphaBaseSha: sha(input.alphaBaseSha, "alphaBaseSha"),
163
- buildchainRuntimeSha: sha(
164
- input.buildchainRuntimeSha,
165
- "buildchainRuntimeSha",
166
- ),
167
- observedDevSha: sha(input.observedDevSha, "observedDevSha"),
168
- blockerRoot: root(input.blockerRoot, "blockerRoot"),
169
- patchRoot: root(input.patchRoot, "patchRoot"),
170
- cutCandidateSha: sha(input.cutCandidateSha, "cutCandidateSha"),
171
- cutCandidateTreeSha: sha(input.cutCandidateTreeSha, "cutCandidateTreeSha"),
172
- cutLandingEvidenceRoot: root(
173
- input.cutLandingEvidenceRoot,
174
- "cutLandingEvidenceRoot",
148
+ ...normalizeFields(
149
+ input,
150
+ ["assignmentRoot", "initiativeRoot", "dependencyProofRoot", "environmentRoot", "blockerRoot", "patchRoot", "cutLandingEvidenceRoot", "devConflictEvidenceRoot", "devLandingEvidenceRoot"],
151
+ root,
175
152
  ),
176
- devBaseSha: sha(input.devBaseSha, "devBaseSha"),
177
- devLandingSha: sha(input.devLandingSha, "devLandingSha"),
178
- devConflictEvidenceRoot: root(
179
- input.devConflictEvidenceRoot,
180
- "devConflictEvidenceRoot",
181
- ),
182
- devLandingEvidenceRoot: root(
183
- input.devLandingEvidenceRoot,
184
- "devLandingEvidenceRoot",
153
+ ...normalizeFields(
154
+ input,
155
+ ["originDevSha", "candidateSha", "candidateTreeSha", "alphaBaseSha", "buildchainRuntimeSha", "observedDevSha", "cutCandidateSha", "cutCandidateTreeSha", "devBaseSha", "devLandingSha"],
156
+ sha,
185
157
  ),
158
+ nativeCommand: text(input.nativeCommand, "nativeCommand"),
159
+ nativeExecutionReceipt: structuredClone(input.nativeExecutionReceipt || {}),
186
160
  ordinaryPullRequestNumber: positiveInteger(
187
161
  input.ordinaryPullRequestNumber,
188
162
  "ordinaryPullRequestNumber",
189
163
  ),
190
164
  recordedAt: timestamp(input.recordedAt, "recordedAt"),
191
165
  };
192
- if (normalized.observedDevSha === normalized.originDevSha) {
193
- throw new Error(
194
- "self-dogfood requires dev to advance beyond the frozen origin",
195
- );
196
- }
197
- if (normalized.cutCandidateSha === normalized.candidateSha) {
198
- throw new Error("self-dogfood requires a successor repair candidate");
199
- }
166
+ requireEvidence(
167
+ normalized.observedDevSha !== normalized.originDevSha,
168
+ "self-dogfood requires dev to advance beyond the frozen origin",
169
+ );
170
+ requireEvidence(
171
+ normalized.cutCandidateSha !== normalized.candidateSha,
172
+ "self-dogfood requires a successor repair candidate",
173
+ );
200
174
  normalized.delivery = normalizeDelivery(input.delivery, normalized);
201
175
  return normalized;
202
176
  }
@@ -214,6 +188,10 @@ function deliveryCandidate(input, deliveryClass = "release") {
214
188
  closureRoot: input.closureRoot,
215
189
  dependencyRoot: input.dependencyRoot,
216
190
  toolchainRoot: input.toolchainRoot,
191
+ ...(input.environmentRoot ? { environmentRoot: input.environmentRoot } : {}),
192
+ ...(input.nativeCommand
193
+ ? { nativeCommandContract: createNativeCommandContract(input.nativeCommand) }
194
+ : {}),
217
195
  deliveryClass,
218
196
  priority: "ordinary",
219
197
  ...(input.releaseBlockerPriority
@@ -366,7 +344,7 @@ function runQueueCampaign(value, repaired, priorityClaim) {
366
344
  dependencyRoot: value.dependencyProofRoot,
367
345
  toolchainRoot: value.dependencyProofRoot,
368
346
  },
369
- "native-proof-required",
347
+ "non-native-fast",
370
348
  );
371
349
  queue = submitDevDeliveryCandidate(queue, ordinary, {
372
350
  now: at(value.recordedAt, 6),
@@ -388,6 +366,8 @@ function runQueueCampaign(value, repaired, priorityClaim) {
388
366
  closureRoot: value.delivery.mergeRoot,
389
367
  dependencyRoot: value.dependencyProofRoot,
390
368
  toolchainRoot: value.delivery.installedProductRoot,
369
+ environmentRoot: value.environmentRoot,
370
+ nativeCommand: value.nativeCommand,
391
371
  releaseBlockerPriority: priorityClaim,
392
372
  });
393
373
  const submitted = submitDevDeliveryCandidate(queue, blocker, {
@@ -426,7 +406,29 @@ function runQueueCampaign(value, repaired, priorityClaim) {
426
406
  "eligible release blocker did not receive bounded priority",
427
407
  );
428
408
  }
429
- const closed = closeDevDeliveryWarrant(selected.queue, selected.warrant, {
409
+ const nativeCommandRoot = createNativeCommandContract(value.nativeCommand).commandRoot;
410
+ const proof = createNativeQualificationProof({
411
+ ...selected.warrant,
412
+ repository: value.repository,
413
+ protectedBase: value.sourceBranch,
414
+ qualifiedBase: value.devBaseSha,
415
+ nativeCommandRoot,
416
+ nativeExecutionReceipt: value.nativeExecutionReceipt,
417
+ affectedPaths: [], shardEvidenceRoots: [],
418
+ qualifiedAt: at(value.recordedAt, 12),
419
+ });
420
+ const current = {
421
+ ...selected.warrant,
422
+ nativeCommandRoot,
423
+ currentBase: value.devBaseSha,
424
+ graphKnown: true, attributionComplete: true,
425
+ changedPaths: [], renames: [],
426
+ };
427
+ const reuseDecision = createNativeProofReuseDecision({ proof, current });
428
+ const qualified = qualifyDevDeliveryWarrant(selected.queue, selected.warrant, {
429
+ nativeProof: proof, reuseDecision, current, now: at(value.recordedAt, 12),
430
+ });
431
+ const closed = closeDevDeliveryWarrant(qualified.queue, qualified.warrant, {
430
432
  outcome: "merged",
431
433
  evidenceRoot: value.delivery.mergeRoot,
432
434
  now: at(value.recordedAt, 13),
@@ -135,6 +135,8 @@ jobs:
135
135
  native-heartbeat-seconds: ${{ inputs.native-heartbeat-seconds || 300 }}
136
136
  delivery-class: ${{ github.event.client_payload.candidate.deliveryClass || inputs.delivery-class || 'native-proof-required' }}
137
137
  delivery-priority: ${{ github.event.client_payload.candidate.priority || inputs.delivery-priority || 'ordinary' }}
138
+ queue-admission-context: Queue admission lease
139
+ active-lease-context: Queue family lease/exact
138
140
  landing-mode: queue
139
141
  dry-run: false
140
142
  secrets: