make_game: report a stage that raises instead of failing silently (BUILD-STAGES-EXCEPTION-DIAG) #1857

Merged
thiefyzheng merged 1 commit from upstream-pr/1857 into main 2026-11-25 17:28:07 +00:00
thiefyzheng commented 2026-11-25 13:18:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T13:18:51Z.


BUILD-STAGES-EXCEPTION-DIAG

Claimed on #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163485212). Fixes @cheltyi's finding (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163281819): run_build_stages' series loop and both wait/final-future handlers catch every Exception assuming fail() already printed, so a stage raising anything else (e.g. a PermissionError from a permission/disk/copy failure) exits 1 with empty stderr — verified against the finding's synthetic repro in both overlap modes.

What

  • A report_unexpected(name, exc) helper inside run_build_stages: skips fail()'s own RuntimeError("stage exited...") sys.exit path, deduplicates per stage, prints ERROR: 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.
  • Wired into all three catch sites (series loop, 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 new UnexpectedStageExceptionTest covering 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.
  • Guard check: reverting only make_game.py makes both new tests fail ('shaders' not found in ''); restored, they pass.

Attribution

AI-assisted (GLM 5.3 Flash worker implementation, contributor verification and orchestration).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5492104304 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1857). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T13:18:51Z. --- ## BUILD-STAGES-EXCEPTION-DIAG Claimed on #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163485212). Fixes @cheltyi's finding (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163281819): `run_build_stages`' series loop and both wait/final-future handlers catch every `Exception` assuming `fail()` already printed, so a stage raising anything else (e.g. a `PermissionError` from a permission/disk/copy failure) exits 1 with **empty stderr** — verified against the finding's synthetic repro in both overlap modes. ### What - A `report_unexpected(name, exc)` helper inside `run_build_stages`: skips `fail()`'s own `RuntimeError("stage exited...")` sys.exit path, deduplicates per stage, prints `ERROR: 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. - Wired into all three catch sites (series loop, `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 new `UnexpectedStageExceptionTest` covering 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**. - Guard check: reverting only `make_game.py` makes 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 commented 2026-11-25 13:27:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-25T13:27:12Z.

Review: COMMENTED


Independent Windows 11 26H2 (26300.9711) check at 93a0f21f4 against main 384abe5b0, 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6058462251 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1857#pullrequestreview-6058462251). Originally posted by [madvillain91](https://github.com/madvillain91) on 2026-11-25T13:27:12Z. **Review:** COMMENTED --- Independent Windows 11 26H2 (26300.9711) check at 93a0f21f4 against main 384abe5b0, 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 commented 2026-11-25 14:21:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T14:21:37Z.


Tested 93a0f21f4 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 71a769d7d (build tool; no GPU):

  • pytest 9.2.0 on tests/test_leonida_tui.py: 27 passed (2 warnings) at this head.
  • The same file on main: 2 failed, 25 passed — the stage-raises diagnostic cases are new.
  • Not run: a real stage raising inside a full make_game build; the tests inject the failing stage.

AI-assisted; synthetic fixtures only, no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165156322 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1857#issuecomment-7165156322). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T14:21:37Z. --- Tested `93a0f21f4` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `71a769d7d` (build tool; no GPU): - pytest 9.2.0 on `tests/test_leonida_tui.py`: **27 passed** (2 warnings) at this head. - The same file on `main`: **2 failed**, 25 passed — the stage-raises diagnostic cases are new. - Not run: a real stage raising inside a full `make_game` build; the tests inject the failing stage. AI-assisted; synthetic fixtures only, no game data.
thiefyzheng commented 2026-11-25 14:23:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T14:23:48Z.


@GeorgiyDemo — thank you. Recorded for the merge decision: test_leonida_tui.py is 27/27 at 93a0f21f4 on the native runner, and the same file on main fails 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 full make_game build with a genuinely failing stage; that path matches the finding's synthetic repro (PermissionError from a patched stage) which the new tests inject the same way. AI-assisted (orchestrator).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165213202 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1857#issuecomment-7165213202). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T14:23:48Z. --- @GeorgiyDemo — thank you. Recorded for the merge decision: `test_leonida_tui.py` is 27/27 at `93a0f21f4` on the native runner, and the same file on `main` fails 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 full `make_game` build with a genuinely failing stage; that path matches the finding's synthetic repro (`PermissionError` from a patched stage) which the new tests inject the same way. AI-assisted (orchestrator).
aslan2142 commented 2026-11-25 17:28:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T17:28:09Z.


Merged. Thank you, @thiefyzheng. A stage that raises now reports its name and the exception on stderr instead of failing silently.

  • The new tests fail on main and pass here; the docs, line-ending and CI/ctest registration checks pass, and so does the game-data check.
  • Checked on main fe1553456 + 93a0f21f4: the semantic suite passes (490 files, 6,292 tests, 0 files failed); test_leonida_tui pass; the 14 docs and writer tests pass; check_no_game_data.py is clean on the 2 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169547320 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1857#issuecomment-7169547320). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T17:28:09Z. --- Merged. Thank you, @thiefyzheng. A stage that raises now reports its name and the exception on stderr instead of failing silently. - The new tests fail on `main` and pass here; the docs, line-ending and CI/ctest registration checks pass, and so does the game-data check. - **Checked on `main` `fe1553456` + `93a0f21f4`:** the semantic suite passes (490 files, 6,292 tests, 0 files failed); `test_leonida_tui` pass; the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 2 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1857
No description provided.