check_no_game_data: exit 2 when git cannot list the files (CHECK-NO-GAME-DATA-GIT-ERROR) #922
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!922
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/922/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@TuroYT on GitHub · 2026-11-24 15:12 UTC · original
TuroYT:fix/check-no-game-data-git-error→main· +49 −4 · 2 files · 2 commits · merged 2026-11-24 20:04 UTCClaimed in the coordination issue as: CHECK-NO-GAME-DATA-GIT-ERROR (#14)
What was wrong
tracked_filesinscripts/check_no_game_data.py(line 256, called frommain) runsgit ls-files -zwithcheck=Trueand no handler. Two cases end in a traceback and exit status 1:CalledProcessError ... status 128.FileNotFoundError: [Errno 2] No such file or directory: 'git'.The docstring says exit 1 means game data was found, so a caller cannot tell the two apart. Only the unreadable-file path returns 2.
Reproduced on the branch before the change:
What changed
maincatchesOSErrorandCalledProcessErroraround the default-mode git call and returns 2.check_no_game_data: cannot list the tracked files with git: <reason>. The reason is the first non-empty line git printed, or the OS error text.tests/test_check_no_game_data.py: two tests. One empties PATH and runs in a plain folder. The other setsGIT_CEILING_DIRECTORIESandLC_ALL=Cand runs in a folder outside any repository. Both expect exit 2, no stdout, one stderr line, and no traceback.Tested
python3 -I tests/test_check_no_game_data.py: Ran 11 tests, OK (on the fixed code).FAILED (failures=2)), so they catch the defect.python3 -I scripts/check_no_game_data.py > out.txton the origin/main copy and on the fixed script gives identical bytes, exit 0 for both.env PATH=/nonexistent /usr/bin/python3 -I scripts/check_no_game_data.pywith a file argument: exit 0 (no git call is made).env PATH=/nonexistent /usr/bin/python3 -I scripts/check_no_game_data.py: one line, exit 2.python3 -m compileall -q scripts tests: OK.python3 -I tests/test_text_write_line_endings.py: OK, 3 tests.python3 -I tests/test_no_game_data_workflow.py: OK, 3 tests.python3 -I scripts/check_no_game_data.py scripts/check_no_game_data.py tests/test_check_no_game_data.py: exit 0.python3 -I scripts/check_no_game_data.pyover the whole tracked tree: exit 0.git diff --check: clean.Not tested: a real git failure with a multi-line message (for example,
detected dubious ownership), a non-UTF-8 git message beyond a quick unit check of the helper, Windows, and macOS.Not tested
AI-assisted (Claude Code).
@kawaii-shakal on GitHub · 2026-11-24 16:14 UTC · original
Independent test of #922 (CHECK-NO-GAME-DATA-GIT-ERROR)
Head tested:
074e53069f(merge basea2892784). Environment: Windows 11, native Python 3.13.13, Git for Windows, no GPU. This covers the Windows run that the PR lists as not tested.Commands and results:
python -I -B tests/test_check_no_game_data.py: Ran 11 tests, OK.python -I -B tests/test_no_game_data_workflow.py: OK.scripts/check_no_game_data.pyfrom the merge base: both new tests FAIL (FAILED (failures=2)).excepttosubprocess.CalledProcessErroronly.test_git_missing_is_one_stderr_line_and_exit_2FAILS, so theOSErrorbranch is covered too. Restored afterwards.python -I scripts/check_no_game_data.pyprints one line,check_no_game_data: cannot list the tracked files with git: fatal: not a git repository (or any of the parent directories): .git, and exits 2.git merge-tree --write-tree origin/main <head>(origin/main0af7753c): clean.python -I scripts/check_no_game_data.pyon the changed files: exit 0.git diff --check: clean.Findings:
tracked_filesalready usescapture_output=True(line 257), so git's message lands ine.stderrand is not also printed raw. That is why the output is exactly one line..github/workflows/no-game-data.yml:35, treats any non-zero code as a failure, so exit 2 changes nothing there.not a git repositorytext viaLC_ALL=C, which is fine on Windows and Linux. However, aGIT_DIRorGIT_WORK_TREEalready set in the caller's environment would let git find a repository. Popping those fromenvwould make the test fully hermetic.Verdict: looks good.
AI-assisted.
@TuroYT on GitHub · 2026-11-24 17:05 UTC · original
Thanks for the Windows run and the mutation check.
Pushed
ec0d003e5:test_outside_a_repository_is_one_stderr_line_and_exit_2now builds its environment withoutGIT_DIR,GIT_WORK_TREEandGIT_INDEX_FILE. The test file passes (11 tests) with and withoutGIT_DIRset in the caller's environment.Setting
GIT_DIRalso showed that the tests that create their own repositories (git addin a temporary directory) are not hermetic either: withGIT_DIRexported, they stage files into the repository thatGIT_DIRpoints at. That is older than this PR and I left it alone here.@MoonEyes on GitHub · 2026-11-24 17:39 UTC · original · approved these changes
LGTM. Measured on Windows 11 (French locale), Python 3.14, against main
cf4c00cba:python -I tests/test_check_no_game_data.py: mainRan 9, OK; this PR and a local merge into mainRan 11, OK. With main's script, both new tests fail.GIT_CEILING_DIRECTORIESset), main prints a traceback and exits 1, and this PR prints one line and exits 2. The same holds with git removed from PATH.e.strerror), so it is localized. It is still one line with exit 2, which is all the test checks.AI-assisted: yes (Claude Code ran the checks; I read them).
@QemmHD on GitHub · 2026-11-24 20:04 UTC · original
Merging.
Why merged: CHECK-NO-GAME-DATA-GIT-ERROR: check_no_game_data exits 2 with one stderr line when git can't list the tracked files. Exit 1 still means game data was found, so a broken git can no longer look like a clean scan or a hit. The scan logic itself is unchanged. kawaii-shakal checked it, and MoonEyes approved after the follow-up push, which only clears GIT_DIR in a test.
Why it's good: Own tests: 11 passed. The consistency set with its 2 new tests: 573 passed.
Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main
6293c1c4f. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 571 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes.AI-assisted (Claude Code, Claude Opus 5.5).