Skip to content

test(ci): skip the smoke matrix when no script can be affected (tier 1) - #220

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/smoke-relevance-gate
Sep 9, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/smoke-relevance-gate

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #219.

Summary

smoke-tests.yml — the reusable workflow every workspace's smoke_tests.yml calls — had exactly one reason to skip its matrix: a docs-only gate. Anything else ran the full curated smoke list, whatever it touched, so a one-character change to any non-markdown file cost the full run (~11m20s in autolens_workspace_test, ~8m40s in autolens_workspace). The repo already records the failure mode, in smoke_tests.txt on the 2026-08-22 disable of multi_dataset/jax_likelihood/mge.py: "Hit 4/4 jobs (3.12 and 3.13, twice each) on autolens_workspace_test#261, whose diff touches no script this gate runs."

This adds a second reason: no_smoke_relevant_changes. A smoke entry is a path in smoke_tests.txt / smoke_notebooks.txt, resolved under scripts/, run with the workspace's config/ and this workflow's own ceremony — so a diff touching none of those, nor .github/ (the vendored runner and the caller workflow), cannot change what any smoke script does.

Tier 1 only. Tier 2 — narrowing the entry list to the packages the diff touches — needs the selected set passed down to each workspace's vendored run_smoke.py and is deferred to its own prompt.

API Changes

None. No workflow input was added, removed or re-typed: the change is one env key (EVENT_NAME), one job output, and one clause on the smoke job's if:. Callers are unaffected — see the caller verification below.

Design notes worth reading before review

  • Both flags come from ONE diff. git diff --name-only still appears exactly once; the new pass re-reads the same $files list. One diff, two verdicts, so they cannot disagree about what changed — and a test pins that.
  • pull_request only, gated inside the step, not on the smoke job's if:. This is the load-bearing half. config/repos.yaml lists "Smoke Tests" under required_workflows for the workspace groups; ci_status.rollup's own docstring says all required must be "present, completed, success and on HEAD" to return success, and "otherwise ... an unknown, never a green". So a skipped run on main would not RED (skipped is not in FAILURE_CONCLUSIONS), but it would leave readiness permanently unable to reach GREEN — while cancelled would RED outright. Narrowing the PR side is free because Heart never reads it; narrowing the main side would cost the readiness gate its signal. Push-to-main behaviour is byte-for-byte unchanged, and the docs-only gate was deliberately not narrowed to pull_request along with it. The gate lives in the step rather than the if: so the published output means "a skip is warranted", instead of being true-but-inapplicable on a push.
  • Fail closed, verified by execution rather than by reading. Both flags are initialised false before the $BASE guard, so every early exit runs everything. The step's real run: body was executed with only git stubbed — its fetch exit status and --name-only output being the two facts the guard reads — and both flags come back false, with an empty step summary, for: an empty $BASE; the all-zero SHA; a failing git fetch; an empty diff. A single relevant path in an otherwise irrelevant diff also yields false, tested at every insertion position since the loop breaks on first match.
  • Two-dot diff against the base tip preserved. merge-base appears nowhere. Upstream drift on the base branch still shows up as extra files and conservatively runs the matrix.
  • Not implemented with on.pull_request.paths — a job filtered out that way reports no conclusion at all and a required check sits pending forever. The job header comment now says so explicitly.
  • The step summary uses elif, so one reason is printed per run; docs-only is the narrower one and wins when a diff satisfies both.

Test Plan

  • python3 -m pytest -q -n auto from the worktree: 965 passed, 0 failed, 0 skipped (5.2s). Run independently by the implementing agent and again by the architect session — same result.
  • tests/test_workflow_wiring.py — the existing docs-only assertion (which compared the if: string by equality) generalised to both gates, plus a new test that both skip reasons are published as job outputs.
  • tests/test_smoke_tests_wiring.py — 11 new test functions / 25 node ids that execute the predicate rather than pattern-match the YAML: a _classify() helper runs the step's own run: body under bash -e (GitHub's shell) against a synthetic diff, following the repo's existing subprocess.run(["bash", …]) convention from test_verify_install_script.py. Covers the 8-path relevant table, 4 irrelevant diffs, the mixed diff at every position, the three unresolvable bases, the empty diff, the pull_request gate on push/workflow_dispatch/schedule, the docs-only verdict staying unchanged (alone and with a config sidecar), env-vs-interpolation, single-diff/no-merge-base, and the step summary's content.
  • Callers verified, one of each shape. autolens_workspace and autolens_workspace_test ship byte-identical smoke_tests.yml (same blob SHA 65789266). Each declares on: push: branches: [main] + pull_request; concurrency: smoke_tests-${{ github.ref }} with cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} — whose own comment already records the cancelled-is-in-FAILURE_CONCLUSIONS reasoning this change is consistent with; and one job calling this workflow with chain: and secrets: inherit. Neither passes an input this change invalidates, neither reads any output of the reusable workflow, and neither declares a job downstream of the matrix, so a skipped matrix has no dependant. The pull_request gate lands correctly for both: a called workflow inherits the caller's github context, which this very step already proves — github.event.pull_request.base.sha resolves off the caller's event today.

Acceptance, against the issue

  • A PR touching only README.md plus a config sidecar still skips — via the unchanged docs-only path. ✔
  • A PR touching nothing under scripts/, config/, smoke_tests.txt, smoke_notebooks.txt or .github/ now skips. ✔
  • A PR with an unresolvable base still runs the full matrix. ✔ (executed, not reasoned about)
  • The Smoke Tests check reports skipped, not pending, on every skip path — the gate is inside the workflow. ✔
  • main-push runs are unchanged and Heart's ci_status still reads a real conclusion. ✔

Validation checklist (--auto run — plan was not pre-approved)

  • Effective level: safe (header: Autonomy: safe, cap: test → safe)
  • Plan: on the issue (test(ci): skip the smoke matrix when no script can be affected (tier 1) #219), written at start, unmodified since
  • Gate: tests 965 passed / 0 failed / 0 skipped · smoke n-a (this repo has no smoke suite of its own; it is the smoke harness) · Heart unavailable, not RED — pyauto-brain vitals reports CI unavailable (query failed) for all 17 repos because this container's egress proxy serves no REST repo paths, so the documented fallback applies and the worktree suite is the gate
  • Human: plan sound in hindsight?
  • Human: diff matches plan (no scope creep)?
  • Human: merge, amend, or reject — then log the outcome

Shipped as member 3 of the ci-smoke bundle; one PR per task, closed out by /prm unchanged.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qr64vy2ZcjjxaS7jSpH5eM


Generated by Claude Code

`smoke-tests.yml` had exactly one reason to skip: a docs-only diff. Anything
else ran the full curated smoke list whatever it touched — ~11m20s in
`autolens_workspace_test` (~17 runs/week), ~8m40s in `autolens_workspace`
(5.8 runs/day). `smoke_tests.txt` already records the failure mode on the
2026-08-22 disable of a jax_likelihood entry: "Hit 4/4 jobs ... whose diff
touches no script this gate runs."

Add a second reason, classified from the SAME `$files` list the docs-only pass
reads: `no_smoke_relevant_changes`. A smoke entry is a path in
`smoke_tests.txt` / `smoke_notebooks.txt`, resolved under `scripts/`, run with
the workspace's `config/` and the ceremony that `.github/` supplies — so a diff
touching none of those cannot change what any smoke script does. The two flags
are independent and ORed in the `smoke` job's `if:`; a docs-only diff satisfies
both, which is fine.

Fail closed, exactly as the docs-only gate is: the new flag is initialised
`false` BEFORE the guard, so no base sha, the all-zero sha, an unfetchable
base, an empty diff or a single relevant path all leave the matrix running.
The two-dot diff against the base TIP is unchanged and not re-derived — one
diff, two verdicts — so upstream drift still shows up as extra files and
conservatively runs everything.

Gated to `pull_request` inside the classify step, so the output itself means
"a skip is warranted" rather than needing a second condition to be read
correctly. `config/repos.yaml` lists "Smoke Tests" under `required_workflows`
for the workspace groups; `ci_status` reads its conclusion on the `main` HEAD
commit and only an explicit `success` rolls up green. Narrowing the PR side is
free — Heart never reads it — so the saving is taken there and only there, and
push-to-`main` behaviour is byte-for-byte what it was.

The skip stays INSIDE the workflow rather than moving to
`on.pull_request.paths`: a path-filtered job reports no conclusion at all and a
required check would sit pending forever, where a skipped job reports
`skipped`, which satisfies required-check semantics.

Tests run the step's own `run:` body against a synthetic diff with only `git`
stubbed, so the `case` glob lists are executed rather than string-matched: the
relevant-path table, the mixed diff at every position, both fail-closed bases,
the empty diff, the `pull_request` gate on three other events, the untouched
docs-only verdict, and the step summary.

Verified against both caller shapes: `autolens_workspace` and
`autolens_workspace_test` ship byte-identical `smoke_tests.yml` callers (blob
6578926), declaring only `chain:`, consuming no output of the reusable workflow
and running no job downstream of the matrix. Neither passes an input this
change invalidates and neither depends on the matrix always running.

Tier 2 (narrowing the entry list to the packages the diff touches) needs the
selected set passed down to each workspace's vendored `run_smoke.py` and is
deliberately left to its own prompt.

Closes #219

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qr64vy2ZcjjxaS7jSpH5eM
@Jammy2211 Jammy2211 added the pending-release Awaiting a published release label Sep 9, 2026 — with Claude
@Jammy2211
Jammy2211 merged commit 1593a76 into main Sep 9, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/smoke-relevance-gate branch September 9, 2026 23:14
@Jammy2211 Jammy2211 removed the pending-release Awaiting a published release label Oct 7, 2026
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.

test(ci): skip the smoke matrix when no script can be affected (tier 1)

2 participants