Repository navigation
tests: keep fixture commits out of the contributor's global Git hooks - #6058
fishingpvalues wants to merge 1 commit into
Conversation
SirKingg
left a comment
There was a problem hiding this comment.
Independent Windows review, AI-assisted. Requesting changes for the blocking Windows test failure below; no approval.
Windows, Python 3.11.3, Git 2.56.1.windows.1, CPU only, synthetic files only; no GPU or game data. python -I tests\test_llvm_source_version.py -v: 6 passed, 0 skipped. python -I tests\test_make_game_assets_decoder.py -v: 5 passed, 1 error. python -I tests\test_make_game_submodule.py -v: 3 passed, 0 skipped.
Separate synthetic rejecting-hook controls verified the hook actually ran for global configuration, GIT_CONFIG_COUNT, and GIT_CONFIG_PARAMETERS; for each, both affected fixture tests failed at the merge base and passed at this head. The full LLVM suite also passed with a synthetic global hook. The full assets suite still errors on Windows while constructing its new control config, before it can verify isolation. No global Git configuration or user files were modified.
| os.chmod(hook, 0o755) | ||
| config = os.path.join(root, "gitconfig") | ||
| with open(config, "w", newline="\n") as f: | ||
| f.write(f"[core]\n\thooksPath = {hooks}\n") |
There was a problem hiding this comment.
This writes a native Windows path such as C:\Users\... directly into Git config, where the backslashes are parsed as escapes. On Windows python -I tests\test_make_game_assets_decoder.py -v errors at git init with exit 128 (fatal: bad config line 2), so the new test breaks the suite before reaching the control. Please write the value with Git's own config quoting/escaping (or another portable encoding), and run the test on Windows.
|
Verified at your head on main 561b65a: test_make_game_assets_decoder 6/6 under python -I, and the new isolation test has teeth — the control commit was genuinely rejected by the poisoned commit-msg hook on this machine before the fixture subprocess ran, no silent skipTest. The GIT_CONFIG_GLOBAL/NOSYSTEM isolation matches the established pattern in test_make_game_submodule.py, and both new writers pin newline. The test_llvm_source_version.py half is pwsh-gated and skipped 6/6 on this Linux host, so that fix stands unexercised here — the Windows CI should be the confirmation. Flag: no CI checks reported on the branch. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
32ae5e1 to
50df321
Compare
|
Fixed the Windows failure @SirKingg found: the synthetic global config wrote |
test_the_digest_follows_an_uncommitted_submodule_edit committed "-m x" in a temporary Git repository. A contributor whose global config sets core.hooksPath (a Conventional Commits commit-msg hook, e.g. a lint setup) had that hook reject the message, so the file failed on their machine while CI stayed green. Commit e1cc07c fixed the same problem in tests/test_make_game_submodule.py; this applies the same isolation to the two fixtures that still lacked it. The new test poisons the global config with a rejecting commit-msg hook, checks the control commit is rejected, and runs the fixture test in a subprocess under that config. It fails on main and passes with the fix.
50df321 to
1d86ef7
Compare
|
Tested
The previous head CPU only, no game files. AI-assisted (Claude Code). |
|
Head is now |
|
@nullmarsh reports Windows 11 pass at |
Claimed in #5781 (claim).
What changed and why
tests/test_make_game_assets_decoder.py(test_the_digest_follows_an_uncommitted_submodule_edit) commits-m xin a temporary Git repository. A contributor whose global Git config setscore.hooksPathhas that hook run inside the fixture: a Conventional Commitscommit-msghook rejectsx, so the file fails on their machine while CI stays green. Commite1cc07c43("Isolate submodule tests from Git hook settings") fixed the same problem intests/test_make_game_submodule.py; this applies the same isolation to the two fixtures that were added later without it.tests/test_make_game_assets_decoder.py: the fixture'sgit()runs withGIT_CONFIG_GLOBAL=/dev/null,GIT_CONFIG_NOSYSTEM=1and withoutGIT_CONFIG_COUNT/GIT_CONFIG_PARAMETERS, so neither the contributor's global config nor-coverrides from a wrapper reach the temporary repository.tests/test_make_game_assets_decoder.py: a new test,test_the_fixture_commit_ignores_a_global_git_hook, writes a global config whosecore.hooksPathholds a rejectingcommit-msg, confirms with a control commit that the hook really is in effect, and then runs the fixture test in a subprocess under that config. It fails onmain(1 failed, theCalledProcessErrorabove) and passes with the fix, so the isolation cannot regress silently.tests/test_llvm_source_version.py: same latent hazard (commit -qm "synthetic release"); its fixture now uses the same environment. Windows-only, so it is skipped on this machine (compile-checked only).The reproduction on this machine is the bug itself: the hook rejects the fixture, and it also rejected this branch's first commit (
tests:is not in its allow-list), which is why the commit was made with--no-verify.Tests run
macOS 27.2 (26B123), Python 3.12.8, CPU only, no game files, no GPU:
python -I tests/test_make_game_assets_decoder.py— OK, 6 tests (was1 failed / 5 passed)python -I tests/test_make_game_submodule.py— OK, 3 testspython -m pytest tests/test_make_game_assets_decoder.py tests/test_make_game_submodule.py tests/test_llvm_source_version.py -q— 9 passed, 6 skippedpython -m pytest tests --ignore=tests/semantic -q— 1 failed, 7395 passed, 879 skipped in 21m54s (before this change: 2 failed, 7393 passed; the remaining failure isfind_hash_lookup's UTF-8 joaat, which find_hash_lookup: hash --hash names as latin-1, like hashdict (test_joaat_agreement fails on main) #4753/find_hash_lookup: hash the Latin-1 bytes of a name, like the dictionary #4882 already fix)AI-assisted.