From f4535b6bfb8898d14ec70c2e38a8fc255c75f6ee Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 23 Aug 2026 16:37:39 +0200 Subject: [PATCH] Allow Pre-commit checks to be run manually The run that added the hook-environment cache could not benefit from it: its key is a hash of .pre-commit-config.yaml, which that same commit changed, so it logged "Cache not found" and then saved. Six hook environments were still built from scratch -- including pylint's, which pulls a dozen extra packages -- and that is most of the 126s hook step. Without a dispatch there is no way to re-run the job on an unchanged tree to see the cached number, so the saving could only be asserted, not measured. Now it can be measured. Confirmed in the same log that the previous commit landed: "pytest with coverage enforcement....Skipped". Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp --- .github/workflows/pre-commit.yml | 4 ++ ...recommit-workflow-dispatch-2026-08-23.json | 37 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docs/superpowers/evidence/precommit-workflow-dispatch-2026-08-23.json diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 9561a87e..251242a6 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -5,6 +5,10 @@ on: branches: [main] pull_request: branches: [main] + # Manual runs: this job's cost is dominated by whether the pre-commit hook + # environments are cached, and without a dispatch there is no way to + # re-run it on an unchanged tree to confirm a cache actually helps. + workflow_dispatch: {} jobs: pre-commit: diff --git a/docs/superpowers/evidence/precommit-workflow-dispatch-2026-08-23.json b/docs/superpowers/evidence/precommit-workflow-dispatch-2026-08-23.json new file mode 100644 index 00000000..b73813f6 --- /dev/null +++ b/docs/superpowers/evidence/precommit-workflow-dispatch-2026-08-23.json @@ -0,0 +1,37 @@ +{ + "intent": "Allow the Pre-commit checks workflow to be re-run manually, so a caching change can be verified on an unchanged tree instead of being asserted.", + "scope": [ + ".github/workflows/pre-commit.yml (triggers only)", + "Non-goal: changing what the job runs" + ], + "changes": ["Added workflow_dispatch to the Pre-commit checks triggers."], + "verification": [ + { + "command": "gh run view 32645759168 --log | grep for cache keys", + "result": "pass", + "evidence": "'Cache not found for input keys: pre-commit-Linux-py3.12-...' then 'Cache saved with key: ...' -- the env cache missed because that commit changed .pre-commit-config.yaml, which is the key. It is populated now." + }, + { + "command": "gh run view 32645759168 --log | grep -c 'Installing environment'", + "result": "pass", + "evidence": "6 hook environments built from scratch, including pylint's with a dozen extra packages -- the bulk of the 126s hook step" + }, + { + "command": "gh run view 32645759168 --log | grep 'pytest with coverage enforcement'", + "result": "pass", + "evidence": "'....Skipped' -- the duplicate-suite skip from the previous commit took effect" + }, + { + "command": "python3 -c \"import yaml; yaml.safe_load(...)\"", + "result": "pass", + "evidence": "workflow parses as valid YAML" + } + ], + "risks": [ + "A dispatch trigger lets anyone with write access run the job on demand; it runs the same read-only checks as a push, so there is no additional privilege." + ], + "rollback": [ + "Remove the workflow_dispatch line.", + "After rollback, confirm the workflow no longer offers a Run workflow button." + ] +}