@kungfu-tech/buildchain 4.0.2-alpha.8 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -1
- package/CONTRIBUTING.md +24 -0
- package/README.md +2 -2
- package/actions/promote-buildchain-ref/README.md +1 -1
- package/actions/v4-release-candidate-promote/README.md +28 -0
- package/architecture/agent-change-map.md +64 -7
- package/architecture/ci-lane-change-budget.json +366 -0
- package/architecture/internal-capabilities.json +53 -8
- package/architecture/maintainability-debt.json +147 -93
- package/architecture/maintainability-policy.json +32 -28
- package/architecture/release-tail-contract-inventory.json +6 -6
- package/architecture/v4-architecture-constitution.md +23 -20
- package/architecture/v4-cross-platform-adopter-qualification.json +1 -1
- package/architecture/v4-delivery-authority-parity.json +2 -2
- package/architecture/v4-delivery-warrant-shadow-bootstrap-plan.json +1 -1
- package/architecture/v4-floating-consumer-policy.json +2 -2
- package/architecture/v4-next-development-parity.json +5 -5
- package/architecture/v4-partial-mutation-recovery-qualification.json +4 -1
- package/architecture/v4-platform-stage-checkpoints.json +1 -1
- package/architecture/v4-provider-operation-journal-contract.json +5 -2
- package/architecture/v4-publication-facade-patches.json +64 -0
- package/architecture/v4-release-activation-shadow-domain.json +5 -2
- package/architecture/v4-release-topology.json +74 -39
- package/architecture/v4-rust-wasm-production-authority.json +58 -0
- package/architecture/v4-stable-publication-fence.json +5 -2
- package/architecture/v4-stage-capsule-qualification.json +2 -2
- package/architecture/v4-tail-reseal-parity.json +8 -6
- package/architecture/v4-universal-workflow-bootstrap.json +171 -0
- package/architecture/v4-universal-workflow-fault-campaign.json +72 -0
- package/architecture/v4-universal-workflow-train-admission.json +40 -0
- package/architecture/workflow-taxonomy.json +1451 -0
- package/bin/buildchain.mjs +7 -7
- package/contracts/buildchain-v2-residuals-v1.json +57 -48
- package/contracts/dev-delivery-authority-v2.schema.json +16 -2
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/contracts/v4-canonical-contracts-v1.schema.json +1 -0
- package/dist/site/buildchain-contract.json +93 -48
- package/dist/site/buildchain-site.json +222 -69
- package/dist/site/capability-registry.json +4 -4
- package/dist/site/controller-registry.json +50 -13
- package/dist/site/kfd-claims.json +2585 -1000
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +13 -13
- package/dist/site/node-api-registry.json +120 -115
- package/dist/site/page-registry.json +204 -51
- package/dist/site/public-surface-audit.json +3205 -1219
- package/dist/site/publication-authority-registry.json +1124 -362
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/schemas/dev-delivery-authority-v2.schema.json +16 -2
- package/dist/site/site-manifest.json +17 -17
- package/dist/site/workflow-registry.json +5061 -1659
- package/docs/MAP.md +1 -0
- package/docs/auditable-demo.md +1 -1
- package/docs/cli.md +21 -8
- package/docs/dev-delivery-warrant.md +1 -1
- package/docs/engineering-housekeeper.md +3 -3
- package/docs/kfd-support.md +26 -2
- package/docs/next-development-transition.md +2 -2
- package/docs/node-api-reference.md +190 -190
- package/docs/publication-authority.md +2 -2
- package/docs/release-candidate.md +3 -3
- package/docs/release-flow.md +67 -19
- package/docs/release-governance.md +8 -8
- package/docs/release-passport.md +27 -2
- package/docs/reusable-build-surface.md +16 -0
- package/docs/v4-adopter-delivery.md +2 -2
- package/docs/v4-production-release.md +71 -8
- package/docs/v4-rust-wasm-production-authority.md +58 -0
- package/docs/v4-stage-capsule.md +2 -2
- package/docs/v4-tail-reseal.md +1 -1
- package/docs/workflow-catalog.md +154 -0
- package/docs/workflow-path-migration.md +109 -0
- package/package.json +10 -6
- package/packages/core/artifact-verification-envelope.js +5 -5
- package/packages/core/buildchain-contract.js +1 -1
- package/packages/core/buildchain-kfd-claims.js +2 -2
- package/packages/core/buildchain-publication-authority.js +42 -26
- package/packages/core/buildchain-v4-domain.wasm +0 -0
- package/packages/core/ci-lane-change-budget.js +14 -1
- package/packages/core/controller-evidence.js +4 -1
- package/packages/core/dev-delivery-candidate-identity.js +40 -6
- package/packages/core/dev-delivery-warrant-state.js +3 -4
- package/packages/core/dev-delivery-warrant.js +12 -2
- package/packages/core/github-governance-authority.js +4 -4
- package/packages/core/kfd-adopter-manifest.js +46 -47
- package/packages/core/next-development-projection.js +2 -2
- package/packages/core/paper-agent-entry.js +30 -4
- package/packages/core/paper-fleet.js +1 -1
- package/packages/core/paper-runtime-channels.js +348 -0
- package/packages/core/paper-scaffold-content.js +10 -0
- package/packages/core/paper.js +37 -71
- package/packages/core/release-line-dry-run.js +1 -1
- package/packages/core/release-passport-contract.js +5 -5
- package/packages/core/release-passport.js +5 -4
- package/packages/core/release-tail-provider-plane.js +68 -1048
- package/packages/core/v4-canonical-contracts.js +10 -75
- package/packages/core/v4-domain-wasm-artifact.js +7 -0
- package/packages/core/v4-domain-wasm.js +216 -0
- package/packages/core/v4-floating-consumer-evidence.js +1 -1
- package/packages/core/v4-floating-consumer-policy.js +1 -1
- package/packages/core/v4-partial-mutation-recovery-qualification.js +9 -386
- package/packages/core/v4-product-publication.js +19 -349
- package/packages/core/v4-protected-publication-source.js +19 -21
- package/packages/core/v4-provider-operation-journal.js +18 -487
- package/packages/core/v4-provider-readback-idempotency.js +12 -97
- package/packages/core/v4-release-activation-shadow.js +13 -500
- package/packages/core/v4-release-invocation.js +28 -389
- package/packages/core/v4-stable-publication-fence.js +13 -342
- package/packages/core/v4-universal-workflow-bootstrap.js +586 -0
- package/scripts/binary-publication-evidence.mjs +135 -0
- package/scripts/build-contract-core.mjs +1 -14
- package/scripts/build-v4-domain-wasm.mjs +189 -0
- package/scripts/check-action-bundles.mjs +12 -2
- package/scripts/check-ci-lane-change-budget.mjs +4 -1
- package/scripts/check-core-mechanism-inventory.mjs +4 -3
- package/scripts/check-inventory.mjs +35 -44
- package/scripts/check-maintainability.mjs +16 -113
- package/scripts/check-v4-floating-consumer-policy-contract.mjs +2 -2
- package/scripts/check-v4-public-dogfood-contract.mjs +22 -9
- package/scripts/check-v4-release-topology.mjs +90 -33
- package/scripts/check-v4-runtime-semantic-closure.mjs +4 -1
- package/scripts/check-v4-universal-workflow-bootstrap.mjs +266 -0
- package/scripts/check-workflow-taxonomy.mjs +6 -0
- package/scripts/copy-v4-domain-wasm.mjs +14 -0
- package/scripts/dev-delivery-authority-command-adapters.mjs +1 -1
- package/scripts/dev-delivery-authority.mjs +8 -8
- package/scripts/dev-delivery-source-proof-reuse.mjs +2 -1
- package/scripts/dev-delivery-warrant-options.mjs +14 -9
- package/scripts/dev-delivery-warrant-store.mjs +73 -7
- package/scripts/dev-delivery-warrant-transition.mjs +109 -0
- package/scripts/dev-delivery-warrant.mjs +76 -99
- package/scripts/dev-pr-auto-merge.mjs +15 -15
- package/scripts/generate-channel-build-workflow.mjs +7 -2
- package/scripts/generate-channel-promotion-workflow.mjs +7 -5
- package/scripts/generate-site-bundle.mjs +11 -11
- package/scripts/generate-v4-universal-workflow-facades.mjs +458 -0
- package/scripts/generate-workflow-taxonomy.mjs +25 -0
- package/scripts/github-output.mjs +31 -0
- package/scripts/maintainability-metrics.mjs +16 -5
- package/scripts/maintainability-public-surface.mjs +115 -0
- package/scripts/next-development-review.mjs +307 -0
- package/scripts/paper-work-fleet-cli.mjs +2 -0
- package/scripts/release-asset-client.mjs +91 -0
- package/scripts/release-candidate-resolver.mjs +9 -9
- package/scripts/source-verification-evidence.mjs +344 -0
- package/scripts/stable-candidate-qualification.mjs +1 -1
- package/scripts/universal-facade-maintainability.mjs +82 -0
- package/scripts/v4-product-publication-intent.mjs +13 -6
- package/scripts/v4-publication-settlement.mjs +211 -0
- package/scripts/v4-universal-workflow-backflow.mjs +212 -0
- package/scripts/v4-universal-workflow-engine.mjs +618 -0
- package/scripts/v4-universal-workflow-self-dogfood.mjs +205 -0
- package/scripts/verify-version-state-delta.mjs +173 -0
- package/scripts/workflow-taxonomy.mjs +507 -0
- package/templates/native-dev-delivery.yml +4 -7
- package/templates/universal-buildchain-bootstrap-recovery.yml +282 -0
- package/templates/universal-buildchain-bootstrap.yml +28 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
name: Universal Buildchain Bootstrap Recovery
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
request-json:
|
|
7
|
+
description: "Versioned exact-candidate request envelope"
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
outputs:
|
|
11
|
+
runtime-sha:
|
|
12
|
+
value: ${{ jobs.recovery-admit.outputs.runtime-sha }}
|
|
13
|
+
result-json:
|
|
14
|
+
value: ${{ jobs.recovery-execute.outputs.result-json }}
|
|
15
|
+
terminal-receipt-json:
|
|
16
|
+
value: ${{ jobs.recovery-settle.outputs.terminal-receipt-json }}
|
|
17
|
+
terminal-receipt-root:
|
|
18
|
+
value: ${{ jobs.recovery-settle.outputs.terminal-receipt-root }}
|
|
19
|
+
backflow-root:
|
|
20
|
+
value: ${{ jobs.recovery-settle.outputs.backflow-root }}
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
recovery-admit:
|
|
27
|
+
runs-on: ubuntu-24.04
|
|
28
|
+
permissions:
|
|
29
|
+
checks: read
|
|
30
|
+
contents: read
|
|
31
|
+
pull-requests: read
|
|
32
|
+
outputs:
|
|
33
|
+
runtime-sha: ${{ steps.admit.outputs.runtime-sha }}
|
|
34
|
+
admission-json: ${{ steps.admit.outputs.admission-json }}
|
|
35
|
+
steps:
|
|
36
|
+
- name: Parse exact recovery coordinates without Buildchain code
|
|
37
|
+
id: request
|
|
38
|
+
shell: bash
|
|
39
|
+
env:
|
|
40
|
+
REQUEST_JSON: ${{ inputs.request-json }}
|
|
41
|
+
run: |
|
|
42
|
+
set -euo pipefail
|
|
43
|
+
printf '%s\n' "${REQUEST_JSON}" > .buildchain-request.json
|
|
44
|
+
jq -e '
|
|
45
|
+
.schema == "kungfu-buildchain-v4-universal-workflow-request/v1" and
|
|
46
|
+
.mode == "train" and
|
|
47
|
+
.candidate.repository == "kungfu-systems/buildchain" and
|
|
48
|
+
(.candidate.discoveryRef | test("^train/v4/v4\\.[0-9]+/[A-Za-z0-9][A-Za-z0-9._/-]*$")) and
|
|
49
|
+
(.candidate.expectedSha | test("^[0-9a-f]{40}$")) and
|
|
50
|
+
(.candidate.reviewPullRequest | type == "number" and . > 0)
|
|
51
|
+
' .buildchain-request.json > /dev/null
|
|
52
|
+
{
|
|
53
|
+
echo "repository=$(jq -r '.candidate.repository' .buildchain-request.json)"
|
|
54
|
+
echo "ref=$(jq -r '.candidate.discoveryRef' .buildchain-request.json)"
|
|
55
|
+
echo "sha=$(jq -r '.candidate.expectedSha' .buildchain-request.json)"
|
|
56
|
+
echo "pr=$(jq -r '.candidate.reviewPullRequest' .buildchain-request.json)"
|
|
57
|
+
} >> "${GITHUB_OUTPUT}"
|
|
58
|
+
|
|
59
|
+
- name: Checkout exact Train candidate without persisted credentials
|
|
60
|
+
uses: actions/checkout@v7.0.0
|
|
61
|
+
with:
|
|
62
|
+
repository: ${{ steps.request.outputs.repository }}
|
|
63
|
+
ref: ${{ steps.request.outputs.ref }}
|
|
64
|
+
path: .buildchain/candidate
|
|
65
|
+
persist-credentials: false
|
|
66
|
+
|
|
67
|
+
- name: Prove exact independent review before candidate code runs
|
|
68
|
+
shell: bash
|
|
69
|
+
env:
|
|
70
|
+
GH_TOKEN: ${{ github.token }}
|
|
71
|
+
EXPECTED_SHA: ${{ steps.request.outputs.sha }}
|
|
72
|
+
REVIEW_PR: ${{ steps.request.outputs.pr }}
|
|
73
|
+
run: |
|
|
74
|
+
set -euo pipefail
|
|
75
|
+
test "$(git -C .buildchain/candidate rev-parse HEAD)" = "${EXPECTED_SHA}"
|
|
76
|
+
gh api "repos/kungfu-systems/buildchain/pulls/${REVIEW_PR}" > .buildchain-pr.json
|
|
77
|
+
gh api --paginate "repos/kungfu-systems/buildchain/pulls/${REVIEW_PR}/reviews" \
|
|
78
|
+
| jq -s 'add' > .buildchain-reviews.json
|
|
79
|
+
gh api --paginate -H 'Accept: application/vnd.github+json' \
|
|
80
|
+
"repos/kungfu-systems/buildchain/commits/${EXPECTED_SHA}/check-runs?per_page=100" \
|
|
81
|
+
| jq -s '[.[].check_runs[]]' > .buildchain-checks.json
|
|
82
|
+
jq -e --arg sha "${EXPECTED_SHA}" '
|
|
83
|
+
.head.repo.full_name == "kungfu-systems/buildchain" and
|
|
84
|
+
.head.sha == $sha and
|
|
85
|
+
.base.ref == "dev/v4/v4.0"
|
|
86
|
+
' .buildchain-pr.json > /dev/null
|
|
87
|
+
jq -e --arg sha "${EXPECTED_SHA}" '
|
|
88
|
+
any(.[]; .state == "APPROVED" and .commit_id == $sha and (.user.login | ascii_downcase) == "kungfu-origin")
|
|
89
|
+
' .buildchain-reviews.json > /dev/null
|
|
90
|
+
jq -e '
|
|
91
|
+
any(.[]; .name == "check" and .status == "completed" and .conclusion == "success")
|
|
92
|
+
' .buildchain-checks.json > /dev/null
|
|
93
|
+
|
|
94
|
+
- name: Admit candidate policy and exact-head checks
|
|
95
|
+
id: admit
|
|
96
|
+
shell: bash
|
|
97
|
+
env:
|
|
98
|
+
BUILDCHAIN_UNIVERSAL_REQUEST_JSON: ${{ inputs.request-json }}
|
|
99
|
+
BUILDCHAIN_UNIVERSAL_CONSUMER_REPOSITORY: ${{ github.repository }}
|
|
100
|
+
BUILDCHAIN_UNIVERSAL_CONSUMER_SHA: ${{ github.sha }}
|
|
101
|
+
BUILDCHAIN_UNIVERSAL_CONSUMER_WORKFLOW_REF: ${{ github.workflow_ref }}
|
|
102
|
+
EXPECTED_SHA: ${{ steps.request.outputs.sha }}
|
|
103
|
+
REVIEW_PR: ${{ steps.request.outputs.pr }}
|
|
104
|
+
run: |
|
|
105
|
+
set -euo pipefail
|
|
106
|
+
observed_at="$(date -u '+%Y-%m-%dT%H:%M:%S.000Z')"
|
|
107
|
+
jq -n --arg expected "${EXPECTED_SHA}" \
|
|
108
|
+
--arg observed_at "${observed_at}" \
|
|
109
|
+
--argjson pull_request "${REVIEW_PR}" \
|
|
110
|
+
--slurpfile reviews .buildchain-reviews.json \
|
|
111
|
+
--slurpfile checks .buildchain-checks.json '
|
|
112
|
+
{
|
|
113
|
+
repository: "kungfu-systems/buildchain",
|
|
114
|
+
pullRequest: $pull_request,
|
|
115
|
+
headSha: $expected,
|
|
116
|
+
baseRef: "dev/v4/v4.0",
|
|
117
|
+
approvals: ($reviews[0]
|
|
118
|
+
| map(select(.state == "APPROVED" and .commit_id == $expected))
|
|
119
|
+
| map({
|
|
120
|
+
reviewer: (.user.login | ascii_downcase),
|
|
121
|
+
commitSha: .commit_id,
|
|
122
|
+
submittedAt: (.submitted_at | fromdateiso8601 | strftime("%Y-%m-%dT%H:%M:%S.000Z"))
|
|
123
|
+
})),
|
|
124
|
+
checks: ($checks[0] | map(select(.status == "completed" and (.conclusion // "") != "")) | map({name, status, conclusion})),
|
|
125
|
+
observedAt: $observed_at
|
|
126
|
+
}
|
|
127
|
+
' > .buildchain-review-evidence.json
|
|
128
|
+
BUILDCHAIN_UNIVERSAL_ADMISSION_POLICY_JSON="$(jq -c '.' .buildchain/candidate/architecture/v4-universal-workflow-train-admission.json)"
|
|
129
|
+
BUILDCHAIN_UNIVERSAL_REVIEW_EVIDENCE_JSON="$(jq -c '.' .buildchain-review-evidence.json)"
|
|
130
|
+
BUILDCHAIN_UNIVERSAL_OBSERVED_SHA="${EXPECTED_SHA}"
|
|
131
|
+
BUILDCHAIN_UNIVERSAL_OBSERVED_AT="${observed_at}"
|
|
132
|
+
export BUILDCHAIN_UNIVERSAL_ADMISSION_POLICY_JSON BUILDCHAIN_UNIVERSAL_REVIEW_EVIDENCE_JSON
|
|
133
|
+
export BUILDCHAIN_UNIVERSAL_OBSERVED_SHA BUILDCHAIN_UNIVERSAL_OBSERVED_AT
|
|
134
|
+
node .buildchain/candidate/scripts/v4-universal-workflow-engine.mjs admit > .buildchain-admission.json
|
|
135
|
+
{
|
|
136
|
+
echo "runtime-sha=${EXPECTED_SHA}"
|
|
137
|
+
echo "admission-json=$(jq -c '.' .buildchain-admission.json)"
|
|
138
|
+
} >> "${GITHUB_OUTPUT}"
|
|
139
|
+
|
|
140
|
+
recovery-execute:
|
|
141
|
+
needs: recovery-admit
|
|
142
|
+
runs-on: ubuntu-24.04
|
|
143
|
+
permissions:
|
|
144
|
+
actions: write
|
|
145
|
+
artifact-metadata: write
|
|
146
|
+
attestations: write
|
|
147
|
+
checks: write
|
|
148
|
+
contents: write
|
|
149
|
+
deployments: write
|
|
150
|
+
id-token: write
|
|
151
|
+
issues: write
|
|
152
|
+
packages: write
|
|
153
|
+
pages: write
|
|
154
|
+
pull-requests: write
|
|
155
|
+
security-events: write
|
|
156
|
+
statuses: write
|
|
157
|
+
outputs:
|
|
158
|
+
result-json: ${{ steps.execute.outputs.result-json }}
|
|
159
|
+
steps:
|
|
160
|
+
- name: Checkout unchanged consumer source
|
|
161
|
+
uses: actions/checkout@v7.0.0
|
|
162
|
+
with:
|
|
163
|
+
persist-credentials: false
|
|
164
|
+
|
|
165
|
+
- name: Checkout exact admitted candidate
|
|
166
|
+
uses: actions/checkout@v7.0.0
|
|
167
|
+
with:
|
|
168
|
+
repository: kungfu-systems/buildchain
|
|
169
|
+
ref: ${{ needs.recovery-admit.outputs.runtime-sha }}
|
|
170
|
+
path: .buildchain/candidate
|
|
171
|
+
persist-credentials: false
|
|
172
|
+
|
|
173
|
+
- name: Execute only the exact admitted engine
|
|
174
|
+
id: execute
|
|
175
|
+
shell: bash
|
|
176
|
+
env:
|
|
177
|
+
BUILDCHAIN_UNIVERSAL_REQUEST_JSON: ${{ inputs.request-json }}
|
|
178
|
+
BUILDCHAIN_UNIVERSAL_ADMISSION_JSON: ${{ needs.recovery-admit.outputs.admission-json }}
|
|
179
|
+
BUILDCHAIN_UNIVERSAL_ENGINE_SHA: ${{ needs.recovery-admit.outputs.runtime-sha }}
|
|
180
|
+
GH_TOKEN: ${{ github.token }}
|
|
181
|
+
run: |
|
|
182
|
+
set -euo pipefail
|
|
183
|
+
node .buildchain/candidate/scripts/v4-universal-workflow-engine.mjs execute > .buildchain-result.json
|
|
184
|
+
echo "result-json=$(jq -c '.' .buildchain-result.json)" >> "${GITHUB_OUTPUT}"
|
|
185
|
+
|
|
186
|
+
recovery-settle:
|
|
187
|
+
needs: [recovery-admit, recovery-execute]
|
|
188
|
+
runs-on: ubuntu-24.04
|
|
189
|
+
permissions:
|
|
190
|
+
contents: read
|
|
191
|
+
issues: write
|
|
192
|
+
pull-requests: read
|
|
193
|
+
outputs:
|
|
194
|
+
terminal-receipt-json: ${{ steps.settle.outputs.terminal-receipt-json }}
|
|
195
|
+
terminal-receipt-root: ${{ steps.settle.outputs.terminal-receipt-root }}
|
|
196
|
+
backflow-root: ${{ steps.backflow.outputs.backflow-root }}
|
|
197
|
+
steps:
|
|
198
|
+
- name: Seal receipt outside candidate authority
|
|
199
|
+
id: settle
|
|
200
|
+
shell: bash
|
|
201
|
+
env:
|
|
202
|
+
BUILDCHAIN_UNIVERSAL_ADMISSION_JSON: ${{ needs.recovery-admit.outputs.admission-json }}
|
|
203
|
+
BUILDCHAIN_UNIVERSAL_RESULT_JSON: ${{ needs.recovery-execute.outputs.result-json }}
|
|
204
|
+
run: |
|
|
205
|
+
set -euo pipefail
|
|
206
|
+
node <<'NODE' > .buildchain-terminal.json
|
|
207
|
+
const crypto = require("node:crypto");
|
|
208
|
+
const admission = JSON.parse(process.env.BUILDCHAIN_UNIVERSAL_ADMISSION_JSON);
|
|
209
|
+
const result = JSON.parse(process.env.BUILDCHAIN_UNIVERSAL_RESULT_JSON);
|
|
210
|
+
const rootPattern = /^sha256:[0-9a-f]{64}$/;
|
|
211
|
+
const shaPattern = /^[0-9a-f]{40}$/;
|
|
212
|
+
const canonical = (value) => Array.isArray(value)
|
|
213
|
+
? value.map(canonical)
|
|
214
|
+
: value && typeof value === "object"
|
|
215
|
+
? Object.fromEntries(Object.keys(value).sort((left, right) => Buffer.from(left).compare(Buffer.from(right))).map((key) => [key, canonical(value[key])]))
|
|
216
|
+
: value;
|
|
217
|
+
const documentRoot = (domain, value) => {
|
|
218
|
+
const hash = crypto.createHash("sha256");
|
|
219
|
+
hash.update(domain, "utf8");
|
|
220
|
+
hash.update(Buffer.from([0]));
|
|
221
|
+
hash.update(`${JSON.stringify(canonical(value))}\n`, "utf8");
|
|
222
|
+
return `sha256:${hash.digest("hex")}`;
|
|
223
|
+
};
|
|
224
|
+
if (
|
|
225
|
+
admission.schema !== "kungfu-buildchain-v4-universal-workflow-admission/v1" ||
|
|
226
|
+
admission.status !== "admitted" ||
|
|
227
|
+
result.schema !== "kungfu-buildchain-v4-universal-workflow-result/v1" ||
|
|
228
|
+
!["succeeded", "failed"].includes(result.status) ||
|
|
229
|
+
result.requestRoot !== admission.requestRoot ||
|
|
230
|
+
result.capabilityRoot !== admission.capabilityRoot ||
|
|
231
|
+
result.runtime?.repository !== admission.runtime?.repository ||
|
|
232
|
+
result.runtime?.sha !== admission.runtime?.sha ||
|
|
233
|
+
!shaPattern.test(admission.runtime?.sha || "") ||
|
|
234
|
+
![
|
|
235
|
+
admission.requestRoot,
|
|
236
|
+
admission.admissionRoot,
|
|
237
|
+
admission.discoveryRoot,
|
|
238
|
+
admission.reviewRoot,
|
|
239
|
+
admission.consumerRoot,
|
|
240
|
+
admission.capabilityRoot,
|
|
241
|
+
result.resultRoot,
|
|
242
|
+
].every((value) => rootPattern.test(value || ""))
|
|
243
|
+
) throw new Error("candidate result does not match the consumer-owned admission lineage");
|
|
244
|
+
const receipt = {
|
|
245
|
+
schema: "kungfu-buildchain-v4-universal-workflow-terminal-receipt/v1",
|
|
246
|
+
status: result.status,
|
|
247
|
+
requestRoot: admission.requestRoot,
|
|
248
|
+
admissionRoot: admission.admissionRoot,
|
|
249
|
+
discoveryRoot: admission.discoveryRoot,
|
|
250
|
+
reviewRoot: admission.reviewRoot,
|
|
251
|
+
consumerRoot: admission.consumerRoot,
|
|
252
|
+
capabilityRoot: admission.capabilityRoot,
|
|
253
|
+
runtime: admission.runtime,
|
|
254
|
+
resultRoot: result.resultRoot,
|
|
255
|
+
};
|
|
256
|
+
process.stdout.write(`${JSON.stringify({ ...receipt, receiptRoot: documentRoot("universal-workflow-receipt", receipt) })}\n`);
|
|
257
|
+
NODE
|
|
258
|
+
{
|
|
259
|
+
echo "terminal-receipt-json=$(jq -c '.' .buildchain-terminal.json)"
|
|
260
|
+
echo "terminal-receipt-root=$(jq -r '.receiptRoot' .buildchain-terminal.json)"
|
|
261
|
+
} >> "${GITHUB_OUTPUT}"
|
|
262
|
+
test "$(jq -r '.status' <<< "${BUILDCHAIN_UNIVERSAL_RESULT_JSON}")" = "succeeded"
|
|
263
|
+
|
|
264
|
+
- name: Checkout exact reviewed backflow coordinator
|
|
265
|
+
uses: actions/checkout@v7.0.0
|
|
266
|
+
with:
|
|
267
|
+
repository: kungfu-systems/buildchain
|
|
268
|
+
ref: ${{ needs.recovery-admit.outputs.runtime-sha }}
|
|
269
|
+
path: .buildchain/candidate
|
|
270
|
+
persist-credentials: false
|
|
271
|
+
|
|
272
|
+
- name: Bind successful delivery to protected backflow
|
|
273
|
+
id: backflow
|
|
274
|
+
shell: bash
|
|
275
|
+
env:
|
|
276
|
+
BUILDCHAIN_UNIVERSAL_REQUEST_JSON: ${{ inputs.request-json }}
|
|
277
|
+
BUILDCHAIN_UNIVERSAL_TERMINAL_RECEIPT_JSON: ${{ steps.settle.outputs.terminal-receipt-json }}
|
|
278
|
+
GH_TOKEN: ${{ github.token }}
|
|
279
|
+
run: |
|
|
280
|
+
set -euo pipefail
|
|
281
|
+
node .buildchain/candidate/scripts/v4-universal-workflow-backflow.mjs > .buildchain-backflow.json
|
|
282
|
+
echo "backflow-root=$(jq -r '.backflowRoot // empty' .buildchain-backflow.json)" >> "${GITHUB_OUTPUT}"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Universal Buildchain Bootstrap
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
request-json:
|
|
7
|
+
description: "Versioned exact-candidate request envelope"
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
outputs:
|
|
11
|
+
runtime-sha:
|
|
12
|
+
value: ${{ jobs.bootstrap.outputs.runtime-sha }}
|
|
13
|
+
terminal-receipt-json:
|
|
14
|
+
value: ${{ jobs.bootstrap.outputs.terminal-receipt-json }}
|
|
15
|
+
terminal-receipt-root:
|
|
16
|
+
value: ${{ jobs.bootstrap.outputs.terminal-receipt-root }}
|
|
17
|
+
backflow-root:
|
|
18
|
+
value: ${{ jobs.bootstrap.outputs.backflow-root }}
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: read
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
bootstrap:
|
|
25
|
+
uses: kungfu-systems/buildchain/.github/workflows/bootstrap.yml@v4
|
|
26
|
+
with:
|
|
27
|
+
request-json: ${{ inputs.request-json }}
|
|
28
|
+
secrets: inherit
|