From 83c8c9deb32d7d42194ae6a9be86a53146432a17 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 23 Aug 2026 16:30:27 +0200 Subject: [PATCH] Stop running the Python suite twice per push in CI Per-step timings showed the real cost was not the install I had just cached: Pre-commit checks Run pre-commit hooks 152s Install dependencies 55s The log explains it -- "pytest with coverage enforcement....Passed" inside the Pre-commit checks job. `pre-commit run --all-files` fires the pytest-coverage hook, which runs every python_pkg suite with --cov-fail-under=100: precisely what the Python tests workflow had already done on the same commit. Two full 2174-test runs per push. SKIP=pytest-coverage in that job only. It is the one hook skipped, and it is skipped for being DUPLICATED rather than for being slow -- noted in the workflow so it gets dropped if Python tests ever goes away. Also checked and deliberately left alone: session-autopsy-hook-mutations costs ~50s locally, but self-skips when ~/.claude/hooks is absent, which is always true on a runner. It was never a CI cost. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp --- .github/workflows/pre-commit.yml | 7 +++- ...ted-pytest-in-precommit-ci-2026-08-23.json | 41 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 docs/superpowers/evidence/skip-duplicated-pytest-in-precommit-ci-2026-08-23.json diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ffaa57b1..9561a87e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -115,4 +115,9 @@ jobs: pip install pre-commit - name: Run pre-commit hooks - run: pre-commit run --all-files --show-diff-on-failure + # SKIP=pytest-coverage: the Python tests workflow already runs the + # whole suite with the same 100% coverage gate, so running it again + # here doubled the cost of this job for no extra signal. It is the + # only hook skipped, and it is skipped because it is DUPLICATED, not + # because it is slow -- if that workflow is ever removed, drop this. + run: SKIP=pytest-coverage pre-commit run --all-files --show-diff-on-failure diff --git a/docs/superpowers/evidence/skip-duplicated-pytest-in-precommit-ci-2026-08-23.json b/docs/superpowers/evidence/skip-duplicated-pytest-in-precommit-ci-2026-08-23.json new file mode 100644 index 00000000..0c4fc82e --- /dev/null +++ b/docs/superpowers/evidence/skip-duplicated-pytest-in-precommit-ci-2026-08-23.json @@ -0,0 +1,41 @@ +{ + "intent": "Stop the Pre-commit checks workflow running the entire Python test suite a second time, when the Python tests workflow already runs it with the same coverage gate.", + "scope": [ + ".github/workflows/pre-commit.yml", + "Non-goal: skipping any hook that is not duplicated elsewhere" + ], + "changes": [ + "Run the hooks with SKIP=pytest-coverage. That hook invokes pytest_changed_packages.py, which runs every python_pkg suite with --cov-fail-under=100 -- exactly what the Python tests workflow does.", + "Recorded in the workflow that this is skipped because it is DUPLICATED, not because it is slow, and that the skip must be dropped if the Python tests workflow ever goes away." + ], + "verification": [ + { + "command": "gh api .../runs/32645337532/jobs -- per-step timings for Pre-commit checks", + "result": "pass", + "evidence": "Run pre-commit hooks = 152s, the dominant step, against Install dependencies at 55s" + }, + { + "command": "gh run view 32645337532 --log | grep for the heavy hooks", + "result": "pass", + "evidence": "'pytest with coverage enforcement....Passed' confirms the suite really was running inside this job as well as in Python tests" + }, + { + "command": "Checked whether session-autopsy-hook-mutations (50s locally) also inflates CI", + "result": "pass", + "evidence": "It self-skips when ~/.claude/hooks is absent, which is the case on a runner, so it was not a CI cost and is left alone" + }, + { + "command": "python3 -c \"import yaml; yaml.safe_load(...)\"", + "result": "pass", + "evidence": "workflow parses as valid YAML" + } + ], + "risks": [ + "If the Python tests workflow is deleted or its path filters stop matching, the suite would no longer run in CI at all. The comment in the workflow names this dependency explicitly.", + "A path-filter gap could mean a change runs Pre-commit checks but not Python tests. Both filters were widened earlier today to cover meta/requirements*.txt for exactly this reason." + ], + "rollback": [ + "Remove the SKIP=pytest-coverage prefix from the Run pre-commit hooks step.", + "After rollback, expect that step to return to roughly 150s." + ] +}