Skip to content

ci(#962): run the bouf patch action steps from Python (GEN-005) - #2806

Merged
zackees merged 2 commits into
masterfrom
infra/2804-windows-patches-python
Oct 28, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2804-windows-patches-python

Conversation

@zackees

@zackees zackees commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What

.github/actions/windows-patches/action.yaml is nine multi-line PowerShell run: blocks (twelve GEN-005 approved exceptions once the shell: pwsh keys are counted). Each step is now one call into ci/windows_patches.py, which opens with a pinned Set Up uv step.

Fixes #2804.

RED

e81b45a09 — ci/test_windows_patches.py only (330 lines). On origin/master it fails: the module does not exist, the action is still PowerShell, and the ci.toml GEN-005 block for the path is present.

GREEN

040bae652 — ci/windows_patches.py, the action rewritten, and the ci.toml exception deleted.

step old new
Download Release Artifact Invoke-External gh release download …, gh attestation verify, Expand-Archive download — the two child processes plus zipfile
Setup bouf two gh release download, two Get-FileHash comparisons, two Expand-Archive setup-bouf — hashlib.sha256 against BOUF_HASH / BOUF_NSIS_HASH, zipfile into bin/ and nsis/
Install NSIS winget install … install-nsis — same argv
Install rclone and pandoc choco install … install-tools — same argv
Download Previous Builds rclone -q copy … download-previous — same argv, RCLONE_* still comes from the step's env:
Prepare Release Notes three git tag -l --format= calls, Set-Location repo prepare-notes — same three calls, cwd=repo, same # rule and blank line
Run bouf bouf.exe + 10 argument pairs run-bouf — same argument list

The Invoke-External "throw on non-zero" rule is the child's exit status; a hash mismatch prints ::error::<zip> hash does not match. and exits 1. Ensure-Location is gone because the module creates bouf/ itself. The Upload Outputs path stays ${{ github.workspace }}/output, where bouf writes.

Evidence

ci-lint precheck (pin a1917ce7…), measured on a clean origin/master and on this branch:

origin/master  5 violation(s), 407 approved exception(s), 10 needs_review
this branch    5 violation(s), 395 approved exception(s), 10 needs_review

The delta is exactly the twelve windows-patches/action.yaml lines (grep -c 'APPROVED EXCEPTION .github/actions/windows-patches/action.yaml': 12 -> 0). No other rule moves: CACHE-013 stays at 12, so the new Set Up uv step adds no finding.

Local gates:

uv run python -m unittest ci/test_windows_patches.py   -> Ran 18 tests ... OK
uv run python -m unittest ci.test_uv_run ci.test_ci_toml -> Ran 50 tests ... OK
uv run --no-project ruff check ci/windows_patches.py ci/test_windows_patches.py -> All checks passed

The test drives every subcommand against stubs on PATH (gh, rclone, winget, choco, git, and a bouf.exe stub), so the argv, the hash-mismatch failure and the exit-status propagation are asserted on Linux. Both callers (publish.yaml, dispatch.yaml) check the repository out before the action, so ${{ github.workspace }}/ci/windows_patches.py resolves.

Not verified

No Windows lane runs from a PR path, and this action only runs on release/workflow_dispatch for obsproject — so the module's real Windows execution (winget/choco/rclone present, bouf.exe runs) is unproven here. The three .ps1 helpers keep their own path-scoped exceptions; this PR removes only the action.yaml block.

@zackees

zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

PR CI is green on 78f341842: CI Gate ✅, Format 🔍 / checks, Validate Data 🕵️, Build 🧱 / Event Data 🔎, Build 🧱 / CI Mode 🛂, Build 🧱 / Fast Gate ⚡ — every other lane skipping, since the diff is ci/, one composite action and one ci.toml block.

Left as a draft deliberately: the action only runs on release/workflow_dispatch for obsproject, so no PR lane executes winget/choco/rclone/bouf.exe. Ready for the coordinator to mark ready when that is acceptable.

GREEN: `ci/windows_patches.py` carries the seven shell steps as
subcommands (`download`, `setup-bouf`, `install-nsis`, `install-tools`,
`download-previous`, `prepare-notes`, `run-bouf`), each action step is one
`uv run --no-project --script` call, and the action opens with a pinned
`Set Up uv` step. The `ci.toml` GEN-005 exception for the action is deleted.

PowerShell's `Expand-Archive`, `Get-FileHash` and `Write-Output` pipelines are
`zipfile`, `hashlib.sha256` and `Path.write_text`; the `Invoke-External` failure
rule is the child's exit status.
@zackees
zackees force-pushed the infra/2804-windows-patches-python branch from 78f3418 to 040bae6 Compare October 28, 2026 14:47
@zackees
zackees marked this pull request as ready for review October 28, 2026 14:53
@zackees
zackees enabled auto-merge October 28, 2026 14:53
@zackees

zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Rebased onto origin/master (5fd1c516d, 4 commits) and force-pushed with --force-with-lease; the rebase was clean and the branch still touches only the four intended paths (action.yaml, ci/windows_patches.py, ci/test_windows_patches.py, ci.toml). New SHAs: RED e81b45a09, GREEN 040bae652 (the body's SHAs are updated).

Re-verified on the rebased tip:

uv run python -m unittest ci/test_windows_patches.py      -> Ran 18 tests, OK
uv run python -m unittest ci.test_uv_run ci.test_ci_toml  -> Ran 50 tests, OK
uv run --no-project ruff check ci/windows_patches.py ci/test_windows_patches.py -> All checks passed
ci-lint precheck (a1917ce7) -> 5 violation(s), 395 approved exception(s), 10 needs_review

The delta is still exactly the twelve windows-patches/action.yaml GEN-005 lines (grep -c on the precheck output: 12 -> 0); ci.toml keeps the three .ps1 path blocks. No local gate stamp: the diff is ci/ plus one composite action, so PR CI is the gate.

PR CI on 040bae652: CI Gate ✅, Fast Gate ⚡, Format 🔍 / checks, Validate Data 🕵️, Event Data 🔎, CI Mode 🛂 all pass, every build lane skipping.

Handed off to the coordinator: marked ready and enabled auto-merge. The one acceptance criterion that stays open is real Windows execution (winget/choco/rclone/bouf.exe), which no PR lane reaches — the module's argv, hash-mismatch failure and exit-status propagation are asserted against stubs on Linux.

@zackees
zackees added this pull request to the merge queue Oct 28, 2026
Merged via the queue into master with commit 74d8e42 Oct 28, 2026
33 checks passed
@zackees
zackees deleted the infra/2804-windows-patches-python branch October 28, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

infra: port .github/actions/windows-patches to Python (GEN-005 sweep, #962)

1 participant