@kungfu-tech/buildchain 2.14.18-alpha.1 → 2.14.18-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -0
  2. package/actions/promote-buildchain-ref/README.md +33 -30
  3. package/bin/buildchain.mjs +16 -4
  4. package/dist/site/buildchain-contract.json +86 -31
  5. package/dist/site/buildchain-site.json +88 -27
  6. package/dist/site/capability-registry.json +6 -5
  7. package/dist/site/cli-registry.json +12 -0
  8. package/dist/site/controller-registry.json +50 -6
  9. package/dist/site/kfd-claims.json +110 -21
  10. package/dist/site/kfd-upstream-aggregate.json +1 -1
  11. package/dist/site/manual-registry.json +21 -6
  12. package/dist/site/node-api-registry.json +19 -6
  13. package/dist/site/page-registry.json +70 -17
  14. package/dist/site/public-surface-audit.json +130 -23
  15. package/dist/site/publication-authority-registry.json +21 -1
  16. package/dist/site/publication-registry.json +4 -4
  17. package/dist/site/release-provenance.json +1 -0
  18. package/dist/site/site-manifest.json +18 -10
  19. package/dist/site/workflow-registry.json +62 -16
  20. package/docs/MAP.md +3 -1
  21. package/docs/github-governance-authority.md +267 -0
  22. package/docs/lifecycle-protocol.md +10 -10
  23. package/docs/publish-transaction.md +73 -4
  24. package/docs/release-governance.md +38 -24
  25. package/docs/reusable-build-surface.md +29 -11
  26. package/docs/web-surface-deployments.md +46 -0
  27. package/package.json +2 -1
  28. package/packages/core/buildchain-kfd-claims.js +2 -0
  29. package/packages/core/buildchain-publication-authority.js +1 -0
  30. package/packages/core/controller-evidence.js +1 -1
  31. package/packages/core/github-governance-authority.js +1312 -0
  32. package/packages/core/index.js +22 -0
  33. package/packages/core/publication-control-plane-audit.js +4 -1
  34. package/scripts/audit-github-governance.mjs +474 -0
  35. package/scripts/audit-publication-control-plane.mjs +41 -5
  36. package/scripts/check-inventory.mjs +8 -0
  37. package/scripts/generate-channel-promotion-workflow.mjs +3 -0
  38. package/scripts/generate-site-bundle.mjs +5 -0
  39. package/scripts/installer-publication.mjs +351 -0
  40. package/scripts/publication-commit-evidence.mjs +158 -0
  41. package/scripts/reconcile-github-governance.mjs +549 -0
  42. package/scripts/release-candidate-resolver.mjs +53 -0
  43. package/scripts/web-surface-core.mjs +127 -14
@@ -12,6 +12,7 @@
12
12
  "buildchain-ref",
13
13
  "buildchain-repository",
14
14
  "evidence-run-id",
15
+ "github-governance-receipt-json",
15
16
  "publication-admission-json",
16
17
  "publication-control-plane-audit-json",
17
18
  "publication-expected-json",
@@ -23,7 +24,7 @@
23
24
  "source-sha",
24
25
  "target-ref"
25
26
  ],
26
- "inputCount": 14,
27
+ "inputCount": 15,
27
28
  "secrets": [],
28
29
  "secretCount": 0,
29
30
  "outputs": [],
@@ -63,6 +64,7 @@
63
64
  "checkout-cache-mode",
64
65
  "checkout-cache-reference-repository-template",
65
66
  "checkout-cache-timeout-seconds",
67
+ "credential-island-caller-owned",
66
68
  "credential-island-environment",
67
69
  "credential-island-macos-app-path",
68
70
  "credential-island-macos-platform-id",
@@ -102,7 +104,7 @@
102
104
  "verify-command",
103
105
  "working-directory"
104
106
  ],
105
- "inputCount": 64,
107
+ "inputCount": 65,
106
108
  "secrets": [
107
109
  "BUILDCHAIN_ARTIFACT_RELAY_S3_DOWNLOAD_ROLE_ARN",
108
110
  "BUILDCHAIN_ARTIFACT_RELAY_S3_ROLE_ARN",
@@ -254,6 +256,7 @@
254
256
  "evidence-summary-artifact",
255
257
  "expected-json",
256
258
  "gate-aggregate-json",
259
+ "github-governance-receipt-json",
257
260
  "package-name",
258
261
  "product",
259
262
  "publication-target",
@@ -265,9 +268,11 @@
265
268
  "target-ref",
266
269
  "used-nonces-json"
267
270
  ],
268
- "inputCount": 32,
269
- "secrets": [],
270
- "secretCount": 0,
271
+ "inputCount": 33,
272
+ "secrets": [
273
+ "KUNGFU_GOVERNANCE_AUDITOR_APP_PRIVATE_KEY"
274
+ ],
275
+ "secretCount": 1,
271
276
  "outputs": [
272
277
  "capability-artifact",
273
278
  "capability-digest",
@@ -298,8 +303,10 @@
298
303
  "buildchain-repository",
299
304
  "channel",
300
305
  "dry-run",
306
+ "github-governance-receipt-json",
301
307
  "github-release",
302
308
  "github-release-notes",
309
+ "github-release-payload-patterns",
303
310
  "github-release-title",
304
311
  "package-manager",
305
312
  "promotion-contract-lock-digest",
@@ -316,6 +323,8 @@
316
323
  "publication-admission-json",
317
324
  "publication-auto-admission",
318
325
  "publication-auto-no-gate",
326
+ "publication-commit-command",
327
+ "publication-commit-evidence-path",
319
328
  "publication-consumer-predicate-id",
320
329
  "publication-consumer-qualification-command",
321
330
  "publication-control-plane-audit-json",
@@ -360,17 +369,20 @@
360
369
  "target-sha",
361
370
  "trusted-publishing"
362
371
  ],
363
- "inputCount": 74,
372
+ "inputCount": 78,
364
373
  "secrets": [
365
374
  "BUILDCHAIN_ISSUE_APP_ID",
366
375
  "BUILDCHAIN_ISSUE_APP_PRIVATE_KEY",
367
376
  "BUILDCHAIN_ISSUE_TOKEN",
368
377
  "BUILDCHAIN_PROMOTION_TOKEN",
378
+ "BUILDCHAIN_PUBLICATION_COMMIT_SIGNING_KEY",
379
+ "BUILDCHAIN_PUBLICATION_COMMIT_TOKEN",
380
+ "KUNGFU_GOVERNANCE_AUDITOR_APP_PRIVATE_KEY",
369
381
  "buildchain-issue-app-id",
370
382
  "buildchain-issue-app-private-key",
371
383
  "buildchain-issue-token"
372
384
  ],
373
- "secretCount": 7,
385
+ "secretCount": 10,
374
386
  "outputs": [
375
387
  "built-source-sha",
376
388
  "controller-plan-artifact",
@@ -382,9 +394,13 @@
382
394
  "controller-receipt-status",
383
395
  "promoted-sha",
384
396
  "publication-capability-digest",
397
+ "publication-commit-evidence-digest",
398
+ "publication-commit-evidence-path",
399
+ "publication-commit-payload-root",
400
+ "publication-commit-url",
385
401
  "release-candidate-artifact"
386
402
  ],
387
- "outputCount": 11,
403
+ "outputCount": 15,
388
404
  "surface": "reusable-workflow",
389
405
  "capabilityGroup": "api-cli-reference",
390
406
  "status": "active"
@@ -660,6 +676,7 @@
660
676
  "buildchain-ref",
661
677
  "buildchain-repository",
662
678
  "fail-on-release-pr-error",
679
+ "github-governance-receipt-json",
663
680
  "node-version",
664
681
  "preview-apply",
665
682
  "preview-aws-role-arn",
@@ -691,7 +708,7 @@
691
708
  "verify-command",
692
709
  "working-directory"
693
710
  ],
694
- "inputCount": 39,
711
+ "inputCount": 40,
695
712
  "secrets": [
696
713
  "production-release-app-private-key"
697
714
  ],
@@ -847,6 +864,7 @@
847
864
  "checkout-cache-mode",
848
865
  "checkout-cache-reference-repository-template",
849
866
  "checkout-cache-timeout-seconds",
867
+ "credential-island-caller-owned",
850
868
  "credential-island-environment",
851
869
  "credential-island-macos-app-path",
852
870
  "credential-island-macos-platform-id",
@@ -886,7 +904,7 @@
886
904
  "verify-command",
887
905
  "working-directory"
888
906
  ],
889
- "inputCount": 67,
907
+ "inputCount": 68,
890
908
  "secrets": [
891
909
  "BUILDCHAIN_ARTIFACT_RELAY_S3_DOWNLOAD_ROLE_ARN",
892
910
  "BUILDCHAIN_ARTIFACT_RELAY_S3_ROLE_ARN",
@@ -1181,6 +1199,20 @@
1181
1199
  "capabilityGroup": "governance-versioning",
1182
1200
  "status": "active"
1183
1201
  },
1202
+ {
1203
+ "id": "github-governance-audit",
1204
+ "path": ".github/workflows/github-governance-audit.yml",
1205
+ "reusable": false,
1206
+ "inputs": [],
1207
+ "inputCount": 0,
1208
+ "secrets": [],
1209
+ "secretCount": 0,
1210
+ "outputs": [],
1211
+ "outputCount": 0,
1212
+ "surface": "dev-governance",
1213
+ "capabilityGroup": "api-cli-reference",
1214
+ "status": "active"
1215
+ },
1184
1216
  {
1185
1217
  "id": "npm-publish",
1186
1218
  "path": ".github/workflows/npm-publish.yml",
@@ -1210,6 +1242,7 @@
1210
1242
  "buildchain-ref",
1211
1243
  "buildchain-repository",
1212
1244
  "dry-run",
1245
+ "github-governance-receipt-json",
1213
1246
  "github-release",
1214
1247
  "github-release-notes",
1215
1248
  "github-release-title",
@@ -1226,7 +1259,7 @@
1226
1259
  "verify-command",
1227
1260
  "working-directory"
1228
1261
  ],
1229
- "inputCount": 25,
1262
+ "inputCount": 26,
1230
1263
  "secrets": [
1231
1264
  "BUILDCHAIN_PROMOTION_TOKEN"
1232
1265
  ],
@@ -1260,6 +1293,7 @@
1260
1293
  "buildchain-ref",
1261
1294
  "buildchain-repository",
1262
1295
  "dry-run",
1296
+ "github-governance-receipt-json",
1263
1297
  "github-release",
1264
1298
  "github-release-notes",
1265
1299
  "github-release-title",
@@ -1286,7 +1320,7 @@
1286
1320
  "verify-command",
1287
1321
  "working-directory"
1288
1322
  ],
1289
- "inputCount": 37,
1323
+ "inputCount": 38,
1290
1324
  "secrets": [],
1291
1325
  "secretCount": 0,
1292
1326
  "outputs": [
@@ -1501,13 +1535,17 @@
1501
1535
  "buildchain-stable-contract-lock-path",
1502
1536
  "channel",
1503
1537
  "dry-run",
1538
+ "github-governance-receipt-json",
1504
1539
  "github-release",
1505
1540
  "github-release-notes",
1541
+ "github-release-payload-patterns",
1506
1542
  "github-release-title",
1507
1543
  "package-manager",
1508
1544
  "publication-admission-json",
1509
1545
  "publication-auto-admission",
1510
1546
  "publication-auto-no-gate",
1547
+ "publication-commit-command",
1548
+ "publication-commit-evidence-path",
1511
1549
  "publication-consumer-predicate-id",
1512
1550
  "publication-consumer-qualification-command",
1513
1551
  "publication-control-plane-audit-json",
@@ -1552,17 +1590,20 @@
1552
1590
  "target-sha",
1553
1591
  "trusted-publishing"
1554
1592
  ],
1555
- "inputCount": 66,
1593
+ "inputCount": 70,
1556
1594
  "secrets": [
1557
1595
  "BUILDCHAIN_ISSUE_APP_ID",
1558
1596
  "BUILDCHAIN_ISSUE_APP_PRIVATE_KEY",
1559
1597
  "BUILDCHAIN_ISSUE_TOKEN",
1560
1598
  "BUILDCHAIN_PROMOTION_TOKEN",
1599
+ "BUILDCHAIN_PUBLICATION_COMMIT_SIGNING_KEY",
1600
+ "BUILDCHAIN_PUBLICATION_COMMIT_TOKEN",
1601
+ "KUNGFU_GOVERNANCE_AUDITOR_APP_PRIVATE_KEY",
1561
1602
  "buildchain-issue-app-id",
1562
1603
  "buildchain-issue-app-private-key",
1563
1604
  "buildchain-issue-token"
1564
1605
  ],
1565
- "secretCount": 7,
1606
+ "secretCount": 10,
1566
1607
  "outputs": [
1567
1608
  "buildchain-channel",
1568
1609
  "built-source-sha",
@@ -1586,9 +1627,13 @@
1586
1627
  "promotion-shell-sha",
1587
1628
  "promotion-target-ref",
1588
1629
  "publication-capability-digest",
1630
+ "publication-commit-evidence-digest",
1631
+ "publication-commit-evidence-path",
1632
+ "publication-commit-payload-root",
1633
+ "publication-commit-url",
1589
1634
  "release-candidate-artifact"
1590
1635
  ],
1591
- "outputCount": 23,
1636
+ "outputCount": 27,
1592
1637
  "surface": "release-governance",
1593
1638
  "capabilityGroup": "reusable-build",
1594
1639
  "status": "active"
@@ -1822,6 +1867,7 @@
1822
1867
  "branch-protection-bypass-users",
1823
1868
  "dry-run",
1824
1869
  "expected-publication-version",
1870
+ "generated-pull-request-token",
1825
1871
  "generated-ref-update-token",
1826
1872
  "generated-status-check-token",
1827
1873
  "github-release",
@@ -1880,7 +1926,7 @@
1880
1926
  "transaction-state-path",
1881
1927
  "verification-command"
1882
1928
  ],
1883
- "inputCount": 63,
1929
+ "inputCount": 64,
1884
1930
  "capabilityGroup": "release-passport-trust",
1885
1931
  "status": "active"
1886
1932
  },
package/docs/MAP.md CHANGED
@@ -34,7 +34,7 @@ workflow, action, and Node API export also carries a `capabilityGroup`,
34
34
  | Publication Artifacts | `publication-registry.json`, `workflow-registry.json`, `node-api-registry.json`, `manual-registry.json`, `kungfu-buildchain-publication-artifact-registry` | [`publication-artifacts.md`](publication-artifacts.md), [`reusable-build-surface.md`](reusable-build-surface.md) |
35
35
  | Distribution Indexes and Badges | `badge-endpoint-registry.json`, `node-api-registry.json`, `manual-registry.json` | [`readme-badges.md`](readme-badges.md), [`homebrew.md`](homebrew.md) |
36
36
  | Build Facts, Observability, and Diagnostics | `cli-registry.json`, `node-api-registry.json`, lifecycle artifacts | [`build-facts.md`](build-facts.md), [`toolkit-observability.md`](toolkit-observability.md), [`consumer-issue-reporting.md`](consumer-issue-reporting.md) |
37
- | Governance, Versioning, and Runtime Drift | `buildchain-contract.json`, `workflow-registry.json`, `release-model.json` | [`release-governance.md`](release-governance.md), [`release-flow.md`](release-flow.md), [`versioning.md`](versioning.md), [`runtime-train-validation.md`](runtime-train-validation.md), [`cli.md`](cli.md) |
37
+ | Governance, Versioning, and Runtime Drift | `buildchain-contract.json`, `workflow-registry.json`, `release-model.json` | [`github-governance-authority.md`](github-governance-authority.md), [`release-governance.md`](release-governance.md), [`release-flow.md`](release-flow.md), [`versioning.md`](versioning.md), [`runtime-train-validation.md`](runtime-train-validation.md), [`cli.md`](cli.md) |
38
38
  | CLI and Node API Reference | `cli-registry.json`, `node-api-registry.json`, `workflow-registry.json`, `manual-registry.json` | [`cli.md`](cli.md), [`../packages/core/README.md`](../packages/core/README.md) |
39
39
 
40
40
  | Capability | Machine-readable entry | Manual entry |
@@ -49,6 +49,7 @@ workflow, action, and Node API export also carries a `capabilityGroup`,
49
49
  | npm publish transactions, evidence, dist-tags, and recovery | `dist/site/release-model.json`, `dist/site/artifact-schemas.json` | [`publish-transaction.md`](publish-transaction.md) |
50
50
  | Git/source/version/module/product build facts | `dist/site/node-api-registry.json`, `dist/site/cli-registry.json`, `kungfu-buildchain-module-build-facts`, `kungfu-buildchain-product-build-facts` | [`build-facts.md`](build-facts.md) |
51
51
  | GitHub Release passport/evidence publication | `dist/site/release-model.json`, `dist/site/artifact-schemas.json` | [`release-governance.md`](release-governance.md), [`release-candidate.md`](release-candidate.md) |
52
+ | GitHub ownership, effective protection, plan capability, and managed-zone governance receipts | `dist/site/node-api-registry.json`, `dist/site/cli-registry.json`, `kungfu-buildchain-github-governance-receipt` | [`github-governance-authority.md`](github-governance-authority.md) |
52
53
  | release propagation for package/publication/site chains | `dist/site/release-model.json` | [`release-propagation.md`](release-propagation.md) |
53
54
  | publication artifact manifests, immutable archive registries, source bundles, and paper repository workflows | `dist/site/publication-registry.json`, `dist/site/workflow-registry.json`, `dist/site/node-api-registry.json`, `kungfu-buildchain-publication-artifact-manifest`, `kungfu-buildchain-publication-artifact-registry` | [`publication-artifacts.md`](publication-artifacts.md) |
54
55
  | Generated badge bundles, README badge blocks, and badge facts | `dist/site/node-api-registry.json`, `dist/site/manual-registry.json`, `kungfu-buildchain-badge-bundle-facts`, `kungfu-buildchain-readme-badge-facts` | [`readme-badges.md`](readme-badges.md) |
@@ -86,6 +87,7 @@ replace them.
86
87
  | How do I publish or verify release passport artifacts? | [`release-passport.md`](release-passport.md) | use | stable |
87
88
  | How do I seal exact artifact, identity, lifecycle, and KFD assessment roots for KFX admission? | [`artifact-verification-envelope.md`](artifact-verification-envelope.md) | verify/use | preview |
88
89
  | How is product publication authority sealed to an exact workflow, runner, control plane, nonce, and artifact? | [`publication-authority.md`](publication-authority.md) | verify | preview |
90
+ | How are GitHub ownership, independent review, effective protection, and plan capability audited fail-closed? | [`github-governance-authority.md`](github-governance-authority.md) | verify | preview |
89
91
  | How do I gate release artifacts with KFD-1 contract-world witnesses? | [`release-passport.md`](release-passport.md#kfd-1-contract-world-release-gate) | verify/use | stable |
90
92
  | How do I declare, render, and audit product KFD-2 release trust claims? | [`kfd-support.md`](kfd-support.md#kfd-2) + [`release-passport.md`](release-passport.md#kfd-2-release-trust-passport-audit) + [`cli.md`](cli.md) | verify/use | stable |
91
93
  | How do I gate KFD-3 collaboration-interface releases? | [`release-passport.md`](release-passport.md#kfd-3-collaboration-interface-release-gate) + [`cli.md`](cli.md) | verify/use | stable |
@@ -0,0 +1,267 @@
1
+ ---
2
+ status: draft
3
+ period: ongoing
4
+ theme: github-governance-authority
5
+ doc_type: protocol
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: B
10
+ review_state: unreviewed
11
+ last_reviewed: 2026-07-24
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-07-24
16
+ limits: Live GitHub state and account recovery remain provider-controlled and must be re-audited.
17
+ ---
18
+
19
+ # GitHub Governance Authority
20
+
21
+ Buildchain treats GitHub governance as an independently verified, fail-closed
22
+ authority boundary. A green CI run, a CODEOWNERS file, an API success response,
23
+ or an administrator's assertion is not sufficient by itself. The verifier
24
+ combines the exact CODEOWNERS bytes from the target base branch, classic branch
25
+ protection, every applicable repository or organization ruleset, account role
26
+ classes, plan capability, required checks, and provider-read completeness into
27
+ one short-lived immutable receipt.
28
+
29
+ The machine contract is
30
+ `@kungfu-tech/buildchain/github-governance-authority`. Its policy root covers
31
+ the managed-zone repository and target-ref admission rules, the exact
32
+ required-check context/App bindings and strict-update semantics for every
33
+ public authoritative target, the dual-account authority split, protected
34
+ verifier paths, native review requirements, break-glass constraints, and the
35
+ explicit trust boundary.
36
+
37
+ ## Trust boundary and non-claims
38
+
39
+ The trusted computing base contains GitHub service integrity, retained
40
+ organization-owner recovery custody, the `kungfu-origin` review/governance
41
+ identity, the exact Buildchain verifier, and official publication identities.
42
+ The protocol does not claim resistance to compromise of GitHub itself,
43
+ compromise of all retained owner and recovery anchors, or malicious control of
44
+ all independent trust anchors. A governance receipt grants no GitHub
45
+ permission and is not a bearer credential.
46
+
47
+ `dongkeren` is the development and pull-request author identity.
48
+ `kungfu-origin` is the independent Code Owner and governance identity. A
49
+ qualifying receipt requires the development identity to be active without an
50
+ administrator or maintainer role and requires the review identity to retain the
51
+ admitted governance role. Account recovery and retained root custody remain
52
+ outside normal contributor and workflow paths.
53
+
54
+ ## Effective policy
55
+
56
+ The verifier evaluates native provider layers together. Every authoritative
57
+ target must require:
58
+
59
+ - a pull request, at least one independent Code Owner approval, and a fresh
60
+ approval after the latest reviewable push;
61
+ - administrator enforcement, resolved review conversations, and a non-empty
62
+ required-check set whose exact contexts, GitHub App producer identities, and
63
+ strict-update setting match the versioned target policy;
64
+ - no unapproved bypass actor, force push, or protected-ref deletion. Managed
65
+ dev/alpha/release ref bookkeeping may admit only the exact GitHub Actions App
66
+ identity versioned for that target; user and team bypass actors remain
67
+ non-qualifying;
68
+ - exact last-match ownership of CODEOWNERS and the governance descriptor,
69
+ collector, rollout planner, and scheduled audit workflow;
70
+ - complete readable GitHub API evidence. Missing, forbidden, ambiguous, or
71
+ malformed provider state is non-qualifying.
72
+
73
+ Repository and organization rulesets are additive to classic branch
74
+ protection. Inspecting only one layer is insufficient because an applicable
75
+ bypass or weaker update path in another layer can invalidate the effective
76
+ policy.
77
+
78
+ ## Repository and plan admission
79
+
80
+ The 2026-07-24 baseline contains 16 managed repositories: 13 public and three
81
+ private. Public repository names are versioned in the descriptor. Private
82
+ repository names are never emitted in public evidence; their identities are
83
+ represented by stable roots derived from the GitHub provider repository ID,
84
+ independent of the governance policy root. This prevents a policy revision from
85
+ changing repository identity or creating a circular admission dependency. A
86
+ newly discovered repository or target ref is non-authoritative until explicitly
87
+ admitted.
88
+
89
+ The descriptor also versions every active public merge target. The full audit
90
+ evaluates one receipt per authoritative target rather than assuming the default
91
+ branch represents dev, alpha, release, or major publish-gate branches. The live
92
+ default branch is always included even if it drifts outside the registry, in
93
+ which case it is non-qualifying. Retained historical channels and generated
94
+ per-release publish-gate refs are not silently deleted or promoted to current
95
+ authority; they require an explicit registry revision before they can qualify.
96
+
97
+ For an admitted private repository, the active target set is the current
98
+ default branch plus existing alpha/release siblings on the same version line.
99
+ Its required-check bindings remain non-qualifying until their sanitized binding
100
+ roots are sealed into the private identity entry after supported native
101
+ protection exists.
102
+
103
+ Public repositories can qualify on supported Free, Team, or Enterprise
104
+ enforcement. Private repositories and organization-wide rules require Team or
105
+ Enterprise capability. On an unsupported plan they remain explicitly
106
+ `non-authoritative-plan-capability-required` and publication-ineligible. The
107
+ verifier does not replace missing native enforcement with CI or documentation,
108
+ and the implementation never makes a private repository public as a
109
+ workaround.
110
+
111
+ ## Read-only audit
112
+
113
+ Run the organization audit without mutation:
114
+
115
+ ```bash
116
+ buildchain audit github-governance \
117
+ --organization kungfu-systems \
118
+ --output github-governance.json \
119
+ --json
120
+ ```
121
+
122
+ Limit a canary to one repository:
123
+
124
+ ```bash
125
+ buildchain audit github-governance \
126
+ --repository kungfu-systems/buildchain \
127
+ --target-ref dev/v2/v2.14 \
128
+ --require-qualifying \
129
+ --json
130
+ ```
131
+
132
+ Protected merge and publication consumers verify the receipt against the exact
133
+ repository, target base ref, policy root, freshness window, and exact
134
+ Buildchain verifier source revision. Non-dry-run publication does not trust a
135
+ caller-supplied JSON hash: it mints a bounded token for the dedicated read-only
136
+ governance auditor GitHub App, recollects live provider state with the exact
137
+ Buildchain runtime, requires the resulting single-repository/single-target
138
+ audit to qualify, and consumes that independently generated receipt. Missing
139
+ App configuration or unreadable provider state denies publication before
140
+ provider mutation. The publication authority workflow is itself an explicit
141
+ Code Owner path.
142
+
143
+ The publication authority job and every reusable-workflow caller grant the
144
+ built-in `GITHUB_TOKEN` only `actions: read`, `checks: read`, `contents: read`,
145
+ and `pull-requests: read`. The dedicated auditor App independently recollects
146
+ the organization-wide governance receipt, while these job-scoped permissions
147
+ allow the exact publication transaction audit to resolve required check runs
148
+ and merged pull-request review lineage. Omitting either read permission makes
149
+ the transaction evidence incomplete and therefore non-qualifying.
150
+
151
+ The output is sanitized. Public repositories retain their public identity.
152
+ Private repositories expose only an identity root, visibility class, target
153
+ ref, sanitized required-check bindings and fact roots, and a qualifying or
154
+ non-qualifying decision. Tokens, cookies, recovery material, private
155
+ CODEOWNERS bytes, raw permission payloads, and credential-bearing URLs are
156
+ never included.
157
+
158
+ ## Mutation and rollback boundary
159
+
160
+ Live role, ruleset, branch-protection, Actions, Environment, or repository
161
+ changes are separate from audit. Every mutation starts from a read-only
162
+ inventory and a frozen rollback snapshot. A rollout plan binds both roots and
163
+ lists the exact API operation, impact, expected observation, and inverse
164
+ operation. Apply must stop on the first unexplained drift and must perform a
165
+ post-change read-back before continuing to the next bounded canary.
166
+
167
+ Plan one exact branch without mutation:
168
+
169
+ ```bash
170
+ buildchain github-governance plan \
171
+ --repository kungfu-systems/buildchain \
172
+ --branch dev/v2/v2.14 \
173
+ --required-check check \
174
+ --required-check-app-id check=15368 \
175
+ --required-approvals 1 \
176
+ --snapshot-output rollback.json \
177
+ --plan-output rollout.json
178
+ ```
179
+
180
+ An already protected check preserves its observed GitHub App binding. Every new
181
+ required check must declare `--required-check-app-id <context>=<app-id>`;
182
+ context-only replacement is rejected because it would broaden which producer
183
+ can satisfy the gate.
184
+
185
+ Classic branch-protection bypass allowances and ruleset bypass actors are both
186
+ part of the effective policy. Reconciliation writes explicit empty user, team,
187
+ and App bypass lists and verifies those lists after apply; omitting the provider
188
+ field is not treated as removal because GitHub may preserve the prior value.
189
+
190
+ The plan prints a `planRoot`. Apply requires that exact root and stops if live
191
+ protection no longer matches the frozen inventory:
192
+
193
+ ```bash
194
+ buildchain github-governance apply \
195
+ --plan-json rollout.json \
196
+ --confirm-plan-root sha256:...
197
+ ```
198
+
199
+ Rollback is separately explicit and root-bound:
200
+
201
+ ```bash
202
+ buildchain github-governance rollback \
203
+ --plan-json rollout.json \
204
+ --confirm-rollback-root sha256:...
205
+ ```
206
+
207
+ For an admitted exact target, classic branch protection can also be compiled
208
+ directly from the authority descriptor. This mode preserves both App-bound
209
+ checks and intentionally unbound check contexts such as Kungfu alpha's
210
+ `build`, rather than guessing a provider App identity.
211
+
212
+ ```bash
213
+ buildchain github-governance protection-policy-plan \
214
+ --repository kungfu-systems/kungfu \
215
+ --branch alpha/v4/v4.0 \
216
+ --snapshot-output protection-rollback.json \
217
+ --plan-output protection-rollout.json
218
+
219
+ buildchain github-governance protection-policy-apply \
220
+ --plan-json protection-rollout.json \
221
+ --confirm-plan-root sha256:...
222
+
223
+ buildchain github-governance protection-policy-rollback \
224
+ --plan-json protection-rollout.json \
225
+ --confirm-rollback-root sha256:...
226
+ ```
227
+
228
+ For an admitted exact target, repository ruleset reconciliation compiles the
229
+ target descriptor into the provider body. It replaces bypass actors with the
230
+ exact provider-admitted desired set, requires fresh Code Owner approval and
231
+ resolved review threads, and binds required checks plus strict-update semantics
232
+ to the target policy. Newly synthesized managed rules include GitHub's explicit
233
+ canonical defaults so the frozen expected root matches provider read-back.
234
+ Repository rulesets default to no bypass actors. The
235
+ descriptor's target-bound GitHub Actions allowance is an upper bound on
236
+ effective provider state, not a requirement to add that actor to every
237
+ protection layer; when needed, the built-in App allowance is expressed by
238
+ classic branch protection. The target condition must contain exactly one
239
+ branch; unrelated rules and conditions are preserved in place.
240
+
241
+ ```bash
242
+ buildchain github-governance ruleset-policy-plan \
243
+ --repository kungfu-systems/buildchain \
244
+ --branch alpha/v2/v2.14 \
245
+ --ruleset-id 19518955 \
246
+ --snapshot-output ruleset-rollback.json \
247
+ --plan-output ruleset-rollout.json
248
+
249
+ buildchain github-governance ruleset-policy-apply \
250
+ --plan-json ruleset-rollout.json \
251
+ --confirm-plan-root sha256:...
252
+
253
+ buildchain github-governance ruleset-policy-rollback \
254
+ --plan-json ruleset-rollout.json \
255
+ --confirm-rollback-root sha256:...
256
+ ```
257
+
258
+ The narrower `ruleset-plan` mode changes only `bypass_actors`; it remains
259
+ available for a bypass-only canary, but it cannot prove that an effective
260
+ ruleset matches the target descriptor. Both modes require the frozen ruleset
261
+ snapshot root for rollback.
262
+
263
+ Paid-plan purchase, billing, legal/account-owner decisions, and any operation
264
+ that could remove the last recoverable owner remain external human gates.
265
+ Break-glass is disabled by default and, if ever admitted, must be separately
266
+ authenticated, reason-bound, time-bounded, independently receipted, and
267
+ followed by mandatory restoration and root comparison.
@@ -297,19 +297,19 @@ verification.
297
297
  On protected alpha and release branches, the generated version-state commit is
298
298
  applied by the promotion automation after the reviewed channel PR has merged.
299
299
  Buildchain keeps review requirements, conversation resolution, strict status
300
- checks, and admin enforcement for human channel changes, but adds the
301
- authenticated promotion token user or app to the managed bypass allowlist for
302
- generated release bookkeeping. Buildchain also creates the configured required
300
+ checks, and admin enforcement for human channel changes, but admits only the
301
+ exact GitHub Actions App to the target-bound bypass allowlist for generated
302
+ release bookkeeping. Buildchain also creates the configured required
303
303
  check on the exact generated version-state commit before patching the protected
304
304
  ref, then applies the protected ref update with the declared generated ref
305
- update token. The reusable wrapper uses
306
- `secrets.BUILDCHAIN_PROMOTION_TOKEN || github.token` for that protected
307
- bookkeeping update. If release finalization bookkeeping is still rejected,
305
+ update token. The reusable wrapper uses the run-scoped `github.token` for that
306
+ protected bookkeeping update. If finalization bookkeeping is still rejected,
308
307
  Buildchain creates or reuses a same-repository `buildchain/version-state/*` PR
309
- from the current target channel head and reports `finalization-needed=true` so
310
- a later idempotent promotion run can resume. Strict alpha bookkeeping remains
311
- fail-fast with a token/protection diagnostic instead of asking humans to review
312
- a post-publish version-state PR.
308
+ and reports `finalization-needed=true` so a later idempotent promotion run can
309
+ resume. This fallback also applies to strict alpha target and dev
310
+ reconciliation. The generated PR must pass the repository's normal protected
311
+ checks, review, and merge-queue policy; Buildchain never weakens that policy or
312
+ treats PR creation as completed finalization.
313
313
 
314
314
  For `version.strategy = "anchored"` with `version.next = "manual"`, release
315
315
  promotion does not generate a Buildchain-owned version-state commit. In that