@kungfu-tech/buildchain 4.0.1-alpha.2 → 4.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/release-tail/README.md +8 -0
- package/architecture/ci-lane-change-budget.json +187 -0
- package/architecture/decisions/0002-next-development-transition.md +101 -0
- package/architecture/decisions/0003-two-phase-delivery-warrant.md +152 -0
- package/architecture/internal-capabilities.json +211 -8
- package/architecture/maintainability-policy.json +113 -28
- package/architecture/release-tail-contract-inventory.json +5 -2
- package/architecture/v3-core-mechanism-inventory.json +91 -0
- package/architecture/v4-adopter-delivery-parity.json +32 -5
- package/architecture/v4-capability-state-machine-manifest.json +73 -0
- package/architecture/v4-compatibility-facts-parity.json +77 -0
- package/architecture/v4-delivery-authority-parity.json +250 -0
- package/architecture/v4-delivery-warrant-shadow-fixtures.json +41 -9
- package/architecture/v4-floating-consumer-policy.json +6 -0
- package/architecture/v4-next-development-parity.json +192 -0
- package/architecture/v4-publication-rehearsal-parity.json +84 -0
- package/architecture/v4-release-train-parity.json +1 -0
- package/architecture/v4-tail-reseal-parity.json +150 -0
- package/bin/buildchain.mjs +32 -3
- package/bin/internal/adopter-delivery-cli.mjs +70 -0
- package/bin/internal/command-registry.mjs +3 -0
- package/bin/internal/compatibility-facts-cli.mjs +101 -0
- package/contracts/dev-delivery-authority-v2.schema.json +662 -0
- package/contracts/fixtures/next-development-transition-v1/anchored-manual-waiting.json +47 -0
- package/contracts/fixtures/next-development-transition-v1/semver-auto-planned.json +47 -0
- package/contracts/fixtures/next-development-transition-v1/version-model-cases.json +40 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/archive-template.json +19 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/bootstrap-positive.json +93 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/gate-positive.json +29 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/gate-unknown-selector.json +26 -0
- package/contracts/fixtures/v4-adopter-delivery-v1/offline-vectors.json +50 -0
- package/contracts/fixtures/v4-compatibility-facts-v1/shared.json +1129 -0
- package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +7 -1
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/artifacts/product.bin +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/config/buildchain.toml +5 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/release-activation.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/documents/signed-channel.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/evidence/qualification.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/candidate.json +5 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/candidate/manifests/release-passport.json +1 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/capsule.json +707 -0
- package/contracts/fixtures/v4-publication-rehearsal-v1/offline-vectors.json +27 -0
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +229 -0
- package/contracts/next-development-request-v1.schema.json +66 -0
- package/contracts/next-development-transition-v1.schema.json +292 -0
- package/contracts/v4-adopter-delivery-v1.schema.json +81 -0
- package/contracts/v4-compatibility-facts-v1.schema.json +230 -0
- package/contracts/v4-floating-consumer-policy-receipt-v1.schema.json +4 -2
- package/contracts/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/contracts/v4-tail-reseal-v1.schema.json +276 -0
- package/dist/site/agent-index.json +5 -0
- package/dist/site/artifact-schemas.json +10 -0
- package/dist/site/buildchain-contract.json +1475 -27
- package/dist/site/buildchain-site.json +627 -31
- package/dist/site/capability-registry.json +17 -14
- package/dist/site/cli-registry.json +205 -3
- package/dist/site/kfd-claims.json +490 -16
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +52 -6
- package/dist/site/node-api-registry.json +14736 -8851
- package/dist/site/page-registry.json +593 -21
- package/dist/site/public-surface-audit.json +837 -48
- package/dist/site/publication-authority-registry.json +44 -8
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +24 -0
- package/dist/site/schemas/dev-delivery-authority-v2.schema.json +662 -0
- package/dist/site/schemas/release-tail-capabilities-v1.schema.json +199 -0
- package/dist/site/schemas/v4-adopter-delivery-v1.schema.json +81 -0
- package/dist/site/schemas/v4-compatibility-facts-v1.schema.json +230 -0
- package/dist/site/schemas/v4-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/dist/site/site-manifest.json +34 -10
- package/dist/site/workflow-registry.json +160 -10
- package/docs/MAP.md +8 -2
- package/docs/cli-reference.md +404 -13
- package/docs/cli.md +8 -0
- package/docs/dev-alpha-candidate-patrol.md +8 -0
- package/docs/dev-delivery-qualification-landing-adr.md +251 -0
- package/docs/dev-delivery-warrant.md +351 -38
- package/docs/next-development-transition.md +118 -0
- package/docs/node-api-reference.md +646 -293
- package/docs/release-tail-provider-plane.md +30 -0
- package/docs/v4-adopter-delivery.md +133 -0
- package/docs/v4-compatibility-facts.md +91 -0
- package/docs/v4-publication-rehearsal.md +130 -0
- package/docs/v4-tail-reseal.md +73 -0
- package/docs/versioning.md +4 -3
- package/package.json +34 -6
- package/packages/core/adopter-delivery-passport.js +259 -0
- package/packages/core/adopter-delivery-vectors.js +158 -0
- package/packages/core/adopter-delivery-vectors.json +77 -0
- package/packages/core/buildchain-agent-manuals.js +3 -0
- package/packages/core/buildchain-compatibility-authority.js +336 -0
- package/packages/core/buildchain-compatibility-fact.js +394 -0
- package/packages/core/buildchain-compatibility-facts.json +217 -0
- package/packages/core/buildchain-compatibility-proof.js +566 -0
- package/packages/core/buildchain-config.js +84 -0
- package/packages/core/buildchain-contract.js +96 -143
- package/packages/core/buildchain-delivery-bootstrap.js +240 -0
- package/packages/core/buildchain-delivery-infrastructure.js +164 -0
- package/packages/core/buildchain-delivery-self-dogfood.js +395 -0
- package/packages/core/buildchain-publication-authority.js +1 -0
- package/packages/core/channel-candidate.js +8 -0
- package/packages/core/channel-promotion-baseline.js +55 -0
- package/packages/core/ci-lane-change-budget.js +247 -0
- package/packages/core/dev-alpha-candidate-selection.js +10 -2
- package/packages/core/dev-delivery-authority-candidate.js +270 -0
- package/packages/core/dev-delivery-authority-evidence.js +146 -0
- package/packages/core/dev-delivery-authority-landing.js +461 -0
- package/packages/core/dev-delivery-authority-observation.js +48 -0
- package/packages/core/dev-delivery-authority-qualification.js +591 -0
- package/packages/core/dev-delivery-authority-settlement.js +213 -0
- package/packages/core/dev-delivery-authority-state.js +583 -0
- package/packages/core/dev-delivery-candidate-identity.js +13 -0
- package/packages/core/dev-delivery-contract-surface.js +76 -0
- package/packages/core/dev-delivery-execution-failure.js +133 -0
- package/packages/core/dev-delivery-execution-transfer.js +592 -0
- package/packages/core/dev-delivery-landing-admission-core.js +119 -0
- package/packages/core/dev-delivery-landing-readback.js +598 -0
- package/packages/core/dev-delivery-landing-terminal-evidence.js +271 -0
- package/packages/core/dev-delivery-landing-testing-port.js +6 -0
- package/packages/core/dev-delivery-native-execution.js +110 -0
- package/packages/core/dev-delivery-native-proof.js +562 -0
- package/packages/core/dev-delivery-process-boundary.js +563 -0
- package/packages/core/dev-delivery-provider-attempt.js +127 -0
- package/packages/core/dev-delivery-provider-heartbeat.js +382 -0
- package/packages/core/dev-delivery-warrant-cancellation.js +1 -0
- package/packages/core/dev-delivery-warrant-qualification.js +145 -0
- package/packages/core/dev-delivery-warrant-settlement.js +237 -36
- package/packages/core/dev-delivery-warrant-state.js +587 -0
- package/packages/core/dev-delivery-warrant.js +328 -370
- package/packages/core/github-governance-authority.js +1 -0
- package/packages/core/index.js +5 -0
- package/packages/core/kungfu-temporal-fact.js +557 -0
- package/packages/core/legacy-kfd-adopter-driver.js +167 -0
- package/packages/core/next-development-candidate-reservation.js +186 -0
- package/packages/core/next-development-controller.js +728 -0
- package/packages/core/next-development-projection.js +287 -0
- package/packages/core/next-development-transition.js +738 -0
- package/packages/core/paper-agent-entry.js +11 -5
- package/packages/core/paper.js +16 -5
- package/packages/core/published-delivery-authority.js +266 -0
- package/packages/core/release-candidate-recovery.js +70 -15
- package/packages/core/release-candidate.js +2 -2
- package/packages/core/release-passport.js +36 -9
- package/packages/core/v4-adopter-delivery-parity.js +3 -3
- package/packages/core/v4-adopter-delivery.js +359 -0
- package/packages/core/v4-canonical-contracts.js +5 -0
- package/packages/core/v4-delivery-warrant-read-candidate.js +10 -3
- package/packages/core/v4-floating-consumer-evidence.js +18 -4
- package/packages/core/v4-floating-consumer-policy.js +143 -20
- package/packages/core/v4-floating-consumer-release-passport.js +32 -5
- package/packages/core/v4-publication-rehearsal-capsule.js +468 -0
- package/packages/core/v4-publication-rehearsal-provider-bindings.js +212 -0
- package/packages/core/v4-publication-rehearsal.js +481 -0
- package/packages/core/v4-tail-reseal-contract.js +26 -0
- package/packages/core/v4-tail-reseal-github.js +178 -0
- package/packages/core/v4-tail-reseal-receipt.js +225 -0
- package/packages/core/v4-tail-reseal.js +594 -0
- package/packages/core/workflow-yaml-contract.js +24 -2
- package/scripts/buildchain-cli-help.mjs +41 -2
- package/scripts/check-ci-lane-change-budget.mjs +100 -0
- package/scripts/check-inventory.mjs +14 -3
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +23 -4
- package/scripts/dev-alpha-candidate-patrol.mjs +22 -1
- package/scripts/dev-delivery-authority-command-adapters.mjs +206 -0
- package/scripts/dev-delivery-authority-provider.mjs +28 -0
- package/scripts/dev-delivery-authority.mjs +490 -0
- package/scripts/dev-delivery-native-run.mjs +177 -0
- package/scripts/dev-delivery-process-boundary.mjs +260 -0
- package/scripts/dev-delivery-proof.mjs +67 -2
- package/scripts/dev-delivery-provider-heartbeat.mjs +215 -0
- package/scripts/dev-delivery-source-proof-replay.mjs +153 -0
- package/scripts/dev-delivery-source-proof-reuse.mjs +13 -97
- package/scripts/dev-delivery-two-phase-resume.mjs +345 -0
- package/scripts/dev-delivery-two-phase.mjs +573 -0
- package/scripts/dev-delivery-warrant-options.mjs +266 -0
- package/scripts/dev-delivery-warrant-store.mjs +231 -0
- package/scripts/dev-delivery-warrant.mjs +232 -194
- package/scripts/dev-pr-auto-merge.mjs +1 -1
- package/scripts/dev-pr-delivery-warrant.mjs +11 -0
- package/scripts/dev-qualification-patrol.mjs +9 -9
- package/scripts/dispatch-artifact-signing-authority.mjs +1 -1
- package/scripts/generate-channel-promotion-workflow.mjs +2 -2
- package/scripts/generate-next-development-guidance.mjs +49 -0
- package/scripts/generate-release-candidate-passport.mjs +152 -0
- package/scripts/generate-site-bundle.mjs +69 -4
- package/scripts/init-repo.mjs +22 -4
- package/scripts/next-development-self-dogfood-harness.mjs +460 -0
- package/scripts/next-development-self-dogfood.mjs +597 -0
- package/scripts/next-development-transition.mjs +47 -0
- package/scripts/npm-publish-transaction.mjs +2 -2
- package/scripts/promotion-channel-router.mjs +4 -4
- package/scripts/release-candidate-anchor-provenance.mjs +99 -0
- package/scripts/release-tail.mjs +51 -3
- package/scripts/release-train-self-dogfood.mjs +94 -92
- package/scripts/resume-from-candidate-run.mjs +557 -30
- package/scripts/site-capability-metadata.mjs +41 -0
- package/scripts/stable-candidate-qualification.mjs +9 -10
- package/scripts/v4-consumer-policy.mjs +5 -5
- package/scripts/v4-publication-rehearsal-fixture.mjs +144 -0
- package/scripts/v4-tail-reseal-macos-rehearsal.mjs +134 -0
- package/scripts/v4-tail-reseal.mjs +416 -0
- package/templates/native-dev-delivery.yml +143 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
status: accepted
|
|
3
|
+
period: ongoing
|
|
4
|
+
theme: dev-delivery-qualification-landing-authority
|
|
5
|
+
doc_type: architecture-decision-record
|
|
6
|
+
source_level: local-files
|
|
7
|
+
confidence: high
|
|
8
|
+
sensitivity: public
|
|
9
|
+
evidence_grade: A
|
|
10
|
+
review_state: self-reviewed
|
|
11
|
+
last_reviewed: 2026-08-15
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# ADR: Qualification Leases and the exclusive Landing Warrant
|
|
15
|
+
|
|
16
|
+
## Decision
|
|
17
|
+
|
|
18
|
+
Buildchain has two explicit protected-dev authority modes:
|
|
19
|
+
|
|
20
|
+
1. `single-flight-warrant` is the default and continues to use the
|
|
21
|
+
`kungfu-buildchain-dev-delivery-warrant-queue` v1 state and
|
|
22
|
+
`buildchain dev warrant` commands unchanged.
|
|
23
|
+
2. `bounded-qualification-landing` is opt-in and uses the
|
|
24
|
+
`kungfu-buildchain-dev-delivery-authority` v2 state. It may issue up to the
|
|
25
|
+
configured number of Qualification Leases, but it may issue exactly one
|
|
26
|
+
Landing Warrant.
|
|
27
|
+
|
|
28
|
+
The modes use different contracts and CLI command families on one canonical
|
|
29
|
+
state ref. There is no implicit reinterpretation of a v1 Warrant. A consumer
|
|
30
|
+
turns the new mode on only by explicitly migrating the exact current v1 state
|
|
31
|
+
and deploying the v2 controller against the canonical
|
|
32
|
+
`buildchain/dev-delivery-warrant/<dev-line>` state ref.
|
|
33
|
+
The migration command reads the canonical
|
|
34
|
+
`buildchain/dev-delivery-warrant/<dev-line>` ref itself, records its exact
|
|
35
|
+
commit and state root, and rechecks both immediately before an expected-old,
|
|
36
|
+
non-force update replaces v1 bytes with v2 bytes on that same ref. A v1
|
|
37
|
+
controller then fails closed instead of becoming a parallel writer, while the
|
|
38
|
+
prior v1 commit remains immutable Git history. Caller-supplied legacy JSON is
|
|
39
|
+
never migration authority.
|
|
40
|
+
|
|
41
|
+
Migration preserves the immutable v1 `stateRoot`, candidate identity, source
|
|
42
|
+
and proof roots, fencing token, generation, and lease times in a rooted
|
|
43
|
+
migration receipt. An active provisional Warrant becomes a
|
|
44
|
+
qualification-only lease and remains unable to admit `merge_group`; an active
|
|
45
|
+
qualified Warrant becomes the one exclusive Landing Warrant. The migration is
|
|
46
|
+
one-shot: a v2 state is never accepted as v1 input, and source/evidence bytes
|
|
47
|
+
are not regenerated. The legacy ref remains immutable rollback evidence.
|
|
48
|
+
|
|
49
|
+
## Authority invariants
|
|
50
|
+
|
|
51
|
+
A Qualification Lease carries:
|
|
52
|
+
|
|
53
|
+
- `authority = qualification-only`;
|
|
54
|
+
- `mergeGroupAdmission = false`;
|
|
55
|
+
- one exact candidate id, token, generation, issue time, and expiry; and
|
|
56
|
+
- a place in a list bounded by `policy.maxQualificationLeases`.
|
|
57
|
+
|
|
58
|
+
It authorizes expensive qualification work only. It cannot authorize GitHub
|
|
59
|
+
`merge_group`, cannot be upgraded in place to landing authority, and is removed
|
|
60
|
+
when qualification evidence is recorded. Each new candidate declares a sorted
|
|
61
|
+
set of rooted `qualificationDomains` and, for native delivery classes, the
|
|
62
|
+
exact `environmentRoot` established before native execution. Candidates with
|
|
63
|
+
disjoint sets may hold leases concurrently. An overlapping set is serialized;
|
|
64
|
+
an empty set is treated as unknown and therefore conflicts with every active
|
|
65
|
+
candidate. The scheduler returns a content-rooted reason for either refusal.
|
|
66
|
+
|
|
67
|
+
The native candidate phase runs in its own GitHub-hosted job without controller
|
|
68
|
+
or provider write credentials anywhere in its process ancestry. A dependent
|
|
69
|
+
credentialed finalizer must use live provider job readback to prove a different
|
|
70
|
+
job id and runner identity, ordered after native completion, and must verify the
|
|
71
|
+
content-addressed proof/state transfer, twice-read recursive regular-file-only
|
|
72
|
+
membership, canonical manifest and failure bytes, exact success or failure
|
|
73
|
+
manifest, live PR head, protected ref, and semantic native proof before it
|
|
74
|
+
rereads the exact live fence and records qualification or terminal settlement.
|
|
75
|
+
The failure chain binds its canonical evidence root to the transfer root,
|
|
76
|
+
provider boundary root, terminal native job, Warrant state root, and exact
|
|
77
|
+
fence. Candidate exit,
|
|
78
|
+
including exit zero from a shell whose descendant detached and unset runner
|
|
79
|
+
tracking, never grants provider mutation or Landing authority by itself.
|
|
80
|
+
Persistent self-hosted runners are unsupported because a job dependency does
|
|
81
|
+
not prove descendant cleanup or a fresh process authority domain.
|
|
82
|
+
|
|
83
|
+
Heartbeat authority is also process-separated. A credentialed GitHub-hosted
|
|
84
|
+
heartbeat job runs on a provider runner domain distinct from admission, native
|
|
85
|
+
execution, evidence sealing, and finalization. It advances only the admitted
|
|
86
|
+
fence with expected-old state roots, retains every transition receipt and
|
|
87
|
+
receipt root, and stops only after live provider readback shows native and seal
|
|
88
|
+
terminal. Every participating runner must be in the exact `GitHub Actions`
|
|
89
|
+
hosted group; a self-hosted group or label fails admission. The credentialless
|
|
90
|
+
native controller retains only the immutable admitted fence in memory and
|
|
91
|
+
never receives provider credentials or rewrites durable state. If renewal is
|
|
92
|
+
lost, the hosted heartbeat coordinator rereads and records the exact current
|
|
93
|
+
attempt but deliberately withholds GitHub's run-scoped cancellation call,
|
|
94
|
+
because a successor rerun can take over the same run coordinate after readback.
|
|
95
|
+
The stale fence stops further durable renewal, and terminal cleanup waits for
|
|
96
|
+
exact-attempt readback. The finalizer independently rereads those jobs and the durable
|
|
97
|
+
authority state, verifies the entire root chain, and requires the latest live
|
|
98
|
+
state root before any provider mutation.
|
|
99
|
+
|
|
100
|
+
The Landing Warrant carries:
|
|
101
|
+
|
|
102
|
+
- `authority = merge-group-admission`;
|
|
103
|
+
- `mergeGroupAdmission = true`;
|
|
104
|
+
- one exact qualified candidate id, token, generation, issue time, and expiry;
|
|
105
|
+
and
|
|
106
|
+
- the only non-null `landingWarrant` slot in the durable state.
|
|
107
|
+
|
|
108
|
+
Only `admitDevDeliveryMergeGroup` and `buildchain dev authority
|
|
109
|
+
admit-merge-group` consume Landing authority. They bind the exact current state
|
|
110
|
+
root, candidate, protected base, source head, merge-group head, token, and
|
|
111
|
+
generation. Before persistence, the public Node API and CLI adapter accept only
|
|
112
|
+
the current run and run-attempt locator, then derive the workflow ref and SHA,
|
|
113
|
+
current Landing-authority job, hosted runner, source head, and merge-group head
|
|
114
|
+
from live GitHub readback. The raw verified-attempt transition is internal and
|
|
115
|
+
caller-supplied provider fields have no package export path. A Qualification
|
|
116
|
+
Lease fails closed at this boundary.
|
|
117
|
+
|
|
118
|
+
A new Landing Warrant is eligible only from
|
|
119
|
+
`authority = verified-native-qualification` with
|
|
120
|
+
`nativeProofAuthority = true` and the complete verified source proof, native
|
|
121
|
+
proof, execution binding, execution receipt, command, qualification contract,
|
|
122
|
+
and qualification receipt roots. `legacy-compatibility-only` evidence remains
|
|
123
|
+
readable and an already-active migrated historical Landing fence remains
|
|
124
|
+
exclusive for safe handoff, but compatibility evidence cannot mint a new
|
|
125
|
+
Landing Warrant.
|
|
126
|
+
|
|
127
|
+
The state normalizer rejects a lease beyond the configured bound, duplicate
|
|
128
|
+
Qualification Leases for one candidate, a candidate holding qualification and
|
|
129
|
+
Landing authority together, a Landing Warrant without its exact landing
|
|
130
|
+
candidate, and any state-root drift. Git expected-old, non-force ref advancement
|
|
131
|
+
continues to serialize durable mutations. These checks retain the existing
|
|
132
|
+
two-phase safety rule: source/native qualification is evidence, while the
|
|
133
|
+
exclusive final authority is candidate- and integration-specific.
|
|
134
|
+
|
|
135
|
+
## Bounded scheduler and recovery
|
|
136
|
+
|
|
137
|
+
Landing selection is FIFO among candidates that have completed qualification.
|
|
138
|
+
When a later candidate receives a Landing Warrant, each older nonterminal
|
|
139
|
+
candidate consumes one durable overtake from its
|
|
140
|
+
`policy.maxLandingOvertakes` budget. Once an older candidate reaches that
|
|
141
|
+
bound, later candidates cannot receive a Warrant. The older candidate receives
|
|
142
|
+
the next landing priority after qualification, or reaches a rooted terminal
|
|
143
|
+
failure after `policy.maxQualificationAttempts` heartbeat expiries. This makes
|
|
144
|
+
the bound independent of controller restart frequency or later arrival rate;
|
|
145
|
+
setting it to zero enforces strict FIFO landing priority.
|
|
146
|
+
|
|
147
|
+
Qualification Leases and Landing Warrants both support fenced heartbeats. An
|
|
148
|
+
expired qualification-only lease may be recovered because its stale token can
|
|
149
|
+
never admit `merge_group`. An expired Landing Warrant remains the exclusive
|
|
150
|
+
slot: elapsed time does not prove that an already-admitted provider attempt
|
|
151
|
+
stopped. Recovery therefore returns a rooted stop-required no-op until exact
|
|
152
|
+
provider stop or terminal evidence settles that same token and generation.
|
|
153
|
+
The cleanup verifier is independent of the caller and must return one rooted,
|
|
154
|
+
terminal readback bound to the exact repository, protected base and observed
|
|
155
|
+
base head, state root, candidate, pull request, source head, Landing token and
|
|
156
|
+
generation, provider run and job, and an observation time fresh for that
|
|
157
|
+
Warrant. A merged outcome additionally requires provider comparison evidence
|
|
158
|
+
that the admitted merge-group head is contained by the protected base. If the
|
|
159
|
+
PR later merges another head, the old attempt settles as dequeued rather than
|
|
160
|
+
receiving false merge evidence. Forged roots, wrong bindings, nonterminal
|
|
161
|
+
states, and stale observations fail closed. Only then does the deterministic
|
|
162
|
+
wake expose the next fair landing candidate. Completion, cancellation,
|
|
163
|
+
terminal failure, dequeue, and already-merged settlement emit the same wake
|
|
164
|
+
shape. Exact duplicate heartbeats, recovery, and terminal events are
|
|
165
|
+
state-root-preserving no-ops. Competing controllers still commit through one
|
|
166
|
+
expected-old, non-force ref update, so only one transition can become durable.
|
|
167
|
+
|
|
168
|
+
After merge-group admission, every Landing heartbeat carries the exact
|
|
169
|
+
persisted provider-attempt document as explicit input. Before renewal, the
|
|
170
|
+
GitHub adapter rereads that exact workflow run attempt and job and requires
|
|
171
|
+
both to remain active with the admitted repository, source head, merge-group
|
|
172
|
+
head, workflow, job, runner, and protected-base bindings. A controller that
|
|
173
|
+
has only the Landing fence cannot extend authority; the public renewal surface
|
|
174
|
+
does not accept a caller-supplied readback adapter. An exact-attempt loss or
|
|
175
|
+
terminal readback fails closed, and an already-expired Landing Warrant cannot
|
|
176
|
+
be revived by a later provider observation.
|
|
177
|
+
|
|
178
|
+
## Terminal settlement
|
|
179
|
+
|
|
180
|
+
Terminal provider evidence is authoritative cleanup input. A matching merged,
|
|
181
|
+
failed, dequeued, or cancelled candidate releases its Qualification Lease or
|
|
182
|
+
Landing Warrant in the same expected-old state transition, even when the lease
|
|
183
|
+
TTL has not expired. An active authority requires its exact token and
|
|
184
|
+
generation for that transition. Repeating the same outcome and evidence is a
|
|
185
|
+
root-preserving no-op; outcome or evidence drift fails closed. A terminal event
|
|
186
|
+
for a candidate that never entered the state is also an explicit no-op.
|
|
187
|
+
|
|
188
|
+
For every Landing Warrant, caller-supplied outcome and evidence are not cleanup
|
|
189
|
+
authority, regardless of whether its TTL has expired. The settlement uses the independently verified provider
|
|
190
|
+
readback outcome and evidence root after exact binding and freshness checks.
|
|
191
|
+
It reads `/actions/runs/{run_id}/attempts/{run_attempt}` rather than the mutable
|
|
192
|
+
run-scoped projection, and verifies the caller workflow through its persisted
|
|
193
|
+
workflow id and workflow endpoint rather than misclassifying it as a referenced
|
|
194
|
+
reusable workflow. The current pull-request head is observational during
|
|
195
|
+
terminal cleanup: synchronization may advance it, while the admitted source
|
|
196
|
+
head remains immutable in the candidate and provider-attempt evidence.
|
|
197
|
+
Before sealing, runtime validation enforces the published terminal schema:
|
|
198
|
+
completed run and job states, a non-empty run conclusion, an allowed terminal
|
|
199
|
+
job conclusion, and an `open` or `closed` pull-request state.
|
|
200
|
+
Terminal failure normalization preserves the native transfer root, finalizer
|
|
201
|
+
boundary root, native and seal job ids, admitted provider-attempt coordinates,
|
|
202
|
+
and the terminal readback root. Partial coordinate sets and round-trip drift
|
|
203
|
+
fail closed.
|
|
204
|
+
|
|
205
|
+
Qualification TTL recovery remains crash recovery, not the normal terminal
|
|
206
|
+
cleanup path. Landing crash recovery additionally requires provider stop or
|
|
207
|
+
terminal reconciliation before exclusive authority is released. Because the
|
|
208
|
+
GitHub cancellation API is run-scoped rather than attempt-scoped, expired
|
|
209
|
+
Landing cleanup never issues a run-level cancellation; it waits for terminal
|
|
210
|
+
readback of the exact admitted attempt and cannot cancel a later rerun.
|
|
211
|
+
|
|
212
|
+
Every later durable candidate for the same pull request must use
|
|
213
|
+
`chained-attempt-v2` and name the immediately preceding durable candidate. The
|
|
214
|
+
predecessor must already be terminal. The submission adapter derives this link
|
|
215
|
+
from the latest persisted state, while normalization rejects unchained,
|
|
216
|
+
skipped, nonterminal, or cross-PR predecessors.
|
|
217
|
+
|
|
218
|
+
## Public contract
|
|
219
|
+
|
|
220
|
+
- Machine schema:
|
|
221
|
+
[`contracts/dev-delivery-authority-v2.schema.json`](../contracts/dev-delivery-authority-v2.schema.json),
|
|
222
|
+
packaged as `dist/site/schemas/dev-delivery-authority-v2.schema.json`.
|
|
223
|
+
- Node API: `@kungfu-tech/buildchain/dev-delivery-authority` exports the v2
|
|
224
|
+
state, migration, lease, heartbeat, recovery, Landing, admission,
|
|
225
|
+
observation, settlement, terminal-readback creation, and Landing readback
|
|
226
|
+
verification functions. The older expired-Landing verifier name remains a
|
|
227
|
+
compatibility alias. `@kungfu-tech/buildchain/dev-delivery-warrant`
|
|
228
|
+
remains byte- and behavior-compatible for v1 consumers.
|
|
229
|
+
- CLI: `buildchain dev authority
|
|
230
|
+
<migrate|submit|lease-qualification|heartbeat-qualification|complete-qualification|lease-landing|heartbeat-landing|recover|admit-merge-group|settle|observe>`.
|
|
231
|
+
- Generated references: [`cli-reference.md`](cli-reference.md) and
|
|
232
|
+
[`node-api-reference.md`](node-api-reference.md).
|
|
233
|
+
|
|
234
|
+
The existing public `dev-pr-auto-merge.yml` reusable workflow remains the
|
|
235
|
+
single-flight v1 controller and does not advertise v2 Landing guarantees.
|
|
236
|
+
Bounded v2 is a separate opt-in controller contract built from the public CLI,
|
|
237
|
+
Node API, and schema; merely calling the v1 reusable workflow never enables or
|
|
238
|
+
claims it. Buildchain's tracked floating `@v4-alpha` self-delivery caller
|
|
239
|
+
continues to exercise that public v1 path without overstating v2 execution.
|
|
240
|
+
|
|
241
|
+
All mutations are plan-only unless `--execute` is supplied. Merge-group
|
|
242
|
+
admission is always a read-only authority check; it never mutates GitHub Merge
|
|
243
|
+
Queue itself.
|
|
244
|
+
|
|
245
|
+
## Consequences
|
|
246
|
+
|
|
247
|
+
Qualification throughput can increase without increasing the number of
|
|
248
|
+
candidates permitted to land. Consumers retain the byte- and behavior-compatible
|
|
249
|
+
single-flight default until they deliberately deploy the v2 mode. The tradeoff
|
|
250
|
+
is a second state contract and controller family; Buildchain keeps that
|
|
251
|
+
separation explicit so a rollout cannot silently weaken Warrant semantics.
|