open-standards/.github/workflows/workflow-hygiene.yml
Transaction Science 4ec33b90e6
All checks were successful
standards workspaces build + test / arl-rs (pull_request) Successful in 1m7s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m58s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m28s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 1m12s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 1m12s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m17s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m13s
standards workspaces build + test / sense-rs (pull_request) Successful in 1m10s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m45s
workflow hygiene / every workflow supersedes its own queue (pull_request) Successful in 3s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 2m29s
standards workspaces build + test / aac-rs (pull_request) Successful in 1m30s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 55s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 37s
standards workspaces build + test / map-rs (pull_request) Successful in 36s
standards workspaces build + test / mesh-rs (pull_request) Successful in 31s
standards workspaces build + test / openpay (pull_request) Successful in 1m46s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 3m52s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 5m44s
ci: guard the concurrency groups, and stop the dev Mac serving 13 of 21 contexts
Two things I argued myself out of doing in #161 and should not have.

## The guard

#161 added a concurrency group to all 15 workflows and nothing stopped the
sixteenth from omitting one — which reintroduces the failure for the whole
repo, invisibly: the workflow still passes, it just queues forever under load.

`scripts/check-workflow-concurrency.sh` requires a top-level `concurrency:`
block whose group varies by `github.ref`. The second condition matters as much
as the first: a fixed group serialises every branch against every other, which
is worse than no group at all.

My reason for skipping it was that a guard "would need its own CI job on the
runner this change exists to unblock". That was wrong on the facts. The guard
runs on `linux` — jetson-hub — not the dev Mac, so it costs nothing I was
trying to protect, and it needs no toolchain.

It also has a self-test, because this repo has a history of gates that passed
while guarding nothing. `check-workflow-concurrency-selftest.sh` breaks the
property both ways against a scratch copy and asserts the check rejects each.

That self-test began as an inline Python heredoc in a `run:` block, and its
body sat at column zero, which made the workflow file **invalid YAML**. An
unparseable workflow means no CI at all — the exact failure the change exists
to prevent, reintroduced by the fix for it. Caught by parsing every workflow
with `yaml.safe_load` before committing; it is a script now.

## The rebalance

#161 named this and left it: the dev Mac hosts **both** the `macos` runner and
the `linux-arm64` colima VM, so it served **13 of 21 contexts** while jetson-hub
sat idle. That is why a PR's `linux` contexts returned in minutes and its macOS
ones could wait indefinitely.

Four workspaces move to `linux` on evidence rather than preference. `arl-rs`,
`sense-rs`, `joulehook-rs` and `joule-ui-rs` each have **zero**
`target_os = "macos"` cfgs, **zero** Apple dependencies, and **zero** Apple
crates in their `Cargo.lock` — so running them on macOS asserted nothing the
repo relies on.

`jouledesk-rs` stays on `macos`, because it does need it: `libwebrtc` and 19
Apple crates in its lockfile. The `linux-arm64` placements stay as well — arm64
is the deployment target, and `jouleclaw-rs` requires `+fp16`.

Labels go from 5 `linux` / 7 `linux-arm64` / 5 `macos` to **9 / 7 / 1**, plus
the dedicated `macOS energy backends` job. The dev Mac drops from 13 contexts
to 9; jetson-hub rises from 5 to 9. macOS is still exercised, by the workspace
that actually depends on it and by the energy job whose whole purpose is the
platform-gated meters.

If one of the four does not build on x86_64, that is a finding rather than a
regression: it would mean a workspace only built on macOS without saying so.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-10-05 12:18:21 -04:00

47 lines
1.8 KiB
YAML

name: workflow hygiene
# Properties of the workflows themselves, checked rather than remembered.
#
# Today that is one property: every workflow declares a concurrency group that
# varies by ref. None of them did until 2026-10-05, and the consequence was not
# a slow build — it was that CI stopped being usable for anyone. A session
# pushing four versions of a branch queued four complete sets of runs, all of
# which had to drain; one PR's 21 contexts settled none in 70 minutes behind a
# backlog of 25, and two PRs were merged on locally-executed equivalents
# because the gate could not run. One omitted block reintroduces that for the
# whole repo, invisibly: the workflow still passes, it just queues forever
# under load.
#
# This job runs on `linux`, which is jetson-hub — deliberately not the dev Mac,
# which already serves 13 of this repo's 21 contexts through two runners. It
# needs no toolchain and finishes in seconds.
on:
push:
branches: [main]
pull_request:
paths:
- '.github/workflows/**'
- 'scripts/check-workflow-concurrency.sh'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
concurrency-groups:
name: every workflow supersedes its own queue
runs-on: linux
steps:
- uses: actions/checkout@v4
# The check must be able to fail, or it is decoration. The self-test
# breaks the property both ways against a scratch copy and asserts the
# check rejects each. It lives in a script because embedding its Python
# in this `run:` block made the file invalid YAML, which would have meant
# no CI at all.
- name: The check fails closed (self-test)
run: ./scripts/check-workflow-concurrency-selftest.sh
- name: Every workflow is grouped per ref
run: ./scripts/check-workflow-concurrency.sh