fix(game): an organized game folder with no diagnostics/ gets it back, so its log is in diagnostics/logs/ #2750
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2750
Loading…
Reference in a new issue
No description provided.
Delete branch "Jiro113/Longshot:fix/diagnostics-dir"
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?
Summary
Since the builder organizes the game folder (#2708), the game's
logs go in
diagnostics/logs/.hos_game_layout(game/game_layout.c) makes that folder with oneCreateDirectoryA,which fails without a word when
diagnostics/itself is missing. A folder the builder makes is not affected: itcreates
diagnostics/on every build (builder/crates/build-driver/src/build.rs). But an organized folder(
data/image.bin) without it is: a runtimedev.py rtmakes (it copies nodiagnostics/), a folder copied by hand,or one whose
diagnostics/the player deleted. In such a folder:longshot_log.txtfalls back besidelongshot.exe(host/hos_main.cchecks thatdiagnostics/logsexists before using it);
diagnostics/bug-reports/is made one level at a time (setupinhost/hos_crash_record.c), so norunning/marker and no crash or unclean-end record.On main:
python -I scripts/dev.py rt --empty, startbuild-windows/rt-base/longshot.exefrom its icon (no stderr),quit. The log is
rt-base/longshot_log.txtand the folder has nodiagnostics/.This PR makes
hos_game_layoutcreatediagnostics/first in an organized folder, thendiagnostics/logs/asbefore. Nothing changes for a folder the builder did not organize. Read
hos_game_layoutingame/game_layout.c,then the new case at the end of
tests/test_game_layout.py.The docs named only
logs/for the game's logs since #2708:docs/dev/reference/architecture.md(the game folder)and
docs/dev/reference/profiles.md(where the logs are) now say an organized folder has them indiagnostics/logs/,beside
diagnostics/bug-reports/; the update's log stays inlogs/(builder/crates/longshot-builder/src/play.rs). Otherpages still say
logs/where an organized folder usesdiagnostics/logs/(docs/dev/developing.md,docs/dev/reference/profiling.md,docs/dev/reference/build.md,docs/user/performance-report.md); they are notchanged here.
This is separate from #2741 (which makes a game started by
longshot-builder playwrite its own log at all), and touches none of its files.Prior work: none found (
diagnostics/,diagnostics/logs,hos_game_layout,hos_organized_build,CreateDirectoryA,game_layout,bug-reports; open, merged and closed PRs and issues, and the team room). Hookshot's API answered HTTP521 on 2026-11-28.
Testing
Tested: Windows 11 (26300), RTX 4090, driver 621.24. Both runs were on main 22d0d2009's base: once alone
(
dev.py rt --empty), once with this branch as a pack (dev.py pack,dev.py rt; the log's first line islongshot v3.2.0-111-gfedfcac31). Each runtime is an organized folder with nodiagnostics/.The game was started with no standard handles, as from its icon, with a throwaway profile and
HOS_AUDIO=0, fullscreen on a second monitor, then quit through the control bridge:
longshot_log.txtwritten besidelongshot.exe, nodiagnostics/at all, so nobug-reports/running/marker during the run;
diagnostics/,diagnostics/logs/longshot_log.txtanddiagnostics/bug-reports/{pending,running}/made at the start, the run's
running/marker there while it played and gone after the clean exit (code 0,stop: close work done), nothing besidelongshot.exe.Checks:
tests/test_game_layout.py: its new case starts an organized folder with nodiagnostics/, the game beside thefolder and in its
bin/. It fails on main (no diagnostics/logs/ made: [..., 'longshot_log.txt']), on Windows andon Linux (WSL, gcc), and passed before the later test changes on Windows (llvm-mingw gcc and clang, and through
run_all.py) and Linux. The updated test, which uses UTF-8 paths and the game manifest on Windows, has not been reported as run.diagnostics/. That catchesmaking
diagnostics/unconditionally, a mutation of the fix the first version let through.host/posix's shim. CI has no Windows runner,so this changes only local Windows runs.
tests/run_all.pyon Windows, whole: 813 passed, 22 failed, 53 skipped. Main22d0d2009(agit archiveof it,same environment) had 809 passed, 25 failed, 54 skipped. Every failure here also fails on main:
test_auto_handheld,test_bug_report,test_builder_channel,test_control_picture,test_coverage_run,test_crash_record,test_dev_ab,test_dev_build,test_dev_migrate,test_framegen_resources,test_game_menu_mouse_buttons,test_input_movie,test_job_queue,test_oot_menu_mouse,test_pads_after_menu,test_parity_gates,test_perf_send,test_present_source_crop,test_run_all_mingw,test_screensaver,test_switch_table,test_xinput_thread.game/game_layout.c(test_crash_record,test_bug_report,test_longshot_exit,test_display_startup_failure) give the same results as on main.test_bug_reportandtest_crash_recordfailwith the same messages there (the latter on
host/posix/display_sdl.c's source check).aeab88195,run_all.py --changed origin/main:byte_compile_trackedandtest_game_layoutpass,test_bug_reportfails as on main, andtest_pipeline_touris skipped (Linux only). Run on Linux (WSL,--exact), it fails here and on main with the same message (the pipeline notes and lists are no longer in the game folder's cache/).d8188d044andaeab88195, docs only):run_all.py --changedon Windows, the six checks that readthe two pages, passed (
test_doc_anchors,test_frame_overlap,test_framegen_fifo_cap,test_present_probe,test_present_queue_default,byte_compile_tracked).pre-commit run --from-ref <merge base> --to-ref HEAD, on the headaeab88195: passed, except gitleaks, which is notinstalled on this PC.
Still to test:
diagnostics/, the game started from its icon (no stderr), expectingdiagnostics/logs/longshot_log.txtanddiagnostics/bug-reports/made at the start (@Beanstalk start a dev.py rt runtime with no diagnostics/ folder on Linux without a terminal and check diagnostics/logs/longshot_log.txt).Measurements
Before: main @
22d0d2009. After: this PR @fedfcac31(the later commits change the docs and test). An organized runtime with nodiagnostics/, started with nostderr, Windows 11, RTX 4090, driver 621.24:
22d0d2009fedfcac31tests/test_game_layout.py(Windows, Linux)no diagnostics/logs/ madelongshot_log.txtbesidelongshot.exediagnostics/logs/longshot_log.txtdiagnostics/bug-reports/running/during the rundiagnostics/)<pid>.record,<pid>.running, gone after the clean exitVerdict: fixed. In such a folder the log is back in
diagnostics/logs/and the crash record keeps itsrunning/marker again; the earlier test fails before and passes after, on Windows and Linux. The updated test has not been reported as run.
There is no performance to measure: the change adds one
CreateDirectoryAat the start, once a process, in a folderthe builder organized.
Risks
diagnostics/is unchanged (thecall fails with "already exists"). A folder the builder did not organize is untouched.
diagnostics/, thelog moves into
diagnostics/logs/and crash records are kept again. Alongshot_log.txtleft besidelongshot.exeby such a start is moved there at the next start, like the other loose logs.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).tests/run_all.pyran onWindows before the later test changes, compared with main in the same environment (Testing). On Linux only
tests/test_game_layout.pyran.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. The updated test has not been reported as run.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11 (26300), RTX 4090, driver 621.24, at
fedfcac31as a pack on main 22d0d2009's base. An organized runtime (data/image.bin) with no diagnostics/, the game started with no stderr (as from its icon), title and menu, full screen, then quit. Before (main): longshot_log.txt beside longshot.exe, no diagnostics/ and no bug-reports/running/ marker. After: diagnostics/logs/longshot_log.txt (first line longshot v3.2.0-111-gfedfcac31), diagnostics/bug-reports/{pending,running}/ made at the start, the run's running/ marker there during play and gone after the clean exit (code 0, stop: close work done), nothing beside longshot.exe. DLSS's NGX started.Docs:
docs/dev/reference/architecture.mdanddocs/dev/reference/profiles.mdnow namediagnostics/logs/for an organized folder (d8188d044, docs only); the description's Summary, Testing and checklist say so.Docs:
docs/dev/reference/profiles.mdkeeps the update's log inlogs/(aeab88195): longshot-builder writeslogs/longshot_update.login an organized folder too (builder/crates/longshot-builder/src/play.rs); only the game's own logs are indiagnostics/logs/.WIP: fix(game): an organized game folder with no diagnostics/ gets it back, so its log is in diagnostics/logs/to fix(game): an organized game folder with no diagnostics/ gets it back, so its log is in diagnostics/logs/@review
Recommendation: Approve. The Windows run shows that the missing diagnostics directory, log and crash marker are restored. The Linux game run is still needed, and the newly enabled Windows test has a path-dependent failure. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The game recreates diagnostics/ before its logs directory in organized builds, restoring the intended log and crash-record locations. The change adds one directory creation at startup and leaves unorganized builds on their existing layout.
Should fix (1): not blocking, but worth doing before merging.
tests/test_game_layout.py:105: The new Windows test executable is linked without the game's UTF-8 code-page manifest, even though the code under test passes UTF-8 paths to Win32 A functions. (more on the line) Do: Embed the game's UTF-8 manifest in the Windows test executable, and exercise it under a non-ASCII temporary path.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
game/game_layout.c:116: The Linux game startup and crash-record path still needs the run identified in the pull request. (more on the line) Do: Run that Linux runtime from its icon without diagnostics/ and check the log location and running crash marker through a clean exit.@fixcan do L1.More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows comparison shows the log moving from the game root to diagnostics/logs/ and the running crash marker being created; the game-free test is reported to fail on the base and pass on the branch on Windows and Linux. A Linux game run remains outstanding.
Other systems: The changed startup path runs on Windows and Linux, including shader preparation. It does not depend on GPU vendor. The reported Windows game run and Linux shim test cover the directory creation, but Linux logging and crash-record startup have not yet been checked in the game.
Switches: None.
Reviewed:
aeab881953against22d0d20098: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the complete diff and commit messages, game/game_layout.c, game/game_layout.h, tests/test_game_layout.py, host/hos_paths.h, profiles.md, and the relevant startup and crash-record call sites. Skimmed architecture.md and the remaining referenced code; no recorded runs, translations or generated files were changed. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run during review. The author's reported Windows game comparison and Windows/Linux game-free test results were considered.
Overlaps and merge order: The description identifies #2741 as separate and touching no common files; no other overlap was available to verify offline.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -107,3 +113,4 @@snprintf(prompts, sizeof prompts, "%scache" SEP_S "prompts", game) >= (int)sizeof prompts)return;CreateDirectoryA(cache, NULL);if (organized) CreateDirectoryA(diagnostics, NULL);L2 (should fix): The Linux game startup and crash-record path still needs the run identified in the pull request.
When: An organized Linux runtime without diagnostics/ must create the log and crash-record directories when started without a terminal; only the isolated layout test has been reported on Linux.
Do: Run that Linux runtime from its icon without diagnostics/ and check the log location and running crash marker through a clean exit.
@ -99,1 +103,3 @@"-o", str(built), "-lpthread", "-ldl"], check=True)shim = [] if os.name == "nt" else [str(ROOT / "host" / "posix" / "win32_posix.c")]libs = [] if os.name == "nt" else ["-lpthread", "-ldl"]subprocess.run([a.cc, *inc, str(layout_o), *shim, str(tmp / "main.c"), "-o", str(built), *libs], check=True)L1 (should fix): The new Windows test executable is linked without the game's UTF-8 code-page manifest, even though the code under test passes UTF-8 paths to Win32 A functions.
When: When the temporary directory is under a Windows user path containing non-ASCII characters and the system ANSI code page is not UTF-8, hos_game_path_a returns UTF-8 bytes but CreateDirectoryA interprets them using the ANSI code page. The newly enabled test fails to create its folders even though the manifested game can use the same path.
Do: Embed the game's UTF-8 manifest in the Windows test executable, and exercise it under a non-ASCII temporary path.
@fix
Recommendation: Approve. The fix restores the diagnostics directory in the reported Windows case. The integrated Linux startup and crash-record run is still outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
a04a25e1e4. I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
Organized game folders that lack diagnostics/ recreate it before creating diagnostics/logs/, restoring the intended log location and enabling crash-record setup. The change adds one directory creation at startup and expands the layout test.
Should fix (1): not blocking, but worth doing before merging.
tests/test_game_layout.py:114: The new Windows resource compiler prerequisite is not declared to the test runner. (more on the line) Do: Add windres to the runner's tool discovery and declare and pass it for the Windows test, with preflight coverage.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
game/game_layout.c:116: The Linux game startup and crash-record path still needs the run identified in the pull request. When: An organized Linux runtime without diagnostics/ must create the log and crash-record directories when started without a terminal; only the isolated layout test has been reported on Linux. Do: Run that Linux runtime from its icon without diagnostics/ and check the log location and running crash marker through a clean exit.@fixcan do L4.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports that on Windows the log moved from beside the executable to diagnostics/logs/, and the running crash marker appeared and was removed on clean exit. The earlier layout test failed on main and passed with the fix on Windows and Linux; the updated test has not been reported as run.
Other systems: The directory creation also runs on Linux; the isolated layout test passed there before the later test edits, but integrated Linux startup and crash recording remain untested. Unorganized folders retain logs/; the test covers that distinction. GPU vendors and rendering are not affected by this startup path.
Switches: None.
Reviewed:
a04a25e1e4against22d0d20098: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the game layout implementation and header, the layout test and declaration tests, the fix diff, and the relevant path and runner code. Skimmed the runner and documentation diffs and the reported runs. docs/review-checklist.md and the adjacent Tooling AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run tests were executed. The author reports a successful Windows game run and earlier isolated layout-test runs on Windows and Linux; the requested integrated Linux run remains outstanding.
Overlaps and merge order: The description identifies Longshot#2741 as separate: it addresses game logging through builder play.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -21,3 +23,2 @@RUN_ALL_ARGS = ["--cc", "gcc"]RUN_ALL_SKIP = {"windows": "builds game/game_layout.c with the Linux POSIX shim"}RUN_ALL_ARGS = {"linux": ["--cc", "gcc"], "windows": ["--cc", "gcc", "--cargo", "{cargo}"]}L3 (should fix): The test runner now requires Cargo on Linux even though this test uses it only on Windows.
When: On a Linux machine with GCC but no Cargo, run_all.py skips test_game_layout, or fails it in strict mode, instead of running the previously available game-free layout check.
Do: Make Cargo a Windows-only prerequisite while allowing the runner to execute the Linux test without it.
@ -100,0 +111,4 @@subprocess.run([a.cargo, "run", "-q", "-p", "build-compile", "--example", "manifest_res", "--", str(res)],cwd=ROOT / "builder", check=True, timeout=1800)subprocess.run([a.windres, "-J", "res", "-O", "coff", "-i", str(res), "-o", str(obj)], check=True)resources = [str(obj)]L4 (should fix): The new Windows resource compiler prerequisite is not declared to the test runner.
When: On Windows with Cargo and gcc available but windres absent from PATH, the runner starts the test instead of skipping it for a missing tool, and the subprocess fails to start.
Do: Add windres to the runner's tool discovery and declare and pass it for the Windows test, with preflight coverage.
@fix
a04a25e1e47f9565c2f3Recommendation: Approve. The code is ready: only testing is left. The Windows run shows that the missing diagnostics folder is restored and used for logs and crash records. The integrated Linux startup still needs the requested check. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
7f9565c2f3. I rebased it ontomain(c56b2387f7). I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The game recreates diagnostics/ in an organized folder before creating its logs directory, restoring the expected log and crash-record locations. It adds one directory-creation call at startup; the test runner also declares the Windows resource compiler prerequisite.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
game/game_layout.c:116: The Linux game startup and crash-record path still needs the run identified in the pull request. When: An organized Linux runtime without diagnostics/ must create the log and crash-record directories when started without a terminal; only the isolated layout test has been reported on Linux. Do: Run that Linux runtime from its icon without diagnostics/ and check the log location and running crash marker through a clean exit.Checks: they run again on this head (
PR description / Title and description (pull_request_target),CI / Third-party parts and guide screenshots (pull_request)failed on the last one); a failure shows on the pull request.Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes on the reported Windows run: main wrote the log beside the executable and made no crash-record marker; the changed build wrote the log under diagnostics/logs/ and created and removed the running marker. An earlier game-free test also failed on main and passed on Windows and Linux; the updated test has not been reported as run.
Other systems: The change affects startup on Windows and Linux, including crash-record setup. The Windows game run is reported; the integrated Linux startup remains unverified. GPU-specific behavior is not changed.
Switches: None.
Reviewed:
7f9565c2f3againstc56b2387f7: Read game/game_layout.c, game/game_layout.h, tests/test_game_layout.py, the resource-compiler fix diff, relevant test-runner and declaration-test sections, repository rules and the pull request template. Skimmed the broader base diff, documentation and recorded runs; the full base diff includes additional logo and audio changes not listed in the pull request description.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project or tests were run. CI has not run on this head.
Overlaps and merge order: The description identifies #2741 as a separate builder-play logging change; no merge dependency is stated.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.