WIP: fix(fs): DeleteDirectoryRecursively says when the folder is still there #2154

Draft
dazemc wants to merge 1 commit from dazemc/Longshot:fix/fs-delete-dir-result into main
Contributor

Summary

nn::fs::DeleteDirectoryRecursively calls delete_tree(path) and returns 0 whatever happened. delete_tree dropped every result from DeleteFileA, its recursion and the final RemoveDirectoryA, so:

  • a folder that cannot be removed — a file held open by the game, a cloud client or an antivirus, or read-only after a restore — is reported deleted. The player's confirmed save-delete appears to work, save:/ is unchanged, and the slot lists again;
  • a path that does not exist also returns 0, where Horizon answers fs::ResultPathNotFound (0x202), the idiom DeleteFile three lines away already uses.

What changed (host/nn_fs.c, rebased over #607 so its save path is untouched): delete_tree returns int and stops at the first entry that will not go, removing the folder only when everything under it went; the HLE now answers R_PATH_NOT_FOUND for a vanished path and R_PERMISSION_DENIED (0x320002, fs::ResultPermissionDenied) when the folder outlived the attempt. #607's save branch — save_busy, save_remember_deleted, save_remove, save_changed — is byte-identical; only the in-place (non-save) tail carries the change.

This fixes the result codes only — it does not fix the 1023-byte case. A folder at the path buffer's edge whose child path does not fit still builds a sub that names the folder itself and recurses without end; that is pre-existing on main and outside what a result code can do. The guard for it, with the find pattern's own buffer (HOS_FS_PATTERN), is #2180, which carries this change; merge this for the result codes, and #2180 alongside or after it for the long-path half. This PR does not close the long-path issue, and its checklist does not claim it.

Testing

Tested: new tests/test_fs_delete_dir.py compiles the mount table, host_path, delete_tree, fs_delete_directory_recursively and the HLE over the posix layer, with a stubbed DeleteFileA that refuses one file as Windows does:

main:  FAIL del("save:/gone") == 0x202
       FAIL del("save:/held") == 0x320002
branch: 2 passed, 0 failed (test_fs_delete_dir, test_fs_links)

Windows host: host/nn_fs.c at 074a38f5 compiles as an x86-64 COFF object with llvm-mingw 20261104's clang 23.1.5 (--target=x86_64-w64-mingw32 -fms-extensions -D_CRT_SECURE_NO_WARNINGS -march=native -ffp-contract=off -O2 -g0 -mcx16 -DA64_POLLING -DA64_WRITE_TRACK, headers from host/, third_party/a64-kit/rt and the base's generated gen/); the full Windows game is not linked on this PC. The five checks that read nn_fs.c and fail here (test_fs_save_commit, test_host_guest_writes, test_damaged_rom_files, test_close_waits_for_save, test_guest_copies) fail identically on untouched 1885234b (0 passed, 5 failed) — pre-existing test drift from #607, not this branch. That comparison no longer holds against current main: #2171 changed tests/test_host_guest_writes.py, one of the five, so the drift is fixed there and this head is simply behind it (the rebase below). run_all --strict on the whole tree: main 813/116/18, branch 814/116/18, failing names identical, the extra pass being the new check.

In the game: Arch Linux, Hyprland, RTX 4070 Ti (NVIDIA 620.70.06), a pack over 1885234b, from this branch at 2d01cab6: Kokiri Forest (child), 20 s after warm-up — 1811 frames, 90.6 fps, median 11.07 ms, 0 cold frames (base: 1820 frames, 91.0 fps, 11.02 ms). That run does not cover the head. 2d01cab6's base is 1101b612, which predates #607 (a1c09a3c), and the head 074a38f5 carries #607's save path: git diff 2d01cab6 074a38f5 -- host/nn_fs.c is 952 insertions / 58 deletions, i.e. #607's whole change to the file, so the save-delete path whose result codes this PR changes was not in the smoked build. Head smoke at 074a38f5 (pack over a2dc5385, gpu mode alone, HOS_FS_TRACE=1; runs pr2154-head-smoke, pr2154-save2 and pr2154-erase2-probe): the game boots to its title, Continue opens its Load screen, the repository save loads and plays Kokiri Forest (child), and the game quits cleanly — the head build runs and its save path works. The pause menu's System → Save, with Save focused (not Cancel), writes a real manual save: slot_02 appeared at 01:56:20 with progress.sav and caption.sav and the log's fs: save: published 2 files, and the Load screen lists it untagged at 1:56 a.m. above the two Autosave rows (1:43 and 1/1 12:00). The manual slot's detail panel offers Load and Cancel only — no Erase, and the autosave rows are the same; X, Y, ZR, ZL, − and the arrows on the Load screen change nothing, and the title's Options has no erase. The log has no fs: delete tree line, and slot_02's progress.sav and caption.sav are still there afterwards. The game's erase is not a control the control bridge can press on this PC, so no in-game recursive delete ran; the changed non-save delete_tree tail is host-only, does not run in the game here, and is covered by tests/test_fs_delete_dir.py.

Still to test:

  • Windows: the failure path itself (a file really held open, a read-only file) and \\?\ long paths — this PC can only stub DeleteFileA (by hand).
  • In game, a recursive delete: the Load screen's detail for a real manual save (slot_02, 1:56 a.m.) offers Load/Cancel only — no Erase — so the changed non-save delete_tree/result-code tail has no in-game run. It is covered by tests/test_fs_delete_dir.py; a person with the game's own erase, or a route that does one, would settle it by hand.

Measurements

Nothing to measure: the change adds result codes to a delete path, not a frame path; the in-game run above is a boot/play check and its one-run difference is not attributable.

Risks

A delete that used to report success while failing now reports a failure the game can show; a caller that ignores the result behaves as before but no longer silently loses the delete. #607's save semantics are preserved verbatim (checked with git diff a1c09a3c HEAD -- host/nn_fs.c: only the define, delete_tree's return and the non-save tail). The one thing a result code cannot reach stays as it is on main: a folder at the 1023-byte edge whose child path does not fit still recurses without end, and that is #2180's guard, not this change's. No switch; a revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. The head build runs at 074a38f5 (title, Load screen, load and play, clean quit), and a manual save is real (slot_02, 01:56:20, fs: save: published 2 files), but no in-game recursive delete could be made: the Load screen's detail for that manual slot offers Load/Cancel only — no Erase reachable with the control bridge. The changed non-save delete_tree tail is covered by the game-free test only. Ticks when an in-game delete runs.
  • mise run test passes (any failure that also fails on main is named). Rebased onto a2dc5385; tests/run_all.py --strict --jobs 3 inside systemd-run --user --scope -p MemoryMax=8G -p MemorySwapMax=0 with the pinned headers. main at 9e10f6f7 was 911/22/18; at a2dc5385 it is 911 passed / 23 failed / 18 skipped in 635 s — the 23rd is tests/test_sim_turf_pools.py; this head 074a38f5: 912 / 23 / 18 in 617 s. Failing names identical (23, compared name by name): nx2/test_import_windows.py, tests/test_close_waits_for_save.py, tests/test_compile_zero_byte.py, tests/test_cpm_discovery.py, tests/test_damaged_rom_files.py, tests/test_dev_packs.py, tests/test_draw_stream_visibility.py, tests/test_fs_save_commit.py, tests/test_fsr_uniform_ownership.py, tests/test_guest_copies.py, tests/test_hold_toggle.py, tests/test_lower_atomg_cas.py, tests/test_menu_i18n.py, tests/test_menu_keys.py, tests/test_menu_slider_ends.py, tests/test_mise_build.py, tests/test_pads_after_menu.py, tests/test_recording_admission.py, tests/test_sim_turf_pools.py, tests/test_sim_turf_settings.py, tests/test_switch_table.py, tests/test_tls_objects.py, tests/test_vibration_menu.py. The 23rd, tests/test_sim_turf_pools.py, is new on a2dc5385 since 9e10f6f7 and is #2174's stale check (it asserts the old zero turf floor, while #2174 made the floor the game's size); it fails identically here. The extra pass is the new tests/test_fs_delete_dir.py (0.1 s). The four checks that read host/nn_fs.c and still fail on main (test_fs_save_commit, test_damaged_rom_files, test_close_waits_for_save, test_guest_copies) fail identically here; test_host_guest_writes passes on both after #2171.
  • 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.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows: the host/nn_fs.c COFF object above (llvm-mingw 20261104); the full Windows link is not made here. Linux: the pack over a2dc5385 at 074a38f5 compiles host/nn_fs.c and links.

Ready to merge

  • Everything in Still to test has run, its results in Tested. Windows has not: the @Beanstalk request was posted on 2026-11-22 00:02, BeanBot answered that only a member of BigBeans can start it, and no approval has come yet. The by-hand item has not run either. Ticks when that result is in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). One Tier 1 machine has run: Arch Linux, RTX 4070 Ti, NVIDIA 620.70.06 (the in-game smoke above). Tier 1's Windows half has not, which is the same pending Windows item.
  • Approved in review, every comment answered. No review yet (pr status: Reviews: none); the Beanstalk approval is waiting for a BigBean.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold. On head 074a38f5 after the rebase: the description check passed, 11 checks still running, every build and test job Blocked by required conditions. The suite re-run and the re-confirmed in-game evidence are in the comment and box above; re-confirm CI when it reports.
## Summary `nn::fs::DeleteDirectoryRecursively` calls `delete_tree(path)` and returns 0 whatever happened. `delete_tree` dropped every result from `DeleteFileA`, its recursion and the final `RemoveDirectoryA`, so: - a folder that cannot be removed — a file held open by the game, a cloud client or an antivirus, or read-only after a restore — is reported deleted. The player's confirmed save-delete appears to work, `save:/` is unchanged, and the slot lists again; - a path that does not exist also returns 0, where Horizon answers `fs::ResultPathNotFound` (0x202), the idiom `DeleteFile` three lines away already uses. What changed (`host/nn_fs.c`, rebased over #607 so its save path is untouched): `delete_tree` returns `int` and stops at the first entry that will not go, removing the folder only when everything under it went; the HLE now answers `R_PATH_NOT_FOUND` for a vanished path and `R_PERMISSION_DENIED` (`0x320002`, `fs::ResultPermissionDenied`) when the folder outlived the attempt. #607's save branch — `save_busy`, `save_remember_deleted`, `save_remove`, `save_changed` — is byte-identical; only the in-place (non-save) tail carries the change. **This fixes the result codes only — it does not fix the 1023-byte case.** A folder at the path buffer's edge whose child path does not fit still builds a `sub` that names the folder itself and recurses without end; that is pre-existing on `main` and outside what a result code can do. The guard for it, with the find pattern's own buffer (`HOS_FS_PATTERN`), is **#2180**, which carries this change; merge this for the result codes, and #2180 alongside or after it for the long-path half. This PR does not close the long-path issue, and its checklist does not claim it. ## Testing **Tested:** new `tests/test_fs_delete_dir.py` compiles the mount table, `host_path`, `delete_tree`, `fs_delete_directory_recursively` and the HLE over the posix layer, with a stubbed `DeleteFileA` that refuses one file as Windows does: ``` main: FAIL del("save:/gone") == 0x202 FAIL del("save:/held") == 0x320002 branch: 2 passed, 0 failed (test_fs_delete_dir, test_fs_links) ``` Windows host: `host/nn_fs.c` at `074a38f5` compiles as an x86-64 COFF object with llvm-mingw 20261104's clang 23.1.5 (`--target=x86_64-w64-mingw32 -fms-extensions -D_CRT_SECURE_NO_WARNINGS -march=native -ffp-contract=off -O2 -g0 -mcx16 -DA64_POLLING -DA64_WRITE_TRACK`, headers from `host/`, `third_party/a64-kit/rt` and the base's generated `gen/`); the full Windows game is not linked on this PC. The five checks that read `nn_fs.c` and fail here (`test_fs_save_commit`, `test_host_guest_writes`, `test_damaged_rom_files`, `test_close_waits_for_save`, `test_guest_copies`) fail identically on untouched `1885234b` (`0 passed, 5 failed`) — pre-existing test drift from #607, not this branch. That comparison no longer holds against current `main`: `#2171` changed `tests/test_host_guest_writes.py`, one of the five, so the drift is fixed there and this head is simply behind it (the rebase below). `run_all --strict` on the whole tree: main 813/116/18, branch 814/116/18, failing names identical, the extra pass being the new check. In the game: Arch Linux, Hyprland, RTX 4070 Ti (NVIDIA 620.70.06), a pack over `1885234b`, from this branch at `2d01cab6`: Kokiri Forest (child), 20 s after warm-up — 1811 frames, 90.6 fps, median 11.07 ms, 0 cold frames (base: 1820 frames, 91.0 fps, 11.02 ms). **That run does not cover the head.** `2d01cab6`'s base is `1101b612`, which predates #607 (`a1c09a3c`), and the head `074a38f5` carries #607's save path: `git diff 2d01cab6 074a38f5 -- host/nn_fs.c` is **952 insertions / 58 deletions**, i.e. #607's whole change to the file, so the save-delete path whose result codes this PR changes was not in the smoked build. Head smoke at `074a38f5` (pack over `a2dc5385`, gpu mode alone, `HOS_FS_TRACE=1`; runs `pr2154-head-smoke`, `pr2154-save2` and `pr2154-erase2-probe`): the game boots to its title, `Continue` opens its Load screen, the repository save loads and plays Kokiri Forest (child), and the game quits cleanly — the head build runs and its save path works. The pause menu's System → Save, with **Save** focused (not Cancel), writes a real **manual save**: `slot_02` appeared at 01:56:20 with `progress.sav` and `caption.sav` and the log's `fs: save: published 2 files`, and the Load screen lists it untagged at 1:56 a.m. above the two `Autosave` rows (1:43 and 1/1 12:00). **The manual slot's detail panel offers `Load` and `Cancel` only — no Erase**, and the autosave rows are the same; X, Y, ZR, ZL, − and the arrows on the Load screen change nothing, and the title's Options has no erase. The log has no `fs: delete tree` line, and `slot_02`'s `progress.sav` and `caption.sav` are still there afterwards. The game's erase is not a control the control bridge can press on this PC, so no in-game recursive delete ran; the changed non-save `delete_tree` tail is host-only, does not run in the game here, and is covered by `tests/test_fs_delete_dir.py`. **Still to test:** - Windows: the failure path itself (a file really held open, a read-only file) and `\\?\` long paths — this PC can only stub `DeleteFileA` (by hand). - In game, a recursive delete: the Load screen's detail for a real manual save (`slot_02`, 1:56 a.m.) offers `Load`/`Cancel` only — no Erase — so the changed non-save `delete_tree`/result-code tail has no in-game run. It is covered by `tests/test_fs_delete_dir.py`; a person with the game's own erase, or a route that does one, would settle it by hand. ## Measurements Nothing to measure: the change adds result codes to a delete path, not a frame path; the in-game run above is a boot/play check and its one-run difference is not attributable. ## Risks A delete that used to report success while failing now reports a failure the game can show; a caller that ignores the result behaves as before but no longer silently loses the delete. #607's save semantics are preserved verbatim (checked with `git diff a1c09a3c HEAD -- host/nn_fs.c`: only the define, `delete_tree`'s return and the non-save tail). The one thing a result code cannot reach stays as it is on `main`: a folder at the 1023-byte edge whose child path does not fit still recurses without end, and that is #2180's guard, not this change's. No switch; a revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. The head build runs at `074a38f5` (title, Load screen, load and play, clean quit), and a manual save is real (`slot_02`, 01:56:20, `fs: save: published 2 files`), but no in-game recursive delete could be made: the Load screen's detail for that manual slot offers `Load`/`Cancel` only — no Erase reachable with the control bridge. The changed non-save `delete_tree` tail is covered by the game-free test only. Ticks when an in-game delete runs. - [x] `mise run test` passes (any failure that also fails on `main` is named). Rebased onto `a2dc5385`; `tests/run_all.py --strict --jobs 3` inside `systemd-run --user --scope -p MemoryMax=8G -p MemorySwapMax=0` with the pinned headers. `main` at `9e10f6f7` was 911/22/18; at `a2dc5385` it is **911 passed / 23 failed / 18 skipped in 635 s** — the 23rd is `tests/test_sim_turf_pools.py`; this head `074a38f5`: **912 / 23 / 18 in 617 s**. Failing names identical (23, compared name by name): `nx2/test_import_windows.py`, `tests/test_close_waits_for_save.py`, `tests/test_compile_zero_byte.py`, `tests/test_cpm_discovery.py`, `tests/test_damaged_rom_files.py`, `tests/test_dev_packs.py`, `tests/test_draw_stream_visibility.py`, `tests/test_fs_save_commit.py`, `tests/test_fsr_uniform_ownership.py`, `tests/test_guest_copies.py`, `tests/test_hold_toggle.py`, `tests/test_lower_atomg_cas.py`, `tests/test_menu_i18n.py`, `tests/test_menu_keys.py`, `tests/test_menu_slider_ends.py`, `tests/test_mise_build.py`, `tests/test_pads_after_menu.py`, `tests/test_recording_admission.py`, `tests/test_sim_turf_pools.py`, `tests/test_sim_turf_settings.py`, `tests/test_switch_table.py`, `tests/test_tls_objects.py`, `tests/test_vibration_menu.py`. The 23rd, `tests/test_sim_turf_pools.py`, is new on `a2dc5385` since `9e10f6f7` and is #2174's stale check (it asserts the old zero turf floor, while #2174 made the floor the game's size); it fails identically here. The extra pass is the new `tests/test_fs_delete_dir.py` (0.1 s). The four checks that read `host/nn_fs.c` and still fail on `main` (`test_fs_save_commit`, `test_damaged_rom_files`, `test_close_waits_for_save`, `test_guest_copies`) fail identically here; `test_host_guest_writes` passes on both after #2171. - [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. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows: the `host/nn_fs.c` COFF object above (llvm-mingw 20261104); the full Windows link is not made here. Linux: the pack over `a2dc5385` at `074a38f5` compiles `host/nn_fs.c` and links. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. Windows has not: the `@Beanstalk` request was posted on 2026-11-22 00:02, BeanBot answered that only a member of `BigBeans` can start it, and no approval has come yet. The by-hand item has not run either. Ticks when that result is in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). One Tier 1 machine has run: Arch Linux, RTX 4070 Ti, NVIDIA 620.70.06 (the in-game smoke above). Tier 1's Windows half has not, which is the same pending Windows item. - [ ] Approved in review, every comment answered. No review yet (`pr status`: Reviews: none); the Beanstalk approval is waiting for a BigBean. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. On head `074a38f5` after the rebase: the description check passed, 11 checks still running, every build and test job `Blocked by required conditions`. The suite re-run and the re-confirmed in-game evidence are in the comment and box above; re-confirm CI when it reports.
fix(fs): DeleteDirectoryRecursively says when the folder is still there
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
342f665d9f
delete_tree returned nothing, so its DeleteFileA, its recursive call and its
RemoveDirectoryA were all made without looking at the answer, and
DeleteDirectoryRecursively answered 0 whatever happened: a folder whose file
another process holds open (or a read-only one after a restore) was reported
deleted, and so was a path that does not exist, where Horizon answers
fs::ResultPathNotFound (0x202) as DeleteFile three lines up already does.

delete_tree now stops at the first thing that would not go and says whether
the folder went. DeleteDirectoryRecursively answers 0x202 for a path that is
not there, and fs::ResultPermissionDenied (0x320002, the fs code behind a
refused delete) for a folder that outlived the attempt; success is still 0.

Windows is the target: host files are opened without FILE_SHARE_DELETE there,
and a read-only file cannot be deleted. On Linux the posix layer reports the
same refusals (unlink/rmdir EACCES, EROFS, ENOTEMPTY) as ERROR_ACCESS_DENIED,
so the walk and the result are right there too.

tests/test_fs_delete_dir.py compiles delete_tree and the HLE over the posix
file functions, with DeleteFileA refusing one file as Windows does and a
missing path, a held file at the top and a held file deepest first. It fails
on main (the missing path and the held folder both answer 0) and passes here.
Author
Contributor

Tested in game: Kokiri Forest (child), pack over 1885234b, 20 s: 90.6 fps median 11.07 ms, 0 cold frames; boots and plays. Arch Linux/Hyprland, RTX 4070 Ti, NVIDIA 620.70.06. Windows failure path is by hand.

Tested in game: Kokiri Forest (child), pack over 1885234b, 20 s: 90.6 fps median 11.07 ms, 0 cold frames; boots and plays. Arch Linux/Hyprland, RTX 4070 Ti, NVIDIA 620.70.06. Windows failure path is by hand.
dazemc force-pushed fix/fs-delete-dir-result from 342f665d9f
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 992432afbc
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 28s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-21 23:33:50 +00:00
Compare
Author
Contributor

Rebased onto 344deb6c (head 992432af); host/nn_fs.c is untouched by the commits since, so the run and the suite diff hold.

Rebased onto 344deb6c (head 992432af); host/nn_fs.c is untouched by the commits since, so the run and the suite diff hold.
Author
Contributor

@Beanstalk Windows: on this branch, delete a save slot with a file held open, and again with a read-only file in the folder — each should return a failure result instead of silent success, and the folder should still be there afterwards. A missing path should give 0x202 (ResultPathNotFound).

Ready otherwise.

@Beanstalk Windows: on this branch, delete a save slot with a file held open, and again with a read-only file in the folder — each should return a failure result instead of silent success, and the folder should still be there afterwards. A missing path should give `0x202` (`ResultPathNotFound`). Ready otherwise.
Member

@dazemc only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for 992432a, and the PR has changed since (074a38f), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@dazemc only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `992432a`, and the PR has changed since (`074a38f`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
dazemc changed title from fix(fs): DeleteDirectoryRecursively says when the folder is still there to WIP: fix(fs): DeleteDirectoryRecursively says when the folder is still there 2026-11-22 01:42:02 +00:00
Author
Contributor

Back to WIP for one box: this head's merge base is 344deb6c, and main has since moved to a2dc5385 with #2171 (9e10f6f7) fixing the game-free checks (~199 test files, tests/test_host_guest_writes.py among them — one of the five this description names as failing identically). The suite numbers here were measured against the old main (813/116/18 there, now 911/22/18), so 'mise run test' is unticked until a rebase onto a2dc5385 and a re-run of tests/run_all.py --strict, the five checks that read host/nn_fs.c included.

The in-game smoke stands: its record (2d01cab6, 1811 frames, 90.6 fps, 0 cold frames) matches, and host/nn_fs.c's changed lines are identical to the head's.

The Ready to merge boxes stay unticked, each with its reason beside it: the Windows failure path (held file, read-only, \\?\ paths) is with the Test Farm, waiting for a BigBean; no review yet; CI's build/test jobs are still pending.

Back to WIP for one box: this head's merge base is `344deb6c`, and `main` has since moved to `a2dc5385` with **#2171** (`9e10f6f7`) fixing the game-free checks (~199 test files, `tests/test_host_guest_writes.py` among them — one of the five this description names as failing identically). The suite numbers here were measured against the old `main` (813/116/18 there, now 911/22/18), so 'mise run test' is unticked until a rebase onto `a2dc5385` and a re-run of `tests/run_all.py --strict`, the five checks that read `host/nn_fs.c` included. The in-game smoke stands: its record (`2d01cab6`, 1811 frames, 90.6 fps, 0 cold frames) matches, and `host/nn_fs.c`'s changed lines are identical to the head's. The Ready to merge boxes stay unticked, each with its reason beside it: the Windows failure path (held file, read-only, `\\?\` paths) is with the Test Farm, waiting for a BigBean; no review yet; CI's build/test jobs are still pending.
dazemc force-pushed fix/fs-delete-dir-result from 992432afbc
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 28s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 074a38f536
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (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
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 6s
2026-11-22 01:48:10 +00:00
Compare
Author
Contributor

Rebased onto a2dc5385: head is now 074a38f5. The rebase was clean — one commit replayed with no conflicts.

Full game-free suite, run in the same shape as a clean a2dc5385 baseline (tests/run_all.py --strict --jobs 3, systemd-run --user --scope -p MemoryMax=8G -p MemorySwapMax=0, the pinned headers):

  • clean a2dc5385: 911 passed / 23 failed / 18 skipped in 635 s
  • this head 074a38f5: 912 / 23 / 18 in 617 s

Failing names identical, compared name by name (23); the extra pass is the new tests/test_fs_delete_dir.py. The one name new on a2dc5385 since 9e10f6f7 is tests/test_sim_turf_pools.py: #2174 changed the simulated-turf floor while that old check still asserts a zero floor, so it is stale on main and red identically here. The four checks that read host/nn_fs.c and still fail on main (test_fs_save_commit, test_damaged_rom_files, test_close_waits_for_save, test_guest_copies) fail identically here; test_host_guest_writes passes on both after #2171.

In-game evidence (Jev: 0.65, likely valid): the smoked 2d01cab6 record matches, the changed lines in host/nn_fs.c are identical to this head, and no commit in 344deb6c..a2dc5385 touches it. No new in-game run was made.

For fspath: this PR's head is now 074a38f5, so fix/fs-pattern-buffer should rebase onto that before it opens.

Rebased onto `a2dc5385`: head is now `074a38f5`. The rebase was clean — one commit replayed with no conflicts. Full game-free suite, run in the same shape as a clean `a2dc5385` baseline (`tests/run_all.py --strict --jobs 3`, `systemd-run --user --scope -p MemoryMax=8G -p MemorySwapMax=0`, the pinned headers): - clean `a2dc5385`: **911 passed / 23 failed / 18 skipped in 635 s** - this head `074a38f5`: **912 / 23 / 18 in 617 s** Failing names identical, compared name by name (23); the extra pass is the new `tests/test_fs_delete_dir.py`. The one name new on `a2dc5385` since `9e10f6f7` is `tests/test_sim_turf_pools.py`: #2174 changed the simulated-turf floor while that old check still asserts a zero floor, so it is stale on `main` and red identically here. The four checks that read `host/nn_fs.c` and still fail on `main` (`test_fs_save_commit`, `test_damaged_rom_files`, `test_close_waits_for_save`, `test_guest_copies`) fail identically here; `test_host_guest_writes` passes on both after #2171. In-game evidence (Jev: **0.65, likely valid**): the smoked `2d01cab6` record matches, the changed lines in `host/nn_fs.c` are identical to this head, and no commit in `344deb6c..a2dc5385` touches it. No new in-game run was made. For fspath: this PR's head is now `074a38f5`, so `fix/fs-pattern-buffer` should rebase onto that before it opens.
dazemc changed title from WIP: fix(fs): DeleteDirectoryRecursively says when the folder is still there to fix(fs): DeleteDirectoryRecursively says when the folder is still there 2026-11-22 02:59:15 +00:00
Author
Contributor

@Beanstalk Windows: on this branch, delete a save slot with a file held open, and again with a read-only file in the folder — each should return a failure result instead of silent success, and the folder should still be there afterwards. A missing path should give 0x202 (ResultPathNotFound).

Head: 074a38f5 (rebased onto a2dc5385).

@Beanstalk Windows: on this branch, delete a save slot with a file held open, and again with a read-only file in the folder — each should return a failure result instead of silent success, and the folder should still be there afterwards. A missing path should give `0x202` (`ResultPathNotFound`). Head: `074a38f5` (rebased onto `a2dc5385`).
Member

@dazemc only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@dazemc only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
dazemc changed title from fix(fs): DeleteDirectoryRecursively says when the folder is still there to WIP: fix(fs): DeleteDirectoryRecursively says when the folder is still there 2026-11-22 07:50:56 +00:00
Author
Contributor

The in-game claim was wrong and is corrected: the smoked 2d01cab6 sits on 1101b612, which predates #607, and git diff 2d01cab6 074a38f5 -- host/nn_fs.c is 952 insertions / 58 deletions — #607's whole change to the file — so the run does not cover the head's save-delete path. Back to WIP with the game box unticked. A head smoke at 074a38f5 is queued after the current queue: a game run that deletes a save slot through the game's file-select Erase and checks the slot's folder. Re-ready when it lands.

The in-game claim was wrong and is corrected: the smoked `2d01cab6` sits on `1101b612`, which predates #607, and `git diff 2d01cab6 074a38f5 -- host/nn_fs.c` is 952 insertions / 58 deletions — #607's whole change to the file — so the run does not cover the head's save-delete path. Back to WIP with the game box unticked. A head smoke at `074a38f5` is queued after the current queue: a game run that deletes a save slot through the game's file-select Erase and checks the slot's folder. Re-ready when it lands.
Author
Contributor

Head smoke at 074a38f5 (pack over a2dc5385, gpu mode alone, HOS_FS_TRACE=1) is in, and it does not reach the game's Erase, so the in-game box stays unticked and the PR stays WIP.

What ran: title → Continue → Load screen; New Game → pause → System → Save into a manual slot slot_01; the game loads and plays Kokiri Forest (child) and quits cleanly (run runs/pr2154-head-smoke, shots 01-newgame-play/02-save-picker/03-saved).

What it could not do: erase. With a real slot_01 present (runs/pr2154-erase-probe, shots 00-load.png — both slots listed — and 01-detail.png/02-detail-down.png), the Load screen's detail for the manual slot shows Load/Cancel only; the Save screen has Save/Cancel; the title's Options has no erase; X, Y, ZR, ZL, − and the arrows on the Load screen change nothing. Final slot state: slot_00/progress.sav, caption.sav (17:47) and slot_01/progress.sav, caption.sav (01:43) all still present; the log has 0 fs: delete tree lines, only three fs: save: published … lines. (The earlier 04-title-screen/07-detail-down shots are gameplay: that title sequence silently failed, and I am not counting them.)

The changed non-save delete_tree tail is host-only, does not run in this game, and is covered by tests/test_fs_delete_dir.py only — that is now in Still to test and in the box's reason. Host-build row added and ticked: Windows host/nn_fs.c COFF object (llvm-mingw 20261104, clang 23.1.5, 281 symbols; runs/pr2154-win/nn_fs.obj) and the Linux pack over a2dc5385 at 074a38f5.

Not ready: the in-game box needs an actual in-game recursive delete, which needs the game's own erase (not on the rendered screen) or a route that does one.

Head smoke at `074a38f5` (pack over `a2dc5385`, gpu mode alone, `HOS_FS_TRACE=1`) is in, and it does **not** reach the game's Erase, so the in-game box stays unticked and the PR stays WIP. What ran: title → `Continue` → Load screen; New Game → pause → System → Save into a manual slot `slot_01`; the game loads and plays Kokiri Forest (child) and quits cleanly (run `runs/pr2154-head-smoke`, shots `01-newgame-play`/`02-save-picker`/`03-saved`). What it could not do: erase. With a real `slot_01` present (`runs/pr2154-erase-probe`, shots `00-load.png` — both slots listed — and `01-detail.png`/`02-detail-down.png`), the Load screen's detail for the manual slot shows **Load/Cancel only**; the Save screen has Save/Cancel; the title's Options has no erase; X, Y, ZR, ZL, − and the arrows on the Load screen change nothing. Final slot state: `slot_00/progress.sav`, `caption.sav` (17:47) and `slot_01/progress.sav`, `caption.sav` (01:43) all still present; the log has **0** `fs: delete tree` lines, only three `fs: save: published …` lines. (The earlier `04-title-screen`/`07-detail-down` shots are gameplay: that title sequence silently failed, and I am not counting them.) The changed non-save `delete_tree` tail is host-only, does not run in this game, and is covered by `tests/test_fs_delete_dir.py` only — that is now in Still to test and in the box's reason. Host-build row added and ticked: Windows `host/nn_fs.c` COFF object (llvm-mingw 20261104, clang 23.1.5, 281 symbols; `runs/pr2154-win/nn_fs.obj`) and the Linux pack over `a2dc5385` at `074a38f5`. Not ready: the in-game box needs an actual in-game recursive delete, which needs the game's own erase (not on the rendered screen) or a route that does one.
Author
Contributor

Correction to the smoke wording above, from the confirmed pause-menu and Save screens: there is no manual slot. The pause menu's System → Save opens one entry (the current play) with Save/Cancel, and choosing it writes a second autosave (slot_01, 01:43). The Load screen then lists slot_01 and slot_00, both tagged Autosave, each with Load/Cancel only — no Erase. So the only reachable slots are autosaves and Erase is unavailable; the in-game box stays unticked for that exact reason, and the PR stays WIP. The changed non-save delete_tree tail remains covered by tests/test_fs_delete_dir.py only.

Correction to the smoke wording above, from the confirmed pause-menu and Save screens: there is **no manual slot**. The pause menu's System → Save opens one entry (the current play) with Save/Cancel, and choosing it writes a second **autosave** (`slot_01`, 01:43). The Load screen then lists `slot_01` and `slot_00`, both tagged Autosave, each with `Load`/`Cancel` only — no Erase. So the only reachable slots are autosaves and Erase is unavailable; the in-game box stays unticked for that exact reason, and the PR stays WIP. The changed non-save `delete_tree` tail remains covered by `tests/test_fs_delete_dir.py` only.
Author
Contributor

The save was real this time and the answer is now conclusive. With Save focused (not Cancel — my earlier press was on Cancel and cancelled), the pause menu's System → Save wrote a genuine manual save: slot_02 at 01:56:20, progress.sav + caption.sav, log fs: save: published 2 files. The Load screen lists it untagged at 1:56 a.m. above the two Autosave rows (1:43, 1/1 12:00) — shots runs/pr2154-erase2-probe/shots/00-load.png, and its detail 01-detail.png: Load/Cancel only, no Erase (02-detail-down.png the same). slot_02 is still on disk after the probe; the log has no fs: delete tree.

So the game has no erase control on the rendered screen even for a manual save, and the control bridge cannot press one; the in-game box stays unticked for that exact reason and the PR stays WIP. The changed non-save delete_tree tail is covered by tests/test_fs_delete_dir.py only. A person with the game's own erase, or a route that does one, would settle it by hand.

The save was real this time and the answer is now conclusive. With **Save** focused (not Cancel — my earlier press was on Cancel and cancelled), the pause menu's System → Save wrote a genuine manual save: `slot_02` at **01:56:20**, `progress.sav` + `caption.sav`, log `fs: save: published 2 files`. The Load screen lists it untagged at **1:56 a.m.** above the two `Autosave` rows (1:43, 1/1 12:00) — shots `runs/pr2154-erase2-probe/shots/00-load.png`, and its detail `01-detail.png`: **`Load`/`Cancel` only, no Erase** (`02-detail-down.png` the same). `slot_02` is still on disk after the probe; the log has no `fs: delete tree`. So the game has no erase control on the rendered screen even for a manual save, and the control bridge cannot press one; the in-game box stays unticked for that exact reason and the PR stays WIP. The changed non-save `delete_tree` tail is covered by `tests/test_fs_delete_dir.py` only. A person with the game's own erase, or a route that does one, would settle it by hand.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (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
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/fs-delete-dir-result:dazemc-fix/fs-delete-dir-result'
git switch 'dazemc-fix/fs-delete-dir-result'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!2154
No description provided.