make_game: report a stage that raises instead of failing silently (BUILD-STAGES-EXCEPTION-DIAG) #1857
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!1857
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1857/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?
@thiefyzheng on GitHub · 2026-11-25 13:18 UTC · original
thiefyzheng:fix/build-stages-exception-diag→main· +68 −3 · 2 files · 1 commits · merged 2026-11-25 17:28 UTCBUILD-STAGES-EXCEPTION-DIAG
Claimed on #1608 (#1608). Fixes @cheltyi's finding (#1608):
run_build_stages' series loop and both wait/final-future handlers catch everyExceptionassumingfail()already printed, so a stage raising anything else (e.g. aPermissionErrorfrom a permission/disk/copy failure) exits 1 with empty stderr — verified against the finding's synthetic repro in both overlap modes.What
report_unexpected(name, exc)helper insiderun_build_stages: skipsfail()'s ownRuntimeError("stage exited...")sys.exit path, deduplicates per stage, printsERROR: stage '<name>' failed with an unexpected exception: {exc!r}plus a traceback to stderr — once per build, never duplicated between the wait() and drain handlers.wait(), final drain).What was run (CPU-only, no game files)
python3 -m compileall -q make_game.py— OK.python3 tests/test_leonida_tui.py— 27 tests OK (includes the newUnexpectedStageExceptionTestcovering both overlap modes: exit 1, stderr names the stage + exception, exactly one report).python3 -m unittest discover -s tests -p "test_make_game_*.py"— 443 OK, 4 skipped;"test_*stage*"— 166 OK, 1 skipped.make_game.pymakes both new tests fail ('shaders' not found in ''); restored, they pass.Attribution
AI-assisted (GLM 5.3 Flash worker implementation, contributor verification and orchestration).
@madvillain91 on GitHub · 2026-11-25 13:27 UTC · original · reviewed
Independent Windows 11 26H2 (26300.9711) check at
93a0f21f4against main384abe5b0, using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. Passed test_leonida_tui.py (27/27 in 0.388s, including both overlap=False and overlap=True unexpected-exception diagnostic tests) and test_text_write_line_endings.py (3/3 in 19.945s), with check_no_game_data.py and compileall clean. Confirmed report_unexpected() skips fail()-wrapped RuntimeErrors, deduplicates across wait() and the final futures drain, and surfaces the failing stage name and traceback on stderr. LGTM.@GeorgiyDemo on GitHub · 2026-11-25 14:21 UTC · original
Tested
93a0f21f4on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain71a769d7d(build tool; no GPU):tests/test_leonida_tui.py: 27 passed (2 warnings) at this head.main: 2 failed, 25 passed — the stage-raises diagnostic cases are new.make_gamebuild; the tests inject the failing stage.AI-assisted; synthetic fixtures only, no game data.
@thiefyzheng on GitHub · 2026-11-25 14:23 UTC · original
@GeorgiyDemo — thank you. Recorded for the merge decision:
test_leonida_tui.pyis 27/27 at93a0f21f4on the native runner, and the same file onmainfails exactly the two new stage-raises cases (the guard is real — an external demonstration that the fix, not the test, carries the behavior). Not-run noted: no fullmake_gamebuild with a genuinely failing stage; that path matches the finding's synthetic repro (PermissionErrorfrom a patched stage) which the new tests inject the same way. AI-assisted (orchestrator).@aslan2142 on GitHub · 2026-11-25 17:28 UTC · original
Merged. Thank you, @thiefyzheng. A stage that raises now reports its name and the exception on stderr instead of failing silently.
mainand pass here; the docs, line-ending and CI/ctest registration checks pass, and so does the game-data check.mainfe1553456+93a0f21f4: the semantic suite passes (490 files, 6,292 tests, 0 files failed);test_leonida_tuipass; the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.AI-assisted (Claude Code, Claude Opus 5.5).