make_game: a run without the LEONIDA board still writes <work>/logs/<stage>.log (MAKE-GAME-PLAIN-LOG) #1378
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1378"
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?
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-24T22:56:28Z.
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, theLeonidaBoard(build_stages, log_dir)branch ofmain()), so a build with--no-tui, or with stdout redirected, left nothing in<work>/logsto read afterwards. With a multi-hour build that is the run you most want a log of.PlainStageLogs(inmake_game.py) is active while the build stages run without the board:log()andfail()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).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\rprogress line still redraws in place), and every\r- or\n-ended piece to the stage's log, with the same split asleonida_tui.pump_process.CREATE_NO_WINDOW), so Ctrl+C reaches it as before. On Ctrl+C it gets 0.25 s to stop and is then killed, assubprocess.rundoes.check, preflight), keepsubprocess.rununchanged.tests/test_make_game_paths.pybuilds into a work folder on a volume that does not exist).tools/leonida_tui.pyis not touched: the class reuses itsStageConsole, 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-tuihelp 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\rprogress line, a\r\n, stderr after stdout, an unended last piece) and the pieces logged, a failing command's exit code and itsERROR:line, caller pipes and unlogged stages kept onsubprocess.run,cwd/envreaching the child, Ctrl+C stopping the child, an unwritable log folder, append across two runs, nothing written without a build stage.tests/test_make_game_*.py,tests/test_leonida_tui.py,tests/test_text_write_line_endings.py: OK.test_make_game_paths.pycaught 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.pyon the changed files: OK.make_game.py --stages runtime --runtime-build <a built runtime> --no-tuiinto a scratch--out/--work: exit 0, the console unchanged, andwork/logs/runtime.logholds the stage's lines.GPUs tested: n/a (no GPU code)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-25T13:13:37Z.
Re-checked against current main (
0d80bc5df). Main changedmake_game.pyandREADME.mdin other places and the PR still merges cleanly, so I did not rebase it. On the merged tree, all 25tests/test_make_game_*.pyfiles pass (including this PR'stest_make_game_plain_logs.py), along withtest_text_write_line_endings.py,compileallandmake_game.py --help.The three open PRs that touch
make_game.py(#1013, #1378, #1407) also merge with each other without conflicts. The same tests pass with all three merged on main (27 files).CI is waiting for workflow approval (first-time contributor).
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T15:13:01Z.
Reviewed
16f3831a5: rantests/test_make_game_plain_logs.pyon the PR (9/9 OK) and on main with the test copied in (9 errors,PlainStageLogsabsent, so the test covers the new code); also ran dry_run/interrupt/argparse/resume/progress/preflight/bvh_shaders_stage/translate_cleanup (all OK) and comparedtest_make_game_platformagainst main (same pre-existing environment failures on both, no regression). A separate probe verified chunk-boundary splitting (\r,\r\n, UTF-8 split across chunks, unterminated tail), 60 000-line volume, two concurrent stages with children, and the failing-child path: no discrepancies. None of the tests that need a GPU, Windows, MSVC or game files were run. Two non-blocking notes:input=/timeout=kwargs would now raiseTypeErroron the plain pump (same as the board path; no caller uses them today), and on Windows the plain pump deliberately leaves the child its console handle, so cmake/ninja/MSBuildWriteConsoleoutput may reach the screen but not the stage log; worth a Windows check before relying on the logs there.AI-assisted review.
Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-25T16:28:44Z.
Thanks for the review. I checked the Windows console-handle note on this PR's head (
16f3831a5) in a real console: cmd in Windows Terminal runningpython -I make_game.py --game <pkg> --out <scratch> --work <scratch> --stages runtime --jobs 12 --no-tui. make_game's stdout was the console, so the children inherited it (Windows 11 Pro 26300, MSVC 19.44, CMake 3.31 + Ninja from VS Build Tools).work/logs/runtime.loghas 911 lines:The CXX compiler identificationtoBuild files have been written;[1/757]through[757/757], includingvk_pipeline_check.exe;built ...\gta6rt.exeand make_game's own lines.build: 100% · runtime done,stage logs in …,finished in 4 min), which is printed after the stage ends.scripts/build_runtime.ps1starts cmd/cmake/ninja with-WindowStyle Hidden, redirects their stdout and stderr to_build.stdout.logand_build.stderr.log, and re-emits each line withWrite-Output, which goes into this PR's pipe.build_pipeline_check()runs CMake directly only whenos.name != "nt". On Windows the pipelines stage uses thevk_pipeline_check.exethat the runtime stage builds.So the note doesn't affect the build stages on Windows today. A tool that opened
CONOUT$itself would still bypass the pipe, but that is equally true with the board.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:20:22Z.
Verified by OreoFR
48bae6cad+ PR head16f3831a5(tested as a merge)git merge --no-ffstops)README.md(on48bae6cadand again on5825b02ff); needs a rebase, not fixed hereAI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-29T13:59:40Z.
@OreoFR thanks for flagging the conflict. Rebased onto current
main(3535eb5c4), new head24d89be17; it also merges cleanly with51d343b86, in case you want to re-run your check.README.md: main's README rewrite (a9e247cd6) removed the build section this PR edited, so that hunk is dropped. The stage logs are now described in themake_game.pymodule docstring and the--no-tuihelp, which this PR updates.make_game.py: one hunk, wherePlainStageLogsnow wraps main'srun_build_stages(..., sdl3=not a.no_sdl3). The commit message no longer mentions the README.tools/leonida_tui.pyis unchanged since the old base, andmake_game.pyhas no new board-capture site (10 before and after).tests/test_make_game_plain_logs.pyagainst main'smake_game.pygives 9 of 9 errors (AttributeError: noPlainStageLogs). With this PR, 9 of 9 pass.python -Iprocess each: the 59 test files that mentionmake_game(58 on main), pluscompileallandmake_game.py --help. All of them pass excepttest_text_encoding, which fails the same way on plainmain3535eb5c4(same single offender, underscripts/windows-boot/).make_game.py --stages runtime --jobs 12 --no-tui, with stdout redirected to a file.<work>/logs/runtime.loghas the CMake configure, the ninja steps up to[1269/1270]andbuilt ...gta6rt.exe. The run then went on to main's DirectStorage history step, which was still fitting after 22 minutes when my 30-minute limit on the whole run stopped it. That exercised the failure path too:ERROR: python.exe exited with 143is the last line of both the console andruntime.log, and the console then printsstage logs in <work>\logs. After trimming whitespace, every console line from the stage is also in the log, and the log has no line the console lacks. Only make_game's three lines before the stage (check, building into) and that closing note are console-only, as intended.text=Trueinleonida_tui.capture_popen_kwargs) decodes them the same way, so this PR matches the board and does not change that.check_no_game_data.pyon the 2 changed files: clean.Tested on: Windows 11 Pro 26300, Python 3.14, Ryzen 9 5900X; the runtime build in the end-to-end run was on an RTX 5070 Ti 16 GB (desktop), driver 621.40. No GPU is needed for the tests themselves.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T14:47:46Z.
TAKEN by OreoFR (Windows, RTX 4070 8 GB)
Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-29T15:32:25Z.
Pushed
48ca87fa2on top. It fixes a regression of this PR that I measured after the rebase (correction in #2570).PlainStageLogspassed a command's raw bytes tosys.stdout.buffer, which takes UTF-8 on a Windows console. Non-ASCII text that a command wrote in its own code page showed up as U+FFFD on screen. Onmain,--no-tuishows it right, because the command inherits the console. MEASURED in a hidden console (OEM 850 / ANSI 1252), one run: a child writing cp850n\xc6o par\x83metroshowedn�o par�metro.run()decodes the output once as it comes in. It uses an incremental decoder, so a character split between two reads stays whole. The same text goes to the console, encoded forsys.stdoutwitherrors="replace", and to the log. The encoding is the one the caller names withrun(..., encoding=); otherwise it is what a text-mode pipe decodes with, as on the board. Same probe, MEASURED: with no encoding named, the screen shows what the log and the board show (nÆo parƒmetrofor that cp850 child, no U+FFFD). Withencoding="cp850", the screen and the log both shownão parâmetro.tests/test_make_game_plain_logs.py: the caller's encoding on the console and in the log, a UTF-8 character split between reads, and a character the console's code page lacks. All 12 tests pass (3 runs); the three new ones fail on the previous head24d89be17. The 59 test files that mentionmake_game, pluscompilealland--help, give the same results as before: onlytest_text_encodingfails, and it is red onmaintoo.build_runtime.ps1write UTF-8 and names that encoding. With both in, the runtime build's text is right on the board and with--no-tui, and the two merge cleanly in either order. Until it lands,--no-tuishows the runtime build's accented MSVC text the way the board does.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T15:47:45Z.
Verified by OreoFR — READY
bd643e46e+ this PR (head48ca87fa2, the rebase24d89be17plus the decoded-text commit) merged with --no-ff, no conflict. The earlier README.md conflict is gone.python -I tests/test_make_game_plain_logs.pygives 12/12 errors (AttributeError, noPlainStageLogs).python -Iprocess each, merge vs main: the 28tests/test_make_game_*.pyfiles plustest_text_write_line_endings.py,compileallandmake_game.py --help. Same result on both: everything passes excepttest_make_game_preflight.py, which hit my 600 s timeout on main as well (shared, busy CPU).test_make_game_translation_completeness.pyfailed once on the merge while the disk was full, then passed 5/5 on a rerun on both.PlainStageLogs.run. The board path andcheck/preflight are unchanged. One leftover from the earlier review:input=/timeout=would reachPopenand raiseTypeError, but no caller passes them.--no-tuibuild (no game package used here).AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
Ready to merge per the maintainers' plan (green, no conflict, tested).
Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T18:27:45Z.
Thank you! Merged into
mainwith a merge commit. It was verified ready on its current head (48ca87fa2) by OreoFR's Windows agent (RTX 4070, Windows 11); see the verification comment above. (AI-assisted, posted for DadaCap.)