test(menu): the menu-keys check compiles again, and closes the menu after Menu shortcut changes #2176

Open
dazemc wants to merge 1 commit from dazemc/Longshot:test/issue2127-menu-shortcut-close into main
Contributor

Summary

tests/test_menu_keys.py does not compile on main @ 9e10f6f7: it stops at error: redefinition of 'std::mutex options_save_mu' before a single case is built, so a red check has been sitting on main since #2126 and #2171 each added that declaration to the check's fixture (one beside the menu_tick stubs, one beside save()'s). This keeps one, beside save(), which takes that lock. The check runs again.

It also pins what #2127 reports: the menu could not be closed after Menu shortcut was changed from Esc to "Insert or F1", then to "F1 only". The tick's close path is not where a press can stay eaten: the branches that spend one (a pending restart's question, the debug warning, a text field) each end on the next press, and the row takes no restart. The new case drives the real key poll and close path for each of the row's three values, right after the value changes, with the queued press Windows uses and the polled one: F1 always closes; Insert closes unless the row is "F1 only", where Insert is left to an overlay by design.

A reviewer reads tests/test_menu_keys.py: test_menu_shortcut_closes (the new case) and the fixture line that is no longer declared twice.

Test-only: it changes no binary. Nothing here runs in the game; the in-game rule does not apply. See #2127: its comment has the report's root cause, the game's own pause menu and the keys controller software synthesizes (#1992, #1563), which this commit does not touch.

Testing

Tested: Linux, g++ (the check compiles its own fixture; no GPU and no game run: no binary changes). tests/test_menu_keys.py passes: 7 PASS lines, the new one being PASS: after changing Menu shortcut, every shortcut the row offers closes the open menu. The same run through abrun.sh, once the shared lock freed, printed the same 7 lines, with the menu checks that read the same sources beside it (the run); the branch now sits on a2dc5385, whose diff touches none of the files this check reads, and the full suite in the checklist re-ran tests/test_menu_keys.py on this head, where it passed. On main @ 9e10f6f7 the same check does not compile, so it has no output at all: error: redefinition of 'std::mutex options_save_mu'.

Negative control: with the close path's press[0] dropped (the press eaten, as the report reads), the new case fails at FAIL:488 press(o, VK_INSERT, queued, true) == (mode == 1) — the first "open, then Insert" for "Insert or F1" and "Insert, F1 or Esc".

The menu checks that read the same sources pass beside it: test_menu_ini_keys, test_menu_hooks, test_menu_modules, test_menu_rows_model, test_menu_restart.

What the focused set proves: the menu key poll and close path do what the new case says, and the new case fails when the close path does not answer to Insert (the negative control above). The rest of the suite is the run in the checklist.

Still to test: None.

Measurements

None: it changes no binary; the check's output on main (does not compile) and here (7 PASS lines) is in Testing.

Risks

Nothing a player sees: one test file, no game code, no build output, no options or saves. 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. (Not a game change: in-game run N/A, as Testing says; the game-free runs are in Testing.)
  • mise run test passes (any failure that also fails on main is named). (main has 22 red checks at 9e10f6f7 (23 at a2dc5385); tests/test_menu_keys.py is one of them, and this PR is its fix. Ran on this head in the slot, after mise run test-deps, with LONGSHOT_SPIRV_HEADERS=_deps/spirv-headers/include LONGSHOT_VULKAN_HEADERS=_deps/vulkan-headers/include systemd-run --user --scope -p MemoryMax=12G -p MemorySwapMax=0 python3 -I -B tests/run_all.py --strict --jobs 5: 912 passed, 22 failed, 18 skipped in 395 s (linux, 5 at once). The 22 names are the refresh lane's clean a2dc5385 baseline's 23 less tests/test_menu_keys.py, an identical diff; tests/test_sim_turf_pools.py and tests/test_switch_table.py stay red because #2202 and #2197 are not in this base.)
  • 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.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
## Summary `tests/test_menu_keys.py` does not compile on `main` @ 9e10f6f7: it stops at `error: redefinition of 'std::mutex options_save_mu'` before a single case is built, so a red check has been sitting on `main` since #2126 and #2171 each added that declaration to the check's fixture (one beside the `menu_tick` stubs, one beside `save()`'s). This keeps one, beside `save()`, which takes that lock. The check runs again. It also pins what https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2127 reports: the menu could not be closed after Menu shortcut was changed from Esc to "Insert or F1", then to "F1 only". The tick's close path is not where a press can stay eaten: the branches that spend one (a pending restart's question, the debug warning, a text field) each end on the next press, and the row takes no restart. The new case drives the real key poll and close path for each of the row's three values, right after the value changes, with the queued press Windows uses and the polled one: F1 always closes; Insert closes unless the row is "F1 only", where Insert is left to an overlay by design. A reviewer reads `tests/test_menu_keys.py`: `test_menu_shortcut_closes` (the new case) and the fixture line that is no longer declared twice. **Test-only: it changes no binary.** Nothing here runs in the game; the in-game rule does not apply. See #2127: its comment has the report's root cause, the game's own pause menu and the keys controller software synthesizes (#1992, #1563), which this commit does not touch. ## Testing **Tested:** Linux, g++ (the check compiles its own fixture; no GPU and no game run: no binary changes). `tests/test_menu_keys.py` passes: 7 PASS lines, the new one being `PASS: after changing Menu shortcut, every shortcut the row offers closes the open menu`. The same run through `abrun.sh`, once the shared lock freed, printed the same 7 lines, with the menu checks that read the same sources beside it ([the run](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2176#issuecomment-70892)); the branch now sits on `a2dc5385`, whose diff touches none of the files this check reads, and the full suite in the checklist re-ran `tests/test_menu_keys.py` on this head, where it passed. On `main` @ 9e10f6f7 the same check does not compile, so it has no output at all: `error: redefinition of 'std::mutex options_save_mu'`. Negative control: with the close path's `press[0]` dropped (the press eaten, as the report reads), the new case fails at `FAIL:488 press(o, VK_INSERT, queued, true) == (mode == 1)` — the first "open, then Insert" for "Insert or F1" and "Insert, F1 or Esc". The menu checks that read the same sources pass beside it: `test_menu_ini_keys`, `test_menu_hooks`, `test_menu_modules`, `test_menu_rows_model`, `test_menu_restart`. What the focused set proves: the menu key poll and close path do what the new case says, and the new case fails when the close path does not answer to Insert (the negative control above). The rest of the suite is the run in the checklist. **Still to test:** None. ## Measurements None: it changes no binary; the check's output on `main` (does not compile) and here (7 PASS lines) is in Testing. ## Risks Nothing a player sees: one test file, no game code, no build output, no options or saves. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. (Not a game change: in-game run N/A, as Testing says; the game-free runs are in Testing.) - [x] `mise run test` passes (any failure that also fails on `main` is named). (`main` has 22 red checks at `9e10f6f7` (23 at `a2dc5385`); `tests/test_menu_keys.py` is one of them, and this PR is its fix. Ran on this head in the slot, after `mise run test-deps`, with `LONGSHOT_SPIRV_HEADERS=_deps/spirv-headers/include LONGSHOT_VULKAN_HEADERS=_deps/vulkan-headers/include systemd-run --user --scope -p MemoryMax=12G -p MemorySwapMax=0 python3 -I -B tests/run_all.py --strict --jobs 5`: 912 passed, 22 failed, 18 skipped in 395 s (linux, 5 at once). The 22 names are the refresh lane's clean `a2dc5385` baseline's 23 less `tests/test_menu_keys.py`, an identical diff; `tests/test_sim_turf_pools.py` and `tests/test_switch_table.py` stay red because #2202 and #2197 are not in this base.) - [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] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers.
test(menu): the menu-keys check compiles again, and closes the menu after Menu shortcut changes
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
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
213dad6700
The check does not compile on main 9e10f6f7: #2126 and #2171 each added the same options_save_mu
declaration to the keys fixture (one beside the menu_tick stubs, one beside save()'s), and the run stops
at "error: redefinition of 'std::mutex options_save_mu'" before a single case is built. This keeps one,
beside save(), which takes that lock (gpu/vk/vk_menu.cpp).

#2127 says the menu could not be closed after Menu shortcut was changed from Esc to "Insert or F1", then
to "F1 only". The tick's close path is not where a press can stay eaten: the branches that spend one
(a pending restart's question, the debug warning, a text field) each end on the next press, and the row
takes no restart. The new case proves it for each of the row's three values, right after the value
changes, with the queued press Windows uses and the polled one: F1 always closes; Insert closes unless
the row is "F1 only", where Insert is left to an overlay by design, and F1 closes.

Negative control: dropping press[0] from the close path (the press eaten, as the report reads) fails the
new case on the first "open, then Insert" for "Insert or F1" and "Insert, F1 or Esc".

The report's game is not this code: it shows the game's own pause menu, and controller software's keys
(#1992, #1563) explain it. This commit records that the menu's own close path is sound.

Assisted-by: opencode (DeepSeek V4.1 Flash 1017)
Author
Contributor

Through abrun.sh once the shared lock freed (another lane held it, then runall): the check and the menu checks that read the same sources, all passing.

PASS: menu shortcuts respect the saved mode, focus and key edges
PASS: after changing Menu shortcut, every shortcut the row offers closes the open menu
PASS: out of the box, Esc opens the closed menu (Insert, F1 or Esc); Insert or F1 and F1 only leave it closed
PASS: an older file's Insert or F1 moves to Insert, F1 or Esc; F1 only and a file saved now keep theirs
PASS: row reset, Reset All and conflict rebind obey the dialog's answer
PASS: confirm and back follow A and B
PASS: A and B, Enter and Esc, and clicks open and leave every page
PASS: 144 saved rows, each with its key; 144 keys as players' files hold them
PASS: the menus', the text boxes' (draw, layout) and the glyphs' hooks go first in their functions, once, only in the supported build's lift
menu modules: every place resolves; HDR where it was, shown and named as it was
PASS: the menu's modules (audio, bindings, bug_report, camera, colour_vision, controller, controller_speaker, crt, debug_tools, detail, discord, display, fps_counter, framegen, gameplay, gpu, hdr, input_recording, intel, language, laptop, menu_settings, motion, nfc, output, pipeline_list, preset, replay_cache, reshade, session, sim_turf, sprint, threads, upscaler, volume, walk, widescreen)
rows as drawn, no module: the table's own order, row for row
rows as drawn, with a module: its rows where it asked, with their own text, hint and key
PASS: the menu's rows through the model
menu restart: all checks passed
relaunch command: all checks passed
PASS: the restart rows and Restart now

Negative control, run beside them: with the close path's press[0] dropped, the new case fails at FAIL:488 press(o, VK_INSERT, queued, true) == (mode == 1).

Through `abrun.sh` once the shared lock freed (another lane held it, then `runall`): the check and the menu checks that read the same sources, all passing. ``` PASS: menu shortcuts respect the saved mode, focus and key edges PASS: after changing Menu shortcut, every shortcut the row offers closes the open menu PASS: out of the box, Esc opens the closed menu (Insert, F1 or Esc); Insert or F1 and F1 only leave it closed PASS: an older file's Insert or F1 moves to Insert, F1 or Esc; F1 only and a file saved now keep theirs PASS: row reset, Reset All and conflict rebind obey the dialog's answer PASS: confirm and back follow A and B PASS: A and B, Enter and Esc, and clicks open and leave every page PASS: 144 saved rows, each with its key; 144 keys as players' files hold them PASS: the menus', the text boxes' (draw, layout) and the glyphs' hooks go first in their functions, once, only in the supported build's lift menu modules: every place resolves; HDR where it was, shown and named as it was PASS: the menu's modules (audio, bindings, bug_report, camera, colour_vision, controller, controller_speaker, crt, debug_tools, detail, discord, display, fps_counter, framegen, gameplay, gpu, hdr, input_recording, intel, language, laptop, menu_settings, motion, nfc, output, pipeline_list, preset, replay_cache, reshade, session, sim_turf, sprint, threads, upscaler, volume, walk, widescreen) rows as drawn, no module: the table's own order, row for row rows as drawn, with a module: its rows where it asked, with their own text, hint and key PASS: the menu's rows through the model menu restart: all checks passed relaunch command: all checks passed PASS: the restart rows and Restart now ``` Negative control, run beside them: with the close path's `press[0]` dropped, the new case fails at `FAIL:488 press(o, VK_INSERT, queued, true) == (mode == 1)`.
dazemc changed title from test(menu): the menu-keys check compiles again, and closes the menu after Menu shortcut changes to WIP: test(menu): the menu-keys check compiles again, and closes the menu after Menu shortcut changes 2026-11-22 04:07:23 +00:00
Author
Contributor

WIP: the full suite is queued. The mise run test box is unticked: it is the whole suite, and only the focused set has run — tests/test_menu_keys.py (7 PASS lines, the new case among them) with test_menu_ini_keys, test_menu_hooks, test_menu_modules, test_menu_rows_model and test_menu_restart, all through abrun.sh (the run). That proves the menu key poll and close path, and that the new case fails when the close path does not answer to Insert (negative control above); it does not prove the rest.

Still to test, by hand, before ready: python3 -I -B tests/run_all.py --strict --jobs 8 in a slot (8 jobs: on this PC the runner would start 32 and each check may compile), expecting this file to pass and nothing newly red against main's own reds — 22 at 9e10f6f7, 23 at a2dc5385 (the 23rd being tests/test_sim_turf_pools.py). The description no longer claims the old 108, which was pre-#2171 drift.

WIP: the full suite is queued. The `mise run test` box is unticked: it is the whole suite, and only the focused set has run — `tests/test_menu_keys.py` (7 PASS lines, the new case among them) with `test_menu_ini_keys`, `test_menu_hooks`, `test_menu_modules`, `test_menu_rows_model` and `test_menu_restart`, all through `abrun.sh` ([the run](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2176#issuecomment-70892)). That proves the menu key poll and close path, and that the new case fails when the close path does not answer to Insert (negative control above); it does not prove the rest. Still to test, by hand, before ready: `python3 -I -B tests/run_all.py --strict --jobs 8` in a slot (8 jobs: on this PC the runner would start 32 and each check may compile), expecting this file to pass and nothing newly red against `main`'s own reds — 22 at 9e10f6f7, 23 at a2dc5385 (the 23rd being `tests/test_sim_turf_pools.py`). The description no longer claims the old 108, which was pre-#2171 drift.
dazemc force-pushed test/issue2127-menu-shortcut-close from 213dad6700
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
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 c6484ead75
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
PR description / Description follows the template (pull_request_target) Successful in 6s
2026-11-22 04:11:03 +00:00
Compare
dazemc changed title from WIP: test(menu): the menu-keys check compiles again, and closes the menu after Menu shortcut changes to test(menu): the menu-keys check compiles again, and closes the menu after Menu shortcut changes 2026-11-22 05:04:01 +00:00
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
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
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 'test/issue2127-menu-shortcut-close:dazemc-test/issue2127-menu-shortcut-close'
git switch 'dazemc-test/issue2127-menu-shortcut-close'
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!2176
No description provided.