WIP: feat(tests): run_all.py --changed runs the checks that read what changed #32

Draft
dyst wants to merge 1 commit from dyst/Longshot:feat/run-all-changed into main
First-time contributor

Why

A full tests/run_all.py is about 490 checks and several minutes, and the ones an edit touches had to be picked by hand, which is how a check that cuts a function far from the edit gets missed (AGENTS.md: "Tests read the source").

What changed

  • tests: tests/run_all.py --changed [BASE]: changed_files takes the files changed since BASE's merge base with HEAD (origin/main by default), committed or not, plus the untracked ones, from git. reads_changed picks:
    • the checks whose text names one of them: by path, by file name standing alone, or as a module they import (import chunks, from chunks import);
    • the changed checks themselves (and the byte-compile check, as before);
    • every check when the runner itself or a shared .py under tests/ that is not a test changed.
  • tests: with --changed, the C++ unit tests run only when something under gpu/ changed or every check runs. It prints how many files changed and how many checks read them, and that a pull request still needs the whole run. --changed can't be combined with names or --write-times. Nothing else in the runner changes.
  • tests: tests/test_run_all_changed.py (new): which checks a changed file picks (by path, by name and not inside a longer name, by import), that a changed check runs itself, that the runner or a shared test file runs everything, that an unnamed file runs none, and the files from git (committed, uncommitted and untracked), with git's answers stood in.

Example, on the GitHub branch (the runner changed): --changed: 2 files changed since origin/main, every check (the runner or a shared test file changed). For a change to nx2/chunks.py alone it picks the chunk, emit and lift-cache checks (under a quarter of all), not the renderer's.

Flags and settings

None: no environment switch, menu row or ini key. The new tests/run_all.py --changed [BASE] option is the test runner's, described above.

Measurements

Nothing to measure in the game: the change is a test-runner option, and no game or renderer code changes. What was run, on the GitHub version (NotRexed/Hookshot#2887), Windows:

  • run_all.py --changed origin/main on that branch: every check, as the runner changed: 423 passed, 21 failed, 79 skipped. The 21 fail the same way on GitHub's main on the same PC (its compilers and Linux-only checks).
  • The checks that read the changed files (10): pass, apart from test_spawn_emit, which fails the same way on main there.

Testing

Tested: the runs under Measurements (on the GitHub version) and the game-free checks this description names. Checked but not measured: the runs above.

Not tested: no gaps are named in the GitHub description; every run it records was on Windows.

Needs other testers: None

Screenshots

Nothing on screen.

Risk and rollback

Only --changed picks checks; a run without it is unchanged. A check that reads a file without naming it (by path, name or import) would be left out of a --changed run, which is why it says a pull request still needs the whole run. Reverting the commit is enough.

Reviewer notes

Carried over from NotRexed/Hookshot#2887 with the move to Longshot: the same change on Longshot's main, with its rename applied. Its review and discussion are there.

The checks were done on the GitHub version; this branch is the same change with the rename applied (the same files and line counts). Forgejo runs no checks; they were not run again here. The whole suite ran there (423 passed, 21 failed, 79 skipped), but the 21 failures are not named one by one, so the run_all.py box is left open. The dev-loop proposal's D1 (NotRexed/Hookshot#2636).

Issues

None on Longshot. See NotRexed/Hookshot#2636 (D1).

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Flags table filled in; README / docs/development.md switch reference updated.
  • Screenshots for a change that shows on screen.
  • A row in docs/tested-configurations.md for each measured run.
  • MKWVK_API_VERSION bumped (gpu/vk/vk_api.h's MkwVkHost or MkwVkRenderer changed).
  • The SPIR-V headers regenerated with glslang (a shader changed).
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.

🤖 Generated with Claude Code

## Why A full `tests/run_all.py` is about 490 checks and several minutes, and the ones an edit touches had to be picked by hand, which is how a check that cuts a function far from the edit gets missed (AGENTS.md: "Tests read the source"). ## What changed - tests: `tests/run_all.py --changed [BASE]`: `changed_files` takes the files changed since BASE's merge base with HEAD (`origin/main` by default), committed or not, plus the untracked ones, from git. `reads_changed` picks: - the checks whose text names one of them: by path, by file name standing alone, or as a module they import (`import chunks`, `from chunks import`); - the changed checks themselves (and the byte-compile check, as before); - every check when the runner itself or a shared `.py` under `tests/` that is not a test changed. - tests: with `--changed`, the C++ unit tests run only when something under `gpu/` changed or every check runs. It prints how many files changed and how many checks read them, and that a pull request still needs the whole run. `--changed` can't be combined with names or `--write-times`. Nothing else in the runner changes. - tests: `tests/test_run_all_changed.py` (new): which checks a changed file picks (by path, by name and not inside a longer name, by import), that a changed check runs itself, that the runner or a shared test file runs everything, that an unnamed file runs none, and the files from git (committed, uncommitted and untracked), with git's answers stood in. Example, on the GitHub branch (the runner changed): `--changed: 2 files changed since origin/main, every check (the runner or a shared test file changed)`. For a change to `nx2/chunks.py` alone it picks the chunk, emit and lift-cache checks (under a quarter of all), not the renderer's. ## Flags and settings None: no environment switch, menu row or ini key. The new `tests/run_all.py --changed [BASE]` option is the test runner's, described above. ## Measurements Nothing to measure in the game: the change is a test-runner option, and no game or renderer code changes. What was run, on the GitHub version (NotRexed/Hookshot#2887), Windows: - `run_all.py --changed origin/main` on that branch: every check, as the runner changed: 423 passed, 21 failed, 79 skipped. The 21 fail the same way on GitHub's `main` on the same PC (its compilers and Linux-only checks). - The checks that read the changed files (10): pass, apart from `test_spawn_emit`, which fails the same way on `main` there. ## Testing **Tested:** the runs under Measurements (on the GitHub version) and the game-free checks this description names. Checked but not measured: the runs above. **Not tested:** no gaps are named in the GitHub description; every run it records was on Windows. **Needs other testers:** None ## Screenshots Nothing on screen. ## Risk and rollback Only `--changed` picks checks; a run without it is unchanged. A check that reads a file without naming it (by path, name or import) would be left out of a `--changed` run, which is why it says a pull request still needs the whole run. Reverting the commit is enough. ## Reviewer notes Carried over from [NotRexed/Hookshot#2887](https://github.com/NotRexed/Hookshot/pull/2887) with the move to Longshot: the same change on Longshot's `main`, with its rename applied. Its review and discussion are there. The checks were done on the GitHub version; this branch is the same change with the rename applied (the same files and line counts). Forgejo runs no checks; they were not run again here. The whole suite ran there (423 passed, 21 failed, 79 skipped), but the 21 failures are not named one by one, so the run_all.py box is left open. The dev-loop proposal's D1 ([NotRexed/Hookshot#2636](https://github.com/NotRexed/Hookshot/pull/2636)). ## Issues None on Longshot. See [NotRexed/Hookshot#2636](https://github.com/NotRexed/Hookshot/pull/2636) (D1). ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [ ] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [ ] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [ ] Flags table filled in; README / docs/development.md switch reference updated. - [ ] Screenshots for a change that shows on screen. - [ ] A row in `docs/tested-configurations.md` for each measured run. - [ ] `MKWVK_API_VERSION` bumped (`gpu/vk/vk_api.h`'s `MkwVkHost` or `MkwVkRenderer` changed). - [ ] The SPIR-V headers regenerated with glslang (a shader changed). - [x] A game-free test added for the fix, failing on `main` and passing here. - [ ] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. - [ ] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A full run is ~490 checks, and the ones an edit touches had to be picked by hand. --changed [BASE] takes the files
changed since BASE's merge base (origin/main by default), committed or not, and the untracked ones, and runs the checks
whose text names one of them, by path, by name or as an imported module, the changed tests themselves, and the
byte-compile check; the C++ unit tests when gpu/ changed, and every check when the runner or a shared test file did. It
says that a pull request still needs the whole run. This is the dev-loop proposal's D1 (#2636).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
dyst changed title from feat(tests): run_all.py --changed runs the checks that read what changed to WIP: feat(tests): run_all.py --changed runs the checks that read what changed 2026-11-13 01:13:55 +00:00
Author
First-time contributor

Back to WIP under #48's process: this was carried over before the new template. Its description will be brought to the template and measured on Longshot (main against this PR, at named commits) when it's wanted for review; ask here if you'd like it sooner.

Back to WIP under #48's process: this was carried over before the new template. Its description will be brought to the template and measured on Longshot (main against this PR, at named commits) when it's wanted for review; ask here if you'd like it sooner.
Author
First-time contributor

Description brought to Longshot's PR template (#48). Still WIP: its numbers are from the GitHub version, and it isn't rebased on current main; it gets measured on Longshot (main against this PR, at named commits) before it is marked ready.

Description brought to Longshot's PR template (#48). Still WIP: its numbers are from the GitHub version, and it isn't rebased on current main; it gets measured on Longshot (main against this PR, at named commits) before it is marked ready.
Author
First-time contributor

Description moved to the template's Testing section and whole checklist (#72): what was tested, what wasn't, and what needs other testers (their test requests to open while this is WIP).

Description moved to the template's Testing section and whole checklist (#72): what was tested, what wasn't, and what needs other testers (their test requests to open while this is WIP).
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/run-all-changed:dyst-feat/run-all-changed'
git switch 'dyst-feat/run-all-changed'
Sign in to join this conversation.
No description provided.