@kungfu-tech/buildchain 3.0.7-alpha.0 → 3.0.7

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 (67) hide show
  1. package/actions/promote-buildchain-ref/README.md +10 -0
  2. package/contracts/auditable-demo-scenario-v1.schema.json +1 -1
  3. package/contracts/engineering-housekeeper-v1.schema.json +143 -0
  4. package/contracts/fixtures/engineering-housekeeper-v1/cases.json +68 -0
  5. package/dist/site/buildchain-contract.json +24 -24
  6. package/dist/site/buildchain-site.json +91 -30
  7. package/dist/site/capability-registry.json +3 -3
  8. package/dist/site/controller-registry.json +6 -2
  9. package/dist/site/kfd-claims.json +122 -11
  10. package/dist/site/kfd-upstream-aggregate.json +1 -1
  11. package/dist/site/manual-registry.json +8 -7
  12. package/dist/site/node-api-registry.json +683 -105
  13. package/dist/site/page-registry.json +80 -19
  14. package/dist/site/public-surface-audit.json +98 -7
  15. package/dist/site/publication-authority-registry.json +81 -1
  16. package/dist/site/publication-registry.json +4 -4
  17. package/dist/site/release-provenance.json +2 -0
  18. package/dist/site/site-manifest.json +11 -11
  19. package/dist/site/workflow-registry.json +119 -2
  20. package/docs/MAP.md +1 -0
  21. package/docs/auditable-demo.md +2 -2
  22. package/docs/dev-delivery-warrant.md +49 -4
  23. package/docs/engineering-housekeeper.md +138 -0
  24. package/docs/lifecycle-protocol.md +4 -2
  25. package/docs/node-api-reference.md +277 -212
  26. package/docs/release-governance.md +17 -2
  27. package/docs/release-tail-provider-plane.md +1 -1
  28. package/docs/reusable-build-surface.md +11 -0
  29. package/package.json +4 -1
  30. package/packages/core/artifact-signing.js +61 -0
  31. package/packages/core/buildchain-config.js +66 -6
  32. package/packages/core/buildchain-publication-authority.js +4 -0
  33. package/packages/core/controller-evidence.js +2 -1
  34. package/packages/core/dev-delivery-warrant-cancellation.js +1 -0
  35. package/packages/core/dev-delivery-warrant-shadow.js +502 -0
  36. package/packages/core/dev-delivery-warrant.js +15 -6
  37. package/packages/core/diagnostics.js +8 -3
  38. package/packages/core/engineering-housekeeper-github-client.js +222 -0
  39. package/packages/core/engineering-housekeeper-github.js +501 -0
  40. package/packages/core/engineering-housekeeper.js +259 -0
  41. package/packages/core/index.js +3 -0
  42. package/packages/core/kfd-gate.js +45 -15
  43. package/packages/core/publication-rehearsal-runtime.js +13 -1
  44. package/packages/core/release-passport.js +130 -20
  45. package/scripts/assemble-self-publication-admission.mjs +1 -1
  46. package/scripts/audit-publication-control-plane.mjs +1 -1
  47. package/scripts/auditable-demo-bundle-verification.mjs +2 -3
  48. package/scripts/auditable-demo-platform.mjs +2 -2
  49. package/scripts/auditable-demo-renditions.mjs +1 -1
  50. package/scripts/auditable-demo.mjs +2 -2
  51. package/scripts/build-contract-core.mjs +8 -3
  52. package/scripts/build-standalone-binary.mjs +14 -3
  53. package/scripts/check-inventory.mjs +3 -1
  54. package/scripts/dev-delivery-warrant.mjs +31 -4
  55. package/scripts/dev-pr-auto-merge.mjs +30 -4
  56. package/scripts/dev-pr-delivery-warrant.mjs +50 -0
  57. package/scripts/engineering-housekeeper-workflow.mjs +394 -0
  58. package/scripts/generate-site-bundle.mjs +23 -4
  59. package/scripts/inspect-artifact-signing-requests.mjs +6 -0
  60. package/scripts/materialize-self-release-candidate-version.mjs +6 -0
  61. package/scripts/publication-commit-evidence.mjs +69 -23
  62. package/scripts/release-candidate-resolver.mjs +16 -10
  63. package/scripts/resume-from-candidate-run.mjs +123 -9
  64. package/scripts/seal-artifact-signing-requests.mjs +6 -0
  65. package/scripts/site-capability-metadata.mjs +2 -0
  66. package/scripts/web-surface-core.mjs +8 -2
  67. package/scripts/workflow-call-contract.mjs +1 -1
@@ -8,11 +8,11 @@ confidence: high
8
8
  sensitivity: public
9
9
  evidence_grade: A
10
10
  review_state: unreviewed
11
- last_reviewed: 2026-08-05
11
+ last_reviewed: 2026-08-09
12
12
  ai_provenance:
13
13
  model_family: GPT-5
14
14
  product: Codex
15
- generated_at: 2026-08-04
15
+ generated_at: 2026-08-09
16
16
  invisible_context: not asserted
17
17
  ---
18
18
 
@@ -125,6 +125,39 @@ buildchain dev proof replay-proof \
125
125
  buildchain dev proof integration --warrant-result warrant.json ...
126
126
  ```
127
127
 
128
+ ## Bounded-concurrency shadow qualification
129
+
130
+ The production queue remains single-flight. A separate effect-disabled shadow
131
+ planner can replay the same deterministic candidate order with a bound of one
132
+ or two lanes. It does not issue, renew, supersede, close, or persist a Warrant;
133
+ it cannot enqueue a pull request; and its output explicitly carries no
134
+ production or rollout authority.
135
+
136
+ Each lane binds the exact queue root and generation, protected-base head,
137
+ source head, projected-base root, Project Cut, approval, required checks,
138
+ status, and lease evidence. An active production candidate must additionally
139
+ match its current fencing token and lease generation. A queued shadow lane must
140
+ not carry either. Stale evidence, an occupied native queue, cross-lane evidence
141
+ aliasing, shared conflict keys, or an incompatible projected base fails closed.
142
+ A failure in one lane remains visible without converting or concealing the
143
+ other lane's result.
144
+
145
+ The planner and aggregate qualification command consume immutable JSON files:
146
+
147
+ ```sh
148
+ buildchain dev warrant shadow-plan --input observation.json \
149
+ --max-concurrency 2 --output shadow-plan.json
150
+
151
+ buildchain dev warrant shadow-qualify --input qualification-input.json \
152
+ --output shadow-qualification.json
153
+ ```
154
+
155
+ Both commands reject `--execute`. Qualification reports compare explicit
156
+ thresholds for sample count, eligible overlap, projected queue-wait benefit,
157
+ additional runner cost, ambiguity, and false positives. A `proceed` result is
158
+ only evidence for a separate reviewed rollout decision; it never changes the
159
+ live Warrant schema, queue state, merge-queue policy, or protected branch.
160
+
128
161
  ## Workflow rollout and rollback
129
162
 
130
163
  The reusable `dev-pr-auto-merge.yml` supports three explicit rollout modes:
@@ -133,7 +166,17 @@ The reusable `dev-pr-auto-merge.yml` supports three explicit rollout modes:
133
166
  - `shadow` qualifies the source and emits a read-only queue submission plan;
134
167
  - `required` persists the submission, selects the Warrant, and refuses GitHub
135
168
  enqueue unless the immutable queue commit, state root, active Warrant, and
136
- selected candidate all pass exact readback validation.
169
+ selected candidate all pass exact readback validation. Immediately before
170
+ enqueue, the controller also rereads the current protected state ref and
171
+ verifies the active candidate, fencing token, generation, pull request, and
172
+ exact head. A previously valid result is not authority after terminal
173
+ closeout. Re-running qualification for the same selected head may regenerate
174
+ timestamped proof bytes, but it retains the immutable active Warrant and its
175
+ originally selected proof instead of rewriting or rejecting that attempt.
176
+ Each candidate also retains the exact successful source workflow run. If a
177
+ controller discovers that another candidate owns the active Warrant, a
178
+ configured consumer workflow is dispatched immediately for that exact PR,
179
+ head, and source run; the candidate is not left waiting for a patrol cron.
137
180
 
138
181
  Consumers should deploy `shadow` first, inspect receipts, then change their
139
182
  protected caller to `required`. Rollback is a reviewed caller change back to
@@ -143,7 +186,9 @@ merged candidate (or accepts explicit evidence for another terminal outcome),
143
186
  then closes only the current fencing generation. The separate queued
144
187
  cancellation reusable workflow cannot close an active generation; it advances
145
188
  the state ref only when the caller's complete terminal binding and expected-old
146
- root still match.
189
+ root still match. A delayed `dequeued` event is ignored when GitHub readback
190
+ shows the same exact PR head is already queued again, so an earlier queue event
191
+ cannot close a newer active Warrant generation.
147
192
 
148
193
  Buildchain uses the same contract for its own protected dev line through
149
194
  `buildchain-dev-delivery.yml`. The manual caller requires the exact PR head and
@@ -0,0 +1,138 @@
1
+ ---
2
+ status: preview
3
+ period: ongoing
4
+ theme: engineering-housekeeper
5
+ doc_type: operational-contract
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: reviewed
11
+ last_reviewed: 2026-08-10
12
+ ---
13
+
14
+ # Engineering Housekeeper
15
+
16
+ Engineering Housekeeper is a reusable GitHub workflow for evidence-backed
17
+ branch and pull-request hygiene. It inventories the complete GitHub branch and
18
+ open pull-request surfaces, produces a rooted plan, and defaults to report-only
19
+ execution. It never closes pull requests and never deletes a branch from its
20
+ name alone.
21
+
22
+ The reusable entrypoint is:
23
+
24
+ ```yaml
25
+ uses: kungfu-systems/buildchain/.github/workflows/engineering-housekeeper.yml@v3
26
+ ```
27
+
28
+ ## Report mode
29
+
30
+ `report` is the default. The caller grants only read permissions and receives
31
+ separate plan, Markdown report, and dry-run receipt artifacts:
32
+
33
+ ```yaml
34
+ jobs:
35
+ housekeeper:
36
+ uses: kungfu-systems/buildchain/.github/workflows/engineering-housekeeper.yml@v3
37
+ permissions:
38
+ contents: read
39
+ pull-requests: read
40
+ with:
41
+ target-branch: dev/v3/v3.0
42
+ mode: report
43
+ ```
44
+
45
+ The plan records the exact repository, target branch and target OID, every
46
+ observed branch and open pull request, each retain/delete/report/label decision,
47
+ and stable reason codes. The report receipt records dry-run outcomes and binds
48
+ them to the plan root.
49
+
50
+ ## Apply mode
51
+
52
+ Mutation has a two-part positive gate. The caller must set both `mode: apply`
53
+ and `apply-enabled: true`; either value alone fails closed. Apply jobs consume
54
+ the uploaded exact plan, re-read provider state, and revalidate exact branch
55
+ and target OIDs, ancestry, protection, retention, active pull requests, rename
56
+ state, pull-request state, and staleness before each mutation.
57
+
58
+ ```yaml
59
+ jobs:
60
+ housekeeper:
61
+ uses: kungfu-systems/buildchain/.github/workflows/engineering-housekeeper.yml@v3
62
+ permissions:
63
+ contents: write
64
+ pull-requests: write
65
+ with:
66
+ target-branch: dev/v3/v3.0
67
+ mode: apply
68
+ apply-enabled: true
69
+ stale-pull-request-label: stale-housekeeping
70
+ max-actions: 10
71
+ ```
72
+
73
+ Branch deletion and pull-request labeling run in separate jobs. The branch job
74
+ has `contents: write` plus `pull-requests: read` for the final active-PR fence.
75
+ The labeling job has `contents: read` and `pull-requests: write`. Inventory is a
76
+ separate read-only job. The reusable workflow declares no workflow-level write
77
+ permission.
78
+
79
+ The action limit applies to the globally ordered plan before actions are split
80
+ by permission surface. A race, missing branch, advanced head, target movement,
81
+ new pull request, new protection, ambiguous ancestry, provider error, or stale
82
+ plan/input mismatch is an explicit receipt outcome rather than permission to
83
+ continue.
84
+
85
+ ## Inputs and outputs
86
+
87
+ | Input | Type | Default | Contract |
88
+ | -------------------------- | ------- | --------------------------- | --------------------------------------------------------------------------------- |
89
+ | `repository` | string | caller repository | Exact `owner/repo` target. |
90
+ | `target-branch` | string | required | Exact ancestry target; the observed OID is recorded in the plan. |
91
+ | `mode` | string | `report` | `report` or `apply`. Other values fail. |
92
+ | `apply-enabled` | boolean | `false` | Required positive gate for `apply`. Invalid with `report`. |
93
+ | `protected-patterns` | string | version/release families | Comma or newline separated branch globs. |
94
+ | `retained-patterns` | string | train/authority families | Comma or newline separated retention globs. |
95
+ | `stale-days` | number | `30` | Positive stale pull-request age. |
96
+ | `stale-pull-request-label` | string | empty | Empty keeps pull requests report-only; non-empty permits labeling, never closure. |
97
+ | `max-actions` | number | `20` | Positive global apply limit. |
98
+ | `artifact-retention-days` | number | `30` | Retention for plan, report, and receipts. |
99
+ | `buildchain-repository` | string | `kungfu-systems/buildchain` | Runtime source repository. |
100
+ | `buildchain-ref` | string | `v3` | Runtime ref; trusted manual qualification may pass a train or exact SHA. |
101
+
102
+ Stable outputs are `plan-root`, `report-receipt-root`, optional
103
+ `branch-receipt-root` and `pull-request-receipt-root`, `action-count`,
104
+ `outcome`, and the plan/report/default-receipt artifact names. Apply receipts
105
+ are uploaded under the same caller-selected artifact prefix with branch and
106
+ pull-request scope names.
107
+
108
+ Artifacts and job summaries contain exact repository coordinates, observed
109
+ refs, decisions, reason codes, outcomes, and semantic roots. They never contain
110
+ tokens, application private keys, or authorization headers.
111
+
112
+ ## Caller-owned authentication
113
+
114
+ The default credential is the caller-scoped `github.token`. A caller may pass
115
+ an alternative token as `github_token`, or pass the paired `github_app_id` and
116
+ `github_app_private_key` secrets to mint an installation token for the exact
117
+ target repository. The workflow contains no repository-specific personal
118
+ credential name or value.
119
+
120
+ GitHub App credentials must be supplied as a pair. The caller owns App
121
+ installation and permission policy and should grant only repository contents
122
+ read/write and pull-request read/write scopes required by its selected mode.
123
+ Secrets are used only as step environment or action inputs and are not written
124
+ to plans, reports, receipts, summaries, or artifacts.
125
+
126
+ ## Scheduled callers
127
+
128
+ Buildchain dogfoods the reusable contract through three thin callers:
129
+
130
+ - `engineering-housekeeper-daily.yml` uses a 30-day window and a 10-action cap;
131
+ - `engineering-housekeeper-weekly.yml` uses a 45-day window and a 20-action cap;
132
+ - `engineering-housekeeper-monthly.yml` uses a 60-day window and a 50-action cap.
133
+
134
+ Schedules are report-only and read-only. Apply is available only through a
135
+ manual dispatch that selects `apply` and positively enables the apply gate.
136
+ The callers contain schedules and policy values only; inventory, planning,
137
+ revalidation, mutation, evidence, and authentication stay in the reusable
138
+ workflow and its runtime.
@@ -301,8 +301,10 @@ and optionally `lifecycle.publish`.
301
301
  The verify stage runs after Buildchain has applied the generated version-state
302
302
  changes to the local checkout, and before it creates release commits or moves
303
303
  refs. After the command finishes, Buildchain checks that only declared
304
- version-state files changed. This prevents verification from quietly adding
305
- extra source changes to the release commit.
304
+ `version.files` and `version.derived_files` changed. The latter declares tracked
305
+ outputs regenerated by `lifecycle.version-state` that do not directly contain a
306
+ version field. This prevents verification from quietly adding extra source
307
+ changes to the release commit while keeping generated evidence explicit.
306
308
 
307
309
  Buildchain-owned untracked runtime evidence is excluded only through an exact
308
310
  internal allowlist. This includes contract-drift issue material under