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

Closed
opened 2026-11-26 21:19:14 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1857
Author: @thiefyzheng
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: fix/build-stages-exception-diag


📝 Commits (1)

  • 93a0f21 BUILD-STAGES: report a stage that raises instead of failing silently

📊 Changes

2 files changed (+68 additions, -3 deletions)

View changed files

📝 make_game.py (+21 -3)
📝 tests/test_leonida_tui.py (+47 -0)

📄 Description

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).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1857 **Author:** [@thiefyzheng](https://github.com/thiefyzheng) **Created:** 11/25/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `fix/build-stages-exception-diag` --- ### 📝 Commits (1) - [`93a0f21`](https://github.com/ubiquitarianism/leonida/commit/93a0f21f490dc892616d78ae45e38e9d79f76c26) BUILD-STAGES: report a stage that raises instead of failing silently ### 📊 Changes **2 files changed** (+68 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+21 -3) 📝 `tests/test_leonida_tui.py` (+47 -0) </details> ### 📄 Description ## 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 21:19:14 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1869
No description provided.