F1 menu: RESET says when the settings file could not be removed (#4939) #4978

Closed
github-bot wants to merge 1 commit from github-bot/gh-4977 into main AGit
Owner

@⁠RochDawid on GitHub · 2026-12-01 16:12 UTC · original
RochDawid:fix/4939-menu-reset → main · +43 −5 · 1 files · 1 commits · closed without merging

Refs #4940

What it changes

Point 4 of #4940. Since the #4635 rewrite of menu.rs, F1's RESET ignores the result of deleting victory-settings.txt and always shows RESET. PLAY DEFAULTS AT THE NEXT START. If the delete fails (the file is read-only, or an editor holds it open), the old settings come back at the next start while the menu said they were reset. With no folder for the file, it also said RESET.

This brings back what main did before #4635 (#2256's reset_at), as a small function reset_file the menu's reset calls:

  • the file is removed: RESET. PLAY DEFAULTS AT THE NEXT START, as now;
  • the file is not there: the same, since it is reset already;
  • the file cannot be removed: COULD NOT RESET THE SETTINGS FILE, and a warning in the log with the path and the error;
  • no folder for the file (VICTORY_MENU_FILE, VICTORY_HOME and LOCALAPPDATA all unset): NO FOLDER FOR THE SETTINGS FILE.

The strings are the ones the menu used before #4635. Nothing else in the menu changes.

The other points of #4940 are not in this pull request: point 2 is #4969, point 3 is #4943, point 5 is #4951. Point 1 (the mouse in F1) has no pull request that I found.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): not run in a game. The menu was not opened.
  • Before: n/a
  • After: n/a
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a
  • cargo test passed for the crates it touches: not run. The new test host::menu::tests::reset_says_when_the_settings_file_stays (removed file, missing file, a folder in the file's place, no folder) builds and links for x86_64-pc-windows-msvc (cargo xwin test -p victory-gpu --lib --no-run), but I have no Windows machine to run it on.
  • Clippy: on this branch alone, both gates report only the five findings main has had since #4635, which #4680 fixes. With #4680's commit applied on top (locally, not pushed), cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features pass for --target x86_64-pc-windows-msvc. Run on macOS through cargo xwin with Rust 1.98.1, at 733d4ad5.
  • cargo xtask policy --staged: 1 file ok.
  • CI: until #4680 (or another fix for those five findings) is merged, this pull request's check job fails at Clippy on those inherited findings, not on this change.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4969, #4943 and #4951 (other points of #4940; none touches reset). Other open pull requests that change host/menu.rs (for example #4765, #4712) do not change reset. #4680 for the inherited Clippy findings.
**@⁠RochDawid** on GitHub · 2026-12-01 16:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4977) `RochDawid:fix/4939-menu-reset` → `main` · +43 −5 · 1 files · 1 commits · closed without merging Refs #4940 ## What it changes Point 4 of #4940. Since the #4635 rewrite of `menu.rs`, F1's RESET ignores the result of deleting `victory-settings.txt` and always shows `RESET. PLAY DEFAULTS AT THE NEXT START`. If the delete fails (the file is read-only, or an editor holds it open), the old settings come back at the next start while the menu said they were reset. With no folder for the file, it also said RESET. This brings back what `main` did before #4635 (#2256's `reset_at`), as a small function `reset_file` the menu's `reset` calls: - the file is removed: `RESET. PLAY DEFAULTS AT THE NEXT START`, as now; - the file is not there: the same, since it is reset already; - the file cannot be removed: `COULD NOT RESET THE SETTINGS FILE`, and a warning in the log with the path and the error; - no folder for the file (`VICTORY_MENU_FILE`, `VICTORY_HOME` and `LOCALAPPDATA` all unset): `NO FOLDER FOR THE SETTINGS FILE`. The strings are the ones the menu used before #4635. Nothing else in the menu changes. The other points of #4940 are not in this pull request: point 2 is #4969, point 3 is #4943, point 5 is #4951. Point 1 (the mouse in F1) has no pull request that I found. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): not run in a game. The menu was not opened. - Before: n/a - After: n/a - For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a - `cargo test` passed for the crates it touches: not run. The new test `host::menu::tests::reset_says_when_the_settings_file_stays` (removed file, missing file, a folder in the file's place, no folder) builds and links for `x86_64-pc-windows-msvc` (`cargo xwin test -p victory-gpu --lib --no-run`), but I have no Windows machine to run it on. - Clippy: on this branch alone, both gates report only the five findings `main` has had since #4635, which #4680 fixes. With #4680's commit applied on top (locally, not pushed), `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features` pass for `--target x86_64-pc-windows-msvc`. Run on macOS through `cargo xwin` with Rust 1.98.1, at 733d4ad5. - `cargo xtask policy --staged`: 1 file ok. - CI: until #4680 (or another fix for those five findings) is merged, this pull request's `check` job fails at Clippy on those inherited findings, not on this change. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4969, #4943 and #4951 (other points of #4940; none touches `reset`). Other open pull requests that change `host/menu.rs` (for example #4765, #4712) do not change `reset`. #4680 for the inherited Clippy findings.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:17:57 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 16:26 UTC · original

I checked 733d4ad5 on Windows with Rust 1.98.1. A small standalone harness ran the exact reset_file function and the test from this PR. The PR's test and one Windows-specific check both passed.

The second check held a synthetic settings file open without delete sharing. On 5fabb46e, the original RESET method displayed success while the file stayed in place. With this PR, the method reported COULD NOT RESET THE SETTINGS FILE and preserved the file bytes. Releasing the handle and retrying removed the file and returned the success message.

This exercised the filesystem behavior in isolation. I didn't run the full crate suite or open F1 in-game.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 16:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4977#issuecomment-7317601507) I checked `733d4ad5` on Windows with Rust 1.98.1. A small standalone harness ran the exact `reset_file` function and the test from this PR. The PR's test and one Windows-specific check both passed. The second check held a synthetic settings file open without delete sharing. On `5fabb46e`, the original RESET method displayed success while the file stayed in place. With this PR, the method reported `COULD NOT RESET THE SETTINGS FILE` and preserved the file bytes. Releasing the handle and retrying removed the file and returned the success message. This exercised the filesystem behavior in isolation. I didn't run the full crate suite or open F1 in-game.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-12-01 17:43 UTC · original

Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.

Base 5fabb46eaf6ed8771321787f8871051abde69b9b, head 733d4ad5beda357c1be4d4e2a382601acfc3c78d. git diff --numstat → crates/victory-gpu/src/host/menu.rs 43/5.

The test is new on the base:

git grep -F reset_says_when_the_settings_file_stays 5fabb46e -- .

→ no match, exit 1.

git diff --check "5fabb46e..733d4ad5" → no output, exit 0.

$env:CARGO_TARGET_DIR='D:\Victory-Contrib\NVIDIA-Contrib\target-4977'
cargo test --locked -p victory-gpu --lib -- host::menu::tests::reset_says_when_the_settings_file_stays --exact --test-threads=1 --quiet

Result: running 1 test, test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out; finished in 0.01s.

What it covers: reset_file is a pure path -> message function, and the test walks all four outcomes on a temp dir — absent file (reset already), present file (removed, same message), a directory in the file's place (the remove_file failure arm, asserting the "COULD NOT RESET" note and that the directory is left alone), and None (no settings folder). That the failure arm is exercised through a real remove_file error rather than a mock is the useful part; the menu's note wiring itself is not asserted, only the string returned.

No settings file of the real app, no title, no device; GPU/driver N/A. No game data.

**@⁠cloph-dsp** on GitHub · 2026-12-01 17:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4977#issuecomment-7319751696) Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree. Base `5fabb46eaf6ed8771321787f8871051abde69b9b`, head `733d4ad5beda357c1be4d4e2a382601acfc3c78d`. `git diff --numstat` → crates/victory-gpu/src/host/menu.rs 43/5. The test is new on the base: ``` git grep -F reset_says_when_the_settings_file_stays 5fabb46e -- . ``` → no match, exit 1. `git diff --check "5fabb46e..733d4ad5"` → no output, exit 0. ``` $env:CARGO_TARGET_DIR='D:\Victory-Contrib\NVIDIA-Contrib\target-4977' cargo test --locked -p victory-gpu --lib -- host::menu::tests::reset_says_when_the_settings_file_stays --exact --test-threads=1 --quiet ``` Result: `running 1 test`, `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out; finished in 0.01s`. What it covers: `reset_file` is a pure path -> message function, and the test walks all four outcomes on a temp dir — absent file (reset already), present file (removed, same message), a *directory* in the file's place (the `remove_file` failure arm, asserting the "COULD NOT RESET" note and that the directory is left alone), and `None` (no settings folder). That the failure arm is exercised through a real `remove_file` error rather than a mock is the useful part; the menu's `note` wiring itself is not asserted, only the string returned. No settings file of the real app, no title, no device; GPU/driver N/A. No game data.
github-bot closed this pull request 2026-12-01 18:30:15 +00:00
Author
Owner

@⁠RochDawid on GitHub · 2026-12-01 18:25 UTC · original

Closing: main has this now. f5c67e18 put the F1 menu back on the paged menu, whose reset again reports a delete that failed as COULD NOT RESET THE SETTINGS FILE (reset_at, with its test reset_settings_reports_errors_and_accepts_missing_file). Thanks for the two Windows checks above.

**@⁠RochDawid** on GitHub · 2026-12-01 18:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4977#issuecomment-7320913497) Closing: `main` has this now. f5c67e18 put the F1 menu back on the paged menu, whose `reset` again reports a delete that failed as `COULD NOT RESET THE SETTINGS FILE` (`reset_at`, with its test `reset_settings_reports_errors_and_accepts_missing_file`). Thanks for the two Windows checks above.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/trustno1-coder--VIctory-NVIDIA!4978
No description provided.