fix(dev): a game folder's logs live beside the tree, so reclaim deletes it whole #2545

Open
dazemc wants to merge 2 commits from dazemc/Longshot:fix/runtime-logs-beside into main
Contributor

Summary

A game folder could never be deleted whole. The game writes its logs, frame traces and whole profiling folders into logs/
inside the folder it runs from (game/game_layout.c, host/profiling.c), and dev.py makes that folder a base's game
folder, a runtime or build-linux/game/. So reclaiming disk always meant picking files out of the tree, hashing them and
keeping them by hand, and it was done three times in one day.

On main, make a runtime on a shared base (dev.py packs rt <base> <runtime>), play or profile it with HOS_PROFILE=1,
then rm -rf <runtime>: the runtime's logs/longshot_log.txt and logs/profile-*/ go with it, and the only safe reclaim
is per file.

This change makes the game's logs/ a link to a folder beside the tree, <tree>.logs (a junction on Windows), so a tree
is deleted whole with rm -rf <tree> and what its runs wrote stays; a runtime made again finds its old evidence. It
applies where a game folder is made: a base (packs.cmd_base), a runtime (packs.cmd_rt, and so dev.py rt and
dev.py ab) and dev.py game (build.cmd_game). A logs/ that is already a real folder is never moved, and where a link
cannot be made the logs stay inside the tree as before.

Read scripts/devtools/packs.py first: logs_beside, drop_evidence, and the three call sites. Then
tests/test_dev_packs.py's test_logs_beside.

Rebase status (2026-11-25, current): a5bf9dd16 → 73846d555 onto main @ 8f7300756701b7c9a278e576bb075ac20e622a32. The PR's own diff is preserved: stable patch-id f6428de4e81f32760a392d682da1dec37502d710 is unchanged. Main's old-base→new-main changes intersect this PR at tests/test_dev_packs.py. The earlier suite therefore does not settle the rebased tree: that box is unticked and a suite is queued with the single suite owner. Focused, in-game, Windows and measurement results below remain identified by the historical commit that produced them; no new run is claimed. Earlier rebase notes are history.

Testing

Tested: Linux (this PC). A scripts-only change: no game binary is built or changed, so no in-game run applies. Run
python -I -B tests/test_dev_packs.py at this head: test_dev_packs: ok. tests/test_dev_build.py 24 tests OK and
tests/test_dev_ab.py 35 tests OK.

The full suite ran at the pre-rebase head a5bf9dd16 (833 passed, 2 failed, 8 skipped; the two failures were the named base failures).
Main now intersects tests/test_dev_packs.py, so a fresh suite at 73846d555 is queued with the single suite owner; no result at the rebased head is claimed.

Game-free test, both ways: at 7f1ede607 (the pre-rebase main plus this test alone, no fix) it fails with

FAIL: the base's log is in the runtime through a link, not a folder of the runtime's

and at this PR it passes. It checks the builder, a refresh, shutil.rmtree(<tree>) leaving logs/profile-*/all.txt and
longshot_log.txt in <tree>.logs, a runtime made again finding it, a real logs/ left untouched, and a dangling link
remade; test_warm checks a warm-up still takes the logs it wrote with it.

Not repaired here, and not this branch's: on the older fork main (971f77f52) three checks in this file were red
(test_caches_named_in_renderer, test_inputs_beside_the_objects, test_stamp_matches_build). They are green on
the pre-rebase main (2e9e41cb0): #2286 moved the builder out of nx2/ and #2411 moved the game, and the test file followed.
This branch is based on current main and changes none of them.

Still to test:

  • Full mise run test at 73846d555, queued with the single suite owner because tests/test_dev_packs.py intersects main's changes (by hand, suite owner).
  • On a shared base, by hand: dev.py rt --empty, play it once, rm -rf build-linux/rt-base, expecting
    build-linux/rt-base.logs/longshot_log.txt to remain (by hand: needs a real base and a game run).
  • Windows, by hand: make a runtime, expecting rt-<name>.logs beside it, made as a junction where this account cannot make
    symbolic links (by hand).

Measurements

Nothing to measure: no renderer or game code changes, so no frame rate, frame time or memory; the disk effect is that a tree is deleted whole (1.2 GB of logs/ was inside 37 runtime trees on this PC, one profiling runtime alone 1.1 GB).

Risks

  • What could break: a tool that expects logs/ to be a real directory. All of them open paths under it
    (dev.py update --logs, scripts/perf.py, scripts/profiling, scripts/devtools/ab.py), which follows the link.
  • New trees only: an existing tree keeps its real logs/, and its evidence is not moved.
  • No link can be made (an odd file system, an account without the right): the logs stay inside the tree exactly as before.
  • After updating: nothing a player sees; this is developer tooling, not the game.
  • A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. — Rebased head 73846d555 is directly on main @ 8f7300756701b7c9a278e576bb075ac20e622a32; the preserved diff is the single topic described in Summary.
  • Tested on my own PC, as Testing says (scripts-only: no game run applies).
  • mise run test passes (any failure that also fails on main is named). — Unticked at 73846d555: main changed a file in this PR's intersection; a fresh suite is queued with the suite owner. The earlier suite record is historical evidence, not a new run at this head. Suite at a5bf9dd16052224d817f261b537edfe9025247e2: 833 passed, 2 failed, 8 skipped in 504 s (linux, 5 at once), exit 1; log prrefresh-logs/suite-2545-a5bf9dd1.log, sha256 01be667e95e6cee281a05e618ab71d8262820ef3d70d48607002053ba57fc382, .head = that sha, .start/.end/.exit and JUnit beside it. Passes against Amendment 1's CORE ∪ FLAKY plus the base failures of Amendment 2 — CORE/FLAKY: none; base-exempt: tests/test_display_startup_failure.py, tests/test_title_card_strips.py; same 8 skips. base failure tests/test_display_startup_failure.py exempt: fails identically at the merge-base be663a08a — display_startup_actual.inc:82:5: error: use of undeclared identifier 'bc_claim'; reproduction prrefresh-logs/base-be663a08a-two-ids.log, sha256 a26e89fa21110e64aa11987f7acae1a9d166b3c6e1877e8335aa3c9b0b9ac257. base failure tests/test_title_card_strips.py exempt: fails identically at the merge-base be663a08a — ModuleNotFoundError: No module named 'oot_patches'; same reproduction, same sha256.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened: test_dev_packs.py gains
    test_logs_beside; no existing check was changed.
  • Docs updated: docs/dev/developing.md, the rt and game rows.
  • AI assistance recorded with Assisted-by: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested. — Merge gate: outstanding items remain in Still to test or are confirmed during review; this update does not tick it.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). — Merge gate: platform coverage is settled during review; this update does not claim new hardware coverage.
  • Approved in review, every comment answered. — Awaiting reviewer approval and resolution of any review comments.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold. — Awaiting CI on the current head; this update does not claim a CI run.
## Summary A game folder could never be deleted whole. The game writes its logs, frame traces and whole profiling folders into `logs/` inside the folder it runs from (`game/game_layout.c`, `host/profiling.c`), and `dev.py` makes that folder a base's game folder, a runtime or `build-linux/game/`. So reclaiming disk always meant picking files out of the tree, hashing them and keeping them by hand, and it was done three times in one day. On `main`, make a runtime on a shared base (`dev.py packs rt <base> <runtime>`), play or profile it with `HOS_PROFILE=1`, then `rm -rf <runtime>`: the runtime's `logs/longshot_log.txt` and `logs/profile-*/` go with it, and the only safe reclaim is per file. This change makes the game's `logs/` a link to a folder beside the tree, `<tree>.logs` (a junction on Windows), so a tree is deleted whole with `rm -rf <tree>` and what its runs wrote stays; a runtime made again finds its old evidence. It applies where a game folder is made: a base (`packs.cmd_base`), a runtime (`packs.cmd_rt`, and so `dev.py rt` and `dev.py ab`) and `dev.py game` (`build.cmd_game`). A `logs/` that is already a real folder is never moved, and where a link cannot be made the logs stay inside the tree as before. Read `scripts/devtools/packs.py` first: `logs_beside`, `drop_evidence`, and the three call sites. Then `tests/test_dev_packs.py`'s `test_logs_beside`. **Rebase status (2026-11-25, current):** `a5bf9dd16` → `73846d555` onto `main @ 8f7300756701b7c9a278e576bb075ac20e622a32`. The PR's own diff is preserved: stable patch-id `f6428de4e81f32760a392d682da1dec37502d710` is unchanged. Main's old-base→new-main changes intersect this PR at **tests/test_dev_packs.py**. The earlier suite therefore does not settle the rebased tree: that box is unticked and a suite is queued with the single suite owner. Focused, in-game, Windows and measurement results below remain identified by the historical commit that produced them; no new run is claimed. Earlier rebase notes are history. ## Testing **Tested:** Linux (this PC). A scripts-only change: no game binary is built or changed, so no in-game run applies. Run `python -I -B tests/test_dev_packs.py` at this head: `test_dev_packs: ok`. `tests/test_dev_build.py` 24 tests OK and `tests/test_dev_ab.py` 35 tests OK. The full suite ran at the pre-rebase head `a5bf9dd16` (833 passed, 2 failed, 8 skipped; the two failures were the named base failures). Main now intersects `tests/test_dev_packs.py`, so a fresh suite at `73846d555` is queued with the single suite owner; no result at the rebased head is claimed. Game-free test, both ways: at `7f1ede607` (the pre-rebase main plus this test alone, no fix) it fails with ``` FAIL: the base's log is in the runtime through a link, not a folder of the runtime's ``` and at this PR it passes. It checks the builder, a refresh, `shutil.rmtree(<tree>)` leaving `logs/profile-*/all.txt` and `longshot_log.txt` in `<tree>.logs`, a runtime made again finding it, a real `logs/` left untouched, and a dangling link remade; `test_warm` checks a warm-up still takes the logs it wrote with it. Not repaired here, and not this branch's: on the older fork `main` (`971f77f52`) three checks in this file were red (`test_caches_named_in_renderer`, `test_inputs_beside_the_objects`, `test_stamp_matches_build`). They are green on the pre-rebase main (`2e9e41cb0`): #2286 moved the builder out of `nx2/` and #2411 moved the game, and the test file followed. This branch is based on current `main` and changes none of them. **Still to test:** - Full `mise run test` at `73846d555`, queued with the single suite owner because `tests/test_dev_packs.py` intersects main's changes (by hand, suite owner). - On a shared base, by hand: `dev.py rt --empty`, play it once, `rm -rf build-linux/rt-base`, expecting `build-linux/rt-base.logs/longshot_log.txt` to remain (by hand: needs a real base and a game run). - Windows, by hand: make a runtime, expecting `rt-<name>.logs` beside it, made as a junction where this account cannot make symbolic links (by hand). ## Measurements Nothing to measure: no renderer or game code changes, so no frame rate, frame time or memory; the disk effect is that a tree is deleted whole (1.2 GB of `logs/` was inside 37 runtime trees on this PC, one profiling runtime alone 1.1 GB). ## Risks - What could break: a tool that expects `logs/` to be a real directory. All of them open paths under it (`dev.py update --logs`, `scripts/perf.py`, `scripts/profiling`, `scripts/devtools/ab.py`), which follows the link. - New trees only: an existing tree keeps its real `logs/`, and its evidence is not moved. - No link can be made (an odd file system, an account without the right): the logs stay inside the tree exactly as before. - After updating: nothing a player sees; this is developer tooling, not the game. - A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. — Rebased head `73846d555` is directly on `main @ 8f7300756701b7c9a278e576bb075ac20e622a32`; the preserved diff is the single topic described in Summary. - [x] Tested on my own PC, as Testing says (scripts-only: no game run applies). - [ ] `mise run test` passes (any failure that also fails on `main` is named). — **Unticked at `73846d555`: main changed a file in this PR's intersection; a fresh suite is queued with the suite owner. The earlier suite record is historical evidence, not a new run at this head.** **Suite at `a5bf9dd16052224d817f261b537edfe9025247e2`: 833 passed, 2 failed, 8 skipped in 504 s (linux, 5 at once), exit 1; log `prrefresh-logs/suite-2545-a5bf9dd1.log`, sha256 `01be667e95e6cee281a05e618ab71d8262820ef3d70d48607002053ba57fc382`, `.head` = that sha, `.start`/`.end`/`.exit` and JUnit beside it.** Passes against Amendment 1's CORE ∪ FLAKY plus the base failures of Amendment 2 — CORE/FLAKY: none; base-exempt: `tests/test_display_startup_failure.py`, `tests/test_title_card_strips.py`; same 8 skips. base failure `tests/test_display_startup_failure.py` exempt: fails identically at the merge-base `be663a08a` — `display_startup_actual.inc:82:5: error: use of undeclared identifier 'bc_claim'`; reproduction `prrefresh-logs/base-be663a08a-two-ids.log`, sha256 `a26e89fa21110e64aa11987f7acae1a9d166b3c6e1877e8335aa3c9b0b9ac257`. base failure `tests/test_title_card_strips.py` exempt: fails identically at the merge-base `be663a08a` — `ModuleNotFoundError: No module named 'oot_patches'`; same reproduction, same sha256. - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened: `test_dev_packs.py` gains `test_logs_beside`; no existing check was changed. - [x] Docs updated: `docs/dev/developing.md`, the `rt` and `game` rows. - [x] AI assistance recorded with `Assisted-by:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. — Merge gate: outstanding items remain in Still to test or are confirmed during review; this update does not tick it. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). — Merge gate: platform coverage is settled during review; this update does not claim new hardware coverage. - [ ] Approved in review, every comment answered. — Awaiting reviewer approval and resolution of any review comments. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. — Awaiting CI on the current head; this update does not claim a CI run.
The test fails on main for the reason the harness wastes disk: a runtime's
logs/ is a real folder of the tree, so no tree can be deleted whole while
its evidence stays. It checks the builder, a refresh, a tree deleted whole
and a run made again, and that a warm-up takes the logs it wrote with it.
Also splits a semicolon E702, which pre-commit flags once this file changes.

Assisted-by: opencode (DeepSeek V4.1 Flash)
fix(dev): a game folder's logs live beside the tree, so reclaim deletes it whole
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website builds (pull_request) Blocked by required conditions
Website / Website preview, build (pull_request) Blocked by required conditions
Website / Website preview, upload (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Has been cancelled
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
a5bf9dd160
A base's game folder, a runtime and dev.py game's folder had the game's
logs, traces and profile folders inside them (game/game_layout.c writes
logs/ beside the exe), so a tree could never be deleted wholesale: every
reclaim had to pick files out of it, hash them and keep the evidence.

logs/ is now a link to <tree>.logs beside the tree (packs.logs_beside, a
junction on Windows), made before the preparation and before a runtime's
play state is seeded. A tree is deleted whole (rm -rf <tree>) and what its
runs wrote stays; a runtime made again finds it. A logs/ that is a real
folder (a tree from before this) is never moved, and where no link can be
made the logs stay inside the tree as before. A warm-up takes the logs it
wrote with it, as it deleted them before.

Assisted-by: opencode (DeepSeek V4.1 Flash)
dazemc changed title from WIP: fix(dev): a game folder's logs live beside the tree, so reclaim deletes it whole to fix(dev): a game folder's logs live beside the tree, so reclaim deletes it whole 2026-11-25 17:43:02 +00:00
dazemc force-pushed fix/runtime-logs-beside from a5bf9dd160
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website builds (pull_request) Blocked by required conditions
Website / Website preview, build (pull_request) Blocked by required conditions
Website / Website preview, upload (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Has been cancelled
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 73846d5559
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Blocked by required conditions
CI / longshot-builder end to end (synthetic game) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 3/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 4/4) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Failing after 10s
2026-11-25 17:54:52 +00:00
Compare
Author
Contributor

Rebased a5bf9dd16 to 73846d555 on main 8f7300756; patch-id unchanged. Intersection tests/test_dev_packs.py means the old suite no longer settles the head: box unticked and suite queued; PR stays non-WIP while queued.

Rebased a5bf9dd16 to 73846d555 on main 8f7300756; patch-id unchanged. Intersection tests/test_dev_packs.py means the old suite no longer settles the head: box unticked and suite queued; PR stays non-WIP while queued.
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Blocked by required conditions
CI / longshot-builder end to end (synthetic game) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 3/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 4/4) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Failing after 10s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/runtime-logs-beside:dazemc-fix/runtime-logs-beside'
git switch 'dazemc-fix/runtime-logs-beside'
Sign in to join this conversation.
No reviewers
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
MagicBeanDev/Longshot!2545
No description provided.