@kungfu-tech/buildchain 3.0.6-alpha.0 → 3.0.6-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 (72) hide show
  1. package/README.md +4 -4
  2. package/actions/promote-buildchain-ref/README.md +8 -0
  3. package/bin/buildchain.mjs +13 -1
  4. package/contracts/auditable-demo-scenario-v1.schema.json +52 -0
  5. package/dist/site/buildchain-contract.json +47 -27
  6. package/dist/site/buildchain-site.json +165 -44
  7. package/dist/site/capability-registry.json +3 -3
  8. package/dist/site/cli-registry.json +40 -4
  9. package/dist/site/controller-registry.json +20 -4
  10. package/dist/site/kfd-claims.json +140 -19
  11. package/dist/site/kfd-upstream-aggregate.json +9 -9
  12. package/dist/site/manual-registry.json +9 -9
  13. package/dist/site/node-api-registry.json +1161 -180
  14. package/dist/site/page-registry.json +152 -31
  15. package/dist/site/public-surface-audit.json +386 -19
  16. package/dist/site/publication-authority-registry.json +61 -1
  17. package/dist/site/publication-registry.json +4 -4
  18. package/dist/site/release-provenance.json +1 -0
  19. package/dist/site/site-manifest.json +13 -13
  20. package/dist/site/workflow-registry.json +151 -13
  21. package/docs/MAP.md +2 -0
  22. package/docs/auditable-demo.md +58 -11
  23. package/docs/aws-us-elastic-runner-burst-plane.md +114 -80
  24. package/docs/cli-reference.md +154 -0
  25. package/docs/dev-alpha-candidate-patrol.md +13 -5
  26. package/docs/dev-delivery-warrant.md +158 -0
  27. package/docs/node-api-reference.md +54 -15
  28. package/docs/publication-authority.md +11 -0
  29. package/docs/release-candidate.md +19 -2
  30. package/docs/release-governance.md +60 -1
  31. package/docs/reusable-build-surface.md +11 -1
  32. package/docs/shifu-gate-profiles.md +12 -1
  33. package/docs/versioning.md +2 -0
  34. package/package.json +4 -2
  35. package/packages/core/buildchain-publication-authority.js +3 -1
  36. package/packages/core/channel-candidate.js +2 -21
  37. package/packages/core/channel-promotion-baseline.js +199 -0
  38. package/packages/core/dev-delivery-candidate-identity.js +94 -0
  39. package/packages/core/dev-delivery-common.js +73 -0
  40. package/packages/core/dev-delivery-proof.js +252 -0
  41. package/packages/core/dev-delivery-warrant-cancellation.js +94 -0
  42. package/packages/core/dev-delivery-warrant-settlement.js +73 -0
  43. package/packages/core/dev-delivery-warrant.js +591 -0
  44. package/scripts/auditable-demo-bundle-verification.mjs +148 -0
  45. package/scripts/auditable-demo-platform.mjs +86 -50
  46. package/scripts/auditable-demo-presentation.mjs +83 -0
  47. package/scripts/auditable-demo-renditions.mjs +264 -0
  48. package/scripts/auditable-demo.mjs +24 -30
  49. package/scripts/aws-windows-jit-campaign-core.mjs +7 -8
  50. package/scripts/aws-windows-jit-controller.mjs +1 -0
  51. package/scripts/aws-windows-jit-core.mjs +1 -1
  52. package/scripts/build-contract-core.mjs +58 -3
  53. package/scripts/buildchain-cli-help.mjs +8 -0
  54. package/scripts/buildchain-patrol.mjs +9 -0
  55. package/scripts/check-inventory.mjs +1 -0
  56. package/scripts/dev-alpha-candidate-patrol.mjs +45 -48
  57. package/scripts/dev-delivery-proof.mjs +193 -0
  58. package/scripts/dev-delivery-warrant.mjs +426 -0
  59. package/scripts/dev-pr-auto-merge.mjs +497 -55
  60. package/scripts/dev-pr-delivery-warrant.mjs +209 -0
  61. package/scripts/dispatch-artifact-signing-authority.mjs +2 -4
  62. package/scripts/gate-profile-core.mjs +24 -0
  63. package/scripts/generate-site-bundle.mjs +2 -2
  64. package/scripts/git-fetch-process-tree.mjs +142 -0
  65. package/scripts/lifecycle-substage-evidence.mjs +274 -0
  66. package/scripts/locked-source-checkout.mjs +6 -3
  67. package/scripts/resolve-artifact-transfer-mode.mjs +9 -0
  68. package/scripts/resolve-build-contract.mjs +7 -0
  69. package/scripts/route-offline-runners.mjs +1 -0
  70. package/scripts/run-lifecycle-core.mjs +9 -9
  71. package/scripts/shifu-gate-profile.mjs +10 -16
  72. package/scripts/site-capability-metadata.mjs +14 -0
@@ -8,11 +8,11 @@ confidence: high
8
8
  sensitivity: public
9
9
  evidence_grade: A
10
10
  review_state: unreviewed
11
- last_reviewed: 2026-08-02
11
+ last_reviewed: 2026-08-03
12
12
  ai_provenance:
13
13
  model_family: GPT-5
14
14
  product: Codex
15
- generated_at: 2026-08-01
15
+ generated_at: 2026-08-03
16
16
  invisible_information: No hidden model checkpoint, parameters, or private training data were available.
17
17
  ---
18
18
 
@@ -189,7 +189,7 @@ and atomically refuses a sixth accepted instance. Five accepted instances
189
189
  therefore reserve at most USD 21.75. The campaign also persists the
190
190
  operator-observed spend from earlier Windows work, and refuses to arm unless
191
191
  that baseline, all five reservations, and one USD 4.35 fail-closed race
192
- allowance remain below the USD 80 phase cap.
192
+ allowance remain below the USD 110 phase cap.
193
193
 
194
194
  The campaign starts unarmed and expires within 24 hours. Its `CONTROL` record
195
195
  can be created only once: a killed or expired campaign cannot be re-armed by
@@ -199,16 +199,38 @@ paid launch. Reservations are never refunded: a controller crash, ambiguous
199
199
  launch, or successful launch all remain charged to the campaign, favoring a
200
200
  false stop over an accidental budget overrun.
201
201
 
202
+ The 2026-08-03 timeout-only campaign decision narrows the campaign to two
203
+ accepted instances with one active instance at a time. The second reservation
204
+ is an operator-gated repair retry: it may be used only after the first attempt
205
+ is classified as non-counting and runner, EC2, EBS, SSM, and workflow residue
206
+ have returned to zero. The two-slot ledger is a maximum spend boundary, not an
207
+ authorization to consume both reservations.
208
+
202
209
  Each stack owns a stack-scoped reaper log group, so an independent retained
203
210
  one-shot campaign stack can be created without colliding with another
204
211
  campaign's audit log resource.
205
212
 
206
- The tag-filtered AWS Budget is defense in depth, not the authoritative launch
207
- gate. It is disabled by default because a linked account cannot activate a
208
- cost-allocation tag. Set `EnableTagFilteredBudget=true` only after the AWS
209
- Organizations management account has activated `kungfu:provider` and a Cost
210
- Explorer readback proves that `windows-ec2-jit` spend is visible. The DynamoDB
211
- reservation cap remains mandatory in either mode.
213
+ The account-native AWS Budget is defense in depth, not the authoritative launch
214
+ gate. It is owned by the singleton
215
+ `kungfu-buildchain-windows-jit-budget-guard` stack rather than any retained
216
+ campaign stack. This prevents Budget-name collisions and prevents a stale
217
+ campaign reaper from becoming the provider-wide cost authority. The Budget
218
+ filters exactly `USAGE_TYPE=BoxUsage:c7i.4xlarge`,
219
+ `OPERATION=RunInstances:0002` (Windows), and `REGION=us-east-1`; its 80% and
220
+ 95% actual notifications persist the provider kill sentinel, terminate every
221
+ tagged Windows JIT instance, and delete scoped JIT parameters. Every launch
222
+ controller refuses to proceed when the sentinel exists or when the Budget
223
+ identity or dimension filter does not match.
224
+
225
+ Budget installation is intentionally deployable by the workload account without
226
+ AWS Organizations management-account access. It fails closed unless Cost
227
+ Explorer exposes all three AWS-owned billing dimensions in the requested phase
228
+ window. The `kungfu:provider=windows-ec2-jit` resource tag remains mandatory for
229
+ ownership, cleanup, and IAM scoping, but it is not a billing filter. Do not
230
+ create an unfiltered fallback Budget or treat an incomplete dimension readback
231
+ as evidence.
232
+ The DynamoDB campaign reservation remains the atomic launch authority because
233
+ Cost Explorer and AWS Budgets can lag provider activity.
212
234
 
213
235
  Qualification requires one runner-profile smoke and three trusted exact-source
214
236
  full Windows jobs all bound to the same campaign, independent cancellation and
@@ -216,82 +238,94 @@ timeout cleanup exercises, and zero repository runner, EC2 instance,
216
238
  disposable volume, min capacity, and desired capacity within 15 minutes of the
217
239
  final job.
218
240
 
219
- ### Phase 2 campaign controller
220
-
221
- `scripts/aws-windows-jit-campaign.mjs` is the one-shot operator boundary.
222
- Without a mutation mode it emits the arm plan. `arm-campaign` requires the
223
- campaign id, exact source SHA, state table, observed prior phase spend, and a
224
- bounded one-to-five accepted-instance ceiling to be repeated as confirmations,
225
- then creates `CONTROL` and `CAMPAIGN#<id>` with
226
- `attribute_not_exists`
227
- conditions. DynamoDB therefore refuses a second campaign in the same retained
228
- state table. The operator can always use `kill-campaign`; there is deliberately
229
- no clear or re-arm operation.
230
-
231
- Every `scripts/aws-windows-jit-controller.mjs --execute` call must provide the
232
- same `--campaign-id`, `--confirm-campaign-id`, `--state-table`, and
233
- `--confirm-state-table`. After the GitHub, AMI, active-instance, SSM, and EC2
234
- DryRun checks pass, the controller
235
- atomically reserves one run. Duplicate run-attempt-qualification identities,
236
- source mismatch, expiry, `KILLED`, the sixth accepted instance, or a
237
- reservation that would exceed the baseline-adjusted USD 80 phase ceiling all
238
- fail closed before `RunInstances`.
239
-
240
- Example dry-run and arm boundary (do not execute without a new campaign budget
241
- decision):
241
+ ### Phase 2 operator workflow
242
+
243
+ `pnpm operator:windows-jit` is the reusable lifecycle entrypoint. Its default
244
+ mode is `plan`, which performs no AWS or GitHub call. A plan binds the account,
245
+ region, unique campaign and stack names, source SHA/ref, Cost Explorer window,
246
+ workflow id, network, OIDC provider, expiry, slot ceiling, singleton Budget
247
+ identity, and exact confirmation digest.
248
+
249
+ The modes are deliberately separated:
250
+
251
+ - `plan` emits the deterministic mutation boundary and digest.
252
+ - `audit` reads AWS and GitHub only. It verifies the account, disabled workflow,
253
+ singleton guard stack, exact Budget filter, SNS thresholds/subscribers,
254
+ provider kill sentinel, campaign stack, and zero EC2/EBS/SSM/JIT/runner
255
+ residue.
256
+ - `install-budget --execute` deploys or updates only the singleton Budget guard.
257
+ It refuses to mutate unless all exact Windows billing dimensions are visible,
258
+ the Windows workflow is disabled, and the account, campaign, source, Budget,
259
+ and plan digest confirmations match.
260
+ - `prepare --execute` requires the installed Budget guard, absent kill
261
+ sentinel, fresh Cost Explorer readback filtered by `BoxUsage:c7i.4xlarge`,
262
+ `RunInstances:0002`, and `us-east-1`, zero residue, a
263
+ never-used campaign stack name, and the disabled workflow. The receipt binds
264
+ the query timestamp and exact filter identity. Preparation deploys the
265
+ campaign stack and atomically arms the ledger with that provider-spend
266
+ baseline. It never enables or dispatches the workflow and never creates EC2
267
+ capacity.
268
+ - `close --execute` disables the workflow first, persists `KILLED`, publishes
269
+ the campaign kill switch, and reports terminal success only after EC2, EBS,
270
+ SSM, JIT parameter, and GitHub runner residue is zero. It is safe to rerun
271
+ while the reaper settles.
272
+
273
+ All mutating modes require `--execute`, `--confirm-plan-digest`,
274
+ `--confirm-account-id`, `--confirm-campaign-id`, and
275
+ `--confirm-source-sha`. Budget installation and preparation additionally
276
+ require `--confirm-budget-name`. A future paid workload still requires a
277
+ separate exact workflow/run authorization and uses
278
+ `scripts/aws-windows-jit-controller.mjs`; preparation is not paid-launch
279
+ authority.
280
+
281
+ Start by recording one reproducible plan:
242
282
 
243
283
  ```bash
244
- windows_campaign=win-REPLACE_WITH_CAMPAIGN_ID
245
- windows_source=REPLACE_WITH_EXACT_40_CHARACTER_SHA
246
- windows_state_table=REPLACE_WITH_CAMPAIGN_STATE_TABLE
247
- windows_expires_at=REPLACE_WITH_ISO_TIMESTAMP_WITHIN_24_HOURS
248
- windows_phase_spend_baseline_usd=REPLACE_WITH_OBSERVED_PRIOR_WINDOWS_SPEND
249
- windows_max_accepted_instances=REPLACE_WITH_INTEGER_FROM_1_THROUGH_5
250
-
251
- node scripts/aws-windows-jit-campaign.mjs plan-arm \
252
- --campaign-id "$windows_campaign" \
253
- --source-sha "$windows_source" \
254
- --state-table "$windows_state_table" \
255
- --expires-at "$windows_expires_at" \
256
- --phase-spend-baseline-usd "$windows_phase_spend_baseline_usd" \
257
- --max-accepted-instances "$windows_max_accepted_instances"
258
-
259
- node scripts/aws-windows-jit-campaign.mjs arm-campaign \
260
- --campaign-id "$windows_campaign" \
261
- --confirm-campaign-id "$windows_campaign" \
262
- --source-sha "$windows_source" \
263
- --confirm-source-sha "$windows_source" \
264
- --state-table "$windows_state_table" \
265
- --confirm-state-table "$windows_state_table" \
266
- --expires-at "$windows_expires_at" \
267
- --phase-spend-baseline-usd "$windows_phase_spend_baseline_usd" \
268
- --confirm-phase-spend-baseline-usd "$windows_phase_spend_baseline_usd" \
269
- --max-accepted-instances "$windows_max_accepted_instances" \
270
- --confirm-max-accepted-instances "$windows_max_accepted_instances"
284
+ pnpm operator:windows-jit plan \
285
+ --aws-profile us \
286
+ --account-id 727884401362 \
287
+ --campaign-id win-REPLACE \
288
+ --source-sha REPLACE_WITH_EXACT_40_CHARACTER_SHA \
289
+ --source-ref refs/heads/dev/v4/v4.0 \
290
+ --observed-at REPLACE_WITH_ISO_TIMESTAMP \
291
+ --expires-at REPLACE_WITH_ISO_TIMESTAMP_WITHIN_24_HOURS \
292
+ --cost-start REPLACE_WITH_PHASE_START_DATE \
293
+ --cost-end REPLACE_WITH_EXCLUSIVE_END_DATE \
294
+ --max-accepted-instances 1 \
295
+ --workflow-id 322620360 \
296
+ --vpc-id REPLACE_WITH_VPC_ID \
297
+ --subnet-id REPLACE_WITH_SUBNET_ID \
298
+ --oidc-provider-arn REPLACE_WITH_GITHUB_OIDC_PROVIDER_ARN
271
299
  ```
272
300
 
273
- Arming creates a permanent one-shot control record and admits only the
274
- explicitly confirmed number of paid instances, never more than five. Its
275
- rollback is fail-closed, not deletion: `kill-campaign` first
276
- persists `KILLED`, then publishes to the dedicated SNS topic so the reaper
277
- terminates active card-owned instances and removes their JIT parameters. The
278
- command is idempotent, but the operator must read back DynamoDB, EC2, SSM, and
279
- GitHub runners before treating cleanup as complete:
301
+ Reuse those exact arguments for `audit`, `install-budget`, `prepare`, or
302
+ `close`; never regenerate `--observed-at` between the plan and its confirmed
303
+ mutation. Capture stdout as the operator receipt. Do not put credentials,
304
+ tokens, JIT configuration, or signed URLs in arguments or receipts.
280
305
 
281
- ```bash
282
- windows_kill_topic=REPLACE_WITH_DEDICATED_KILL_SWITCH_TOPIC_ARN
283
-
284
- node scripts/aws-windows-jit-campaign.mjs kill-campaign \
285
- --campaign-id "$windows_campaign" \
286
- --confirm-campaign-id "$windows_campaign" \
287
- --source-sha "$windows_source" \
288
- --confirm-source-sha "$windows_source" \
289
- --state-table "$windows_state_table" \
290
- --confirm-state-table "$windows_state_table" \
291
- --kill-switch-topic "$windows_kill_topic" \
292
- --confirm-kill-switch-topic "$windows_kill_topic" \
293
- --reason operator-kill
294
- ```
306
+ ### Lower-level campaign and launch controllers
307
+
308
+ `scripts/aws-windows-jit-campaign-core.mjs` owns the pure one-shot ledger
309
+ contract used by the operator and launch controller. Arming creates `CONTROL`
310
+ and `CAMPAIGN#<id>` with `attribute_not_exists` conditions, so DynamoDB refuses
311
+ a second campaign in the same retained state table. There is deliberately no
312
+ clear or re-arm operation.
313
+
314
+ Every `scripts/aws-windows-jit-controller.mjs --execute` call must provide the
315
+ same `--account-id`, `--campaign-id`, `--confirm-campaign-id`, `--state-table`,
316
+ and `--confirm-state-table`. Before GitHub JIT material is created, the
317
+ controller verifies the exact provider Budget/dimension filter and proves the
318
+ global Budget kill sentinel absent. After the GitHub, AMI, active-instance,
319
+ SSM, and EC2 DryRun checks pass, the controller
320
+ atomically reserves one run. Duplicate run-attempt-qualification identities,
321
+ source mismatch, expiry, `KILLED`, the sixth accepted instance, or a
322
+ reservation that would exceed the USD 110 ceiling after combining the persisted
323
+ fresh Cost Explorer baseline with all in-flight campaign reservations all fail
324
+ closed in one DynamoDB transaction before `RunInstances`. AWS Budget alarms are
325
+ defense in depth for delayed billing telemetry; the atomic ledger is the
326
+ authoritative launch-time guard. The operator is the only supported mutation
327
+ surface for campaign preparation and closeout; direct imports of the core are
328
+ not operator authority.
295
329
 
296
330
  ## Phase 3 contract
297
331
 
@@ -223,6 +223,160 @@ buildchain dev
223
223
  buildchain dev merge-queue --repository <owner/repo> --branch <dev/vN/vN.M> [--from-config | --workflow <required-workflow.yml>...] [--cwd <dir>] [--check-response-timeout-minutes <n>] [--max-entries-to-build <n>] [--apply]
224
224
  ```
225
225
 
226
+ ### `buildchain dev pr-admit`
227
+
228
+ - Help: `buildchain dev pr-admit --help`
229
+ - Canonical id: `dev`
230
+ - Options: `--branch`, `--execute`, `--expected-head`, `--json`, `--output`, `--pull-request`, `--repository`
231
+ - Syntax:
232
+
233
+ ```text
234
+ buildchain dev pr-admit --repository <owner/repo> --branch <dev/vN/vN.M> --pull-request <n> --expected-head <sha> [--execute] [--output <file>] [--json]
235
+ ```
236
+
237
+ ### `buildchain dev proof classify`
238
+
239
+ - Help: `buildchain dev proof classify --help`
240
+ - Canonical id: `dev`
241
+ - Options: `--json`, `--output`
242
+ - Syntax:
243
+
244
+ ```text
245
+ buildchain dev proof <source|verify-source|classify|replay|integration|verify-integration> [--output <file>] [--json]
246
+ ```
247
+
248
+ ### `buildchain dev proof integration`
249
+
250
+ - Help: `buildchain dev proof integration --help`
251
+ - Canonical id: `dev`
252
+ - Options: `--json`, `--output`
253
+ - Syntax:
254
+
255
+ ```text
256
+ buildchain dev proof <source|verify-source|classify|replay|integration|verify-integration> [--output <file>] [--json]
257
+ ```
258
+
259
+ ### `buildchain dev proof replay`
260
+
261
+ - Help: `buildchain dev proof replay --help`
262
+ - Canonical id: `dev`
263
+ - Options: `--json`, `--output`
264
+ - Syntax:
265
+
266
+ ```text
267
+ buildchain dev proof <source|verify-source|classify|replay|integration|verify-integration> [--output <file>] [--json]
268
+ ```
269
+
270
+ ### `buildchain dev proof source`
271
+
272
+ - Help: `buildchain dev proof source --help`
273
+ - Canonical id: `dev`
274
+ - Options: `--json`, `--output`
275
+ - Syntax:
276
+
277
+ ```text
278
+ buildchain dev proof <source|verify-source|classify|replay|integration|verify-integration> [--output <file>] [--json]
279
+ ```
280
+
281
+ ### `buildchain dev proof verify-integration`
282
+
283
+ - Help: `buildchain dev proof verify-integration --help`
284
+ - Canonical id: `dev`
285
+ - Options: `--json`, `--output`
286
+ - Syntax:
287
+
288
+ ```text
289
+ buildchain dev proof <source|verify-source|classify|replay|integration|verify-integration> [--output <file>] [--json]
290
+ ```
291
+
292
+ ### `buildchain dev proof verify-source`
293
+
294
+ - Help: `buildchain dev proof verify-source --help`
295
+ - Canonical id: `dev`
296
+ - Options: `--json`, `--output`
297
+ - Syntax:
298
+
299
+ ```text
300
+ buildchain dev proof <source|verify-source|classify|replay|integration|verify-integration> [--output <file>] [--json]
301
+ ```
302
+
303
+ ### `buildchain dev warrant cancel-queued`
304
+
305
+ - Help: `buildchain dev warrant cancel-queued --help`
306
+ - Canonical id: `dev`
307
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
308
+ - Syntax:
309
+
310
+ ```text
311
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
312
+ ```
313
+
314
+ ### `buildchain dev warrant close`
315
+
316
+ - Help: `buildchain dev warrant close --help`
317
+ - Canonical id: `dev`
318
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
319
+ - Syntax:
320
+
321
+ ```text
322
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
323
+ ```
324
+
325
+ ### `buildchain dev warrant heartbeat`
326
+
327
+ - Help: `buildchain dev warrant heartbeat --help`
328
+ - Canonical id: `dev`
329
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
330
+ - Syntax:
331
+
332
+ ```text
333
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
334
+ ```
335
+
336
+ ### `buildchain dev warrant observe`
337
+
338
+ - Help: `buildchain dev warrant observe --help`
339
+ - Canonical id: `dev`
340
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
341
+ - Syntax:
342
+
343
+ ```text
344
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
345
+ ```
346
+
347
+ ### `buildchain dev warrant recover`
348
+
349
+ - Help: `buildchain dev warrant recover --help`
350
+ - Canonical id: `dev`
351
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
352
+ - Syntax:
353
+
354
+ ```text
355
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
356
+ ```
357
+
358
+ ### `buildchain dev warrant select`
359
+
360
+ - Help: `buildchain dev warrant select --help`
361
+ - Canonical id: `dev`
362
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
363
+ - Syntax:
364
+
365
+ ```text
366
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
367
+ ```
368
+
369
+ ### `buildchain dev warrant submit`
370
+
371
+ - Help: `buildchain dev warrant submit --help`
372
+ - Canonical id: `dev`
373
+ - Options: `--branch`, `--execute`, `--json`, `--output`, `--repository`
374
+ - Syntax:
375
+
376
+ ```text
377
+ buildchain dev warrant <submit|select|heartbeat|recover|close|cancel-queued|observe> --repository <owner/repo> --branch <dev/vN/vN.M> [--execute] [--output <file>] [--json]
378
+ ```
379
+
226
380
  ## `diagnostics`
227
381
 
228
382
  ### `buildchain diagnostics`
@@ -8,12 +8,12 @@ confidence: high
8
8
  sensitivity: public
9
9
  evidence_grade: A
10
10
  review_state: self-reviewed
11
- last_reviewed: 2026-08-03
11
+ last_reviewed: 2026-08-04
12
12
  ai_provenance:
13
13
  model_family: GPT-5
14
14
  product: Codex
15
- generated_at: 2026-07-29
16
- visible_context: Existing Buildchain source locks, Kungfu exact-source Alpha preflight, Dev Patrol, protected auto-merge policy, repository release governance, and the consumer-owned settlement renderer threat model.
15
+ generated_at: 2026-08-04
16
+ visible_context: Existing Buildchain source locks, Kungfu exact-source Alpha preflight, Dev Patrol, cancelled duplicate runs, protected auto-merge policy, repository release governance, and the consumer-owned settlement renderer threat model.
17
17
  invisible_context_boundary: No credentials, private logs, or private configuration were used.
18
18
  ---
19
19
 
@@ -27,8 +27,10 @@ bounded development history from newest to oldest (stopping early at the Alpha
27
27
  head), and selects the newest commit that satisfies all of these conditions:
28
28
 
29
29
  - the source is strictly ahead of the recorded target head;
30
- - the latest completed Dev Patrol for that exact commit SHA succeeded;
31
- - the latest completed Alpha preflight for the same commit SHA succeeded; and
30
+ - the latest completed, non-cancelled Dev Patrol for that exact commit SHA
31
+ succeeded;
32
+ - the latest completed, non-cancelled Alpha preflight for the same commit SHA
33
+ succeeded; and
32
34
  - both runs are within the caller's evidence age limit.
33
35
 
34
36
  The selected commit can be behind the observed development head when newer
@@ -37,6 +39,12 @@ head, selected SHA, and count of skipped newer commits. This makes a slow native
37
39
  verification lane live under continuous development without silently treating
38
40
  an unqualified head as releasable.
39
41
 
42
+ A cancelled workflow run carries no qualification verdict, so a newer
43
+ cancelled duplicate does not erase the prior completed verdict for the same
44
+ workflow and source SHA. Other non-success conclusions remain authoritative:
45
+ a newer failed, timed-out, skipped, or otherwise non-successful completed run
46
+ still excludes that SHA and forces the controller to fall back or fail closed.
47
+
40
48
  History discovery is bounded to the newest 1000 development commits. The
41
49
  controller then compares the selected SHA to the exact Alpha head before it can
42
50
  be eligible, so a bounded scan cannot turn a commit outside the promotion
@@ -0,0 +1,158 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: dev-delivery-warrant
5
+ doc_type: technical-reference
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-08-05
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-08-04
16
+ invisible_context: not asserted
17
+ ---
18
+
19
+ # Dev Delivery Warrant Queue
20
+
21
+ Buildchain's Dev Delivery Warrant Queue gives a qualified slow pull request a
22
+ durable, non-preemptive delivery turn without replacing GitHub Merge Queue as
23
+ the final protected-ref authority.
24
+
25
+ The queue is stored on a dedicated Git ref below
26
+ `buildchain/dev-delivery-warrant/`. Every update creates a child Git commit and
27
+ advances the ref without force. The transition receipt binds the expected old
28
+ state root; a competing controller receives a visible non-fast-forward failure
29
+ instead of a second authority claim.
30
+
31
+ ## Contract
32
+
33
+ A submission binds the repository, protected dev line, pull request, semantic
34
+ source identity, exact source head, native Assignment and Initiative roots,
35
+ source patch or tree intent, reusable Source Qualification Proof, plan,
36
+ affected closure, dependencies, toolchain, delivery class, priority, attempts,
37
+ and retained enqueue time.
38
+
39
+ Selection is deterministic FIFO plus aging with bounded priority. Priority may
40
+ reorder queued work, but it cannot preempt the active Warrant. Exactly one
41
+ candidate receives a leased Warrant containing a fencing token, lease
42
+ generation, expected-old state root, expiry, and the complete exact source
43
+ binding. Heartbeat extends only that generation. Expiry recovery rejects the
44
+ old token, retains queue age, and returns the candidate to selection.
45
+
46
+ A terminal event may cancel a candidate before selection without minting a
47
+ Warrant. This transition is limited to an exact non-active queued candidate and
48
+ binds its candidate root, pull request, recorded source head, event-observed
49
+ source head, terminal event action, evidence root, and expected-old queue root.
50
+ An active candidate still requires its current fencing token and lease
51
+ generation. Exact duplicate cancellation evidence is a visible no-op; identity,
52
+ state, event, or evidence drift fails closed.
53
+
54
+ The reusable terminal controller uses one `settle` operation for active,
55
+ queued, already-terminal, and never-admitted pull requests. An active Warrant
56
+ still requires its exact fence and evidence. A matching queued cancellation is
57
+ persisted normally. A duplicate terminal event or a pull request that never
58
+ entered Warrant authority returns a rooted explicit no-op instead of failing
59
+ the workflow or inventing queue state.
60
+
61
+ The supported priority classes are `ordinary`, `expedited`, and `emergency`.
62
+ The queue does not infer an emergency: callers must choose it explicitly under
63
+ their reviewed policy. Delivery classes are `non-native-fast`,
64
+ `native-proof-required`, `cross-platform`, and `release`.
65
+
66
+ ## Split proof authority
67
+
68
+ Source Qualification Proof is independent of the moving dev base. It binds the
69
+ semantic source, exact source head and patch/tree intent, plan, affected
70
+ closure, dependencies, toolchain, covered paths, and shard evidence.
71
+
72
+ Before reuse, the consumer classifies the dev delta:
73
+
74
+ - unchanged roots plus an unrelated attributed delta reuse source
75
+ qualification and run only a cheap Project Cut replay. GitHub's `behind`
76
+ state is accepted only when a rooted replay proof binds the exact current
77
+ protected base, unchanged PR head and source patch, replay tree, required
78
+ context roots, and a qualified `project.cut.merge-queue-admission/v1`
79
+ receipt;
80
+ - an overlapping delta reruns the affected source shards;
81
+ - an unknown graph or changed source, plan, closure, dependency, or toolchain
82
+ root fails closed to full source qualification.
83
+
84
+ Integration Delivery Proof is separate and cannot be cached across candidates.
85
+ It binds the exact current dev base, replay tree, GitHub `merge_group` head and
86
+ tree, active Warrant fencing generation, Source Qualification Proof root, and
87
+ final required-context roots. GitHub's exact merge-group checks remain the
88
+ final integration authority.
89
+
90
+ ## CLI
91
+
92
+ Queue commands are dry-run by default:
93
+
94
+ ```sh
95
+ buildchain dev warrant submit --repository owner/repository \
96
+ --branch dev/v4/v4.0 --pull-request 123 --source-head <sha> \
97
+ --assignment-root <root> --initiative-root <root> \
98
+ --source-identity-root <root> --source-patch-root <root> \
99
+ --source-proof-root <root> --plan-root <root> --closure-root <root> \
100
+ --dependency-root <root> --toolchain-root <root> \
101
+ --delivery-class native-proof-required
102
+
103
+ buildchain dev warrant select --repository owner/repository \
104
+ --branch dev/v4/v4.0 --execute
105
+
106
+ buildchain dev warrant cancel-queued --repository owner/repository \
107
+ --branch dev/v4/v4.0 --candidate-id <root> --pull-request 123 \
108
+ --expected-source-head <queued-sha> --observed-source-head <event-sha> \
109
+ --expected-old <queue-root> --event-action closed --outcome cancelled \
110
+ --evidence-root <terminal-event-root> --execute
111
+ ```
112
+
113
+ `heartbeat`, `recover`, `close`, `settle`, `cancel-queued`, and `observe` use the same durable authority.
114
+ Warrant-scoped mutations require the exact fencing token and lease generation.
115
+ `close` also requires a rooted terminal evidence object.
116
+
117
+ Proof commands create, verify, classify, and compose the two proof layers:
118
+
119
+ ```sh
120
+ buildchain dev proof source ...
121
+ buildchain dev proof classify --source-proof source-proof.json ...
122
+ buildchain dev proof replay ...
123
+ buildchain dev proof replay-proof \
124
+ --qualification-receipt project-cut-admission.json ...
125
+ buildchain dev proof integration --warrant-result warrant.json ...
126
+ ```
127
+
128
+ ## Workflow rollout and rollback
129
+
130
+ The reusable `dev-pr-auto-merge.yml` supports three explicit rollout modes:
131
+
132
+ - `off` preserves the previous exact-head admission controller;
133
+ - `shadow` qualifies the source and emits a read-only queue submission plan;
134
+ - `required` persists the submission, selects the Warrant, and refuses GitHub
135
+ enqueue unless the immutable queue commit, state root, active Warrant, and
136
+ selected candidate all pass exact readback validation.
137
+
138
+ Consumers should deploy `shadow` first, inspect receipts, then change their
139
+ protected caller to `required`. Rollback is a reviewed caller change back to
140
+ `off`; it does not delete queue history or reinterpret old receipts. The
141
+ terminal reusable workflow creates the exact Integration Delivery Proof for a
142
+ merged candidate (or accepts explicit evidence for another terminal outcome),
143
+ then closes only the current fencing generation. The separate queued
144
+ cancellation reusable workflow cannot close an active generation; it advances
145
+ the state ref only when the caller's complete terminal binding and expected-old
146
+ root still match.
147
+
148
+ Buildchain uses the same contract for its own protected dev line through
149
+ `buildchain-dev-delivery.yml`. The manual caller requires the exact PR head and
150
+ all native/source proof roots, pins the runtime to the caller commit, selects
151
+ `delivery-warrant-mode: required`, and targets GitHub Merge Queue. It does not
152
+ offer an `off` switch: rollback is a reviewed change to this caller, not an
153
+ operator-time weakening of a specific delivery attempt.
154
+
155
+ This mechanism schedules protected delivery only. It does not serialize local
156
+ development, source-only checks, unrelated channels, release publication, or
157
+ runner provisioning. It never grants authority to enable cloud runner
158
+ campaigns.