diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 27927ea3..24f768a3 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -147,6 +147,7 @@ jobs: env: BASE: ${{ github.event.pull_request.base.sha || github.event.before }} EVENT_NAME: ${{ github.event_name }} + RUNNER: ${{ inputs.runner }} run: | docs_only=false no_smoke_relevant_changes=false @@ -181,7 +182,10 @@ jobs: # side is free because Heart never reads it; narrowing the `main` # side would cost the readiness gate its signal. So a push to # `main` keeps running the full matrix, always. - if [ "$EVENT_NAME" = "pull_request" ]; then + # Custom runners may consume root Python modules or tests/. + # Only the default smoke runner has this narrower input surface. + if [ "$EVENT_NAME" = "pull_request" ] \ + && [ "$RUNNER" = ".github/scripts/run_smoke.py" ]; then no_smoke_relevant_changes=true while IFS= read -r f; do case "$f" in diff --git a/docs/internals.md b/docs/internals.md index ff858fa5..0be7dfe7 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -215,3 +215,24 @@ hand-maintained registry. Missing catalogues do not affect readiness. Rendering collects no new evidence, and opening a disclosure triggers no execution. Resource CI is displayed only when available run URLs match the catalogue canonical GitHub repository. A reused local key, absent run provenance or foreign workflow URL cannot establish resource health; those rows show unavailable. + +## Reusable smoke workflow: custom runners and skipped checks + +The smoke-only PR path filter applies only to the default +`.github/scripts/run_smoke.py`. A non-default `runner` bypasses that filter: +pytest may depend on root Python modules, `tests/`, or packaging configuration. +The separate docs-only allowlist still applies. Unknown or unavailable diffs +continue to run the matrix. Existing callers need no new input. + +Caller audit (2026-10-16): the pipeline's `tests.yml` supplies +`.github/scripts/run_tests.py` to both unit and slow jobs; both inherit the fix. +`autolens_workspace_test` and `autogalaxy_workspace_test` supply +`.github/scripts/retime.py` in their dispatch-only `retime.yml`; dispatch was +already outside the PR filter. Default workspace smoke callers retain their +existing filter. These are the custom-runner callers found in the organisation +code search; live adoption is checked separately from this source audit. + +A skipped required job on a PR is **not green test evidence**, even if GitHub +allows merging. Review the job conclusion and why it skipped. Heart's main-head +CI rollup likewise requires explicit success; a synthetic classifier regression +is not a substitute for observing the pipeline's unit/slow jobs on a live PR. diff --git a/tests/test_smoke_tests_wiring.py b/tests/test_smoke_tests_wiring.py index c317dece..70ef6550 100644 --- a/tests/test_smoke_tests_wiring.py +++ b/tests/test_smoke_tests_wiring.py @@ -491,7 +491,7 @@ def _classify_step(): def _classify(tmp_path, files, *, event_name="pull_request", base=A_BASE, - fetch_ok=True): + fetch_ok=True, runner=".github/scripts/run_smoke.py"): """Run the real `Classify the diff` body over a synthetic file list. Returns ``(flags, step_summary)`` — the `$GITHUB_OUTPUT` pairs the step @@ -512,6 +512,7 @@ def _classify(tmp_path, files, *, event_name="pull_request", base=A_BASE, PATH=f"{bindir}{os.pathsep}{env['PATH']}", BASE=base, EVENT_NAME=event_name, + RUNNER=runner, GITHUB_OUTPUT=str(out), GITHUB_STEP_SUMMARY=str(summary), FAKE_GIT_FILES="\n".join(files), @@ -666,3 +667,19 @@ def test_a_relevance_skip_shows_the_reader_what_it_classified(tmp_path): for pattern in ("scripts/", "config/", ".github/", "smoke_tests.txt", "smoke_notebooks.txt"): assert pattern in summary, pattern + + +@pytest.mark.parametrize("runner", [".github/scripts/run_tests.py", ".github/scripts/retime.py", ""]) +@pytest.mark.parametrize("path", ["util.py", "tests/test_util.py", "catalogue/export.py", "pytest.ini", "pyproject.toml"]) +def test_custom_runners_run_for_non_smoke_code(tmp_path, runner, path): + flags, _ = _classify(tmp_path, [path], runner=runner) + assert flags == {"docs_only": "false", "no_smoke_relevant_changes": "false"} + + +def test_custom_runner_keeps_docs_only_skip(tmp_path): + flags, _ = _classify(tmp_path, ["README.md"], runner=".github/scripts/run_tests.py") + assert flags == {"docs_only": "true", "no_smoke_relevant_changes": "false"} + + +def test_runner_input_reaches_classifier(): + assert _classify_step()["env"]["RUNNER"] == "${{ inputs.runner }}"