Skip to content

Add a verify workflow: a lane pushes a verify/ branch and GitHub's runner runs one tests/run.sh selector from the head commit's trailers, with PostgreSQL 16 on request (part of opensoft/openRepoTools#165) - #34

Merged
brettheap merged 2 commits into
mainfrom
verify/l3-ci-verify-workflow
Nov 11, 2026

Conversation

@brettheap

@brettheap brettheap commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openRepoTools-3
Claim: none (Brett Heap's "CI verifies (Recommended)", 2026-11-10)

Why

A lane's local tests/run.sh waits while any python3 -m pytest runs anywhere on the workstation. On 2026-11-10, T303's verify waited an hour on Eagle and timed out without running. Brett Heap chose "CI verifies (Recommended)" in a dialog in lane openRepoTools-3's session (recorded at 2026-11-10T22:58:57Z). The option read: "Lane 3 briefs every lane to verify on CI by default. Local runs shrink to one short test by node id."

This PR adds .github/workflows/verify.yml, one new file. Nothing else changes.

Design

A push to a verify/ branch, with the selector in the head commit's trailers. GitHub dispatches only a workflow that is already on the default branch, so a dispatch-only file could not be tried before it lands. A push runs the workflow file of the commit pushed, so this design works from this PR's own branch and from any lane branch that carries the file. The trailers sit in the commit, so the commit records what was asked for. The run reads them with git's own parser, %(trailers:key=…,valueonly,unfold). A Verify-Selector: in the message body, outside the last paragraph, is not read.

  • Verify-Selector: … is required, given once, and is one pytest -k expression. There is no default, because the whole suite is tests.yml's job.
  • Verify-Postgres: 1 turns PostgreSQL on. 0, or no trailer at all, leaves it off.
  • workflow_dispatch takes the inputs selector and postgres (0 or 1). It works once this file is on main, and it then ignores the trailers.
  • A newer push to the same verify branch cancels the older run. A dispatch never cancels another run.

The run is bash tests/run.sh -k "$SELECTOR" -rs --junitxml=…, never under a flock.

  • -rs prints why each test skipped, and the JUnit report is what the summary counts.

  • The run's output (plan.txt, run.log, junit.xml, the exit code, and the engine logs when PostgreSQL is on) is kept for 14 days as the artifact verify-RUNID-aATTEMPT.

  • The step summary is one line: the selector, PostgreSQL on or off, and the passed, failed and skipped counts. The line also gives errors when there are any, and the exit code; exit 5 means the selector selected no test.

  • The counts follow .github/ci/ci_shards.py's rule, one outcome per test case:

    • an xfail counts as skipped, and an xpass as passed;
    • a test that passes and then errors in teardown counts only as an error.

    The suite has no xfail today.

PostgreSQL

  • Runner. The job runs on ubuntu-24.04, as every tests.yml job does, and for that file's reason: ubuntu-latest has been 26.04 since 2026-10-21.
  • Where the engine comes from. Today it is the runner image's own PGDG build of PostgreSQL 16. In proof run 2, apt found postgresql-16 already at the newest version (16.15-1.pgdg24.04+2) and installed nothing. The install step stays, so the job does not depend on the image: Ubuntu 24.04's default major is 16, so if the image drops it, postgresql-16 comes from Ubuntu's archive. The job adds no PGDG source.
  • Start check. The job checks that initdb, pg_ctl, postgres and psql each report major 16. It then starts a socket-only cluster of its own, reads server_version 16, and stops the cluster.
  • What the fixture reads. tests/pgcluster.py (lane 2's T229 line) reads exactly two variables, and the suite step sets both in its env::
    • OPENREPOTOOLS_REQUIRE_PG is 1 when on and 0 when off. With 1, pytest refuses a run that finds no engine, exit 4, before any test runs.
    • PG_BIN is /usr/lib/postgresql/16/bin when on.
  • Off. When PostgreSQL is off, PG_BIN names an empty directory, as lane 2's own no_engine() does. Otherwise the image's own PostgreSQL 16 would be found without being asked for. The real-engine tests then skip, and the skip reason names PG_BIN and postgresql-16.
  • No service container. No service container or system service is started, because the fixture runs its own postmaster as the runner's user, on a Unix socket under /tmp. T229's TLS cluster listens on 127.0.0.1.

Security

  • No run: contains a ${{ }} expression. Values from the event reach the shell only through env:, and are used double-quoted.

  • The selector is refused unless it:

    • uses only letters, digits, _, space, ., (, ), [, ], :, +, / and -;
    • begins with a letter, a digit, _ or (;
    • is at most 4096 bytes. The longest task selector in spec#17's tasks.md is 1,438 bytes.

    So it cannot carry a quote, $, a backtick or a newline. It cannot be read as a pytest option, start a workflow command, or break out of the summary's code span.

  • A refused value is printed %q-quoted.

  • permissions: {} for the workflow, and contents: read for the job.

  • The checkout keeps no credential (persist-credentials: false), and the workflow uses no secret.

  • Actions are pinned by commit, to the same three commits tests.yml pins.

  • pytest 8.3.4 is installed with --only-binary=:all:.

For lanes: verifying a task on CI

  1. Run git fetch origin first, so that origin/main is current.
  2. Build a throwaway branch named verify/LANE/TASK from the commit you want verified. The commit you push must carry .github/workflows/verify.yml. If your tip predates the file, check it out from origin/main once this lands.
  3. Put the trailers in the last paragraph of the head commit's message.
  4. Push the branch, find its run by the head commit's sha, read the run, then delete the branch.

For example, lane 2 verifying T229b, from its task branch's tip:

git fetch origin
TIP=$(git rev-parse HEAD)
git switch -c verify/l2/T229b "$TIP"
git checkout origin/main -- .github/workflows/verify.yml
git commit --allow-empty -F - <<'EOF'
Verify T229b on CI

Verify-Selector: sql_register_fixture
Verify-Postgres: 1
Lane: openRepoTools-2
EOF
SHA=$(git rev-parse HEAD)
git push origin verify/l2/T229b:refs/heads/verify/l2/T229b
RUN_ID=
for _ in $(seq 30); do
  RUN_ID=$(gh run list -R opensoft/openRepoTools-code --workflow verify.yml --branch verify/l2/T229b --json databaseId,headSha --jq ".[] | select(.headSha == \"$SHA\") | .databaseId" | head -n 1)
  [ -n "$RUN_ID" ] && break
  sleep 10
done
gh run watch "$RUN_ID" -R opensoft/openRepoTools-code --exit-status
gh run view "$RUN_ID" -R opensoft/openRepoTools-code
gh run view "$RUN_ID" -R opensoft/openRepoTools-code --log-failed
gh run download "$RUN_ID" -R opensoft/openRepoTools-code --dir verify-out
git push origin --delete verify/l2/T229b

The run is picked by the head commit's sha, not by --limit 1. Straight after a push, --limit 1 can list nothing yet, or an older run on a reused branch name.

Points to know:

  • -k matches test names, not node ids. tests/x.py::y passes the check, selects nothing, and exits 5. Use words from the module and test names instead, such as test_lanes_index.py or repo_hygiene.
  • A long selector can be folded. Continue it on indented lines inside the trailer, and git's unfold joins them with single spaces. A selector is at most 4096 bytes.
  • [skip ci] in the head commit's message stops the run: GitHub starts none. So do [ci skip], [no ci], [skip actions] and [actions skip].
  • A whole-suite verify is refused by design. T328's (tasks:1560) is bash tests/run.sh -rs, with no -k. It goes to tests.yml, through the PR's own CI or a dispatch on the branch (gh workflow run tests.yml --ref BRANCH).
  • When landing, leave the Verify-* trailers out of the squash message, this PR's included.

Reading the result:

  • gh run view shows the job's result and any refusal.
  • The summary line is on the run's page, and also in the log of the step the summary line.
  • When PostgreSQL is on, the log's foot names the engine: real-engine: real PostgreSQL 16 at /usr/lib/postgresql/16/bin (PG_BIN).

Proof runs

  1. Pushing this branch at 04be130. The head commit carried Verify-Selector: repo_hygiene and Verify-Postgres: 0. The run succeeded: 240 passed, 0 failed, 18 skipped, exit 0. The 18 skips are the root-document skips a standalone leg always has. Run: https://github.com/opensoft/openRepoTools-code/actions/runs/42928765631

  2. The branch verify/l3/ci-verify-pg-proof, at 975c959. It is an empty commit on 04be130, with the same tree, carrying Verify-Selector: guard_launch_mode or repo_hygiene and Verify-Postgres: 1. The run succeeded: 253 passed, 0 failed, 18 skipped, exit 0. The two-word selector reached pytest as one argument.

    • apt found the image's postgresql-16 already newest and installed nothing.
    • All four tools said 16.15, and the cluster started, answered server_version 16.15, and stopped.
    • No test on main needs PostgreSQL yet, so this run proves the engine only.
    • The coordinator deleted the branch at 2026-11-11T00:22:42Z.

    Run: https://github.com/opensoft/openRepoTools-code/actions/runs/42928771028

  3. This PR's fix commit carries Verify-Selector: repo_hygiene and Verify-Postgres: 0 too, so its own push runs green.

The fixture itself is not yet proven on CI. A lane's branch proves it by pushing a verify branch whose tree has tests/pgcluster.py and its real-engine tests, with Verify-Postgres: 1. Its JUnit counts then show those tests passed and none skipped for want of PostgreSQL 16, and the log's foot names the engine.

Checked locally (no suite was run)

  • actionlint 1.7.12 exits 0. yaml.safe_load parses the file.

  • bash -n and shellcheck pass on each of the six run: bodies, and none of them contains ${{.

  • The plan step, on 18 throwaway commits, accepts:

    • one-word, multi-word, bracketed and folded selectors;
    • dispatch inputs, which win over trailers.

    It refuses:

    • a missing selector, a doubled selector, and a selector only in the message body;
    • $(…), ;, a backtick, a quote, a leading - and a leading ::;
    • a bad or doubled Verify-Postgres.

    No injected command ran. At the cap, 4096 bytes is accepted and 4097 refused.

  • Real selectors. spec#17's tasks.md at 8523aa0 holds 229 single-quoted -k selectors. Run through the plan step:

    • 226 are accepted, including the eight over 500 bytes, the longest 1,438;
    • the other three are template placeholders, not selectors.
  • The engine step passes against PostgreSQL 16.15 binaries.

  • The summary step gives the right line for:

    • a mixed report;
    • exit 5;
    • exit 4 with no report;
    • a suite that did not run;
    • a refused plan.
  • The repository's own host-path rule finds nothing in the new file.

🤖 Generated with Claude Code

…nner runs one tests/run.sh selector from the head commit's trailers, with PostgreSQL 16 on request (part of opensoft/openRepoTools#165)

Every lane's local tests/run.sh waits while any `python3 -m pytest` runs
on the workstation, and on 2026-11-10 a task's verify waited an hour and
timed out without running. Brett Heap chose "CI verifies (Recommended)",
whose option read: "Lane 3 briefs every lane to verify on CI by default.
Local runs shrink to one short test by node id." (a dialog in lane
openRepoTools-3's session, recorded at 2026-11-10T22:58:57Z).

.github/workflows/verify.yml is a new file; tests.yml is unchanged, since
lane 1 holds a pending patch to it for opensoft/openRepoTools#186 (T010).
It is not a gate: the release workflow reads only runs whose path is
.github/workflows/tests.yml.

How a run is asked for:
- A push to a branch under verify/ runs the workflow file of the pushed
  commit, so it works before this file is on main. The run reads the head
  commit's trailers with git's own trailer parser: Verify-Selector (one
  pytest -k expression, required) and Verify-Postgres (1 on; 0 or absent
  off).
- workflow_dispatch, with the inputs selector and postgres, once the file
  is on main.
- A newer push to the same verify branch cancels the older run.

The run is `bash tests/run.sh -k "$SELECTOR" -rs --junitxml=...`, never
under a flock. The run's output is kept as an artifact for 14 days. The
step summary is one line: the selector, PostgreSQL on or off, and the
passed, failed and skipped counts.

PostgreSQL: the job runs on ubuntu-24.04, as every tests.yml job does.
Ubuntu 24.04's own major is 16, so on request the job installs
postgresql-16 from Ubuntu's archive, with no PGDG source. The job then
checks that initdb, pg_ctl, postgres and psql each say 16. It also starts
a socket-only cluster of its own, reads server_version 16, and stops it.
No service container or system service is used, because tests/pgcluster.py
(lane 2's T229 line) starts its own postmaster.

The job exports exactly what that fixture reads:
- OPENREPOTOOLS_REQUIRE_PG, 1 or 0, set only in env:;
- PG_BIN, /usr/lib/postgresql/16/bin when on.
When off, PG_BIN names an empty directory, as lane 2's no_engine() does.
The image's own PostgreSQL 16 would otherwise be found unasked.

Injection: no run: holds an expression. Event values reach the shell only
through env:, double-quoted. A selector must match pytest's -k alphabet
and begin with a letter, digit, _ or (, at most 500 bytes. It can then hold
no quote, $, backtick or newline, start no workflow command, and not be
read as a pytest option. The workflow has permissions: {}. The job has
contents: read, the checkout keeps no credential, and the job uses no
secret. Actions are pinned by commit, as tests.yml pins them, and pip
installs with --only-binary=:all:.

This commit's own trailers below ask for the first proof run: repo_hygiene
without PostgreSQL.

Verify-Selector: repo_hygiene
Verify-Postgres: 0
Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 3 days and 21 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Add the standalone verify workflow, including its triggers, permissions, concurrency, runner setup, and pinned actions, so lane branches and manual dispatches can request targeted CI runs.

  • .github/workflows/verify.yml L1-111

Read and validate the selector and PostgreSQL choice, optionally install and verify PostgreSQL 16, run the selected tests, and publish the summary and retained artifact.

  • .github/workflows/verify.yml L112-332

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

…wn selectors need, and its comments say where PostgreSQL comes from and how the summary counts (review of #34; part of opensoft/openRepoTools#165)

The independent review of 04be130 read READY AFTER FIXES: one SHOULD and
three NITs, no MUST. This commit makes the workflow's three fixes; the
fourth NIT is in the PR body.

- SHOULD: the selector cap goes from 500 to 4096 bytes, in the check, in
  its refusal and in the header comment. spec#17's tasks.md at 8523aa0
  holds 229 single-quoted -k selectors. The five tasks T107, T502, T507,
  T510 and T512 carry eight of them over 500 bytes, the longest 1,438.
  The plan step now accepts 226 of the 229, those eight included. The
  other three are template placeholders, not selectors. At the cap, 4096
  bytes is accepted and 4097 refused. Nothing else about the check
  changes.
- NIT: where PostgreSQL comes from. In proof run 2, apt found postgresql-16
  already newest at 16.15-1.pgdg24.04+2, so today the runner image's own
  PGDG build runs. Ubuntu 24.04's archive is the fallback if the image
  drops it. The comments on the job and on the install step now say so;
  the step itself is unchanged.
- NIT: the summary counts one outcome per test case, by ci_shards.py's
  rule. An xfail counts as skipped and an xpass as passed. A test that
  passes and then errors in teardown counts only as an error. A comment
  at the loop now says so; the suite has no xfail today.

This commit's own trailers below ask for repo_hygiene without
PostgreSQL, so its push runs green.

Verify-Selector: repo_hygiene
Verify-Postgres: 0
Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

Coordination for Brett's approved narrow CI-only stacking/batching pilot:

This pilot will reference #34 as targeted feedback, not full or composed acceptance. The feature's governance record is prepared separately in the spec leg. This is coordination, not a claim on #34 or its lane's work.

@brettheap

Copy link
Copy Markdown
Contributor Author

The complementary pilot is now #37, with governance/feature 008 in opensoft/openRepoTools-spec#24. It touches neither verify.yml nor tests.yml/release.yml. Hosted shadow/contract jobs passed; full acceptance stays in the existing tests workflow. The shared Claude/Codex instructions reference #34 as the owner of targeted feedback and require checking its actual merge state before use. No live canary/queue has been run and no change or interruption is requested of lanes 1–5.

@brettheap
brettheap merged commit 4b1485d into main Nov 11, 2026
16 checks passed
@brettheap
brettheap deleted the verify/l3-ci-verify-workflow branch November 11, 2026 01:08
brettheap added a commit that referenced this pull request Nov 11, 2026
…ff-refuses-closed-lane

Lane 3 asked for this merge and a fresh CI run before landing (opensoft/openRepoTools#165, 6783977065).

Lane: openRepoTools-5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 11, 2026
…sals-keep-their-words

Lane 3 asked for this merge and a fresh CI run before landing (opensoft/openRepoTools#165, 6783977065).

Lane: openRepoTools-5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 11, 2026
…udge-race

Part of opensoft/openRepoTools#165 (lane 4's batch 6 Q18); the branch is
#36. main moved from 749e969 by
#34, which adds only .github/workflows/verify.yml,
so the merge changes nothing in tests/test_lane_helpers.sh.

Lane: openRepoTools-3
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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