Skip to content

Commit 92e3ee5

Browse files
committed
refactor: complete engineering-discipline remediation
1 parent 88338cf commit 92e3ee5

451 files changed

Lines changed: 22475 additions & 11692 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/update-runtime/action.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ outputs:
2121
devshell:
2222
description: Pinned development environment
2323
value: ${{ steps.runtime.outputs.devshell }}
24+
nixpkgs:
25+
description: Pinned nixpkgs source path for required semantic tests
26+
value: ${{ steps.runtime.outputs.nixpkgs }}
2427
runs:
2528
using: composite
2629
steps:

‎.github/workflows/cachix-flush-proof.yml‎

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
# Deliberate failure after a unique store path is pushed. The proof job is
3-
# the required check: the designed fail step exits 1, and gkze.cachix.org
4-
# must still have the path. continue-on-error is only on that designed
5-
# fail step. The job conclusion stays green only when flush and the
6-
# cachix-action post hook both succeed; a post-hook throw (missing pid
7-
# after a drained daemon) fails the job and this workflow.
2+
# Trusted events deliberately fail after a unique store path is pushed. The
3+
# proof job is the required check: the designed fail step exits 1, and
4+
# gkze.cachix.org must still have the path. Fork PRs instead run a read-only
5+
# cache proof with no upload credential. continue-on-error is only on the
6+
# designed fail step. The trusted job conclusion stays green only when flush
7+
# and the cachix-action post hook both succeed; a post-hook throw fails it.
88
name: Cachix flush proof
99
on:
1010
pull_request:
@@ -13,6 +13,9 @@ permissions:
1313
contents: read
1414
jobs:
1515
fail-after-push:
16+
if: >-
17+
github.event_name == 'workflow_dispatch' ||
18+
github.event.pull_request.head.repo.full_name == github.repository
1619
runs-on: ubuntu-24.04
1720
timeout-minutes: 30
1821
steps:
@@ -123,9 +126,48 @@ jobs:
123126
import runpy
124127
runpy.run_path("lib/update/ci/jobs.py", run_name="__main__")
125128
shell: python
129+
fork-read-only:
130+
if: >-
131+
github.event_name == 'pull_request' &&
132+
github.event.pull_request.head.repo.full_name != github.repository
133+
runs-on: ubuntu-24.04
134+
timeout-minutes: 30
135+
permissions:
136+
contents: read
137+
steps:
138+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
139+
with:
140+
persist-credentials: false
141+
- uses: ./.github/actions/update-runtime
142+
id: runtime
143+
with:
144+
github-token: ${{ github.token }}
145+
cachix-token: ""
146+
- name: Validate read-only Cachix access
147+
shell: python
148+
run: |
149+
import subprocess
150+
151+
# Fork PRs must prove cache reads without receiving an upload token
152+
# or realizing a unique path that would require a write proof.
153+
subprocess.run(
154+
["nix", "store", "ping", "--store", "https://gkze.cachix.org"],
155+
check=True,
156+
)
157+
- name: Flush Cachix daemon
158+
if: always()
159+
env:
160+
NIXCFG_CI_STAGE: flush-cachix
161+
run: |
162+
import runpy
163+
runpy.run_path("lib/update/ci/jobs.py", run_name="__main__")
164+
shell: python
126165
assert-partial:
127166
needs: fail-after-push
128-
if: always()
167+
if: >-
168+
always() && !cancelled() &&
169+
(github.event_name == 'workflow_dispatch' ||
170+
github.event.pull_request.head.repo.full_name == github.repository)
129171
runs-on: ubuntu-24.04
130172
timeout-minutes: 30
131173
steps:
@@ -170,17 +212,27 @@ jobs:
170212
proof:
171213
needs:
172214
- fail-after-push
215+
- fork-read-only
173216
- assert-partial
174217
if: always() && !cancelled()
175218
runs-on: ubuntu-24.04
176219
steps:
177-
- name: Require designed failure plus Cachix hit
220+
- name: Require trusted write or fork read proof
178221
shell: python
179222
run: |-
180-
# continue-on-error is only on the designed fail step. The job
181-
# conclusion is success only when flush and the cachix-action
182-
# post hook both succeed. A post-hook throw fails this job.
223+
# Trusted events require the designed write failure and Cachix hit.
224+
# Fork PRs instead require the meaningful read-only proof, so this
225+
# aggregate required check has a successful outcome on either path.
226+
trusted = "${{ github.event_name == 'workflow_dispatch' }}" == "true"
227+
if not trusted:
228+
trusted = (
229+
"${{ github.event.pull_request.head.repo.full_name == github.repository }}"
230+
== "true"
231+
)
183232
failed = "${{ needs.fail-after-push.result }}"
233+
fork_read = "${{ needs.fork-read-only.result }}"
184234
proved = "${{ needs.assert-partial.result }}"
185-
if failed != "success" or proved != "success":
186-
raise SystemExit(f"proof job results: fail={failed} assert={proved}")
235+
if trusted and (failed != "success" or proved != "success"):
236+
raise SystemExit(f"write proof job results: fail={failed} assert={proved}")
237+
if not trusted and fork_read != "success":
238+
raise SystemExit(f"fork read-only proof result: {fork_read}")

‎.github/workflows/update-native.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jobs:
8989
steps:
9090
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
9191
with:
92+
ref: ${{ github.event.inputs.repair_commit || github.sha }}
9293
persist-credentials: false
9394
- uses: ./.github/actions/update-runtime
9495
id: runtime

‎.github/workflows/update.yml‎

Lines changed: 73 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ on:
1515
description: Allow one agent repair and a fresh fully validated attempt
1616
type: boolean
1717
default: true
18+
repair_commit:
19+
description: Internal approved repair commit; pins follow-up checkouts and no-op publication
20+
type: string
21+
default: ""
1822
canary_warm_rust:
1923
description: >
2024
Dispatch-only. Realize specified rust-warmup slot(s) or crate
21-
family against the current plan on this branch. Skips prepare,
22-
Linux validate, Darwin roots, publish, and coverage. The push
25+
family against a freshly prepared current plan on this branch.
26+
Runs prepare/plan producers; skips Linux validate, Darwin roots,
27+
publish, and coverage. The push
2328
and schedule no-skip run is still the done-bar proof.
2429
type: boolean
2530
default: false
@@ -35,14 +40,13 @@ on:
3540
- cron: "17 7 * * 1"
3641
# workflow_dispatch is unavailable to the Cursor GitHub App token
3742
# (HTTP 403, missing actions:write). Touching .github/update-kick on
38-
# main or a listed feature branch queues one Update run. Prefer
43+
# main queues one Update run. Prefer
3944
# `gh workflow run` when the App has Actions write.
4045
# lib/update/** also queues so a pipeline fix can start Update
4146
# without a kick-file bump.
4247
push:
4348
branches:
4449
- main
45-
- cursor/no-skip-darwin-shards-6614
4650
paths:
4751
- .github/update-kick
4852
- lib/update/**
@@ -65,10 +69,6 @@ jobs:
6569
# #1263 force-local dry-runs the will-be-built set so a 406-drv
6670
# bootstrap compile fails the slot immediately.
6771
prepare-pins:
68-
if: |-
69-
github.event_name != 'workflow_dispatch' ||
70-
(inputs.canary_warm_rust != true && inputs.canary_warm_rust != 'true' &&
71-
inputs.canary_slots == '' && inputs.canary_crates == '')
7272
uses: ./.github/workflows/update-native.yml
7373
with:
7474
runner: ubuntu-24.04
@@ -215,7 +215,10 @@ jobs:
215215
needs: prepare-merge
216216
if: |-
217217
always() && !cancelled() &&
218-
needs.prepare-merge.result == 'success'
218+
needs.prepare-merge.result == 'success' &&
219+
(github.event_name != 'workflow_dispatch' ||
220+
(inputs.canary_warm_rust != true && inputs.canary_warm_rust != 'true' &&
221+
inputs.canary_slots == '' && inputs.canary_crates == ''))
219222
uses: ./.github/workflows/update-native.yml
220223
with:
221224
runner: ubuntu-24.04-arm
@@ -227,7 +230,10 @@ jobs:
227230
needs: prepare-merge
228231
if: |-
229232
always() && !cancelled() &&
230-
needs.prepare-merge.result == 'success'
233+
needs.prepare-merge.result == 'success' &&
234+
(github.event_name != 'workflow_dispatch' ||
235+
(inputs.canary_warm_rust != true && inputs.canary_warm_rust != 'true' &&
236+
inputs.canary_slots == '' && inputs.canary_crates == ''))
231237
uses: ./.github/workflows/update-native.yml
232238
with:
233239
runner: ubuntu-24.04
@@ -251,6 +257,7 @@ jobs:
251257
steps:
252258
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
253259
with:
260+
ref: ${{ github.event.inputs.repair_commit || github.sha }}
254261
persist-credentials: false
255262
- name: Compute canary rust-warmup matrix
256263
id: slots
@@ -353,11 +360,13 @@ jobs:
353360
canary-warm-rust:
354361
needs:
355362
- canary-slots
363+
- prepare-merge
356364
- plan-darwin-closures
357365
- canary-darwin-fods
358366
if: |-
359367
always() && !cancelled() &&
360368
needs.canary-slots.result == 'success' &&
369+
needs.prepare-merge.result == 'success' &&
361370
needs.plan-darwin-closures.result == 'success' &&
362371
needs.canary-darwin-fods.result == 'success' &&
363372
needs.canary-slots.outputs.enabled == 'true'
@@ -403,7 +412,10 @@ jobs:
403412
always() && !cancelled() &&
404413
needs.prepare-merge.result == 'success' &&
405414
needs.plan-darwin-closures.result == 'success' &&
406-
needs.canary-darwin-fods.result == 'success'
415+
needs.canary-darwin-fods.result == 'success' &&
416+
(github.event_name != 'workflow_dispatch' ||
417+
(inputs.canary_warm_rust != true && inputs.canary_warm_rust != 'true' &&
418+
inputs.canary_slots == '' && inputs.canary_crates == ''))
407419
strategy:
408420
fail-fast: false
409421
max-parallel: 5
@@ -448,7 +460,10 @@ jobs:
448460
needs.canary-darwin-fods.result == 'success' &&
449461
(needs.canary-warm-rust.result == 'success' ||
450462
needs.canary-warm-rust.result == 'skipped' ||
451-
needs.canary-warm-rust.result == 'failure')
463+
needs.canary-warm-rust.result == 'failure') &&
464+
(github.event_name != 'workflow_dispatch' ||
465+
(inputs.canary_warm_rust != true && inputs.canary_warm_rust != 'true' &&
466+
inputs.canary_slots == '' && inputs.canary_crates == ''))
452467
uses: ./.github/workflows/update-native.yml
453468
with:
454469
runner: macos-15
@@ -619,6 +634,7 @@ jobs:
619634
steps:
620635
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
621636
with:
637+
ref: ${{ github.event.inputs.repair_commit || github.sha }}
622638
persist-credentials: false
623639
- uses: ./.github/actions/update-runtime
624640
id: runtime
@@ -669,7 +685,10 @@ jobs:
669685
env:
670686
NIXCFG_RUNTIME: ${{ steps.runtime.outputs.runtime }}
671687
NIXCFG_DEVSHELL: ${{ steps.runtime.outputs.devshell }}
688+
NIXCFG_NIXPKGS_PATH: ${{ steps.runtime.outputs.nixpkgs }}
689+
NIXCFG_REQUIRE_NIX_EVAL: "true"
672690
NIXCFG_CI_STAGE: certify
691+
NIXCFG_REPAIR_COMMIT: ${{ inputs.repair_commit || '' }}
673692
run: |
674693
import runpy
675694
runpy.run_path("lib/update/ci/jobs.py", run_name="__main__")
@@ -689,6 +708,7 @@ jobs:
689708
# This job already has contents:write and pull-requests:write.
690709
GH_TOKEN: ${{ github.token }}
691710
UPDATE_BASE_BRANCH: ${{ github.event.repository.default_branch }}
711+
NIXCFG_REPAIR_COMMIT: ${{ inputs.repair_commit || '' }}
692712
NIXCFG_CI_STAGE: publish
693713
run: |
694714
import runpy
@@ -703,6 +723,8 @@ jobs:
703723
runpy.run_path("lib/update/ci/jobs.py", run_name="__main__")
704724
shell: python
705725
repair:
726+
outputs:
727+
tree: ${{ steps.proposal.outputs.tree }}
706728
needs:
707729
- prepare-pins
708730
- prepare-darwin
@@ -728,21 +750,24 @@ jobs:
728750
(inputs.canary_warm_rust != true && inputs.canary_warm_rust != 'true' &&
729751
inputs.canary_slots == '' && inputs.canary_crates == '')
730752
# The repair gate runs the Darwin-maintained Python suite, as publish does.
753+
# The agent runs with --allow-all-tools on untrusted failure logs, so this
754+
# job holds read-only tokens and no Cachix or signing credentials. The
755+
# start-repair job owns every write.
731756
runs-on: macos-15
732757
timeout-minutes: 120
733758
permissions:
734-
actions: write
735-
contents: write
759+
actions: read
760+
contents: read
736761
copilot-requests: write
737762
steps:
738763
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
739764
with:
765+
ref: ${{ github.event.inputs.repair_commit || github.sha }}
740766
persist-credentials: false
741767
- uses: ./.github/actions/update-runtime
742768
id: runtime
743769
with:
744-
github-token: ${{ secrets.UPDATE_SELF_HEAL_GITHUB_TOKEN }}
745-
cachix-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
770+
github-token: ${{ github.token }}
746771
cache-generators: "true"
747772
light-image-reclaim: "true"
748773
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
@@ -764,9 +789,12 @@ jobs:
764789
env:
765790
NIXCFG_CI_STAGE: install-agent
766791
- name: Propose one repair
792+
id: proposal
767793
env:
768794
NIXCFG_RUNTIME: ${{ steps.runtime.outputs.runtime }}
769795
NIXCFG_DEVSHELL: ${{ steps.runtime.outputs.devshell }}
796+
NIXCFG_NIXPKGS_PATH: ${{ steps.runtime.outputs.nixpkgs }}
797+
NIXCFG_REQUIRE_NIX_EVAL: "true"
770798
GITHUB_TOKEN: ${{ github.token }}
771799
COPILOT_MODEL: gpt-6-astra
772800
COPILOT_AUTO_UPDATE: 'false'
@@ -782,10 +810,37 @@ jobs:
782810
name: repair
783811
path: |
784812
${{ runner.temp }}/repair.patch
813+
${{ runner.temp }}/repair-receipt.json
785814
${{ runner.temp }}/repair-evidence/repair.log
786815
if-no-files-found: warn
787816
overwrite: true
788817
retention-days: 30
818+
start-repair:
819+
needs: repair
820+
if: needs.repair.result == 'success'
821+
# This environment must have required reviewers in GitHub settings. The
822+
# approval gates this exact artifact before any write or credentialed run.
823+
environment: update-repair-approval
824+
# Commit and dispatch only; the repair job already ran the Darwin gates.
825+
runs-on: ubuntu-24.04
826+
timeout-minutes: 30
827+
permissions:
828+
actions: write
829+
contents: write
830+
steps:
831+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
832+
with:
833+
ref: ${{ github.event.inputs.repair_commit || github.sha }}
834+
persist-credentials: false
835+
- uses: ./.github/actions/update-runtime
836+
id: runtime
837+
with:
838+
github-token: ${{ secrets.UPDATE_SELF_HEAL_GITHUB_TOKEN }}
839+
light-image-reclaim: "true"
840+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
841+
with:
842+
name: repair
843+
path: ${{ runner.temp }}
789844
- uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6
790845
with:
791846
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
@@ -795,18 +850,12 @@ jobs:
795850
- name: Start a fresh attempt with repair disabled
796851
env:
797852
NIXCFG_DEVSHELL: ${{ steps.runtime.outputs.devshell }}
853+
NIXCFG_RUNTIME: ${{ steps.runtime.outputs.runtime }}
798854
GH_TOKEN: ${{ github.token }}
799855
NIXCFG_CI_STAGE: start-repair
856+
NIXCFG_REPAIR_TREE: ${{ needs.repair.outputs.tree }}
800857
NIXCFG_UPDATE_TARGETS: ${{ inputs.targets || '' }}
801858
run: |
802859
import runpy
803860
runpy.run_path("lib/update/ci/jobs.py", run_name="__main__")
804861
shell: python
805-
- name: Flush Cachix daemon
806-
if: always()
807-
env:
808-
NIXCFG_CI_STAGE: flush-cachix
809-
run: |
810-
import runpy
811-
runpy.run_path("lib/update/ci/jobs.py", run_name="__main__")
812-
shell: python

‎.github/workflows/zed-darwin.yml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ on:
88
type: string
99
default: ""
1010
# workflow_dispatch is unavailable to the Cursor GitHub App token
11-
# (HTTP 403). Touching .github/zed-kick on this branch queues one
12-
# Zed-only family build. Separate concurrency from Update so a kick
13-
# here cannot cancel the no-skip run.
11+
# (HTTP 403). Touching .github/zed-kick on a listed feature branch
12+
# queues one Zed-only family build. Separate concurrency from Update so
13+
# a kick here cannot cancel an Update run.
1414
push:
1515
branches:
16-
- cursor/no-skip-darwin-shards-6614
1716
- "cursor/*-fa49"
1817
paths:
1918
- .github/zed-kick

0 commit comments

Comments
 (0)