launcher: restart after an update that changes the launcher, also in the installed app; the status corner shows the new commit #3427
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3427
Loading…
Reference in a new issue
No description provided.
Delete branch "oreofr/launcher-global-3"
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?
Pull request successfully merged and closed
Launcher change: needs OreoFR's review. AI-assisted.
What happened. On OreoFR's PC, the installed app (Mandy.exe, repo copy at main
312d88d1d) showed 6 updates. Update Mandy moved the copy toe1a13ab25; #3405/#3414, #3421 and #3425 changetools/leonida_launcher.pyand its translations. The launcher did not restart. The window stayed on the old code, said "À jour", and its status corner still showedmain 312d88d1d.Root cause.
312d88d1dthe window restarts only whenrestart_due(True, code, ...)is true (tools/leonida_launcher.py:5125), andrestart_dueneedscode == 0(:1067). On main it is the same code (:6271,:1516).run_updatereturnsrebuild_if_changed(...)(312d88d1d:2047), and that is the exit code of the runtime build whend3d12/changed (return build(),:1615). The six merges changed3d12/(dlss.rs,fg.rs,ffx.rs, ...), so the build ran right after the pull. In the copy, the reflog shows the pull at 04:47:08, andd3d12/target/diagwas written from 04:47:11 to 04:49 but holds noleonida.exe. So the build did not finish,code != 0, andrestart_duereturned false. Git had already moved the launcher files, so the window kept running old code over new files. Thecheck_updates(fetch=False)that follows then said "Up to date".read_rail()is called only in__init__(312d88d1d:4097; main:5115), so the corner keeps the commit from the window's start.print(). It does not on this install.Mandy.exe --run-python probe.py, started withstdout=PIPEandCREATE_NO_WINDOWasspawndoes, gives a realsys.stdout(TextIOWrapper, cp1252) and fd 1 works, andconsole_streams()covers theNonecase. I also ran the old312d88d1dlauncher's--updateon a temporary clone (312d88d1d->e1a13ab25): it prints@@launcher-updatedand exits 0 when the build succeeds. The window no longer relies on that line anyway: see the fix.Fix.
run()recordslauncher_fingerprint(REPO)(HEAD plus a SHA-256 of theLAUNCHER_FILESon disk) before Update Mandy starts. When the update ends,after_updatecompares it withlauncher_changed: either the hash differs, or HEAD moved andgit diff --name-only before afternames a launcher file. The decision no longer needs the child's stdout, and it also works for a zip copy (hash only). The@@launcher-updatedline still counts.update_restart(updated, code, game_running):"restart"when the update succeeded (as before,restart_due)."ask"when the launcher files changed and the update then stopped with an error, such as a failed build: a dialog offers the restart and the output stays readable. If the player says no, the log tells them to close and reopen the launcher. Never while a game runs (restart_launcher/ask_restartreturn whileself.processis set).launcher_command()gives[Mandy.exe]in the installed app (the new process hands over to the repository's new launcher;is_hostedis false for the bundle's copy even withMANDY_HOSTinherited) andpython -I tools/leonida_launcher.pyfrom source. The old window then callsroot.destroy(). This part is unchanged; only its docstring is updated.read_rail_version()readsrail_version()(git rev-parse --abbrev-ref HEAD/--short HEAD) again after every update (after_update) and every check (show_update). The card line is kept (rail_text).docs/launcher.mdupdated.Tests (
tests/test_leonida_launcher.py). They are red on maine1a13ab25(tools/ stashed, new tests kept): 4 errors (the functions don't exist) and 5 failures. All are green with the fix.UpdateRestartWindowTestsbuilds the real window (run_gui, Tk withdrawn) on a real temporary git repository. A fake update child commits a change and prints nothing on stdout, like a frozen child whose output is lost:tools/leonida_launcher.py: restart requested (main: no restart)tools/launcher_i18n/fr.json: restart requested (main: no restart)d3d12/only: no restart, no questionmain 312d88d1d->main e1a13ab25(main: unchanged)update_restart;launcher_changedwith a fake git (diff --name-only aaa bbb: launcher file -> true,d3d12/only -> false, HEAD unchanged -> false); a zip copy (hash only);rail_text.test_text_write_line_endings,test_bug_report_infoandtest_win_launchers(29 files), run withscripts/run_standalone_tests.py -j 8: all OK. The i18n JSON files load (545 keys each).check_no_game_datapasses on the changed files.compileallpasses. There is still a singleif __name__ == "__main__":.Windows 11, Python 3.12. No GPU involved.
🤖 Generated with Claude Code
Merged by OreoFR (agent) after local CI on head
a28505425merged into current maine1a13ab25: all PASS in quick mode (merge clean, no game data, compile,make_game.py --help, standard-library Python tests 159 s; Rust skipped as launcher-only; pytest not installed here).What it changes for players: after Update Mandy, the launcher now restarts itself when its own files moved (even when the build step after the update failed, which used to leave the old launcher running and showing "Up to date" with an old commit), asks before restarting on error, and the version in the corner is re-read after an update.
Not yet checked: a real restart from the installed app (Mandy.exe) — OreoFR tests it on the next update. Beta gets this with the next main→beta sync.