feat(menu): the search finds a row by its options' names and hints #3272

Merged
HumanBean merged 2 commits from HumanBean/Longshot:feat/menu-search-options into main 2026-12-05 19:27:11 +00:00
Owner

Summary

The menu's search read a row's label, key and help. A player who types what an option is called or what its hint says finds nothing, or only part: on main, "aa" finds Upscaler through its help alone.

Now a choice row's option names (those this PC offers, and the one chosen) rank beside its key's words, and its options' hints and its current hint beside its help. A result still shows the row's own help. To carry the hints, a settings declaration gains choiceHints (longshot/settings-host, system mods only; additive).

searchItems (longshot/ui/kit, any mod) now ignores hyphens as it does case and accents, so "antialiasing" finds "Anti-aliasing".

Testing

Tested: Linux (CachyOS), RTX 3090: "aa" typed on the on-screen keyboard (screenshots). The new menu test ("finds a choice by its options' names and hints...") fails on the test commit and passes on the head. The existing test "finds a setting on any page" now waits until every page is indexed: earlier pages match through hints, so it no longer shows "Searching…" until the last page.

mise run test on a tree of this PR, its two sibling PRs and main @ 4e16bf06 (before the review's text corrections; the text and row tests re-run on the heads): 923 passed, 11 failed, 13 skipped; the same 11 fail on main there: test_dlssg, test_input_background, test_lifter, test_present_acquire_ahead, test_present_held_image, test_present_image_free, test_present_semaphores, test_sandbox_windows, test_settings_area_keys, test_vk_draw_overhead_lean, test_walk_key.

The menu's own tests do not compile on main (4e16bf06 to bb5a5682: game/crates/modtool/src/import.rs:396, a test from #3169 calls patches::collect without the argument #3165 added). With that call patched for the run only, both search tests pass; layout: ... (PLACED) the graphics tab, the settings page's table order and Custom fog sliders fail on main and here alike, and at times the 2.00 ms per-frame budget does. cargo test -p api: 648 passed, 1 failed (a_rows_dependencies_come_from_its_data), as on main.

Still to test:

  • A Steam Deck: that typing in the search stays smooth with the longer texts (by hand).

Measurements

Verdict: finds more; no frame cost that I can tell from the noise.

The menu's frame-cost test alone, debug build, a shared PC, 4 runs each side alternating: the worst search frame divided by the run's CPU scale.

Measured before the last rebase; main since moved to bb5a5682 without a change to the menu's search, so the comparison holds.

Before: main @ 6dbebabe After: this PR @ 9bc7eb07
Worst search frame, ms (4 runs) 2.12, 2.87, 1.46, 1.56 2.36, 2.41, 1.32, 2.19
Rows found by "aa", in game 1 (Upscaler) with its sibling Anti-aliasing row: Upscaler, Anti-aliasing, ReShade preset, DLSS model

Risks

More rows match a short word, ranked after those whose name matches. Reverting 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.
  • mise run test passes (any failure that also fails on main is named).
  • 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 check under tests/ that reads changed source is updated, not weakened.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • Docs updated.
  • Generated files regenerated (schema-gen), not edited by hand.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e16e9JsGLrugow9vJQ

## Summary The menu's search read a row's label, key and help. A player who types what an option is called or what its hint says finds nothing, or only part: on `main`, "aa" finds **Upscaler** through its help alone. Now a choice row's option names (those this PC offers, and the one chosen) rank beside its key's words, and its options' hints and its current hint beside its help. A result still shows the row's own help. To carry the hints, a settings declaration gains `choiceHints` (`longshot/settings-host`, system mods only; additive). `searchItems` (`longshot/ui/kit`, any mod) now ignores hyphens as it does case and accents, so "antialiasing" finds "Anti-aliasing". ## Testing **Tested:** Linux (CachyOS), RTX 3090: "aa" typed on the on-screen keyboard (screenshots). The new menu test ("finds a choice by its options' names and hints...") fails on the test commit and passes on the head. The existing test "finds a setting on any page" now waits until every page is indexed: earlier pages match through hints, so it no longer shows "Searching…" until the last page. `mise run test` on a tree of this PR, its two sibling PRs and `main` @ 4e16bf06 (before the review's text corrections; the text and row tests re-run on the heads): 923 passed, 11 failed, 13 skipped; the same 11 fail on `main` there: `test_dlssg`, `test_input_background`, `test_lifter`, `test_present_acquire_ahead`, `test_present_held_image`, `test_present_image_free`, `test_present_semaphores`, `test_sandbox_windows`, `test_settings_area_keys`, `test_vk_draw_overhead_lean`, `test_walk_key`. The menu's own tests do not compile on `main` (4e16bf06 to bb5a5682: `game/crates/modtool/src/import.rs:396`, a test from #3169 calls `patches::collect` without the argument #3165 added). With that call patched for the run only, both search tests pass; `layout: ... (PLACED) the graphics tab`, the settings page's table order and `Custom fog sliders` fail on `main` and here alike, and at times the 2.00 ms per-frame budget does. `cargo test -p api`: 648 passed, 1 failed (`a_rows_dependencies_come_from_its_data`), as on `main`. **Still to test:** - A Steam Deck: that typing in the search stays smooth with the longer texts (by hand). ## Measurements **Verdict:** finds more; no frame cost that I can tell from the noise. The menu's frame-cost test alone, debug build, a shared PC, 4 runs each side alternating: the worst search frame divided by the run's CPU scale. Measured before the last rebase; `main` since moved to bb5a5682 without a change to the menu's search, so the comparison holds. | | Before: main @ 6dbebabe | After: this PR @ 9bc7eb07 | |---|---|---| | Worst search frame, ms (4 runs) | 2.12, 2.87, 1.46, 1.56 | 2.36, 2.41, 1.32, 2.19 | | Rows found by "aa", in game | 1 (Upscaler) | with its sibling Anti-aliasing row: Upscaler, Anti-aliasing, ReShade preset, DLSS model | ## Risks More rows match a short word, ranked after those whose name matches. Reverting 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. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [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 check under `tests/` that reads changed source is updated, not weakened. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] Docs updated. - [x] Generated files regenerated (`schema-gen`), not edited by hand. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e16e9JsGLrugow9vJQ
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e16e9JsGLrugow9vJQ
feat(menu): the search finds a row by its options' names and hints
Some checks are pending
CI / What the change needs (pull_request) Successful in 8s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
PR description / Title and description (pull_request_target) Successful in 7s
d983f363f3
The search read a row's label, key and help, so "MAKO" or what an option's hint says found nothing. A choice's
options (those this PC offers, and the one chosen) now count beside its key's words, and their hints and the row's hint
beside its help; declarations carry the hints (choiceHints). Hyphens are dropped on both sides, so "antialiasing"
finds "anti-aliasing".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e16e9JsGLrugow9vJQ
Author
Owner

Tested in game: Linux (CachyOS), RTX 3090: "aa" typed on the on-screen keyboard in game lists Upscaler, Anti-aliasing (from the sibling PR), ReShade preset and DLSS model; on main it lists Upscaler alone.

Tested in game: Linux (CachyOS), RTX 3090: "aa" typed on the on-screen keyboard in game lists Upscaler, Anti-aliasing (from the sibling PR), ReShade preset and DLSS model; on main it lists Upscaler alone.
Author
Owner

Searching "aa", Linux, RTX 3090. The second picture is a tree with this PR and its two siblings, so the Anti-aliasing row (#3273) is listed too. main @ bb5a5682 this PR and siblings

Searching "aa", Linux, RTX 3090. The second picture is a tree with this PR and its two siblings, so the Anti-aliasing row (#3273) is listed too. ![main @ bb5a5682](https://git.magicbean.dev/attachments/329a4156-0e16-4283-97cc-2d95a63005bb) ![this PR and siblings](https://git.magicbean.dev/attachments/0b45e0de-883d-4ad8-b300-ec3e4254967c)
HumanBean changed title from WIP: feat(menu): the search finds a row by its options' names and hints to feat(menu): the search finds a row by its options' names and hints 2026-12-05 19:04:27 +00:00
Author
Owner
@review
BeanBot left a comment

Recommendation: Approve. The search index can retain an outdated current hint while the menu is open. The new search behavior otherwise has an in-game demonstration, with Steam Deck responsiveness still to be checked. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

The menu searches option names and hints as well as row text, and shared UI search ignores hyphens. This makes more settings discoverable at the cost of indexing longer text.

Should fix (1): not blocking, but worth doing before merging.

  • L1 game/mods/menu/src/view.ts:423: The current hint is copied into the index once, but row changes do not invalidate that indexed page. (more on the line) Do: Invalidate or update the affected search part when an indexed row's value or hint changes, and test a hint change without a declaration generation change.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 game/mods/menu/src/view.ts:449: The longer indexed texts have not been checked for typing responsiveness on the Steam Deck. (more on the line) Do: Run the stated Steam Deck search test by hand and record whether typing and result updates remain smooth.

@fix can do L1.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the demonstrated case: the author reports that searching “aa” on Linux with an RTX 3090 found Upscaler on main and four rows on the combined PR tree. The timing runs overlap substantially: worst search frames were 1.46–2.87 ms before and 1.32–2.41 ms after, so they do not establish a performance change.

Other systems: The shared search function also affects mods using longshot/ui/kit. Choice declarations and their translations affect system mods on Windows and Linux; no platform-specific behavior is apparent in the diff. Steam Deck typing responsiveness remains untested.

Switches: None.

Reviewed: d983f363f3 against bb5a5682ce: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the diff and commit messages; traced the changed search, declaration, store and test paths. Skimmed generated documentation and the larger changed Rust and test files; they were not read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The changed files contain no apparent game-derived output or new switch.
  • Unavailable declared choices are filtered except when currently selected.
  • Results continue to display the row's own help rather than the concatenated search text.

Testing: No commands that build or run project code were executed. The author reports an in-game Linux run and game-free test results; CI was still running.

Overlaps and merge order: The description names sibling PR #3273 as supplying the Anti-aliasing row; this change does not require that row for its demonstrated Upscaler search. Other overlaps were not available in the offline checkout.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The search index can retain an outdated current hint while the menu is open. The new search behavior otherwise has an in-game demonstration, with Steam Deck responsiveness still to be checked. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. The menu searches option names and hints as well as row text, and shared UI search ignores hyphens. This makes more settings discoverable at the cost of indexing longer text. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `game/mods/menu/src/view.ts:423`: The current hint is copied into the index once, but row changes do not invalidate that indexed page. (more on the line) **Do:** Invalidate or update the affected search part when an indexed row's value or hint changes, and test a hint change without a declaration generation change. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `game/mods/menu/src/view.ts:449`: The longer indexed texts have not been checked for typing responsiveness on the Steam Deck. (more on the line) **Do:** Run the stated Steam Deck search test by hand and record whether typing and result updates remain smooth. `@fix` can do L1. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the demonstrated case: the author reports that searching “aa” on Linux with an RTX 3090 found Upscaler on main and four rows on the combined PR tree. The timing runs overlap substantially: worst search frames were 1.46–2.87 ms before and 1.32–2.41 ms after, so they do not establish a performance change. **Other systems:** The shared search function also affects mods using longshot/ui/kit. Choice declarations and their translations affect system mods on Windows and Linux; no platform-specific behavior is apparent in the diff. Steam Deck typing responsiveness remains untested. **Switches:** None. **Reviewed:** d983f363f388 against bb5a5682cea3: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the diff and commit messages; traced the changed search, declaration, store and test paths. Skimmed generated documentation and the larger changed Rust and test files; they were not read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The changed files contain no apparent game-derived output or new switch. - Unavailable declared choices are filtered except when currently selected. - Results continue to display the row's own help rather than the concatenated search text. **Testing:** No commands that build or run project code were executed. The author reports an in-game Linux run and game-free test results; CI was still running. **Overlaps and merge order:** The description names sibling PR #3273 as supplying the Anti-aliasing row; this change does not require that row for its demonstrated Upscaler search. Other overlaps were not available in the offline checkout. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -427,8 +447,10 @@ export function searchPart(source: string, decls: readonly SettingsHostDecl[],
continue;
// (a binding is on the Keyboard page, listed from the Controls page's)
const binds = row.kind === "binding" || row.key === "bindings_reset";
Member

L2 (should fix): The longer indexed texts have not been checked for typing responsiveness on the Steam Deck.

When: A player typing a short query on a Steam Deck causes the menu to fold and search the expanded option and hint text across its pages; the reported desktop debug runs do not show whether that remains smooth there.

Do: Run the stated Steam Deck search test by hand and record whether typing and result updates remain smooth.

**L2** (should fix): The longer indexed texts have not been checked for typing responsiveness on the Steam Deck. *When:* A player typing a short query on a Steam Deck causes the menu to fold and search the expanded option and hint text across its pages; the reported desktop debug runs do not show whether that remains smooth there. **Do:** Run the stated Steam Deck search test by hand and record whether typing and result updates remain smooth.
@ -407,0 +420,4 @@
names.push(name);
hints.push(d.choiceHints[i] ?? "");
});
hints.push(now?.hint ?? "");
Member

L1 (should fix): The current hint is copied into the index once, but row changes do not invalidate that indexed page.

When: A Frame generation hint can change with renderer status while search remains open. The store receives the updated row, but Finder rebuilds a part only when its declarations change, so searches continue to use the old hint and cannot find the new one.

Do: Invalidate or update the affected search part when an indexed row's value or hint changes, and test a hint change without a declaration generation change.

**L1** (should fix): The current hint is copied into the index once, but row changes do not invalidate that indexed page. *When:* A Frame generation hint can change with renderer status while search remains open. The store receives the updated row, but Finder rebuilds a part only when its declarations change, so searches continue to use the old hint and cannot find the new one. **Do:** Invalidate or update the affected search part when an indexed row's value or hint changes, and test a hint change without a declaration generation change.
Author
Owner

On L1: I checked and I'm leaving it. The index is built by Finder, which is mounted only while results show (TabSearchOf: only with a query) and the menu's closing clears the query, so each search builds it anew. Rows cannot be changed from the results. What could still move mid-search is a hint the renderer changes by itself, for the length of one search; which rows are listed (pageLines with their state at indexing) already holds that way on main. Invalidating parts for it would add per-frame work to a path with a frame budget.

On L1: I checked and I'm leaving it. The index is built by `Finder`, which is mounted only while results show (`TabSearchOf`: only with a query) and the menu's closing clears the query, so each search builds it anew. Rows cannot be changed from the results. What could still move mid-search is a hint the renderer changes by itself, for the length of one search; which rows are listed (`pageLines` with their state at indexing) already holds that way on `main`. Invalidating parts for it would add per-frame work to a path with a frame budget.
HumanBean deleted branch feat/menu-search-options 2026-12-05 19:27:11 +00:00
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!3272
No description provided.