Skip to content

ci: split Project Checks into parallel lanes - #1702

Merged
c-vigo merged 7 commits into
devfrom
feature/1692-project-checks-lanes
Sep 25, 2026
Merged

c-vigo merged 7 commits into
devfrom
feature/1692-project-checks-lanes

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Project Checks was the only job on CI's critical path and a serial chain of
independent work: 9m59s on run
36108278820 while
every other job finished by 8m37s. Nothing after setup-env consumed another
block's output — prek, BATS, pytest and the nix gates each read the checkout and
the warm dev-shell and nothing else — so the job cost the sum of its blocks
rather than the longest one.

This splits it into four parallel lanes (Project Lint, Project Tests,
Project BATS, Project Flake Gates), each running setup-env once and one
block, with the test-project composite as the single source of truth for every
block body. The critical path becomes setup + the longest block.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

1. The composite owns every block (.github/actions/test-project/action.yml).
The seven flake gates (Tier 0 nix-fast-build, flake output schema, dev-shell
contracts, hooks fidelity + services, capability modules, downstream stub, zizmor
audit) lived inline in ci.yml — in the composite's only caller. They moved into
the composite verbatim (each body gaining the shell: bash a composite step
requires) under a new flake suite value, and the BATS and pytest blocks gained
their own values. suite is now a single enum: all | lint | bats | pytest | flake, with all unchanged. Coverage summary + upload are guarded to pytest
(nothing else produces coverage.xml) and the prek cache to lint.

setup-env's sync-dependencies is derived from the suite
(inputs.suite == 'bats' && 'false' || 'true') rather than exposed as a caller
input: the environment a block needs is a property of the block. The bats block
needs the flake toolchain but never the project venv — verified: init.bats only
probes command -v uv, the uv sync strings in init-workspace.bats are heredoc
payloads, and just.bats/init-workspace.bats stub the binary.

An unrecognized suite is refused by a first, toolchain-free step
(::error::unknown test-project suite '<value>'). Every block is guarded on an
exact match, so a typo in a lane (flakes, tests) would run nothing and
report the lane green — the one silent-pass mode a per-lane split introduces that
the serial chain could not have. The static half of the same gap is pinned in
tests/test_workflow_summary_gate.py: each lane passes the block it is named
for, no two lanes pass the same block, and every block the composite guards (bar
all) is some lane's suite, so a block cannot be implemented with no job running
it.

I did not add the optional bats-files input that would let a later matrix
split the BATS lane without touching the composite: it costs a word-splitting
$BATS_FILES and a shellcheck disable for a split the issue itself says to
measure first. YAGNI — it is a two-line change when that measurement happens.

2. Four lanes (.github/workflows/ci.yml). project-lint (15 min),
project-tests (15), project-bats (15), project-flake (25 — it keeps the old
chain's budget for a cold-Cachix dev-shell rebuild). The short lanes are sized for
setup-env, not for their block: a flake.lock change that misses Cachix builds
the dev-shell in every lane rather than once, so 15 minutes buys that headroom
four times over. Each lane carries the
unchanged workflow_dispatch gate
(inputs.test-suite == 'all' || … == 'project'), so a dispatch of project still
runs all four, and each keeps its own checkout (a local uses: ./… is resolved
from the workspace before the composite's own checkout runs).

3. summary fans in over all four. needs:, the four echo lines and four
failure/cancelled legs. skipped stays tolerated. This is load-bearing: with
if: always() a lane left out of needs: is not merely unchecked, it is
invisible to the only required status check.

4. Docs. docs/WORKFLOW_SECURITY.md names project-flake as the job running
the zizmor regression gate (that file is hand-written, not generated from
docs/templates/). zizmor.yml's own header pointed a reader at
.github/workflows/ci.yml → "Audit managed workflows", where that step no longer
lives; it now names the composite step and the project-flake lane that runs it.

That correction could not be confined to the root file: assets/workspace/zizmor.yml
is not hand-edited — sync-manifest regenerates it from the root copy and only
prepends the managed banner, so the hook rewrites the mirror (and fails the commit)
the moment the root text changes. Both files therefore carry the same comment-only
edit; no rule changes, so a consumer sees one line of header drift on their next
upgrade and no behavior difference. Deferring the fix instead would have meant
leaving the pointer wrong in the file a maintainer actually reads.

Archival docs/issues/*, docs/pull-requests/* and released CHANGELOG entries
that mention "Project Checks" are left as the historical record they are.

Critical path

Block Before (run 36108278820) After
setup-env 44s (paid once) ~42s per lane (34s dev-shell pull), in parallel
prek linters 42s 42s — Project Lint job 1m36s
bats -j 4 tests/bats/ 3m11s 3m17s — Project BATS job 4m08s
pytest + coverage 1m18s 1m24s — Project Tests job 2m14s
nix gates (Tier 0 45s, schema 29s, dev-shell 2s, hooks+services 35s, modules 1m58s, stub+zizmor 6s) 3m55s 3m52s (Tier 0 46s, schema 31s, dev-shell 2s, hooks+services 31s, modules 1m57s, stub+zizmor 5s) — Project Flake Gates job 4m49s
critical path 9m59s (one serial job) 4m49s (Project Flake Gates); BATS lane 4m08s. Whole run 10m46s → 8m58s; the run's path is now build-image 1m49s → Security Scan 6m39s (#1701)

Target from the issue: ≤ 5 min for the longest lane on a warm cache — met (4m49s) on run 36118110737.

Changelog Entry

No changelog needed — CI-internal. No consumer-visible artifact changes: nothing
under assets/workspace/ or the image is touched, and the issue's own Changelog
Category is "No changelog needed".

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

just test is left unticked deliberately: it runs the whole of tests/,
including test_image.py / test_integration.py, which need a freshly built
image and podman and fail off a stale local :dev image. What ran instead is the
selection the project-tests lane itself runs, plus the workflow-shape suites —
below.

Manual Testing Details

  • nix develop --command actionlint — rc 0 over all workflows.
  • nix run nixpkgs#zizmor -- --offline .github/workflows/ci.yml .github/actions/test-project/action.yml
    — 1 medium, 0 high, same as dev (the known artipacked on the composite's
    own checkout). The three new lanes only add findings that are already
    ignored/suppressed: 42 findings (8 ignored, 33 suppressed) on dev → 57
    (11 ignored, 45 suppressed), identical severity profile.
  • Every run: body of the composite shellchecked by hand (shellcheck -x, GH
    expressions neutralised) — actionlint does not lint composite-action shells.
    All seven moved bodies clean; the only finding is the pre-existing, deliberate
    SC2086 on $TEST_ARGS.
  • The pytest lane's own sweep — exactly what project-tests runs (tests/ minus
    the 9 heavy Nix/image modules, plus packages/vig-utils/tests): 1591 passed.
  • Every workflow-shape suite (tests/test_workflow_*.py): 312 passed.
  • The suite guard exercised directly for each accepted value, an unknown one and
    the empty string: rc 0 / rc 1 with the annotation, as intended.
  • The new lane pins mutation-checked: pointing project-tests at lint fails the
    per-lane pin and the distinctness pin.
  • nix develop --command prek run --all-files: all hooks Passed, exit 0, tree
    still clean.
  • The lanes themselves can only be proven by the PR's first CI run — that is what
    fills the table above.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Two of the issue's acceptance criteria need correcting.

Rulesets: the criterion assumes a ruleset names Project Checks. It does not.
gh api repos/vig-os/devkit/rulesets shows Dev protection and Release protection
requiring only Test Summary, and Main protection requiring Test Summary +
CodeQL Analysis (actions) + CodeQL Analysis (python). The aggregate absorbs
the rename, so no org-config change is needed and no aggregate job has to be
kept for the check name.

Scope: the criterion says only .github/** changes. This PR also touches
tests/test_workflow_summary_gate.py (the exact needs: set — deliberately not
relaxed to a subset), tests/test_workflow_zizmor_baseline.py (the zizmor gate
now lives in the composite) and one line of docs/WORKFLOW_SECURITY.md. All three
are consequences of the rename, none is a consumer artifact.

Lane: this targets dev, not the release-neutral lane (#1676) — main does not
yet carry the bats -j wrapper from #1690, so the drvPath-identity guard has no
matching base there. It ships with the next train.

Three prose comments still say "project-checks" where the lane is now named —
flake.nix:1221, tests/test_utils.py:459 and tests/test_install_script.py:5
(the complete live set; grep -rn project-checks over non-archival files finds no
others). All three read correctly as generic descriptions of "the cheap project
lane", none is a path or a job reference a tool resolves, so they are left out of
this diff rather than widening it further.

Follow-up the issue predicted: Security Scan is now the whole-run bottleneck
(build-image 1m57s → security-scan 6m28s = 8m25s on the same run). Filed as #1701.

Refs: #1692

Project Checks is a serial chain of independent blocks. Pin the target job
layout before splitting it:

- the summary aggregate's `needs:` set becomes the four `project-*` lanes
  instead of `project-checks`. The set is asserted exactly: under
  `if: always()` a lane missing from `needs:` is invisible to the aggregate,
  so a red lane could not block the merge.
- the zizmor managed-set gate is read from the `test-project` composite's
  `runs.steps` (its new home) and the `project-flake` lane must exist to run
  it.

Both fail on the current layout.

Refs: #1692
The seven flake gates (Tier 0 nix-fast-build, flake output schema, dev-shell
contracts, hooks fidelity + services, capability modules, downstream stub,
zizmor audit) lived inline in ci.yml's project-checks job, which has the
composite's only caller. Move them verbatim into the composite under a `flake`
suite value (each body gains the `shell: bash` a composite step requires) and
give the BATS and pytest blocks their own suite values too, so every block can
be selected individually without duplicating its body.

setup-env's `sync-dependencies` is now derived from the suite instead of being
hardcoded: the bats block needs the flake toolchain but never the project venv,
since no BATS test executes `uv`.

Behaviour is unchanged: the single caller still passes the default `all`, which
runs every block in the same order as before.

Refs: #1692
Project Checks was the only job on the critical path and a serial chain of
independent work: 9m59s on run 36108278820 while every other job finished by
8m37s. Nothing after `setup-env` consumed another block's output, so the chain
was the sum of its blocks instead of the longest one.

Split it into `project-lint`, `project-tests`, `project-bats` and
`project-flake`, each calling the `test-project` composite with its own suite
and each carrying the unchanged `workflow_dispatch` gate, so a dispatch of
`project` still runs all four. Timeouts are sized per block (10/10/15/25)
rather than for the old chain. The critical path becomes setup + the longest
block — the BATS lane at ~3m11s plus its 44s setup.

The `summary` aggregate fans in over the four lanes: with `if: always()` a job
missing from `needs:` is invisible to it, so all four are listed there and each
has its own failure/cancelled leg. `skipped` stays tolerated.

The zizmor regression gate moved into the composite with the flake block, so
WORKFLOW_SECURITY.md now names the lane that runs it.

Refs: #1692
A lane that is observed by the summary aggregate but runs no block is green:
`needs:` coverage alone does not prove work happened. Pin the static half of
that gap — each lane passes the block it is named for, no two lanes pass the
same block, and every block the composite guards (bar `all`) is some lane's
suite, so a block cannot be implemented with no CI job running it.

These pass on the current layout: they pin what the preceding commits built
rather than driving it red-first. Mutation-checked instead — pointing
`project-tests` at `lint` fails the per-lane pin and the distinctness pin.

Refs: #1692
Every block is guarded on an exact `inputs.suite` match, so a typo in a lane
('flakes', 'tests') runs no block at all and the lane reports success — a
silent-pass mode the serial chain could not have. A first composite step now
validates the value and fails with a `::error::` annotation naming it.

Cheap and local: no checkout, no toolchain, so a bad suite fails in seconds
instead of after a dev-shell provision. Verified by running the case arm
directly for each accepted value, an unknown one, and the empty string.

Refs: #1692
10 minutes was sized on the blocks themselves (42s of prek, 1m18s of pytest).
The cost the split multiplies is `setup-env`: a flake.lock change that misses
Cachix builds the dev-shell in every lane rather than once, so the two short
lanes get 15 minutes like the BATS lane. The flake lane keeps its 25.

Refs: #1692
The baseline's header told a reader to look for the gate in
.github/workflows/ci.yml, where the "Audit managed workflows" step no longer
lives; it is in the test-project composite, run by the project-flake lane.

The scaffolded copy carries the same change because it is not hand-edited:
sync-manifest regenerates assets/workspace/zizmor.yml from this file and only
prepends the managed banner, so the root text cannot be corrected without the
mirror following. Comment-only, no rule change — consumers see one line of
header drift on their next upgrade and no behavior difference.

Refs: #1692
@c-vigo c-vigo self-assigned this Sep 25, 2026
@c-vigo

c-vigo commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Verification of the PR's claims on the first CI run

Run 36118110737, all 14 checks green, Test Summary passed.

Claim Evidence Verdict
Four independent lanes, each running setup-env once and one block Jobs Project Lint 1m36s, Project Tests 2m14s, Project BATS 4m08s, Project Flake Gates 4m49s, all success, no needs: between them; each lane's composite log shows exactly one block's steps executing and the others skipped holds
test-project stays the SSoT; flake gates moved verbatim The flake lane ran all seven gates inside the composite: Tier 0 46s, schema 31s, dev-shell 2s, hooks+services 31s, modules 1m57s, stub 5s, zizmor (uvx [email protected] … completed), same order and times as the old inline steps holds
summary fans in over every lane Its log echoes Project Lint/Tests/BATS/Flake Gates: success and carries a failure/cancelled leg for each holds
BATS lane skips uv sync Lane log: sync-dependencies: false; Sync Python dependencies skipped; BATS block 3m17s (was 3m11s inside the serial job, within noise) holds
Coverage stays with the pytest lane Artifacts: coverage-report uploaded once, from Project Tests holds
Unknown-suite guard Validate suite ran first in all four lanes present (negative path pinned by the shape tests, not exercised live)
Longest lane ≤ 5 min warm 4m49s (Project Flake Gates); the BATS lane 4m08s met
Critical path drops from the sum to setup + longest block Project Checks 9m59s → longest lane 4m49s; whole run 10m46s (run 36108278820) → 8m58s holds
Security Scan becomes the run bottleneck build-image 1m49s → Security Scan 6m39s = 8m28s, the run's path; filed as #1701 confirmed
No ruleset change needed Dev/Release rulesets require only Test Summary; the aggregate name is unchanged and the merge is not blocked holds

One observation, not a defect: Integration Tests started 3m36s after build-image finished (09:24:58 → 09:28:34), runner-queue latency with 11 jobs plus CodeQL in flight, so the run total is a little above the sum of its longest chain. Not a concern under the Free plan's 20-concurrent cap, but worth a glance if the run total stops improving.

The AFTER column of the critical-path table in the description is filled from this run.

@c-vigo
c-vigo merged commit c492a0e into dev Sep 25, 2026
15 checks passed
@c-vigo
c-vigo deleted the feature/1692-project-checks-lanes branch September 25, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant