@kungfu-tech/buildchain 4.0.1-alpha.8 → 4.0.1
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/README.md +9 -6
- package/actions/v4-release-candidate-promote/README.md +3 -0
- package/architecture/agent-change-map.md +1015 -0
- package/architecture/ci-lane-change-budget.json +70 -1
- package/architecture/decisions/0004-v4-declarative-release-tail.md +47 -0
- package/architecture/internal-capabilities.json +156 -11
- package/architecture/maintainability-debt.json +3229 -0
- package/architecture/maintainability-policy.json +480 -129
- package/architecture/v3-core-mechanism-inventory.json +4 -3
- package/architecture/v3-v4-capability-closure.md +59 -0
- package/architecture/v3-v4-live-capability-inventory.json +102404 -0
- package/architecture/v4-cross-platform-adopter-qualification.json +52 -0
- package/architecture/v4-delivery-warrant-shadow-fixtures.json +3 -3
- package/architecture/v4-runtime-semantic-closure.json +710 -0
- package/bin/internal/trust-release-release-handlers.mjs +5 -0
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/contracts/v4-publication-qualification-v1.schema.json +51 -0
- package/dist/site/agent-index.json +1 -0
- package/dist/site/artifact-schemas.json +2 -0
- package/dist/site/buildchain-contract.json +123 -32
- package/dist/site/buildchain-site.json +96 -28
- package/dist/site/capability-registry.json +6 -6
- package/dist/site/cli-registry.json +5 -2
- package/dist/site/controller-registry.json +41 -5
- package/dist/site/kfd-claims.json +170 -21
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +6 -6
- package/dist/site/node-api-registry.json +1474 -215
- package/dist/site/page-registry.json +85 -17
- package/dist/site/public-surface-audit.json +85 -20
- package/dist/site/publication-authority-registry.json +28 -1
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +5 -0
- package/dist/site/schemas/v4-publication-qualification-v1.schema.json +51 -0
- package/dist/site/site-manifest.json +10 -10
- package/dist/site/workflow-registry.json +94 -18
- package/docs/MAP.md +1 -1
- package/docs/cli-reference.md +4 -4
- package/docs/dev-delivery-warrant.md +12 -9
- package/docs/node-api-reference.md +291 -206
- package/docs/publish-transaction.md +11 -4
- package/docs/release-candidate.md +7 -0
- package/docs/v4-adopter-delivery.md +23 -4
- package/docs/v4-declarative-release-tail-migration.md +43 -0
- package/package.json +8 -3
- package/packages/core/adopter-delivery-passport.js +36 -0
- package/packages/core/buildchain-contract.js +31 -1
- package/packages/core/buildchain-publication-authority.js +1 -0
- package/packages/core/dev-delivery-warrant-settlement.js +239 -3
- package/packages/core/dev-delivery-warrant-state.js +15 -2
- package/packages/core/dev-delivery-warrant.js +21 -4
- package/packages/core/github-governance-authority.js +4 -4
- package/packages/core/index.js +1 -0
- package/packages/core/paper-scaffold-content.js +401 -0
- package/packages/core/paper.js +12 -378
- package/packages/core/publication-control-plane-audit.js +135 -111
- package/packages/core/publication-rehearsal-projection.js +104 -0
- package/packages/core/publication-rehearsal-runtime.js +190 -0
- package/packages/core/release-candidate-recovery.js +6 -5
- package/packages/core/release-passport.js +82 -184
- package/packages/core/v4-cross-platform-adopter-qualification.js +343 -0
- package/packages/core/v4-floating-consumer-policy.js +3 -2
- package/packages/core/v4-floating-consumer-release-passport.js +134 -15
- package/packages/core/v4-publication-qualification.js +222 -0
- package/scripts/artifact-signing-controller-core.mjs +1 -1
- package/scripts/audit-publication-control-plane.mjs +17 -17
- package/scripts/buildchain-cli-help.mjs +3 -0
- package/scripts/check-internal-architecture.mjs +23 -3
- package/scripts/check-inventory.mjs +23 -5
- package/scripts/check-maintainability.mjs +145 -4
- package/scripts/check-project-cut-merge-queue-admission.mjs +87 -0
- package/scripts/check-v3-v4-capability-inventory.mjs +574 -0
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +10 -3
- package/scripts/check-v4-runtime-semantic-closure.mjs +266 -0
- package/scripts/dev-delivery-warrant-options.mjs +27 -11
- package/scripts/dev-delivery-warrant.mjs +45 -5
- package/scripts/dev-pr-auto-merge.mjs +25 -11
- package/scripts/dev-pr-delivery-warrant.mjs +44 -0
- package/scripts/dev-pr-prequeue-guard.mjs +0 -18
- package/scripts/dispatch-artifact-signing-authority.mjs +1 -1
- package/scripts/generate-agent-change-map.mjs +118 -0
- package/scripts/generate-release-candidate-passport.mjs +26 -1
- package/scripts/generate-site-bundle.mjs +6 -0
- package/scripts/maintainability-domain-metrics.mjs +237 -0
- package/scripts/maintainability-governance.mjs +473 -0
- package/scripts/maintainability-metrics.mjs +28 -6
- package/scripts/project-cut-merge-queue-admission.mjs +394 -0
- package/scripts/promotion-routing-evidence.mjs +35 -6
- package/scripts/release-candidate-resolver.mjs +44 -0
- package/scripts/release-line-policy.mjs +25 -15
- package/scripts/release-tail.mjs +19 -2
- package/scripts/resume-from-candidate-run.mjs +106 -103
- package/scripts/run-lifecycle-core.mjs +341 -376
- package/scripts/site-capability-metadata.mjs +4 -0
- package/scripts/stable-candidate-qualification.mjs +9 -10
- package/scripts/v3-v4-capability-catalog.mjs +439 -0
- package/scripts/v4-cross-platform-adopter-qualification.mjs +228 -0
- package/scripts/v4-declarative-promotion-admission.mjs +42 -0
|
@@ -97,6 +97,13 @@ state for `vX.Y.Z-alpha.N` and cannot resume it with the same transaction
|
|
|
97
97
|
identity, alpha version selection must advance to the next prerelease instead
|
|
98
98
|
of reusing or overwriting that failed transaction slot.
|
|
99
99
|
|
|
100
|
+
The immutable `publish-gate/{alpha,release}/.../<version>` source lock also
|
|
101
|
+
reserves its exact version when a failure happens before durable transaction
|
|
102
|
+
state can be created. A later candidate with a different source SHA advances to
|
|
103
|
+
the next version; it never rebinds or overwrites the earlier source lock. The
|
|
104
|
+
same source SHA reuses its own lock so authority planning and mutation stay on
|
|
105
|
+
one exact version.
|
|
106
|
+
|
|
100
107
|
`release-candidate-promote.yml` can establish or restore this state from an
|
|
101
108
|
older successful candidate run through the documented fresh-event recovery
|
|
102
109
|
inputs. The recovery receipt and sealed bundle are verified before the action
|
|
@@ -251,10 +258,10 @@ Example reused OCI evidence entry (the pre-publish requirement may omit
|
|
|
251
258
|
|
|
252
259
|
Buildchain distinguishes two npm release modes:
|
|
253
260
|
|
|
254
|
-
| Mode
|
|
255
|
-
|
|
|
256
|
-
| `publish-final-version`
|
|
257
|
-
| `promote-existing-version` | same-version alpha-to-latest recovery | `npm-token`
|
|
261
|
+
| Mode | Use | Auth | npm operation |
|
|
262
|
+
| -------------------------- | ------------------------------------- | -------------------- | ----------------------------------------------- |
|
|
263
|
+
| `publish-final-version` | normal alpha or stable publication | `trusted-publishing` | `npm publish --tag <alpha\|vX.Y-alpha\|latest>` |
|
|
264
|
+
| `promote-existing-version` | same-version alpha-to-latest recovery | `npm-token` | `npm dist-tag add <pkg>@<version> latest` |
|
|
258
265
|
|
|
259
266
|
The normal libnode path is `publish-final-version`: publish an alpha package set
|
|
260
267
|
such as `22.22.3-kf.3-alpha.0` with the `alpha` dist-tag, then publish a
|
|
@@ -234,6 +234,13 @@ restored sealed bundle, and a conflicting payload digest fails closed. Ordinary
|
|
|
234
234
|
duplicate publication without a complete recovery receipt retains the stricter
|
|
235
235
|
same-name/same-digest rule for all assets.
|
|
236
236
|
|
|
237
|
+
If that explicit complete recovery finds that the public Release Passport is
|
|
238
|
+
absent, it may restore the complete locally verified evidence closure. Before
|
|
239
|
+
the first upload, Buildchain rejects undeclared remote assets and compares every
|
|
240
|
+
same-name remote asset byte-for-byte; any unknown name or digest conflict fails
|
|
241
|
+
closed without mutation. Ordinary duplicate publication cannot enter this
|
|
242
|
+
repair path.
|
|
243
|
+
|
|
237
244
|
After a transaction finalizes, the target branch can legitimately advance from
|
|
238
245
|
the original promotion SHA. Repeating explicit recovery accepts that movement
|
|
239
246
|
only when the caller supplies the exact durable transaction identity, the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
status: preview
|
|
3
|
-
period: 2026-08-
|
|
3
|
+
period: 2026-08-27
|
|
4
4
|
theme: buildchain-v4-adopter-delivery
|
|
5
5
|
doc_type: product-manual
|
|
6
6
|
source_level: local-files
|
|
@@ -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-
|
|
11
|
+
last_reviewed: 2026-08-27
|
|
12
12
|
ai_provenance:
|
|
13
13
|
model_family: GPT-5
|
|
14
14
|
product: Codex
|
|
15
|
-
generated_at: 2026-08-
|
|
16
|
-
visible_context: Exact protected v3 adopter-delivery cut, v4 pure contract core, published npm archive bytes,
|
|
15
|
+
generated_at: 2026-08-27
|
|
16
|
+
visible_context: Exact protected v3 adopter-delivery cut, v4 pure contract core, published npm archive bytes, public consumer policy, complete v3 capability inventory, and rooted cross-platform qualification reports.
|
|
17
17
|
invisible_context_boundary: No credentials, provider mutations, signing operations, publication operations, or release authority were used.
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -124,6 +124,25 @@ committed byte roots, semantic identity, and authority readback root. It has
|
|
|
124
124
|
only `contents: read`; no provider credential or production writer is accepted
|
|
125
125
|
or synthesized.
|
|
126
126
|
|
|
127
|
+
## Cross-platform capability qualification
|
|
128
|
+
|
|
129
|
+
The reusable workflow also produces a rooted report on `linux-x64`,
|
|
130
|
+
`macos-arm64`, and `windows-x64`. Each report binds `job.workflow_sha`, the
|
|
131
|
+
consumer source SHA, and the complete 4,648-row v3-to-v4 inventory. Source-only
|
|
132
|
+
capabilities retain their raw category counts with an `exact-source-route`
|
|
133
|
+
applicability; they are not mislabeled as operating-system executions.
|
|
134
|
+
|
|
135
|
+
The executable boundary is exercised rather than inferred: a public run must
|
|
136
|
+
pass, a substituted readback must fail, retry must reproduce the original root,
|
|
137
|
+
terminal verification and N-1 bootstrap must pass, and the independent
|
|
138
|
+
`ledger-specification-driver` clean-room test must pass without a KFD package.
|
|
139
|
+
The workflow then reconciles one exact report from each platform. Final family
|
|
140
|
+
qualification combines the Buildchain self-dogfood and `agent-hub-demo`
|
|
141
|
+
matrices through the exported
|
|
142
|
+
`@kungfu-tech/buildchain/v4-cross-platform-adopter-qualification` aggregator.
|
|
143
|
+
The report and aggregate explicitly grant no production, provider, release, or
|
|
144
|
+
stable-publication authority.
|
|
145
|
+
|
|
127
146
|
## Offline vectors
|
|
128
147
|
|
|
129
148
|
[`offline-vectors.json`](../contracts/fixtures/v4-adopter-delivery-v1/offline-vectors.json)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
status: active
|
|
3
|
+
period: ongoing
|
|
4
|
+
theme: buildchain-v4-declarative-release-tail
|
|
5
|
+
doc_type: migration-guide
|
|
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-26
|
|
12
|
+
ai_provenance:
|
|
13
|
+
model_family: GPT-5
|
|
14
|
+
product: Codex
|
|
15
|
+
generated_at: 2026-08-26
|
|
16
|
+
invisible_context: unavailable
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Migrate a release-candidate promotion to the v4 Provider Plane
|
|
20
|
+
|
|
21
|
+
Persist the public workflow call at the floating major ref and keep the matching contract lock in the consumer repository:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
jobs:
|
|
25
|
+
promote:
|
|
26
|
+
uses: kungfu-systems/buildchain/.github/workflows/release-candidate-promote.yml@v4
|
|
27
|
+
with:
|
|
28
|
+
buildchain-contract-lock-path: .buildchain/contract-lock.json
|
|
29
|
+
declarative-release-tail: true
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The Build/Verify workflow now uploads these candidate-owned inputs together:
|
|
33
|
+
|
|
34
|
+
- `release-candidate-passport.json`
|
|
35
|
+
- `release-candidate-stage-capsules.json`
|
|
36
|
+
- `release-candidate-publication-qualification.json`
|
|
37
|
+
- the typed payload and manifest artifacts bound by those documents
|
|
38
|
+
|
|
39
|
+
Remove all v4 values for `publish-command`, `publication-gate-command`, `publication-consumer-qualification-command`, `publication-commit-command`, `release-activation-command`, `release-passport-evidence-command`, KFD/invariant command inputs, and every other `command`, `cmd`, `script`, `shell`, or `run` field. v4 admission rejects them before publication planning. Do not replace them with a wrapper script or a standalone workflow; declare provider evidence and let the reusable workflow execute the fixed Provider Plane.
|
|
40
|
+
|
|
41
|
+
On interruption, rerun with the same candidate and transaction state. Buildchain verifies the candidate/source/artifact/policy roots and continues from the first missing standardized receipt. Never delete the state file to make a failed capability replay from the beginning.
|
|
42
|
+
|
|
43
|
+
v3 workflow calls retain their existing command-compatible behavior. Migrating a v3 consumer is an explicit contract change, not an automatic reinterpretation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungfu-tech/buildchain",
|
|
3
|
-
"version": "4.0.1
|
|
3
|
+
"version": "4.0.1",
|
|
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",
|
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
"./v4-tail-reseal": "./packages/core/v4-tail-reseal.js",
|
|
49
49
|
"./v4-tail-reseal-receipt": "./packages/core/v4-tail-reseal-receipt.js",
|
|
50
50
|
"./v4-publication-rehearsal": "./packages/core/v4-publication-rehearsal.js",
|
|
51
|
+
"./publication-rehearsal-runtime": "./packages/core/publication-rehearsal-runtime.js",
|
|
52
|
+
"./publication-rehearsal-projection": "./packages/core/publication-rehearsal-projection.js",
|
|
53
|
+
"./v4-publication-qualification": "./packages/core/v4-publication-qualification.js",
|
|
51
54
|
"./adopter-delivery-gate": "./packages/core/adopter-delivery-gate.js",
|
|
52
55
|
"./kfd-adopter-category-driver": "./packages/core/kfd-adopter-category-driver.js",
|
|
53
56
|
"./buildchain-delivery-infrastructure": "./packages/core/buildchain-delivery-infrastructure.js",
|
|
@@ -58,6 +61,7 @@
|
|
|
58
61
|
"./adopter-delivery-passport": "./packages/core/adopter-delivery-passport.js",
|
|
59
62
|
"./adopter-delivery-vectors": "./packages/core/adopter-delivery-vectors.js",
|
|
60
63
|
"./v4-adopter-delivery": "./packages/core/v4-adopter-delivery.js",
|
|
64
|
+
"./v4-cross-platform-adopter-qualification": "./packages/core/v4-cross-platform-adopter-qualification.js",
|
|
61
65
|
"./logging": "./packages/core/logging.js",
|
|
62
66
|
"./portable-dev-cache": "./packages/core/portable-dev-cache.js",
|
|
63
67
|
"./publication-artifact": "./packages/core/publication-artifact.js",
|
|
@@ -114,6 +118,7 @@
|
|
|
114
118
|
"./site/schemas/v4-publication-rehearsal-capsule-v1.schema.json": "./dist/site/schemas/v4-publication-rehearsal-capsule-v1.schema.json",
|
|
115
119
|
"./site/schemas/v4-adopter-delivery-v1.schema.json": "./dist/site/schemas/v4-adopter-delivery-v1.schema.json",
|
|
116
120
|
"./site/schemas/release-tail-capabilities-v1.schema.json": "./dist/site/schemas/release-tail-capabilities-v1.schema.json",
|
|
121
|
+
"./site/schemas/v4-publication-qualification-v1.schema.json": "./dist/site/schemas/v4-publication-qualification-v1.schema.json",
|
|
117
122
|
"./site/buildchain-contract.json": "./dist/site/buildchain-contract.json",
|
|
118
123
|
"./site/product-mechanism.json": "./dist/site/product-mechanism.json",
|
|
119
124
|
"./site/release-provenance.json": "./dist/site/release-provenance.json",
|
|
@@ -151,8 +156,8 @@
|
|
|
151
156
|
"scripts": {
|
|
152
157
|
"precheck:static": "prettier --check architecture/decisions/0003-two-phase-delivery-warrant.md architecture/v4-delivery-authority-parity.json contracts/dev-delivery-authority-v2.schema.json dist/site/schemas/dev-delivery-authority-v2.schema.json docs/dev-delivery-qualification-landing-adr.md packages/core/dev-delivery-authority-candidate.js packages/core/dev-delivery-authority-evidence.js packages/core/dev-delivery-authority-landing.js packages/core/dev-delivery-authority-observation.js packages/core/dev-delivery-authority-qualification.js packages/core/dev-delivery-authority-settlement.js packages/core/dev-delivery-authority-state.js packages/core/dev-delivery-execution-failure.js packages/core/dev-delivery-execution-transfer.js packages/core/dev-delivery-landing-readback.js packages/core/dev-delivery-landing-terminal-evidence.js packages/core/dev-delivery-landing-testing-port.js packages/core/dev-delivery-native-execution.js packages/core/dev-delivery-native-proof.js packages/core/dev-delivery-process-boundary.js packages/core/dev-delivery-warrant-qualification.js packages/core/dev-delivery-warrant-state.js scripts/dev-delivery-authority-command-adapters.mjs scripts/dev-delivery-authority-provider.mjs scripts/dev-delivery-authority.mjs scripts/dev-delivery-native-run.mjs scripts/dev-delivery-process-boundary.mjs scripts/dev-delivery-two-phase-resume.mjs scripts/dev-delivery-two-phase.mjs scripts/dev-delivery-warrant-options.mjs scripts/dev-delivery-warrant-store.mjs templates/native-dev-delivery.yml",
|
|
153
158
|
"operator:windows-jit": "bash scripts/aws-windows-jit-operator.sh",
|
|
154
|
-
"check": "pnpm run check:static && node scripts/check-ci-lane-change-budget.mjs && node scripts/check-v4-public-dogfood-contract.mjs && node scripts/check-v4-floating-consumer-policy-contract.mjs && pnpm run check:v4-bridge && pnpm run check:v4-contracts && node scripts/check-maintainability.mjs && node scripts/check-internal-architecture.mjs && node scripts/check-inventory.mjs && node scripts/check-core-mechanism-inventory.mjs && node scripts/check-release-tail-contract.mjs && node scripts/v4-publication-rehearsal-fixture.mjs --check && node scripts/v4-architecture.mjs validate && node scripts/v4-warrant-shadow-plan.mjs validate && pnpm run check:site && pnpm run check:workflows && pnpm run test:unit && pnpm run check:golden-path && node scripts/check-action-bundles.mjs",
|
|
155
|
-
"check:static": "node scripts/check-javascript-syntax.mjs && prettier --check architecture/*.json contracts/release-tail-provider-bindings-v1.schema.json contracts/v4-canonical-contracts-v1.schema.json contracts/v4-compatibility-facts-v1.schema.json contracts/v4-delivery-warrant-semantic-diff-report-v1.schema.json contracts/v4-delivery-warrant-trace-v1.schema.json contracts/v4-floating-consumer-policy-receipt-v1.schema.json contracts/v4-runtime-ref-resume-authority-v1.schema.json contracts/v4-tail-reseal-v1.schema.json contracts/v4-host-contract-v1.schema.json contracts/v4-provider-operation-journal-v1.schema.json contracts/v4-release-activation-shadow-v1.schema.json contracts/v4-stable-publication-fence-v1.schema.json contracts/v4-partial-mutation-recovery-v1.schema.json contracts/v4-stage-capsule-v1.schema.json contracts/v4-stage-capsule-store-v1.schema.json contracts/v4-stage-capsule-resume-v1.schema.json contracts/release-tail-capabilities-v1.schema.json contracts/fixtures/release-tail-capabilities-v1/*.json contracts/fixtures/v4-delivery-warrant-trace-v1/*.json contracts/fixtures/v4-floating-consumer-policy-v1/*.json contracts/fixtures/v4-runtime-ref-resume-authority-v1/*.json contracts/fixtures/v4-tail-reseal-v1/*.json contracts/fixtures/v4-compatibility-facts-v1/*.json contracts/fixtures/v4-provider-operation-journal-v1/*.json contracts/fixtures/v4-provider-readback-idempotency-v1/*.json contracts/fixtures/v4-release-activation-shadow-v1/*.json contracts/fixtures/v4-stable-publication-fence-v1/*.json contracts/fixtures/v4-partial-mutation-recovery-v1/*.json contracts/fixtures/v4-stage-capsule-v1/*.json contracts/fixtures/v4-stage-capsule-store-v1/*.json contracts/fixtures/v4-stage-capsule-resume-v1/*.json bin/internal/command-registry.mjs bin/internal/compatibility-facts-cli.mjs packages/core/v4-canonical-contracts.js packages/core/kungfu-temporal-fact.js packages/core/buildchain-compatibility-fact.js packages/core/buildchain-compatibility-authority.js packages/core/buildchain-compatibility-proof.js packages/core/v4-floating-consumer-evidence.js packages/core/v4-floating-consumer-policy.js packages/core/v4-floating-consumer-release-passport.js packages/core/v4-runtime-ref-resume-authority.js packages/core/v4-tail-reseal-contract.js packages/core/v4-tail-reseal-github.js packages/core/v4-tail-reseal-receipt.js packages/core/v4-tail-reseal.js packages/core/v4-runtime-selector-persistence.js packages/core/v4-provider-operation-journal.js packages/core/v4-provider-readback-idempotency.js packages/core/v4-release-activation-shadow.js packages/core/v4-stable-publication-fence.js packages/core/v4-partial-mutation-recovery-qualification.js packages/core/v4-stage-capsule.js packages/core/v4-stage-capsule-store.js packages/core/v4-stage-capsule-local-store.js packages/core/v4-platform-stage-checkpoints.js packages/core/v4-stage-capsule-resume-planner.js packages/core/v4-stage-capsule-qualification.js packages/core/v4-stage-capsule-qualification-campaign.js packages/core/v4-delivery-warrant-fixture-runner.js packages/core/v4-delivery-warrant-read-candidate.js packages/core/v4-delivery-warrant-semantic-diff-gate.js packages/core/v4-delivery-warrant-shadow-adapter.js scripts/authorize-promotion-runtime-override.cjs scripts/check-core-mechanism-inventory.mjs scripts/check-release-tail-contract.mjs scripts/check-javascript-syntax.mjs scripts/check-maintainability.mjs scripts/dev-pr-prequeue-guard.mjs scripts/check-v4-public-dogfood-contract.mjs scripts/maintainability-metrics.mjs scripts/public-reference.mjs scripts/site-reference-registry.mjs scripts/generate-public-reference.mjs scripts/v4-architecture.mjs scripts/v4-bridge-bootstrap.mjs scripts/v4-bridge-evidence.mjs scripts/v4-consumer-policy.mjs scripts/v4-host-adapter.mjs scripts/v4-platform-stage-checkpoint-rehearsal.mjs scripts/v4-stage-capsule-resume-rehearsal.mjs scripts/v4-stage-capsule-qualification.mjs scripts/v4-tail-reseal-macos-rehearsal.mjs scripts/v4-tail-reseal.mjs scripts/v4-warrant-shadow-plan.mjs scripts/verify-golden-path.mjs tests/authorize-promotion-runtime-override.test.mjs tests/command-registry.test.mjs tests/core-mechanism-inventory.test.mjs tests/release-tail-contract.test.mjs tests/maintainability.test.mjs tests/promotion-responsibilities.test.mjs tests/public-reference.test.mjs tests/v4-architecture.test.mjs tests/v4-bridge.test.mjs tests/v4-canonical-contracts.test.mjs tests/v4-delivery-warrant-fixture-runner.test.mjs tests/v4-delivery-warrant-read-candidate.test.mjs tests/v4-floating-consumer-policy.test.mjs tests/v4-runtime-ref-resume-authority.test.mjs tests/v4-tail-reseal.test.mjs tests/v4-tail-reseal-parity.test.mjs tests/v4-compatibility-facts.test.mjs tests/v4-platform-stage-checkpoints.test.mjs tests/v4-provider-operation-journal.test.mjs tests/v4-provider-readback-idempotency.test.mjs tests/v4-public-dogfood-contract.test.mjs tests/v4-release-activation-shadow.test.mjs tests/v4-stable-publication-fence.test.mjs tests/v4-partial-mutation-recovery-qualification.test.mjs tests/v4-stage-capsule.test.mjs tests/v4-stage-capsule-store.test.mjs tests/v4-stage-capsule-resume-planner.test.mjs tests/v4-stage-capsule-qualification.test.mjs tests/v4-warrant-shadow-plan.test.mjs",
|
|
159
|
+
"check": "pnpm run check:static && node scripts/check-ci-lane-change-budget.mjs && node scripts/check-v4-public-dogfood-contract.mjs && node scripts/check-v4-floating-consumer-policy-contract.mjs && pnpm run check:v4-bridge && pnpm run check:v4-contracts && node scripts/check-maintainability.mjs && node scripts/check-internal-architecture.mjs && node scripts/generate-agent-change-map.mjs && node scripts/check-inventory.mjs && node scripts/check-core-mechanism-inventory.mjs && node scripts/check-v4-runtime-semantic-closure.mjs && node scripts/check-v3-v4-capability-inventory.mjs && node scripts/check-release-tail-contract.mjs && node scripts/v4-publication-rehearsal-fixture.mjs --check && node scripts/v4-architecture.mjs validate && node scripts/v4-warrant-shadow-plan.mjs validate && pnpm run check:site && pnpm run check:workflows && pnpm run test:unit && pnpm run check:golden-path && node scripts/check-action-bundles.mjs",
|
|
160
|
+
"check:static": "node scripts/check-javascript-syntax.mjs && prettier --check architecture/*.json contracts/release-tail-provider-bindings-v1.schema.json contracts/v4-canonical-contracts-v1.schema.json contracts/v4-compatibility-facts-v1.schema.json contracts/v4-delivery-warrant-semantic-diff-report-v1.schema.json contracts/v4-delivery-warrant-trace-v1.schema.json contracts/v4-floating-consumer-policy-receipt-v1.schema.json contracts/v4-runtime-ref-resume-authority-v1.schema.json contracts/v4-tail-reseal-v1.schema.json contracts/v4-host-contract-v1.schema.json contracts/v4-provider-operation-journal-v1.schema.json contracts/v4-release-activation-shadow-v1.schema.json contracts/v4-stable-publication-fence-v1.schema.json contracts/v4-partial-mutation-recovery-v1.schema.json contracts/v4-stage-capsule-v1.schema.json contracts/v4-stage-capsule-store-v1.schema.json contracts/v4-stage-capsule-resume-v1.schema.json contracts/release-tail-capabilities-v1.schema.json contracts/fixtures/release-tail-capabilities-v1/*.json contracts/fixtures/v4-delivery-warrant-trace-v1/*.json contracts/fixtures/v4-floating-consumer-policy-v1/*.json contracts/fixtures/v4-runtime-ref-resume-authority-v1/*.json contracts/fixtures/v4-tail-reseal-v1/*.json contracts/fixtures/v4-compatibility-facts-v1/*.json contracts/fixtures/v4-provider-operation-journal-v1/*.json contracts/fixtures/v4-provider-readback-idempotency-v1/*.json contracts/fixtures/v4-release-activation-shadow-v1/*.json contracts/fixtures/v4-stable-publication-fence-v1/*.json contracts/fixtures/v4-partial-mutation-recovery-v1/*.json contracts/fixtures/v4-stage-capsule-v1/*.json contracts/fixtures/v4-stage-capsule-store-v1/*.json contracts/fixtures/v4-stage-capsule-resume-v1/*.json bin/internal/command-registry.mjs bin/internal/compatibility-facts-cli.mjs packages/core/v4-canonical-contracts.js packages/core/kungfu-temporal-fact.js packages/core/buildchain-compatibility-fact.js packages/core/buildchain-compatibility-authority.js packages/core/buildchain-compatibility-proof.js packages/core/v4-floating-consumer-evidence.js packages/core/v4-floating-consumer-policy.js packages/core/v4-floating-consumer-release-passport.js packages/core/v4-runtime-ref-resume-authority.js packages/core/v4-tail-reseal-contract.js packages/core/v4-tail-reseal-github.js packages/core/v4-tail-reseal-receipt.js packages/core/v4-tail-reseal.js packages/core/v4-runtime-selector-persistence.js packages/core/v4-provider-operation-journal.js packages/core/v4-provider-readback-idempotency.js packages/core/v4-release-activation-shadow.js packages/core/v4-stable-publication-fence.js packages/core/v4-partial-mutation-recovery-qualification.js packages/core/v4-stage-capsule.js packages/core/v4-stage-capsule-store.js packages/core/v4-stage-capsule-local-store.js packages/core/v4-platform-stage-checkpoints.js packages/core/v4-stage-capsule-resume-planner.js packages/core/v4-stage-capsule-qualification.js packages/core/v4-stage-capsule-qualification-campaign.js packages/core/v4-delivery-warrant-fixture-runner.js packages/core/v4-delivery-warrant-read-candidate.js packages/core/v4-delivery-warrant-semantic-diff-gate.js packages/core/v4-delivery-warrant-shadow-adapter.js scripts/authorize-promotion-runtime-override.cjs scripts/check-core-mechanism-inventory.mjs scripts/check-v4-runtime-semantic-closure.mjs scripts/check-release-tail-contract.mjs scripts/check-javascript-syntax.mjs scripts/check-maintainability.mjs scripts/dev-pr-prequeue-guard.mjs scripts/check-v4-public-dogfood-contract.mjs scripts/maintainability-metrics.mjs scripts/maintainability-domain-metrics.mjs scripts/maintainability-governance.mjs scripts/generate-agent-change-map.mjs scripts/public-reference.mjs scripts/site-reference-registry.mjs scripts/generate-public-reference.mjs scripts/v4-architecture.mjs scripts/v4-bridge-bootstrap.mjs scripts/v4-bridge-evidence.mjs scripts/v4-consumer-policy.mjs scripts/v4-host-adapter.mjs scripts/v4-platform-stage-checkpoint-rehearsal.mjs scripts/v4-stage-capsule-resume-rehearsal.mjs scripts/v4-stage-capsule-qualification.mjs scripts/v4-tail-reseal-macos-rehearsal.mjs scripts/v4-tail-reseal.mjs scripts/v4-warrant-shadow-plan.mjs scripts/verify-golden-path.mjs tests/authorize-promotion-runtime-override.test.mjs tests/command-registry.test.mjs tests/core-mechanism-inventory.test.mjs tests/release-tail-contract.test.mjs tests/maintainability.test.mjs tests/maintainability-governance.test.mjs tests/promotion-responsibilities.test.mjs tests/public-reference.test.mjs tests/v4-architecture.test.mjs tests/v4-bridge.test.mjs tests/v4-canonical-contracts.test.mjs tests/v4-delivery-warrant-fixture-runner.test.mjs tests/v4-delivery-warrant-read-candidate.test.mjs tests/v4-floating-consumer-policy.test.mjs tests/v4-runtime-ref-resume-authority.test.mjs tests/v4-runtime-semantic-closure.test.mjs tests/v4-tail-reseal.test.mjs tests/v4-tail-reseal-parity.test.mjs tests/v4-compatibility-facts.test.mjs tests/v4-platform-stage-checkpoints.test.mjs tests/v4-provider-operation-journal.test.mjs tests/v4-provider-readback-idempotency.test.mjs tests/v4-public-dogfood-contract.test.mjs tests/v4-release-activation-shadow.test.mjs tests/v4-stable-publication-fence.test.mjs tests/v4-partial-mutation-recovery-qualification.test.mjs tests/v4-stage-capsule.test.mjs tests/v4-stage-capsule-store.test.mjs tests/v4-stage-capsule-resume-planner.test.mjs tests/v4-stage-capsule-qualification.test.mjs tests/v4-warrant-shadow-plan.test.mjs",
|
|
156
161
|
"check:v4-bridge": "cargo fmt --manifest-path crates/buildchain-v4-bridge/Cargo.toml -- --check && cargo clippy --locked --manifest-path crates/buildchain-v4-bridge/Cargo.toml -- -D warnings && cargo test --locked --manifest-path crates/buildchain-v4-bridge/Cargo.toml",
|
|
157
162
|
"check:v4-contracts": "cargo fmt --manifest-path crates/buildchain-v4-contracts/Cargo.toml -- --check && cargo clippy --locked --manifest-path crates/buildchain-v4-contracts/Cargo.toml -- -D warnings && cargo test --locked --manifest-path crates/buildchain-v4-contracts/Cargo.toml && node --test tests/v4-canonical-contracts.test.mjs tests/v4-delivery-warrant-fixture-runner.test.mjs tests/v4-delivery-warrant-read-candidate.test.mjs tests/v4-floating-consumer-policy-contract.test.mjs tests/v4-floating-consumer-policy.test.mjs tests/v4-runtime-ref-resume-authority.test.mjs tests/v4-tail-reseal.test.mjs tests/v4-tail-reseal-parity.test.mjs tests/v4-compatibility-facts.test.mjs tests/v4-publication-rehearsal.test.mjs tests/v4-platform-stage-checkpoints.test.mjs tests/v4-provider-operation-journal.test.mjs tests/v4-provider-readback-idempotency.test.mjs tests/v4-public-dogfood-contract.test.mjs tests/v4-release-activation-shadow.test.mjs tests/v4-stable-publication-fence.test.mjs tests/v4-partial-mutation-recovery-qualification.test.mjs tests/v4-stage-capsule.test.mjs tests/v4-stage-capsule-store.test.mjs tests/v4-stage-capsule-resume-planner.test.mjs tests/v4-stage-capsule-qualification.test.mjs",
|
|
158
163
|
"check:workflows": "bash scripts/check-workflows.sh",
|
|
@@ -7,6 +7,42 @@ export const ADOPTER_DELIVERY_PASSPORT_BINDING_CONTRACT =
|
|
|
7
7
|
"kungfu-buildchain-adopter-delivery-passport-binding";
|
|
8
8
|
|
|
9
9
|
const ROOT_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
10
|
+
const EXACT_SHA_PATTERN = /^[0-9a-f]{40}$/u;
|
|
11
|
+
|
|
12
|
+
export function releasePassportKfdAdopterSourceSha({
|
|
13
|
+
passportSourceSha = "",
|
|
14
|
+
release = undefined,
|
|
15
|
+
} = {}) {
|
|
16
|
+
const exactSha = (value) =>
|
|
17
|
+
EXACT_SHA_PATTERN.test(String(value || "").trim());
|
|
18
|
+
const candidateSourceSha = String(release?.candidateSourceSha || "").trim();
|
|
19
|
+
const builtSourceSha = String(release?.builtSourceSha || "").trim();
|
|
20
|
+
const promotionChannelSha = String(release?.promotionChannelSha || "").trim();
|
|
21
|
+
const candidateSourceTreeSha = String(
|
|
22
|
+
release?.candidateSourceTreeSha || "",
|
|
23
|
+
).trim();
|
|
24
|
+
const builtSourceTreeSha = String(release?.builtSourceTreeSha || "").trim();
|
|
25
|
+
const promotionChannelTreeSha = String(
|
|
26
|
+
release?.promotionChannelTreeSha || "",
|
|
27
|
+
).trim();
|
|
28
|
+
if (
|
|
29
|
+
release?.treeEquivalent !== true ||
|
|
30
|
+
!exactSha(passportSourceSha) ||
|
|
31
|
+
!exactSha(candidateSourceSha) ||
|
|
32
|
+
!exactSha(builtSourceSha) ||
|
|
33
|
+
!exactSha(promotionChannelSha) ||
|
|
34
|
+
candidateSourceSha !== builtSourceSha ||
|
|
35
|
+
promotionChannelSha !== passportSourceSha ||
|
|
36
|
+
!exactSha(candidateSourceTreeSha) ||
|
|
37
|
+
!exactSha(builtSourceTreeSha) ||
|
|
38
|
+
!exactSha(promotionChannelTreeSha) ||
|
|
39
|
+
candidateSourceTreeSha !== builtSourceTreeSha ||
|
|
40
|
+
candidateSourceTreeSha !== promotionChannelTreeSha
|
|
41
|
+
) {
|
|
42
|
+
return passportSourceSha;
|
|
43
|
+
}
|
|
44
|
+
return candidateSourceSha;
|
|
45
|
+
}
|
|
10
46
|
|
|
11
47
|
function issue(code, message, details = {}) {
|
|
12
48
|
return { code, message, details };
|
|
@@ -166,6 +166,36 @@ function declarativeAuditableDemoSurface(root, pkg, majorLine) {
|
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
function v4ReleaseCandidatePromoteSurface(root, majorLine) {
|
|
170
|
+
return surface(root, {
|
|
171
|
+
id: "v4-release-candidate-promote-action",
|
|
172
|
+
kind: "action",
|
|
173
|
+
path: "actions/v4-release-candidate-promote/action.yml",
|
|
174
|
+
publicRef: `kungfu-systems/buildchain/actions/v4-release-candidate-promote@${majorLine}`,
|
|
175
|
+
requiredInputs: [
|
|
176
|
+
"token", "repository", "source-sha", "version", "tag", "channel",
|
|
177
|
+
"candidate-passport-path", "stage-capsules-path",
|
|
178
|
+
"publication-qualification-path",
|
|
179
|
+
],
|
|
180
|
+
requiredOutputs: [
|
|
181
|
+
"release-passport-path", "release-passport-root", "transaction-state",
|
|
182
|
+
"declaration-root", "transaction-root", "state-root",
|
|
183
|
+
"receipt-roots-json",
|
|
184
|
+
],
|
|
185
|
+
breakingDefaults: {
|
|
186
|
+
statePath: ".buildchain/release-tail/state.json",
|
|
187
|
+
executionBoundary: "built-in-provider-plane-only",
|
|
188
|
+
},
|
|
189
|
+
optionalInputs: ["artifact-paths", "state-path", "failure-after-capability"],
|
|
190
|
+
guarantees: [
|
|
191
|
+
"v4 promotion consumes only sealed candidate, Stage Capsule, qualification, and artifact evidence",
|
|
192
|
+
"GitHub Release, signed-channel commit, activation, readback, and released-evidence synthesis use built-in provider adapters",
|
|
193
|
+
"durable provider checkpoints resume completed capabilities without replay",
|
|
194
|
+
"no consumer command, script, shell, checkout, or executable tail hook is accepted",
|
|
195
|
+
],
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
169
199
|
export function createBuildchainContractWorld({
|
|
170
200
|
root = process.cwd(),
|
|
171
201
|
packageJson = undefined,
|
|
@@ -484,7 +514,7 @@ export function createBuildchainContractWorld({
|
|
|
484
514
|
"Build Images owns encoding, Buildchain owns qualification and receipts, and site repositories own browser loading and accessibility behavior",
|
|
485
515
|
"media qualification does not claim browser playback, responsive layout, reduced-motion behavior, accessibility, or production deployment",
|
|
486
516
|
],
|
|
487
|
-
}), declarativeAuditableDemoSurface(root, pkg, majorLine),
|
|
517
|
+
}), declarativeAuditableDemoSurface(root, pkg, majorLine), v4ReleaseCandidatePromoteSurface(root, majorLine),
|
|
488
518
|
surface(root, {
|
|
489
519
|
id: "promote-buildchain-ref-action",
|
|
490
520
|
kind: "action",
|
|
@@ -58,6 +58,7 @@ const DESCRIPTORS = Object.freeze([
|
|
|
58
58
|
[".github/workflows/release-tail.yml", "product-publication", true, ["artifact.publish", "signed-channel.commit", "release.activate", "released-evidence.synthesize"], "caller-secrets", "caller-bound", "caller-bound", "fixed"],
|
|
59
59
|
[".github/workflows/release-verify.yml", "governance-write"],
|
|
60
60
|
[".github/workflows/stable-candidate-patrol.yml", "governance-write"],
|
|
61
|
+
[".github/workflows/v4-declarative-release-tail-dogfood.yml", "product-publication", true, ["artifact.publish", "signed-channel.commit", "release.activate", "released-evidence.synthesize"], "caller-secrets", "none", "fixed", "fixed"],
|
|
61
62
|
]);
|
|
62
63
|
|
|
63
64
|
export function buildchainPublicationAuthorityDescriptors() {
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
devDeliveryClone as clone,
|
|
2
3
|
devDeliveryContentRoot,
|
|
3
4
|
devDeliveryExactRoot as exactRoot,
|
|
4
5
|
devDeliveryExactSha as exactSha,
|
|
5
6
|
devDeliveryPositiveInteger as positiveInteger,
|
|
6
7
|
devDeliveryText as text,
|
|
8
|
+
devDeliveryTimestamp as timestamp,
|
|
7
9
|
} from "./dev-delivery-common.js";
|
|
10
|
+
import { verifyIntegrationDeliveryProof } from "./dev-delivery-proof.js";
|
|
8
11
|
|
|
9
12
|
export const DEV_DELIVERY_SETTLEMENT_RECEIPT_SCHEMA =
|
|
10
13
|
"kungfu.buildchain.dev-delivery-settlement-receipt/v1";
|
|
14
|
+
export const DEV_DELIVERY_TERMINAL_EVIDENCE_CORRECTION_SCHEMA =
|
|
15
|
+
"kungfu.buildchain.dev-delivery-terminal-evidence-correction/v1";
|
|
11
16
|
|
|
12
17
|
const PROVIDER_FAILURE_FIELDS = [
|
|
13
18
|
"transferRoot",
|
|
@@ -16,6 +21,233 @@ const PROVIDER_FAILURE_FIELDS = [
|
|
|
16
21
|
"sealJobId",
|
|
17
22
|
];
|
|
18
23
|
|
|
24
|
+
function correctionBody(input) {
|
|
25
|
+
const body = clone(input || {});
|
|
26
|
+
delete body.correctionRoot;
|
|
27
|
+
return body;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function normalizeTerminalEvidenceCorrection(
|
|
31
|
+
input,
|
|
32
|
+
{ candidate, repository, protectedBase } = {},
|
|
33
|
+
) {
|
|
34
|
+
const correction = correctionBody(input);
|
|
35
|
+
if (correction.schema !== DEV_DELIVERY_TERMINAL_EVIDENCE_CORRECTION_SCHEMA) {
|
|
36
|
+
throw new Error("unsupported terminal evidence correction schema");
|
|
37
|
+
}
|
|
38
|
+
correction.candidateId = exactRoot(
|
|
39
|
+
correction.candidateId,
|
|
40
|
+
"terminal evidence correction candidateId",
|
|
41
|
+
);
|
|
42
|
+
correction.pullRequestNumber = positiveInteger(
|
|
43
|
+
correction.pullRequestNumber,
|
|
44
|
+
"terminal evidence correction pullRequestNumber",
|
|
45
|
+
);
|
|
46
|
+
correction.sourceHead = exactSha(
|
|
47
|
+
correction.sourceHead,
|
|
48
|
+
"terminal evidence correction sourceHead",
|
|
49
|
+
);
|
|
50
|
+
correction.outcome = text(correction.outcome);
|
|
51
|
+
correction.priorEvidenceRoot = exactRoot(
|
|
52
|
+
correction.priorEvidenceRoot,
|
|
53
|
+
"terminal evidence correction priorEvidenceRoot",
|
|
54
|
+
);
|
|
55
|
+
correction.correctedAt = timestamp(
|
|
56
|
+
correction.correctedAt,
|
|
57
|
+
"terminal evidence correction correctedAt",
|
|
58
|
+
);
|
|
59
|
+
correction.reason = text(correction.reason);
|
|
60
|
+
if (!correction.reason) {
|
|
61
|
+
throw new Error("terminal evidence correction reason is required");
|
|
62
|
+
}
|
|
63
|
+
const verification = verifyIntegrationDeliveryProof(
|
|
64
|
+
correction.integrationProof,
|
|
65
|
+
);
|
|
66
|
+
if (!verification.ok) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`terminal evidence correction requires an exact integration proof: ${verification.reason}`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (
|
|
72
|
+
correction.integrationProof.currentBase !==
|
|
73
|
+
correction.integrationProof.mergeGroupHead ||
|
|
74
|
+
correction.integrationProof.replayTree !==
|
|
75
|
+
correction.integrationProof.mergeGroupTree
|
|
76
|
+
) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
"terminal evidence correction requires exact merge-group commit and tree continuity",
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (candidate) {
|
|
82
|
+
const checks = {
|
|
83
|
+
candidateId: correction.candidateId === candidate.candidateId,
|
|
84
|
+
pullRequestNumber:
|
|
85
|
+
correction.pullRequestNumber === candidate.pullRequestNumber,
|
|
86
|
+
sourceHead: correction.sourceHead === candidate.sourceHead,
|
|
87
|
+
outcome:
|
|
88
|
+
correction.outcome === candidate.status &&
|
|
89
|
+
correction.outcome === candidate.terminal?.outcome,
|
|
90
|
+
priorEvidenceRoot:
|
|
91
|
+
correction.priorEvidenceRoot === candidate.terminal?.evidenceRoot,
|
|
92
|
+
repository: correction.integrationProof.repository === repository,
|
|
93
|
+
protectedBase:
|
|
94
|
+
correction.integrationProof.protectedBase === protectedBase,
|
|
95
|
+
sourceProofRoot:
|
|
96
|
+
correction.integrationProof.sourceProofRoot ===
|
|
97
|
+
candidate.sourceProofRoot,
|
|
98
|
+
warrantCandidateId:
|
|
99
|
+
correction.integrationProof.warrantCandidateId ===
|
|
100
|
+
candidate.candidateId,
|
|
101
|
+
warrantFencingToken:
|
|
102
|
+
correction.integrationProof.warrantFencingToken ===
|
|
103
|
+
candidate.terminal?.fencingToken,
|
|
104
|
+
warrantGeneration:
|
|
105
|
+
correction.integrationProof.warrantGeneration ===
|
|
106
|
+
candidate.terminal?.leaseGeneration,
|
|
107
|
+
};
|
|
108
|
+
const failed = Object.entries(checks)
|
|
109
|
+
.filter(([, matches]) => !matches)
|
|
110
|
+
.map(([field]) => field);
|
|
111
|
+
if (failed.length > 0) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
`terminal evidence correction identity drift: ${failed.join(", ")}`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const correctionRoot = devDeliveryContentRoot(correction);
|
|
118
|
+
if (input?.correctionRoot && input.correctionRoot !== correctionRoot) {
|
|
119
|
+
throw new Error("terminal evidence correction root drift");
|
|
120
|
+
}
|
|
121
|
+
return { ...correction, correctionRoot };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function effectiveTerminalEvidenceRoot(candidate) {
|
|
125
|
+
return (
|
|
126
|
+
candidate?.terminal?.integrationEvidenceCorrection?.integrationProof
|
|
127
|
+
?.proofRoot ||
|
|
128
|
+
candidate?.terminal?.evidenceRoot ||
|
|
129
|
+
""
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function createTerminalEvidenceCorrection(
|
|
134
|
+
candidate,
|
|
135
|
+
input,
|
|
136
|
+
{ repository, protectedBase, now } = {},
|
|
137
|
+
) {
|
|
138
|
+
return normalizeTerminalEvidenceCorrection(
|
|
139
|
+
{
|
|
140
|
+
schema: DEV_DELIVERY_TERMINAL_EVIDENCE_CORRECTION_SCHEMA,
|
|
141
|
+
candidateId: candidate?.candidateId,
|
|
142
|
+
pullRequestNumber: candidate?.pullRequestNumber,
|
|
143
|
+
sourceHead: candidate?.sourceHead,
|
|
144
|
+
outcome: candidate?.status,
|
|
145
|
+
priorEvidenceRoot: input?.expectedPriorEvidenceRoot,
|
|
146
|
+
integrationProof: input?.integrationProof,
|
|
147
|
+
correctedAt: now,
|
|
148
|
+
reason: input?.reason,
|
|
149
|
+
},
|
|
150
|
+
{ candidate, repository, protectedBase },
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function createDevDeliveryTerminalEvidenceReconciler({
|
|
155
|
+
normalizeQueue,
|
|
156
|
+
transition,
|
|
157
|
+
}) {
|
|
158
|
+
return function reconcileDevDeliveryTerminalEvidence(
|
|
159
|
+
queueInput,
|
|
160
|
+
input,
|
|
161
|
+
{ now = new Date().toISOString() } = {},
|
|
162
|
+
) {
|
|
163
|
+
const before = normalizeQueue(queueInput);
|
|
164
|
+
const candidate = before.candidates.find(
|
|
165
|
+
(entry) =>
|
|
166
|
+
entry.candidateId === exactRoot(input?.candidateId, "candidateId"),
|
|
167
|
+
);
|
|
168
|
+
if (!candidate)
|
|
169
|
+
throw new Error("terminal evidence candidate does not exist");
|
|
170
|
+
if (candidate.status !== "merged") {
|
|
171
|
+
throw new Error(
|
|
172
|
+
"integration evidence correction requires a merged candidate",
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const existing = candidate.terminal?.integrationEvidenceCorrection;
|
|
176
|
+
const correction = createTerminalEvidenceCorrection(candidate, input, {
|
|
177
|
+
repository: before.repository,
|
|
178
|
+
protectedBase: before.protectedBase,
|
|
179
|
+
now: existing?.correctedAt || timestamp(now, "now"),
|
|
180
|
+
});
|
|
181
|
+
if (existing) {
|
|
182
|
+
if (existing.correctionRoot !== correction.correctionRoot) {
|
|
183
|
+
throw new Error(
|
|
184
|
+
"terminal evidence correction already exists with different evidence",
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
const receipt = {
|
|
188
|
+
schema: DEV_DELIVERY_SETTLEMENT_RECEIPT_SCHEMA,
|
|
189
|
+
action: "duplicate-terminal-evidence-correction-noop",
|
|
190
|
+
applicable: true,
|
|
191
|
+
repository: before.repository,
|
|
192
|
+
protectedBase: before.protectedBase,
|
|
193
|
+
candidateId: candidate.candidateId,
|
|
194
|
+
pullRequestNumber: candidate.pullRequestNumber,
|
|
195
|
+
sourceHead: candidate.sourceHead,
|
|
196
|
+
outcome: candidate.status,
|
|
197
|
+
priorEvidenceRoot: candidate.terminal.evidenceRoot,
|
|
198
|
+
evidenceRoot: correction.integrationProof.proofRoot,
|
|
199
|
+
correctionRoot: correction.correctionRoot,
|
|
200
|
+
expectedOldStateRoot: before.stateRoot,
|
|
201
|
+
nextStateRoot: before.stateRoot,
|
|
202
|
+
nextAction:
|
|
203
|
+
"Retain the exact verified integration evidence correction.",
|
|
204
|
+
};
|
|
205
|
+
return {
|
|
206
|
+
queue: before,
|
|
207
|
+
receipt,
|
|
208
|
+
receiptRoot: devDeliveryContentRoot(receipt),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const transaction = transition(
|
|
212
|
+
before,
|
|
213
|
+
(queue) => {
|
|
214
|
+
const mutable = queue.candidates.find(
|
|
215
|
+
(entry) => entry.candidateId === candidate.candidateId,
|
|
216
|
+
);
|
|
217
|
+
mutable.terminal = {
|
|
218
|
+
...mutable.terminal,
|
|
219
|
+
integrationEvidenceCorrection: correction,
|
|
220
|
+
};
|
|
221
|
+
return { candidate: mutable };
|
|
222
|
+
},
|
|
223
|
+
correction.correctedAt,
|
|
224
|
+
);
|
|
225
|
+
const receipt = {
|
|
226
|
+
schema: DEV_DELIVERY_SETTLEMENT_RECEIPT_SCHEMA,
|
|
227
|
+
action: "terminal-evidence-corrected",
|
|
228
|
+
applicable: true,
|
|
229
|
+
repository: transaction.after.repository,
|
|
230
|
+
protectedBase: transaction.after.protectedBase,
|
|
231
|
+
candidateId: candidate.candidateId,
|
|
232
|
+
pullRequestNumber: candidate.pullRequestNumber,
|
|
233
|
+
sourceHead: candidate.sourceHead,
|
|
234
|
+
outcome: candidate.status,
|
|
235
|
+
priorEvidenceRoot: candidate.terminal.evidenceRoot,
|
|
236
|
+
evidenceRoot: correction.integrationProof.proofRoot,
|
|
237
|
+
correctionRoot: correction.correctionRoot,
|
|
238
|
+
expectedOldStateRoot: transaction.expectedOldStateRoot,
|
|
239
|
+
nextStateRoot: transaction.after.stateRoot,
|
|
240
|
+
nextAction:
|
|
241
|
+
"Read back the corrected terminal candidate and repeat settlement idempotently.",
|
|
242
|
+
};
|
|
243
|
+
return {
|
|
244
|
+
queue: transaction.after,
|
|
245
|
+
receipt,
|
|
246
|
+
receiptRoot: devDeliveryContentRoot(receipt),
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
19
251
|
export function normalizeProviderFailureAuthorityBinding(
|
|
20
252
|
input = {},
|
|
21
253
|
{ required = false } = {},
|
|
@@ -56,7 +288,7 @@ function noopReceipt(queue, identity, candidate, action, details = {}) {
|
|
|
56
288
|
outcome: identity.outcome,
|
|
57
289
|
candidateId: candidate?.candidateId || null,
|
|
58
290
|
evidenceRoot:
|
|
59
|
-
candidate
|
|
291
|
+
effectiveTerminalEvidenceRoot(candidate) || identity.evidenceRoot || null,
|
|
60
292
|
expectedOldStateRoot: queue.stateRoot,
|
|
61
293
|
nextStateRoot: queue.stateRoot,
|
|
62
294
|
nextAction: "No fenced delivery state remains for this terminal event.",
|
|
@@ -95,7 +327,7 @@ function settleTerminalCandidate(queue, identity, candidate) {
|
|
|
95
327
|
"duplicate terminal event provider failure authority drift",
|
|
96
328
|
);
|
|
97
329
|
}
|
|
98
|
-
if (candidate
|
|
330
|
+
if (effectiveTerminalEvidenceRoot(candidate) !== identity.evidenceRoot) {
|
|
99
331
|
throw new Error("duplicate terminal event evidenceRoot drift");
|
|
100
332
|
}
|
|
101
333
|
const receipt = noopReceipt(
|
|
@@ -103,6 +335,7 @@ function settleTerminalCandidate(queue, identity, candidate) {
|
|
|
103
335
|
identity,
|
|
104
336
|
candidate,
|
|
105
337
|
"duplicate-terminal-event-noop",
|
|
338
|
+
{ successorWake: candidate.terminal?.successorWake || null },
|
|
106
339
|
);
|
|
107
340
|
return { queue, receipt, receiptRoot: devDeliveryContentRoot(receipt) };
|
|
108
341
|
}
|
|
@@ -207,7 +440,10 @@ export function createDevDeliveryTerminalSettler({
|
|
|
207
440
|
throw new Error("stale fencing token");
|
|
208
441
|
if (leaseGeneration !== queue.activeWarrant.generation)
|
|
209
442
|
throw new Error("stale lease generation");
|
|
210
|
-
if (
|
|
443
|
+
if (
|
|
444
|
+
identity.outcome === "dequeued" &&
|
|
445
|
+
queue.activeWarrant.phase === "provisional"
|
|
446
|
+
) {
|
|
211
447
|
return retainDequeuedWarrant(
|
|
212
448
|
queue,
|
|
213
449
|
identity,
|
|
@@ -19,7 +19,10 @@ import {
|
|
|
19
19
|
normalizeNativeCommandContract,
|
|
20
20
|
validateActiveDevDeliveryWarrant,
|
|
21
21
|
} from "./dev-delivery-native-proof.js";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
normalizeProviderFailureAuthorityBinding,
|
|
24
|
+
normalizeTerminalEvidenceCorrection,
|
|
25
|
+
} from "./dev-delivery-warrant-settlement.js";
|
|
23
26
|
import {
|
|
24
27
|
compareReleaseBlockerPriority,
|
|
25
28
|
normalizeReleaseBlockerPriorityClaim,
|
|
@@ -244,8 +247,18 @@ function normalizeCandidate(input, expected) {
|
|
|
244
247
|
"provider failure authority can exist only on terminal-failure state",
|
|
245
248
|
);
|
|
246
249
|
}
|
|
247
|
-
if (failureAuthority)
|
|
250
|
+
if (failureAuthority)
|
|
248
251
|
candidate.terminal = { ...candidate.terminal, ...failureAuthority };
|
|
252
|
+
if (candidate.terminal.integrationEvidenceCorrection) {
|
|
253
|
+
candidate.terminal.integrationEvidenceCorrection =
|
|
254
|
+
normalizeTerminalEvidenceCorrection(
|
|
255
|
+
candidate.terminal.integrationEvidenceCorrection,
|
|
256
|
+
{
|
|
257
|
+
candidate,
|
|
258
|
+
repository: expected.repository,
|
|
259
|
+
protectedBase: expected.protectedBase,
|
|
260
|
+
},
|
|
261
|
+
);
|
|
249
262
|
}
|
|
250
263
|
}
|
|
251
264
|
if (Object.hasOwn(input, "affectedPaths")) {
|