[PR #1378] make_game: a run without the LEONIDA board still writes <work>/logs/<stage>.log (MAKE-GAME-PLAIN-LOG) #1408

Open
opened 2026-11-26 20:21:09 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1378
Author: @Diegobecker07
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: make-game-plain-log


📝 Commits (1)

  • 16f3831 make_game: a run without the LEONIDA board still writes /logs/.log (MAKE-GAME-PLAIN-LOG)

📊 Changes

3 files changed (+287 additions, -8 deletions)

View changed files

📝 README.md (+2 -2)
📝 make_game.py (+120 -6)
➕ tests/test_make_game_plain_logs.py (+165 -0)

📄 Description

Claimed in the coordination issue as: MAKE-GAME-PLAIN-LOG (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146425751)

What and why

Only the LEONIDA board wrote the stage logs (make_game.py, the LeonidaBoard(build_stages, log_dir) branch of main()), so a build with --no-tui, or with stdout redirected, left nothing in <work>/logs to read afterwards. With a multi-hour build that is the run you most want a log of.

PlainStageLogs (in make_game.py) is active while the build stages run without the board:

  • log() and fail() lines go to the console as before, and to the running stage's <work>/logs/<stage>.log, the files the board writes (opened in append mode, as there).
  • A command run() starts for a build stage has its stdout and stderr through one pipe. Every byte goes on to the console as it arrives (read1, so a \r progress line still redraws in place), and every \r- or \n-ended piece to the stage's log, with the same split as leonida_tui.pump_process.
  • The child keeps the console (no CREATE_NO_WINDOW), so Ctrl+C reaches it as before. On Ctrl+C it gets 0.25 s to stop and is then killed, as subprocess.run does.
  • A caller that sets its own pipes, and a command outside a build stage (check, preflight), keep subprocess.run unchanged.
  • A stage's file is opened with its first line. An unwritable folder gives one note on stderr, and the build goes on without the logs (tests/test_make_game_paths.py builds into a work folder on a volume that does not exist).

tools/leonida_tui.py is not touched: the class reuses its StageConsole, so this does not overlap #1305.

What changes on the console in plain mode: a child now writes to a pipe instead of the console, as it already does under the board. Ninja, for example, prints its status one line per step instead of redrawing one line. A tool that writes straight to the console handle (WriteConsole) still shows there but is not in the log.

The module docstring, the --no-tui help and the README say where the logs are in both modes.

Tested

  • tests/test_make_game_plain_logs.py (new, 9 tests, real child processes, 4 runs): log()/fail() lines per stage, bytes mirrored unchanged (a \r progress line, a \r\n, stderr after stdout, an unended last piece) and the pieces logged, a failing command's exit code and its ERROR: line, caller pipes and unlogged stages kept on subprocess.run, cwd/env reaching the child, Ctrl+C stopping the child, an unwritable log folder, append across two runs, nothing written without a build stage.
  • All 24 tests/test_make_game_*.py, tests/test_leonida_tui.py, tests/test_text_write_line_endings.py: OK. test_make_game_paths.py caught the first version, which created the folder up front.
  • python -m compileall -q make_game.py tools tests, python -I make_game.py --help, scripts/check_no_game_data.py on the changed files: OK.
  • End to end on Windows: make_game.py --stages runtime --runtime-build <a built runtime> --no-tui into a scratch --out/--work: exit 0, the console unchanged, and work/logs/runtime.log holds the stage's lines.

GPUs tested: n/a (no GPU code)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🔄 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/1378 **Author:** [@Diegobecker07](https://github.com/Diegobecker07) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `make-game-plain-log` --- ### 📝 Commits (1) - [`16f3831`](https://github.com/ubiquitarianism/leonida/commit/16f3831a5f7e68e1cb4f808cf991bfa614b4899c) make_game: a run without the LEONIDA board still writes <work>/logs/<stage>.log (MAKE-GAME-PLAIN-LOG) ### 📊 Changes **3 files changed** (+287 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+2 -2) 📝 `make_game.py` (+120 -6) ➕ `tests/test_make_game_plain_logs.py` (+165 -0) </details> ### 📄 Description Claimed in the coordination issue as: MAKE-GAME-PLAIN-LOG (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146425751) ### What and why Only the LEONIDA board wrote the stage logs (`make_game.py`, the `LeonidaBoard(build_stages, log_dir)` branch of `main()`), so a build with `--no-tui`, or with stdout redirected, left nothing in `<work>/logs` to read afterwards. With a multi-hour build that is the run you most want a log of. `PlainStageLogs` (in `make_game.py`) is active while the build stages run without the board: - `log()` and `fail()` lines go to the console as before, and to the running stage's `<work>/logs/<stage>.log`, the files the board writes (opened in append mode, as there). - A command `run()` starts for a build stage has its stdout and stderr through one pipe. Every byte goes on to the console as it arrives (`read1`, so a `\r` progress line still redraws in place), and every `\r`- or `\n`-ended piece to the stage's log, with the same split as `leonida_tui.pump_process`. - The child keeps the console (no `CREATE_NO_WINDOW`), so Ctrl+C reaches it as before. On Ctrl+C it gets 0.25 s to stop and is then killed, as `subprocess.run` does. - A caller that sets its own pipes, and a command outside a build stage (`check`, preflight), keep `subprocess.run` unchanged. - A stage's file is opened with its first line. An unwritable folder gives one note on stderr, and the build goes on without the logs (`tests/test_make_game_paths.py` builds into a work folder on a volume that does not exist). `tools/leonida_tui.py` is not touched: the class reuses its `StageConsole`, so this does not overlap #1305. What changes on the console in plain mode: a child now writes to a pipe instead of the console, as it already does under the board. Ninja, for example, prints its status one line per step instead of redrawing one line. A tool that writes straight to the console handle (`WriteConsole`) still shows there but is not in the log. The module docstring, the `--no-tui` help and the README say where the logs are in both modes. ### Tested - `tests/test_make_game_plain_logs.py` (new, 9 tests, real child processes, 4 runs): `log()`/`fail()` lines per stage, bytes mirrored unchanged (a `\r` progress line, a `\r\n`, stderr after stdout, an unended last piece) and the pieces logged, a failing command's exit code and its `ERROR:` line, caller pipes and unlogged stages kept on `subprocess.run`, `cwd`/`env` reaching the child, Ctrl+C stopping the child, an unwritable log folder, append across two runs, nothing written without a build stage. - All 24 `tests/test_make_game_*.py`, `tests/test_leonida_tui.py`, `tests/test_text_write_line_endings.py`: OK. `test_make_game_paths.py` caught the first version, which created the folder up front. - `python -m compileall -q make_game.py tools tests`, `python -I make_game.py --help`, `scripts/check_no_game_data.py` on the changed files: OK. - End to end on Windows: `make_game.py --stages runtime --runtime-build <a built runtime> --no-tui` into a scratch `--out`/`--work`: exit 0, the console unchanged, and `work/logs/runtime.log` holds the stage's lines. GPUs tested: n/a (no GPU code) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1408
No description provided.