@kungfu-tech/buildchain 4.0.1-alpha.5 → 4.0.1-alpha.8
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/internal-capabilities.json +65 -5
- package/architecture/maintainability-policy.json +27 -21
- package/architecture/release-tail-contract-inventory.json +5 -2
- package/architecture/v4-adopter-delivery-parity.json +32 -5
- package/architecture/v4-floating-consumer-policy.json +6 -0
- package/architecture/v4-publication-rehearsal-parity.json +84 -0
- package/bin/buildchain.mjs +7 -1
- package/bin/internal/adopter-delivery-cli.mjs +70 -0
- package/bin/internal/command-registry.mjs +1 -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-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 +1 -1
- package/contracts/v4-adopter-delivery-v1.schema.json +81 -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/dist/site/agent-index.json +3 -0
- package/dist/site/artifact-schemas.json +6 -0
- package/dist/site/buildchain-contract.json +14 -14
- package/dist/site/buildchain-site.json +231 -24
- package/dist/site/capability-registry.json +11 -10
- package/dist/site/cli-registry.json +53 -1
- package/dist/site/kfd-claims.json +279 -14
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +20 -5
- package/dist/site/node-api-registry.json +11569 -9299
- package/dist/site/page-registry.json +214 -15
- package/dist/site/public-surface-audit.json +206 -11
- package/dist/site/publication-authority-registry.json +39 -8
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +15 -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-publication-rehearsal-capsule-v1.schema.json +233 -0
- package/dist/site/site-manifest.json +17 -9
- package/dist/site/workflow-registry.json +110 -8
- package/docs/MAP.md +3 -1
- package/docs/cli-reference.md +68 -0
- package/docs/cli.md +8 -0
- package/docs/dev-delivery-warrant.md +22 -1
- package/docs/node-api-reference.md +332 -172
- package/docs/release-tail-provider-plane.md +30 -0
- package/docs/v4-adopter-delivery.md +133 -0
- package/docs/v4-publication-rehearsal.md +130 -0
- package/package.json +18 -3
- 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 +1 -0
- package/packages/core/buildchain-config.js +84 -0
- 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/ci-lane-change-budget.js +247 -0
- package/packages/core/dev-delivery-native-proof.js +43 -27
- package/packages/core/dev-delivery-warrant-state.js +31 -8
- package/packages/core/dev-delivery-warrant.js +8 -3
- package/packages/core/github-governance-authority.js +1 -0
- package/packages/core/index.js +5 -0
- package/packages/core/legacy-kfd-adopter-driver.js +167 -0
- package/packages/core/published-delivery-authority.js +266 -0
- package/packages/core/release-candidate-recovery.js +66 -11
- 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-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 +138 -35
- package/packages/core/v4-floating-consumer-release-passport.js +30 -3
- 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/workflow-yaml-contract.js +24 -2
- package/scripts/buildchain-cli-help.mjs +10 -0
- package/scripts/check-ci-lane-change-budget.mjs +100 -0
- package/scripts/check-inventory.mjs +3 -3
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +23 -4
- package/scripts/dev-delivery-source-proof-replay.mjs +153 -0
- package/scripts/dev-delivery-source-proof-reuse.mjs +13 -97
- package/scripts/dev-delivery-warrant-store.mjs +10 -6
- package/scripts/dev-delivery-warrant.mjs +5 -1
- package/scripts/dev-pr-delivery-warrant.mjs +1 -0
- package/scripts/dev-qualification-patrol.mjs +9 -9
- package/scripts/generate-channel-promotion-workflow.mjs +2 -2
- package/scripts/generate-release-candidate-passport.mjs +152 -0
- package/scripts/generate-site-bundle.mjs +30 -0
- 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/resume-from-candidate-run.mjs +556 -29
- package/scripts/site-capability-metadata.mjs +17 -0
- package/scripts/v4-consumer-policy.mjs +4 -0
- package/scripts/v4-publication-rehearsal-fixture.mjs +144 -0
|
@@ -38,6 +38,36 @@ inspects, verifies, and diagnoses bounded v3 compatibility using the same core
|
|
|
38
38
|
transaction format. The reusable workflow checks out an exact Buildchain ref
|
|
39
39
|
and invokes the packaged Action; callers cannot inject an execution command.
|
|
40
40
|
|
|
41
|
+
The reusable workflow is permission-neutral: it inherits the calling job's
|
|
42
|
+
GitHub token permissions and never elevates them. A rehearsal caller can remain
|
|
43
|
+
`contents: read` and must pass `execute: false`. An effectful production caller
|
|
44
|
+
owns and declares its provider authority explicitly:
|
|
45
|
+
|
|
46
|
+
<!-- release-tail-production-caller-contract -->
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
name: Production release tail
|
|
50
|
+
|
|
51
|
+
on:
|
|
52
|
+
workflow_dispatch:
|
|
53
|
+
|
|
54
|
+
jobs:
|
|
55
|
+
release-tail:
|
|
56
|
+
permissions:
|
|
57
|
+
contents: write
|
|
58
|
+
uses: kungfu-systems/buildchain/.github/workflows/release-tail.yml@<exact-buildchain-sha>
|
|
59
|
+
with:
|
|
60
|
+
buildchain-ref: <exact-buildchain-sha>
|
|
61
|
+
declaration-path: .buildchain/release-tail/declaration.json
|
|
62
|
+
provider-bindings-path: .buildchain/release-tail/provider-bindings.json
|
|
63
|
+
execute: true
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Omitting caller write authority cannot be repaired by the reusable workflow;
|
|
67
|
+
GitHub rejects or constrains the call before provider execution. `execute:
|
|
68
|
+
false` remains a plan/rehearsal boundary and does not authorize production
|
|
69
|
+
mutation even when a caller token has broader ambient permissions.
|
|
70
|
+
|
|
41
71
|
## Inputs and secrets
|
|
42
72
|
|
|
43
73
|
The declaration follows
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
status: preview
|
|
3
|
+
period: 2026-08-16
|
|
4
|
+
theme: buildchain-v4-adopter-delivery
|
|
5
|
+
doc_type: product-manual
|
|
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-16
|
|
12
|
+
ai_provenance:
|
|
13
|
+
model_family: GPT-5
|
|
14
|
+
product: Codex
|
|
15
|
+
generated_at: 2026-08-16
|
|
16
|
+
visible_context: Exact protected v3 adopter-delivery cut, v4 pure contract core, published npm archive bytes, and public consumer policy.
|
|
17
|
+
invisible_context_boundary: No credentials, provider mutations, signing operations, publication operations, or release authority were used.
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# V4 Public Adopter Delivery
|
|
21
|
+
|
|
22
|
+
Buildchain v4 carries the v3 adopter-delivery capability through a public,
|
|
23
|
+
protocol-neutral boundary. Consumers select an exact protocol driver and
|
|
24
|
+
artifact profile, retain the rooted gate result, and independently recompute
|
|
25
|
+
that readback. Buildchain does not interpret a protocol owned by another
|
|
26
|
+
project and a passing result never grants runtime, provider, signing,
|
|
27
|
+
publication, or release authority.
|
|
28
|
+
|
|
29
|
+
The parity source is the read-only protected cut
|
|
30
|
+
`dev/v3/v3.0@6b96bdad8d9f8ccf9275f27d9370a226a9c78465`. Work began from the
|
|
31
|
+
minimal v4 absorption base
|
|
32
|
+
`dev/v4/v4.0@e5611377efc03178f8687d99968cfdfa3ce2825b` and absorbed the
|
|
33
|
+
verified protected-base advances through
|
|
34
|
+
`dev/v4/v4.0@e0342713c7447960c13bd73377282b2e93f4853d` before delivery. These
|
|
35
|
+
identities, the v3 vector-suite root, and the KFD package cut are committed in
|
|
36
|
+
[`v4-adopter-delivery-parity.json`](../architecture/v4-adopter-delivery-parity.json)
|
|
37
|
+
and exposed by the public Node API.
|
|
38
|
+
|
|
39
|
+
## Public contract
|
|
40
|
+
|
|
41
|
+
The JSON input schema is
|
|
42
|
+
[`v4-adopter-delivery-v1.schema.json`](../contracts/v4-adopter-delivery-v1.schema.json).
|
|
43
|
+
An input names both selectors and the exact request identities. A selector
|
|
44
|
+
whose implementation identity differs from the request fails closed. The
|
|
45
|
+
public selectors are `json-assertion`, `kfd-category`, and `legacy-kfd`, with
|
|
46
|
+
`git-commit` and `package` artifact profiles.
|
|
47
|
+
|
|
48
|
+
Applications can also import the lower-level driver interface from
|
|
49
|
+
`@kungfu-tech/buildchain/adopter-delivery-gate` and define an isolated driver.
|
|
50
|
+
The v4 convenience runtime, exact source declaration, readback verification,
|
|
51
|
+
N-1 lineage check, and published archive loader are exported from
|
|
52
|
+
`@kungfu-tech/buildchain/v4-adopter-delivery`.
|
|
53
|
+
|
|
54
|
+
## CLI
|
|
55
|
+
|
|
56
|
+
All four operations are offline after the declared archive bytes exist:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
buildchain adopter-delivery run \
|
|
60
|
+
--input contracts/fixtures/v4-adopter-delivery-v1/gate-positive.json \
|
|
61
|
+
--output .buildchain/adopter-delivery/readback.json
|
|
62
|
+
|
|
63
|
+
buildchain adopter-delivery verify \
|
|
64
|
+
--input contracts/fixtures/v4-adopter-delivery-v1/gate-positive.json \
|
|
65
|
+
--readback .buildchain/adopter-delivery/readback.json
|
|
66
|
+
|
|
67
|
+
buildchain adopter-delivery bootstrap \
|
|
68
|
+
--input contracts/fixtures/v4-adopter-delivery-v1/bootstrap-positive.json
|
|
69
|
+
|
|
70
|
+
buildchain adopter-delivery archive \
|
|
71
|
+
--input contracts/fixtures/v4-adopter-delivery-v1/archive-template.json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`verify` requires the complete rooted readback and recomputes it. Missing or
|
|
75
|
+
substituted readback, unknown selector, unknown driver, protocol-version
|
|
76
|
+
mismatch, archive-byte or package-identity mismatch, and altered bootstrap
|
|
77
|
+
lineage all fail closed.
|
|
78
|
+
|
|
79
|
+
## N-1 and published archives
|
|
80
|
+
|
|
81
|
+
N-1 bootstrap is distinct from the candidate. The lineage wrapper requires
|
|
82
|
+
the exact v3 authority commit, exact v4 absorption base, and exact public
|
|
83
|
+
Buildchain archive root. The retained v3 bootstrap also requires protected and
|
|
84
|
+
published N-1 authority, rejects self-authorization, binds the candidate gate
|
|
85
|
+
artifact, and requires merged Warrant-shaped evidence. Protocol, profile, or
|
|
86
|
+
gate changes require independently reviewed transition evidence.
|
|
87
|
+
|
|
88
|
+
Published authority loading verifies compressed bytes before extraction,
|
|
89
|
+
rejects unsafe paths and links, verifies extracted package identity, verifies
|
|
90
|
+
KFD's semantic package root, and imports only declared public delivery modules.
|
|
91
|
+
The caller must supply an independently retained authority readback root. The
|
|
92
|
+
fixture binds `@kungfu-tech/buildchain@3.0.9-alpha.16` and
|
|
93
|
+
`@kungfu-tech/kfd@1.0.0-alpha.65`; a package version is not treated as proof of
|
|
94
|
+
the Git source cut.
|
|
95
|
+
|
|
96
|
+
## Config and reusable workflow
|
|
97
|
+
|
|
98
|
+
Consumer configuration is closed and repository-relative:
|
|
99
|
+
|
|
100
|
+
```toml
|
|
101
|
+
[adopter_delivery]
|
|
102
|
+
contract = "kungfu-buildchain-v4-adopter-delivery/v1"
|
|
103
|
+
input_path = "contracts/adopter-delivery/input.json"
|
|
104
|
+
readback_path = ".buildchain/adopter-delivery/readback.json"
|
|
105
|
+
bootstrap_path = "contracts/adopter-delivery/bootstrap.json"
|
|
106
|
+
archive_path = "contracts/adopter-delivery/archives.json"
|
|
107
|
+
result_path = ".buildchain/adopter-delivery/result.json"
|
|
108
|
+
driver_selector = "kfd-category"
|
|
109
|
+
artifact_profile_selector = "package"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The public reusable workflow is
|
|
113
|
+
`kungfu-systems/buildchain/.github/workflows/v4-adopter-delivery.yml@v4` for
|
|
114
|
+
stable use and `@v4-alpha` during prerelease evaluation. It resolves the exact
|
|
115
|
+
called-workflow SHA, enforces floating selector plus dual-lock consumer
|
|
116
|
+
admission, and runs the same CLI on Linux, macOS, and Windows. Buildchain
|
|
117
|
+
dogfoods it through the thin
|
|
118
|
+
[`v4-adopter-delivery-dogfood.yml`](../.github/workflows/v4-adopter-delivery-dogfood.yml)
|
|
119
|
+
caller, which contains no steps or local orchestration and persists only the
|
|
120
|
+
floating `@v4-alpha` selector.
|
|
121
|
+
|
|
122
|
+
The reusable workflow downloads exact public N-1 npm archives and uses the
|
|
123
|
+
committed byte roots, semantic identity, and authority readback root. It has
|
|
124
|
+
only `contents: read`; no provider credential or production writer is accepted
|
|
125
|
+
or synthesized.
|
|
126
|
+
|
|
127
|
+
## Offline vectors
|
|
128
|
+
|
|
129
|
+
[`offline-vectors.json`](../contracts/fixtures/v4-adopter-delivery-v1/offline-vectors.json)
|
|
130
|
+
indexes positive driver, N-1, and archive cases plus negative selector, driver,
|
|
131
|
+
archive identity, bootstrap lineage, protocol version, and tampered readback
|
|
132
|
+
cases. Tests synthesize archives locally so extraction and identity failures do
|
|
133
|
+
not depend on the network.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
status: preview
|
|
3
|
+
period: 2026-08-16
|
|
4
|
+
theme: buildchain-v4-publication-rehearsal
|
|
5
|
+
doc_type: product-manual
|
|
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-16
|
|
12
|
+
ai_provenance:
|
|
13
|
+
model_family: GPT-5
|
|
14
|
+
product: Codex
|
|
15
|
+
generated_at: 2026-08-16
|
|
16
|
+
visible_context: Exact v3 rehearsal runtime, v4 release-tail core, Stage Capsule contracts, public workflow and offline vectors.
|
|
17
|
+
invisible_context_boundary: No credentials, private provider state, signed URLs or production publication receipts were read.
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# V4 Publication Rehearsal Capsule
|
|
21
|
+
|
|
22
|
+
The v4 Publication Rehearsal Capsule is the content-addressed input for
|
|
23
|
+
testing publication behavior without acquiring production publication
|
|
24
|
+
authority. It is deliberately not a Stage Capsule. A Stage Capsule retains a
|
|
25
|
+
pure platform-stage build checkpoint; a Publication Rehearsal Capsule binds a
|
|
26
|
+
release candidate and asks the production release-tail planner and executor to
|
|
27
|
+
simulate, replay, or observe provider-facing publication behavior.
|
|
28
|
+
|
|
29
|
+
The rooted parity matrix is
|
|
30
|
+
[`architecture/v4-publication-rehearsal-parity.json`](../architecture/v4-publication-rehearsal-parity.json),
|
|
31
|
+
and the public schema is
|
|
32
|
+
[`v4-publication-rehearsal-capsule-v1.schema.json`](../contracts/v4-publication-rehearsal-capsule-v1.schema.json).
|
|
33
|
+
|
|
34
|
+
## Bound identity
|
|
35
|
+
|
|
36
|
+
One capsule commits to all of these values:
|
|
37
|
+
|
|
38
|
+
- its own canonical capsule root;
|
|
39
|
+
- the exact source repository, Git revision, and source root;
|
|
40
|
+
- the sorted candidate file inventory and candidate root;
|
|
41
|
+
- the exact candidate manifest and Buildchain config paths and roots;
|
|
42
|
+
- the canonical data-only provider bindings and `providerBindingsRoot`;
|
|
43
|
+
- the effect-disabled provider policy and its exact capability/adapter set;
|
|
44
|
+
- expected provider observations and their root;
|
|
45
|
+
- the initial transaction produced by the production release-tail planner;
|
|
46
|
+
- `buildchain.release-tail/v1` as the shared core version.
|
|
47
|
+
|
|
48
|
+
Changing any one of those values, or changing a candidate byte, fails closed.
|
|
49
|
+
Candidate paths must remain regular non-symlink files below an explicit
|
|
50
|
+
absolute root. Every artifact, provider document, and released-evidence input
|
|
51
|
+
named by the bindings must also appear in the rooted file inventory. The
|
|
52
|
+
evidence output may be absent, but its path and every existing ancestor must
|
|
53
|
+
remain below that root without symlinks.
|
|
54
|
+
|
|
55
|
+
## Modes and authority
|
|
56
|
+
|
|
57
|
+
`simulate` uses in-memory adapters and makes no provider call. `replay` feeds a
|
|
58
|
+
recorded response sequence through the same production transaction executor.
|
|
59
|
+
`provider` requires a capsule-bound
|
|
60
|
+
`buildchain-v4-publication-rehearsal-authority/v1` receipt plus the declared
|
|
61
|
+
provider adapters. The authority binds `providerBindingsRoot` directly as well
|
|
62
|
+
as through `capsuleRoot`, so request bytes cannot be replaced while retaining
|
|
63
|
+
authority. It is rehearsal-only: its
|
|
64
|
+
`productionAuthority` field is always `false`, and it binds a separately
|
|
65
|
+
supplied live `authorizationRoot` rather than minting authority from the
|
|
66
|
+
capsule alone.
|
|
67
|
+
|
|
68
|
+
Every provider readback and apply request is retained in the rooted transcript.
|
|
69
|
+
The resulting evidence always contains `productionAuthority: false` and
|
|
70
|
+
`releasePassport: null`. It therefore cannot publish by itself, authorize a
|
|
71
|
+
production release tail, or stand in for a Release Passport, protected
|
|
72
|
+
readback, or Delivery Warrant.
|
|
73
|
+
|
|
74
|
+
## CLI and Node API
|
|
75
|
+
|
|
76
|
+
Local simulation and replay use the public `release-tail` command:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
buildchain release-tail rehearse \
|
|
80
|
+
--capsule "$PWD/contracts/fixtures/v4-publication-rehearsal-v1/capsule.json" \
|
|
81
|
+
--candidate-root "$PWD/contracts/fixtures/v4-publication-rehearsal-v1/candidate" \
|
|
82
|
+
--mode simulate \
|
|
83
|
+
--state "$PWD/.buildchain/publication-rehearsal/state.json" \
|
|
84
|
+
--evidence "$PWD/.buildchain/publication-rehearsal/evidence.json"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Applications import `@kungfu-tech/buildchain/v4-publication-rehearsal` to
|
|
88
|
+
create and verify capsules, create provider-rehearsal authority, and execute
|
|
89
|
+
all three modes. The API delegates planning, transaction initialization, and
|
|
90
|
+
execution to the same `release-tail-provider-plane` functions used by the
|
|
91
|
+
production Action.
|
|
92
|
+
|
|
93
|
+
## Config and public workflow
|
|
94
|
+
|
|
95
|
+
The consumer config is closed and effect-disabled:
|
|
96
|
+
|
|
97
|
+
```toml
|
|
98
|
+
[publication_rehearsal]
|
|
99
|
+
contract = "buildchain-v4-publication-rehearsal-capsule/v1"
|
|
100
|
+
capsule_path = "contracts/fixtures/v4-publication-rehearsal-v1/capsule.json"
|
|
101
|
+
candidate_root = "contracts/fixtures/v4-publication-rehearsal-v1/candidate"
|
|
102
|
+
state_path = ".buildchain/publication-rehearsal/state.json"
|
|
103
|
+
evidence_path = ".buildchain/publication-rehearsal/evidence.json"
|
|
104
|
+
effect_default = "disabled"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The public reusable
|
|
108
|
+
[`release-tail.yml`](../.github/workflows/release-tail.yml) accepts the same
|
|
109
|
+
capsule, candidate root, mode, state and evidence paths. Before publication,
|
|
110
|
+
Buildchain dogfoods that public surface through a thin same-commit local reusable
|
|
111
|
+
call with the exact PR-head or dispatch SHA as its runtime. The reusable is
|
|
112
|
+
permission-neutral and the self-dogfood caller stays `contents: read`, passes
|
|
113
|
+
`execute: false`, and therefore cannot inherit or synthesize production write
|
|
114
|
+
authority. Effectful production callers must explicitly declare their own
|
|
115
|
+
provider permission. Durable external consumers remain on the floating
|
|
116
|
+
`@v4-alpha` contract. Provider mode additionally requires the exact authority
|
|
117
|
+
path. Provider bindings come from the capsule; an optional external bindings
|
|
118
|
+
input is accepted only when its canonical exact root and payload equal the
|
|
119
|
+
capsule binding. Ordinary calls default to `simulate`.
|
|
120
|
+
|
|
121
|
+
## Offline portability vectors
|
|
122
|
+
|
|
123
|
+
[`offline-vectors.json`](../contracts/fixtures/v4-publication-rehearsal-v1/offline-vectors.json)
|
|
124
|
+
records Linux, macOS and Windows projections. Their capsule, transaction,
|
|
125
|
+
state, and evidence roots are byte-identical. Regenerate or verify them with:
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
node scripts/v4-publication-rehearsal-fixture.mjs
|
|
129
|
+
node scripts/v4-publication-rehearsal-fixture.mjs --check
|
|
130
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungfu-tech/buildchain",
|
|
3
|
-
"version": "4.0.1-alpha.
|
|
3
|
+
"version": "4.0.1-alpha.8",
|
|
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",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"./buildchain-contract": "./packages/core/buildchain-contract.js",
|
|
26
26
|
"./compatibility-fact-authority": "./packages/core/buildchain-compatibility-proof.js",
|
|
27
27
|
"./candidate-timeline": "./packages/core/candidate-timeline.js",
|
|
28
|
+
"./ci-lane-change-budget": "./packages/core/ci-lane-change-budget.js",
|
|
28
29
|
"./channel-candidate": "./packages/core/channel-candidate.js",
|
|
29
30
|
"./cache-evidence": "./packages/core/cache-evidence.js",
|
|
30
31
|
"./controller-evidence": "./packages/core/controller-evidence.js",
|
|
@@ -46,6 +47,17 @@
|
|
|
46
47
|
"./v4-runtime-ref-resume-authority": "./packages/core/v4-runtime-ref-resume-authority.js",
|
|
47
48
|
"./v4-tail-reseal": "./packages/core/v4-tail-reseal.js",
|
|
48
49
|
"./v4-tail-reseal-receipt": "./packages/core/v4-tail-reseal-receipt.js",
|
|
50
|
+
"./v4-publication-rehearsal": "./packages/core/v4-publication-rehearsal.js",
|
|
51
|
+
"./adopter-delivery-gate": "./packages/core/adopter-delivery-gate.js",
|
|
52
|
+
"./kfd-adopter-category-driver": "./packages/core/kfd-adopter-category-driver.js",
|
|
53
|
+
"./buildchain-delivery-infrastructure": "./packages/core/buildchain-delivery-infrastructure.js",
|
|
54
|
+
"./buildchain-delivery-bootstrap": "./packages/core/buildchain-delivery-bootstrap.js",
|
|
55
|
+
"./buildchain-delivery-self-dogfood": "./packages/core/buildchain-delivery-self-dogfood.js",
|
|
56
|
+
"./published-delivery-authority": "./packages/core/published-delivery-authority.js",
|
|
57
|
+
"./legacy-kfd-adopter-driver": "./packages/core/legacy-kfd-adopter-driver.js",
|
|
58
|
+
"./adopter-delivery-passport": "./packages/core/adopter-delivery-passport.js",
|
|
59
|
+
"./adopter-delivery-vectors": "./packages/core/adopter-delivery-vectors.js",
|
|
60
|
+
"./v4-adopter-delivery": "./packages/core/v4-adopter-delivery.js",
|
|
49
61
|
"./logging": "./packages/core/logging.js",
|
|
50
62
|
"./portable-dev-cache": "./packages/core/portable-dev-cache.js",
|
|
51
63
|
"./publication-artifact": "./packages/core/publication-artifact.js",
|
|
@@ -99,6 +111,9 @@
|
|
|
99
111
|
"./site/schemas/kfd-support-projection-v1.schema.json": "./dist/site/schemas/kfd-support-projection-v1.schema.json",
|
|
100
112
|
"./site/schemas/dev-delivery-authority-v2.schema.json": "./dist/site/schemas/dev-delivery-authority-v2.schema.json",
|
|
101
113
|
"./site/schemas/v4-compatibility-facts-v1.schema.json": "./dist/site/schemas/v4-compatibility-facts-v1.schema.json",
|
|
114
|
+
"./site/schemas/v4-publication-rehearsal-capsule-v1.schema.json": "./dist/site/schemas/v4-publication-rehearsal-capsule-v1.schema.json",
|
|
115
|
+
"./site/schemas/v4-adopter-delivery-v1.schema.json": "./dist/site/schemas/v4-adopter-delivery-v1.schema.json",
|
|
116
|
+
"./site/schemas/release-tail-capabilities-v1.schema.json": "./dist/site/schemas/release-tail-capabilities-v1.schema.json",
|
|
102
117
|
"./site/buildchain-contract.json": "./dist/site/buildchain-contract.json",
|
|
103
118
|
"./site/product-mechanism.json": "./dist/site/product-mechanism.json",
|
|
104
119
|
"./site/release-provenance.json": "./dist/site/release-provenance.json",
|
|
@@ -136,10 +151,10 @@
|
|
|
136
151
|
"scripts": {
|
|
137
152
|
"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",
|
|
138
153
|
"operator:windows-jit": "bash scripts/aws-windows-jit-operator.sh",
|
|
139
|
-
"check": "pnpm run check:static && 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-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",
|
|
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",
|
|
140
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",
|
|
141
156
|
"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",
|
|
142
|
-
"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-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",
|
|
157
|
+
"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",
|
|
143
158
|
"check:workflows": "bash scripts/check-workflows.sh",
|
|
144
159
|
"generate:reference": "node scripts/generate-public-reference.mjs",
|
|
145
160
|
"check:reference": "node scripts/generate-public-reference.mjs --check",
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ADOPTER_DELIVERY_GATE_RESULT_CONTRACT,
|
|
3
|
+
adopterDeliveryGateDigest,
|
|
4
|
+
} from "./adopter-delivery-gate.js";
|
|
5
|
+
|
|
6
|
+
export const ADOPTER_DELIVERY_PASSPORT_BINDING_CONTRACT =
|
|
7
|
+
"kungfu-buildchain-adopter-delivery-passport-binding";
|
|
8
|
+
|
|
9
|
+
const ROOT_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
10
|
+
|
|
11
|
+
function issue(code, message, details = {}) {
|
|
12
|
+
return { code, message, details };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function validateRootedJson(value, rootField, code, label) {
|
|
16
|
+
const root = value?.[rootField];
|
|
17
|
+
if (!ROOT_PATTERN.test(root ?? "")) {
|
|
18
|
+
return [issue(code, `${label} must be a canonical sha256 root`)];
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const preimage = structuredClone(value);
|
|
22
|
+
delete preimage[rootField];
|
|
23
|
+
return adopterDeliveryGateDigest(preimage) === root
|
|
24
|
+
? []
|
|
25
|
+
: [issue(code, `${label} does not match its exact JSON closure`)];
|
|
26
|
+
} catch {
|
|
27
|
+
return [issue(code, `${label} requires finite acyclic JSON`)];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function validateGateIdentity(result) {
|
|
32
|
+
const issues = [];
|
|
33
|
+
if (
|
|
34
|
+
result.schemaVersion !== 1 ||
|
|
35
|
+
result.contract !== ADOPTER_DELIVERY_GATE_RESULT_CONTRACT
|
|
36
|
+
) {
|
|
37
|
+
issues.push(
|
|
38
|
+
issue(
|
|
39
|
+
"adopterDelivery.gateResult.contract",
|
|
40
|
+
"adopter delivery gate result contract is unsupported",
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (
|
|
45
|
+
!result.project ||
|
|
46
|
+
!result.artifact ||
|
|
47
|
+
!result.protocol ||
|
|
48
|
+
!result.artifactProfile
|
|
49
|
+
) {
|
|
50
|
+
issues.push(
|
|
51
|
+
issue(
|
|
52
|
+
"adopterDelivery.gateResult.closure",
|
|
53
|
+
"gate result must retain project, artifact, protocol, and artifact-profile bindings",
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if (!ROOT_PATTERN.test(result.artifact?.root ?? "")) {
|
|
58
|
+
issues.push(
|
|
59
|
+
issue(
|
|
60
|
+
"adopterDelivery.gateResult.artifact.root",
|
|
61
|
+
"delivery artifact root must be a canonical sha256 root",
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (result.qualifying !== false || result.selfCertified !== false) {
|
|
66
|
+
issues.push(
|
|
67
|
+
issue(
|
|
68
|
+
"adopterDelivery.gateResult.nonClaims",
|
|
69
|
+
"delivery evidence must remain non-qualifying and non-self-certifying",
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return issues;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function validatePassedGate(result) {
|
|
77
|
+
if (result.status !== "passed") {
|
|
78
|
+
return result.status === "failed"
|
|
79
|
+
? []
|
|
80
|
+
: [
|
|
81
|
+
issue(
|
|
82
|
+
"adopterDelivery.gateResult.status",
|
|
83
|
+
"gate status must be passed or failed",
|
|
84
|
+
),
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
const passed =
|
|
88
|
+
result.protocol?.loaded === true &&
|
|
89
|
+
ROOT_PATTERN.test(result.protocol?.reportRoot ?? "") &&
|
|
90
|
+
result.artifactProfile?.loaded === true &&
|
|
91
|
+
result.artifactProfile?.valid === true &&
|
|
92
|
+
result.semanticReport !== null &&
|
|
93
|
+
(result.issues?.length ?? -1) === 0;
|
|
94
|
+
return passed
|
|
95
|
+
? []
|
|
96
|
+
: [
|
|
97
|
+
issue(
|
|
98
|
+
"adopterDelivery.gateResult.status",
|
|
99
|
+
"a passed gate must retain successful exact driver and artifact-profile evidence",
|
|
100
|
+
),
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function validateAdopterDeliveryGateResult(result) {
|
|
105
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) {
|
|
106
|
+
return {
|
|
107
|
+
valid: false,
|
|
108
|
+
passed: false,
|
|
109
|
+
issues: [
|
|
110
|
+
issue(
|
|
111
|
+
"adopterDelivery.gateResult",
|
|
112
|
+
"adopter delivery gate result must be an object",
|
|
113
|
+
),
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const issues = [
|
|
118
|
+
...validateGateIdentity(result),
|
|
119
|
+
...validateRootedJson(
|
|
120
|
+
result,
|
|
121
|
+
"gateRoot",
|
|
122
|
+
"adopterDelivery.gateResult.gateRoot",
|
|
123
|
+
"adopter delivery gate root",
|
|
124
|
+
),
|
|
125
|
+
...validatePassedGate(result),
|
|
126
|
+
];
|
|
127
|
+
const valid = issues.length === 0;
|
|
128
|
+
return { valid, passed: valid && result.status === "passed", issues };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function createAdopterDeliveryPassportBinding(gateResult) {
|
|
132
|
+
const normalized = structuredClone(gateResult);
|
|
133
|
+
const validation = validateAdopterDeliveryGateResult(normalized);
|
|
134
|
+
const binding = {
|
|
135
|
+
schemaVersion: 1,
|
|
136
|
+
contract: ADOPTER_DELIVERY_PASSPORT_BINDING_CONTRACT,
|
|
137
|
+
valid: validation.passed,
|
|
138
|
+
qualifying: false,
|
|
139
|
+
selfCertified: false,
|
|
140
|
+
gateResult: normalized,
|
|
141
|
+
validationIssues: validation.issues,
|
|
142
|
+
nonClaims: [
|
|
143
|
+
"A passing adopter delivery gate does not grant runtime permission or release authority.",
|
|
144
|
+
"The selected protocol driver retains semantic authority; Buildchain only binds its exact result into delivery evidence.",
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
binding.bindingRoot = adopterDeliveryGateDigest(binding);
|
|
148
|
+
return binding;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function normalizeAdopterDeliveryPassportBinding(value) {
|
|
152
|
+
if (!value) return undefined;
|
|
153
|
+
return value.contract === ADOPTER_DELIVERY_PASSPORT_BINDING_CONTRACT
|
|
154
|
+
? structuredClone(value)
|
|
155
|
+
: createAdopterDeliveryPassportBinding(value);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function validateAdopterDeliveryPassportBinding(
|
|
159
|
+
binding,
|
|
160
|
+
{ expectedProjectRepository = "" } = {},
|
|
161
|
+
) {
|
|
162
|
+
if (!binding || typeof binding !== "object" || Array.isArray(binding)) {
|
|
163
|
+
return [
|
|
164
|
+
issue(
|
|
165
|
+
"adopterDelivery.binding",
|
|
166
|
+
"adopter delivery passport binding must be an object",
|
|
167
|
+
),
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
const gateValidation = validateAdopterDeliveryGateResult(binding.gateResult);
|
|
171
|
+
const issues = [
|
|
172
|
+
...validateRootedJson(
|
|
173
|
+
binding,
|
|
174
|
+
"bindingRoot",
|
|
175
|
+
"adopterDelivery.binding.bindingRoot",
|
|
176
|
+
"adopter delivery binding root",
|
|
177
|
+
),
|
|
178
|
+
...gateValidation.issues,
|
|
179
|
+
];
|
|
180
|
+
if (
|
|
181
|
+
binding.schemaVersion !== 1 ||
|
|
182
|
+
binding.contract !== ADOPTER_DELIVERY_PASSPORT_BINDING_CONTRACT
|
|
183
|
+
) {
|
|
184
|
+
issues.push(
|
|
185
|
+
issue(
|
|
186
|
+
"adopterDelivery.binding.contract",
|
|
187
|
+
"adopter delivery passport binding contract is unsupported",
|
|
188
|
+
),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
if (
|
|
192
|
+
binding.valid !== gateValidation.passed ||
|
|
193
|
+
binding.qualifying !== false ||
|
|
194
|
+
binding.selfCertified !== false
|
|
195
|
+
) {
|
|
196
|
+
issues.push(
|
|
197
|
+
issue(
|
|
198
|
+
"adopterDelivery.binding.status",
|
|
199
|
+
"binding status must preserve a passing non-authoritative gate result",
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
if (!gateValidation.passed) {
|
|
204
|
+
issues.push(
|
|
205
|
+
issue(
|
|
206
|
+
"adopterDelivery.status",
|
|
207
|
+
"release passport requires a passed adopter delivery gate",
|
|
208
|
+
),
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
if (
|
|
212
|
+
expectedProjectRepository &&
|
|
213
|
+
binding.gateResult?.project?.adopterId !== expectedProjectRepository
|
|
214
|
+
) {
|
|
215
|
+
issues.push(
|
|
216
|
+
issue(
|
|
217
|
+
"adopterDelivery.project",
|
|
218
|
+
"delivery project must match the release passport product repository",
|
|
219
|
+
),
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return issues;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function sameJson(left, right) {
|
|
226
|
+
try {
|
|
227
|
+
return adopterDeliveryGateDigest(left) === adopterDeliveryGateDigest(right);
|
|
228
|
+
} catch {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function validateAdopterDeliveryReleaseEvidence({
|
|
234
|
+
binding,
|
|
235
|
+
artifactBinding,
|
|
236
|
+
expectedProjectRepository = "",
|
|
237
|
+
} = {}) {
|
|
238
|
+
if (!binding && !artifactBinding) return [];
|
|
239
|
+
if (!binding) {
|
|
240
|
+
return [
|
|
241
|
+
issue(
|
|
242
|
+
"adopterDelivery.passport",
|
|
243
|
+
"artifact evidence cannot introduce delivery authority absent from the passport",
|
|
244
|
+
),
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
const issues = validateAdopterDeliveryPassportBinding(binding, {
|
|
248
|
+
expectedProjectRepository,
|
|
249
|
+
});
|
|
250
|
+
if (!artifactBinding || !sameJson(artifactBinding, binding)) {
|
|
251
|
+
issues.push(
|
|
252
|
+
issue(
|
|
253
|
+
"adopterDelivery.artifactEvidence",
|
|
254
|
+
"passport and artifact evidence must bind the same exact delivery result",
|
|
255
|
+
),
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
return issues;
|
|
259
|
+
}
|