Repository navigation
Run CI on the release pull request the Release workflow opens - #208
Conversation
GitHub starts no workflow for a pull request that a workflow's own token opened, so #207 showed no checks. workflow_dispatch is the one event that token may trigger, so the propose job now dispatches ci.yml on the release branch, and ci.yml accepts workflow_dispatch. docs/release.md also names the three levels that must allow Actions to open pull requests: enterprise, organization, and repository.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.7 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 13m 31s
The Release workflow's first release pull request, #207, showed no checks when it opened, and this change aims to run CI on every release pull request without anyone's help. After the propose job opens the release pull request, or finds one already open, it runs gh workflow run ci.yml --ref release/vX.Y.Z, and ci.yml gains workflow_dispatch as a trigger. Only the propose job gets the actions: write that the dispatch needs. The change also names the three levels of the setting that lets Actions open pull requests, and rewrites the release pull request's Testing text. The dispatch itself cannot run until the change merges, because GitHub dispatches only a workflow whose trigger is on the default branch.
1 finding thread: 0 resolved, 1 open
Covered 4 of 4 changed files; no generated files skipped.
Disclosures:
- No
actionlint. It isn't installed here. I parsed both workflows withyamland ranbash -non all 19runsteps instead, and rendered the release pull request body's heredoc with stand-in values. - The dispatch path is unexercised. I ran no workflow and dispatched nothing. The checks of a
workflow_dispatchrun attach to the commit it ran on, but no run in this repository has yet shown them on a pull request. - Windows CI failed on a timeout this change does not touch.
linuxpassed.windowsfailed one test,src/release.test.ts> "tags what the remote branch holds, not an unpushed bump", which took 10.4 s against vitest's 5-second default. The same test took 2.0 s in #206's Windows run and 1.8 s in #205's, and this change alters neither the script nor its test, so the failure is a flake in #205's test. - The body's post-merge test no longer applies. It says to run Release with
minorwhile #207 is still open. #207 merged at 19:25:19Z, and Release run 38167947880 then tagged and releasedv0.2.0, so running Release withminornow proposes 0.3.0. The next real release pull request is the first one that can show the dispatched checks.
The install plan is in-progress, and this change leaves its status alone. Its open questions, §7.2, §7.4, §7.5, and §7.6, predate the change and concern chunks 3 and 4, so they do not block it.
Suggestions
docs/projects/install/readme.md:607: §9.2 still says the workflow has not run, which the new §9.1 text contradicts, and §9.3 (line 615) still owes the first release, which run 38167947880 published asv0.2.0. Record the first release in both. Both lines predate this change.src/release.test.ts:145: give the git-heavy tests in this file a longer timeout. On this head's Windows run, this test took 10.4 s and "moves the major tag forward on the next release" took 4.8 s, against vitest's 5-second default. The timeout predates this change.
What I ran
pnpm install --frozen-lockfileandpnpm typecheck. Both pass.project check. It printsProject plans are valid., with two warnings about Projector's own generated files that this change does not touch.pnpm exec vitest run src/release.test.ts. 19 tests pass. The script is unchanged.- Script injection. Neither workflow puts a
${{ }}expression inside arunstep. The branch name reachesgh workflow runas a quoted shell variable, built from the version thatscripts/release.ts bumpprints. - Permissions.
actions: writeis scoped to the propose job, which runs only onworkflow_dispatch. The publish job keeps the top-levelcontents: write, and the repository's default token permission is stillread. - Re-runs and failures. A re-run that finds the pull request open dispatches again, and
ci.yml's concurrency group,CI-refs/heads/release/vX.Y.Z, cancels the older dispatched run. Underset -euo pipefail, a failed dispatch fails the job after the pull request is open, and a re-run repeats it. ci.ymlunderworkflow_dispatch. No job or step readsgithub.event_nameorgithub.event.pull_request. The checkout takes the branch's tip, which is the pull request's head.
…er than starting none For a pull request that a workflow's token opened, GitHub creates the pull_request run as action_required; #207's run 38167745651 ran only once approved. The dispatch still runs CI unattended, so the docs now tell the reviewer to leave the held run unapproved, since approving it runs every job twice, and plan §9.1 records why the dispatch beat approving by hand.
The Release workflow's release pull requests get no checks. The propose
job opens the pull request with `${{ github.token }}`, and GitHub starts
no workflow for an event that a workflow's own token caused, neither the
push of `release/vX.Y.Z` nor the opened pull request. So `check.yml`,
which runs on `pull_request` and on pushes to `main`, never sees a
release before it merges. `workflow_dispatch` is the one event that
token may trigger, and a dispatched run's checks land on the branch's
commit, which is the pull request's head, so they show on the release
pull request like any other checks.
The propose job now runs `gh workflow run check.yml --ref "$branch"`
after its `gh pr list` / `gh pr create` block, so the dispatch happens
both when the job opens the pull request and when a rerun finds one
already open. `check.yml` gains `workflow_dispatch` as a trigger, and
the propose job gains `actions: write`, which the dispatch needs. The
workflow-level `contents: write` and the repository's read-only default
stay as they are. The Testing text the job writes into the release pull
request now says that Check was dispatched on the branch, and
`docs/plugins.md` ("Release an update") and `docs/develop.md`
("Release") explain the dispatch and why. A GitHub App token would also
have avoided the rule, but it needs an App and its secrets to do what
one extra trigger does. This mirrors okamnesiac/field#208, which fixed
the same gap after field's first release pull request showed no checks.
The repository already lets Actions open pull requests
(`can_approve_pull_request_reviews` is `true`), so only the dispatch was
missing.
## Testing
From the repository root of a checkout of `release-dispatch-check`, with
no build step needed:
1. Parse both workflows and print their triggers and the propose job's
permissions:
```sh
ruby -ryaml -e 'ARGV.each { |f| w = YAML.safe_load(File.read(f)); puts
"#{f} #{(w["on"] || w[true]).keys.inspect} #{w.dig("jobs", "propose",
"permissions").inspect}" }' .github/workflows/check.yml
.github/workflows/release.yml
```
It prints `["pull_request", "push", "workflow_dispatch"]` for
`check.yml`, and for `release.yml` it prints `["workflow_dispatch",
"push"]` and `{"actions"=>"write", "contents"=>"write",
"pull-requests"=>"write"}`. A missing `workflow_dispatch` or `actions`
entry means the change is wrong.
2. Syntax-check every `run` step with `bash -n`:
```sh
ruby -ryaml -ropen3 -e 'ARGV.each { |f|
YAML.safe_load(File.read(f))["jobs"].each { |j, job| job["steps"].each {
|s| next unless s["run"]; _, e, st = Open3.capture3("bash", "-n",
stdin_data: s["run"]); puts "#{f} #{j}: #{st.success? ? "ok" : e}" } }
}' .github/workflows/check.yml .github/workflows/release.yml
```
Every line ends in `ok`. Any other output is the shell error in that
step.
3. Run the gate: `PYTHONPATH=src python3 -m unittest discover -v`
reports 801 tests `OK (skipped=1)`, where the skip is the
compiled-script check that needs `npm ci` in `site/` (this change
touches no TypeScript). `PYTHONPATH=src python3 -m projector check`
prints `Project plans are valid.`, `claude plugin validate .` and
`claude plugin validate skills` both print `✔ Validation passed`, and
`git diff --check` prints nothing.
None of these commands leave state behind.
The dispatch itself can't be exercised before this merges, because
GitHub dispatches a workflow only once its `workflow_dispatch` trigger
is on the default branch. After the merge, the next release checks it:
```sh
gh workflow run release.yml --repo ninjudd/projector -f bump=patch
gh pr checks release/vX.Y.Z --repo ninjudd/projector
```
Once the Release run finishes, the release pull request lists the
`check` job from the Check workflow. If the propose job's last step
fails with `Workflow does not have 'workflow_dispatch' trigger`, `main`
doesn't have this change yet. If it fails with `Resource not accessible
by integration`, the propose job is missing `actions: write`. A release
pull request with no checks at all means the dispatch step never ran.
That run leaves a `release/vX.Y.Z` branch and an open release pull
request; merging it ships the release, and closing it and deleting the
branch ships nothing.
<!-- projector-summary v=1 sha=6c3bfb9d85ecd787a6deb5927ac834aa194c0850
-->
📽️ **Projector summary** of 6c3bfb9:
https://ninjudd.com/projector/reviews/253
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.7 · model claude-opus-5-5 · effort xhigh · CLEAN · took 5m 13s
The Release workflow opens its release pull request with GITHUB_TOKEN, so GitHub holds that pull request's CI run until someone approves it. This change makes CI run on every release pull request without that approval. After the propose job opens the release pull request, or finds one already open, it runs gh workflow run ci.yml --ref release/vX.Y.Z, and ci.yml gains workflow_dispatch as a trigger. Only the propose job gets the actions: write that the dispatch needs. The docs, the release pull request's own Testing text, and plan §9.1 tell the reviewer to leave the held run unapproved, and §9.1 records the two alternatives the dispatch beat. The dispatch itself cannot run until the change merges, because GitHub dispatches only a workflow whose trigger is on the default branch.
1 finding thread: 1 resolved, 0 open
Covered 4 of 4 changed files; no generated files skipped.
The earlier finding at docs/release.md:23 is fixed at this head, and its thread was already resolved. All four passages now say that GitHub holds the release pull request's pull_request run for approval: the trigger comment in ci.yml, the comment above the dispatch in release.yml, docs/release.md, and plan §9.1. §9.1 names both exempt events, and it records why the dispatch beat both approving the held run and a GitHub App token. docs/release.md and the release pull request's Testing text tell the reviewer to leave the held run unapproved. #207's CI run 38167745651 bears out §9.1's account: its second attempt passed both linux and windows.
Disclosures:
- The pull request body's post-merge test is still out of date. It still says to run Release with
minor"while #207 is still open", and that the propose job will bump 0.1.0 and force-pushrelease/v0.2.0. #207 merged at 19:25:19Z, and Release run 38167947880 releasedv0.2.0, so that run now proposes 0.3.0 and opens a new release pull request. The body becomes the squash commit message, so rewrite that paragraph around the next release before merging. - No
actionlint. It isn't installed here. I parsed both workflows withyaml, ranbash -non all 19runsteps, and rendered the release pull request body's heredoc with stand-in values. - The dispatch path is unexercised. I ran no workflow and dispatched nothing.
The install plan is in-progress, and this change leaves its status alone. Its open questions, §7.2, §7.4, §7.5, and §7.6, predate the change and concern chunks 3 and 4, so they do not block it.
Suggestions
docs/projects/install/readme.md:616: §9.2 still says the workflow has not run, and §9.3 (line 624) still owes the first release, which run 38167947880 published asv0.2.0. Record the first release in both. Both lines predate this change.src/release.test.ts:145: give the git-heavy tests in this file a longer timeout. Onb294214's Windows run this test took 10.4 s, against vitest's 5-second default. The timeout predates this change.
What I checked
- Build and tests.
pnpm install --frozen-lockfileandpnpm typecheckpass,project checkprintsProject plans are valid., andpnpm exec vitest run src/release.test.tsgives 19 passed. - The release pull request body. The new sentence in the heredoc escapes its backticks, and the body renders cleanly with
BUMP=minorandversion=0.3.0. - Script injection. Neither workflow puts a
${{ }}expression inside arunstep. The branch name reachesgh workflow runas a quoted shell variable, built from the version thatscripts/release.ts bumpprints. - Permissions.
actions: writeis scoped to the propose job, which runs only onworkflow_dispatch. The publish job keeps the top-levelcontents: write, and the repository's default token permission is stillread. - Re-runs and failures. A re-run that finds the pull request open dispatches again, and
ci.yml's concurrency group,CI-refs/heads/release/vX.Y.Z, cancels the older dispatched run. Underset -euo pipefail, a failed dispatch fails the job after the pull request is open, and a re-run repeats it. ci.ymlunderworkflow_dispatch. No job or step readsgithub.event_nameorgithub.event.pull_request. The checkout takes the branch's tip, which is the pull request's head.- CI at this head. Run 38169962930 passed
linuxandwindows, so the Windows timeout onb294214did not recur.
On the Windows runner one of them took 10.4 s against vitest's 5-second default, which failed b294214's run; Linux takes under a second.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.7 · model claude-opus-5-5 · effort xhigh · CLEAN · incremental from 66dabf1 · took 4m 33s
Incremental review of the change since the full review of 66dabf1: +7 −2 lines in 1 file.
The push gives the tagging a release and the command line suites in src/release.test.ts a 30-second test timeout. A probe confirmed that vitest 3.2 applies a describe options timeout to its tests, and pnpm typecheck and the file's 19 tests pass. The new comment states a constraint and matches CI, where the whole file takes 2.2 s on Linux. CI passed linux and windows. Still open outside this push: the body's Testing assumes #207 is open, and plan §9.2 and §9.3 still owe the first release.
…pgrade for release installs (install.md chunk 3) (#214) Field can now be installed without a clone. Piped from curl, or downloaded by `field upgrade`, `install.sh` installs the newest release: ```sh curl -fsSL https://raw.githubusercontent.com/okamnesiac/field/v0/install.sh | bash ``` Before this, `install.sh` installed only the checkout it sat in, and anywhere else it told you to clone. Field releases publish no binaries (install.md §7.1, so no JUCE binary is ever distributed), so a release install builds from source as a checkout install does. It reads the version from `package.json` at `v0`, downloads GitHub's archive of that version's immutable tag into `~/.local/share/field/<version>/`, runs the same builds with the same prerequisite checks, and sets up again the model workers you had in the version it replaces. Only then does it switch `current` to the new version with one atomic rename. A failed download, build, or worker setup therefore leaves the installed version current, the installer says so, and it removes what it built of the version that failed. `field` is a two-line shim in `~/.local/bin` that runs `current/dist/cli.js`, so an upgrade relinks nothing and a release install needs no pnpm global bin directory. The installer keeps the version an upgrade replaced and removes older ones. JUCE's download goes into a cache shared by every version (`native/audiod/CMakeLists.txt` reads `FIELD_FETCHCONTENT_BASE_DIR`), so an upgrade doesn't clone JUCE again. The installer refuses a version from before release installs, such as 0.2.0, because that version's own `field upgrade` runs its `install.sh` as a checkout's and could never move off it. It also refuses in a Windows shell such as Git Bash, and refuses a bin directory it cannot write, before anything changes. It lists, replaces, and removes only the versions and downloads it can show it made, so a `FIELD_DATA_DIR` that holds other things loses none of them to a prune, and a directory of someone else's where the new version goes stops the install. A version's own installer, and `field upgrade`, take the directory beside a `current` link as the data directory only when the version's directory is named `X.Y.Z`, so a release unpacked as `field-0.2.0` beside another program's `current` installs to the default instead. `field upgrade` tells the two kinds of install apart the same way the installer does. A checkout, with `src/cli.ts` and a `.git` beside the installer, runs its own `install.sh`, as before. A release install reads `release.conf`, which records the repository and ref it follows, downloads `install.sh` at that ref, and runs it with the same target. `FIELD_REPO` and `FIELD_REF` follow a fork or pin a release, and `FIELD_REF=v0 field upgrade` leaves a pin. Under `FIELD_OFFLINE`, `field upgrade` downloads nothing and runs the installed version's own `install.sh` instead. `field upgrade status` compares the installed version with the release and checks each piece is built. Most of the code and tests came from the `live-supercollider` session (the `0f5468d` and `ea305dd` work-in-progress commits), which handed chunk 3 over before finishing it. This session merged `main`, finished `docs/install.md`, and revised the README and the CLI manual to lead with the one-line install now that the repository is public. It also ran the end-to-end checks that had never finished. Plan §2.1, §3.2, §4, §5, §6, and a new §10 describe chunk 3 as built. §7.5 (workers are set up again in each version) and §7.6 (no `install.ps1` here) are now decided. A Windows installer moves to windows-portability.md §7.2, so the question keeps an owner. §9 also records the first release, 0.2.0, as #208's review suggested. Two test changes keep the much larger `src/install.test.ts` honest under vitest. It yields one event-loop turn after each test, because a minute of synchronous `spawnSync` tests left the worker's `onTaskUpdate` reply unread until it timed out as an unhandled error, with every test passing. It also takes a 30-second timeout, which the yield makes enforceable. `field.one/install.sh` (chunk 4, okamnesiac/audiofield) serves `install.sh` at `v0`, so it starts doing anything useful only once a release contains this change. Merge this, release it with the Release workflow (`minor`, so 0.3.0), and only then merge chunk 4. ## Testing From the repository root of a checkout of `install/release-installer`, after `pnpm install --frozen-lockfile`: 1. `pnpm exec vitest run src/install.test.ts src/commands/upgrade.test.ts src/release.test.ts` should report 3 files and 113 tests passed, with no unhandled errors. `src/install.test.ts` runs the real `install.sh` under real bash (macOS's 3.2 locally, 5 in CI) with stand-ins for pnpm, cmake, the CLI, and the downloads, and covers both modes and every status row. If `Errors 1 error` with `Timeout calling "onTaskUpdate"` comes back, the event-loop yield in its `afterEach` is gone. 2. The full gate, `pnpm typecheck && pnpm build && pnpm test && project check`, gave 91 files, 1258 passed and 1 skipped, and valid plans, at `2a9277a`. Build the daemon first with `./install.sh audiod`, because this change edits `native/audiod/CMakeLists.txt`, the merge of `main` brings daemon changes, and `./install.sh status` reports `audiod-stale` until you do. The daemon tests need the current build. `src/keys/routing-voice.test.ts` plays through scsynth on your default output device. At `ce42ef9` it heard a peak of 0.0033 against its 0.01 threshold, with AirPods Pro as the default output, and it passed again at `2a9277a` with nothing changed that reaches it, so a failure there points at the audio device rather than at this change. 3. The release installer end to end, without touching GitHub or your own `~/.local`. This is the harness I ran, in full, from any directory: ```sh E2E=$(mktemp -d); W=<this checkout> export FIELD_DATA_DIR=$E2E/data FIELD_BIN_DIR=$E2E/bin FIELD_RAW_URL=file://$E2E/serve/raw FIELD_ARCHIVE_URL=file://$E2E/serve/github PATH=$E2E/bin:$PATH cut() { mkdir -p $E2E/work/field-$1 $E2E/serve/github/okamnesiac/field/archive/refs/tags $E2E/serve/raw/okamnesiac/field/v0 git -C $W archive HEAD | tar -x -C $E2E/work/field-$1 sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$1\"/" $E2E/work/field-$1/package.json COPYFILE_DISABLE=1 tar -czf $E2E/serve/github/okamnesiac/field/archive/refs/tags/v$1.tar.gz -C $E2E/work field-$1 cp $E2E/work/field-$1/package.json $E2E/work/field-$1/install.sh $E2E/serve/raw/okamnesiac/field/v0/; rm -rf $E2E/work; } cut 0.90.0; curl -fsSL $FIELD_RAW_URL/okamnesiac/field/v0/install.sh | bash field --version | head -1 cut 0.91.0; field upgrade field upgrade status FIELD_OFFLINE=1 FIELD_RAW_URL=file:///nonexistent field upgrade status ``` Run verbatim, the first install took 254 seconds. It printed `building field-audiod for the first time: CMake fetches JUCE and compiles it` and ended with `switched … current -> 0.90.0`. `field --version` printed `field 0.90.0 (not a git checkout)`. `field upgrade` printed `+ curl -fsSL file://…/v0/install.sh | bash`, then `building field-audiod for this version: CMake compiles JUCE from its download in …/data/cache/fetchcontent`, installed 0.91.0 in 61 seconds, and switched `current`. `status` showed `release-latest 0.91.0 is installed` and `previous 0.90.0 … kept to switch back to by hand`. If the upgrade's `building` row says `fetches JUCE` again, the cache isn't working. The offline `status` prints `+ …/data/0.91.0/install.sh status` and `release okamnesiac/field v0 (offline; not compared)`, and exits 0. `cannot upgrade: could not download the installer` there means it still downloads offline. At `98dc9d5`, with my copy of the harness, an upgrade from 0.91.0 to a 0.93.0 cut from this head took 63 seconds, and the offline `status` printed those rows. The run leaves everything under `$E2E`; delete it afterwards. A failed release, in the same shell afterwards: ```sh sed -i '' 's/"version": "0.91.0"/"version": "0.92.0"/' $E2E/serve/raw/okamnesiac/field/v0/package.json curl -fsSL $FIELD_RAW_URL/okamnesiac/field/v0/install.sh | bash; echo "exit $?" field --version | head -1 ``` There's no archive for 0.92.0, so the install exits 1 with `install.sh: 0.92.0 did not install, so 0.91.0 stays current and field still runs it`, and `field --version` still prints 0.91.0. `ls -a $E2E/data` shows no `0.92.0` and no `.download-0.92.0`. Output that switches `current` before the failure, or a `.download-0.92.0` left behind, means the change is wrong. (I ran this case with my own copy of the same harness, pointing `v0` at 0.92.0 and, at `98dc9d5`, at 0.94.0, each with no archive.) Not verified: Linux, a real install from GitHub, and pruning a third version by hand (the unit tests cover pruning). The first real install is the release that carries this change. <!-- projector-summary v=1 sha=2a9277a87de911d0c395d67289edc25a6453a68e --> 📽️ **Projector summary** of 2a9277a: https://field.amnes.ac/reviews/214
The Release workflow opened #207, its first release pull request, and its CI did not run until Justin approved it. For a pull request that a workflow's own token opened, GitHub creates the
pull_requestrun but holds it asaction_required, so a release would wait on a click every time.workflow_dispatchruns need no approval. The propose job now runsgh workflow run ci.yml --ref release/vX.Y.Zright after it opens the pull request, or after it finds one already open on a re-run, andci.ymlgainsworkflow_dispatchas a trigger. A dispatched run's checks land on the branch's commit, which is the pull request's head, so they show on the release pull request like any other CI. The heldpull_requestrun still appears, and the docs tell the reviewer to leave it unapproved, because approving it runs every job a second time. The propose job getsactions: writefor the dispatch, and the default token permission stays read-only.Two alternatives lost. Approving the held run by hand needs no workflow change, but it is a click on every release. A GitHub App token would avoid the hold, but it needs an App and two secrets to do what one extra trigger does.
docs/release.mdnow explains why CI is dispatched. It also names the three levels that must allow GitHub Actions to open pull requests: the enterprise (amnesiac, under Policies > Actions), the organization, and the repository. The first release run found out the hard way that the repository's checkbox stays greyed out until the enterprise allows it. The release pull request's own Testing text now describesreleased --since, which #205 introduced, and mentions the dispatched CI. Plan §9.1 records both of these points.Testing
From the repository root of a checkout of
release-ci:node -e "const y=require('yaml');for (const f of ['.github/workflows/ci.yml','.github/workflows/release.yml']) { const w=y.parse(require('fs').readFileSync(f,'utf8')); console.log(f, Object.keys(w.on), JSON.stringify(w.jobs.propose?.permissions ?? '')) }"should print[ 'push', 'pull_request', 'workflow_dispatch' ]forci.yml. Forrelease.ymlit should print[ 'workflow_dispatch', 'push' ]and{"actions":"write","contents":"write","pull-requests":"write"}. Everyrunstep in both files passesbash -n.pnpm exec vitest run src/release.test.tsshould report 19 passed (the script is unchanged), andproject checkshould printProject plans are valid.The dispatch can't be exercised before this merges, because GitHub dispatches a workflow only once its
workflow_dispatchtrigger is on the default branch. After the merge, run Actions > Release withminoragain while #207 is still open. The propose job will bump 0.1.0 on the newmain, force-pushrelease/v0.2.0, reporta pull request from release/v0.2.0 is already open, and dispatch CI. #207 should then list thelinuxandwindowschecks on its new head. If the dispatch step fails withWorkflow does not have 'workflow_dispatch' trigger,maindoesn't have this change yet.📽️ Projector summary of 6c2f933: https://field.amnes.ac/reviews/208