Skip to content

Keep menu search inside visible submenus - #19835

Open
AnPod wants to merge 9 commits into
omacom:quattrofrom
AnPod:fix/menu-search-ancestor-visibility
Open

AnPod wants to merge 9 commits into
omacom:quattrofrom
AnPod:fix/menu-search-ancestor-visibility

Conversation

@AnPod

@AnPod AnPod commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #19807

Problem

Menu search listed rows under a submenu its when: guard hides. With one kernel installed, Update › Kernel is correctly hidden while browsing — but typing "omarchy" into search surfaced a linux-omarchy provider row under it, and selecting it ran omarchy-kernel set linux-omarchy.

matchesQuery() passed only root.isVisible(entry): the row's own visibility. Provider rows (mergeProviderRows) carry when: "", so they always pass, and a provider-backed submenu stays visible even when its own guard ran false (MenuModel.isVisible returns true for provider menus) — so nothing in the chain asked whether the submenu above the row was hidden.

Fix

isReachable(entry) walks the entry's ancestors through root.item(e.parent) and requires each to be visible; matchesQuery now gates rows on isReachable(entry) && !isDisabled(entry). Browsing is untouched (it never lists a hidden submenu's children anyway, since you cannot enter what is not listed). Search also still matches the guarded submenu entry itself when the guard passes.

Test

New block at the end of test/shell.d/menu-test.sh: extracts matchesQuery and isReachable from Menu.qml, drives them over a MenuModel fixture shaped like the real case (guarded provider submenu update.kernel, provider row without its own guard, unguarded sibling). Asserts the provider row is excluded while the guard is false, kept once it is true, and that sibling rows are unaffected. Red-before fails with "no isReachable in Menu.qml"; green passes; menu-guards-test.sh and keybindings-menu-test.sh stay green; shellcheck clean.

Menu.qml has several open PRs, but none touch the search region: nearest hunks are #19543 at ~L470 and #19817 at ~L95/L109/L1356+ — my change sits at L590-L608 (matchesQuery + new helper), disjoint from all eleven open Menu.qml PRs (#19822, #19817, #19667, #19628, #19612, #19543, #19459, #19449, #19362, #19326, #19175).

Search filtered rows by their own visibility only, so a provider row under
a submenu hidden by its when: guard still surfaced in results — Update >
Kernel hid itself with a single kernel installed, yet typing "omarchy"
listed linux-omarchy under it, and selecting it ran omarchy-kernel set.

Provider rows carry no guard of their own and a provider-backed submenu
stays visible even when its guard ran false, so only an ancestor walk can
see the difference. matchesQuery now requires every entry above the row to
be visible (isReachable); browsing is unchanged.

The new menu-test.sh block extracts both functions from Menu.qml and drives
them over the MenuModel fixture; it fails before the fix and passes after.
@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Search now checks the visible path from each row to the active menu.

  • Menu search only shows rows beneath visible parents.

Both earlier, unnumbered findings are addressed: the parent walk is bounded, and the comments no longer claim providers bypass their own guards.

Reviews (8) · Last reviewed commit: "Merge remote-tracking branch 'origin/qua..." · Reviewed by Greptile

Comment thread shell/plugins/menu/Menu.qml Resolved
Comment thread test/shell.d/menu-test.sh Resolved
@omarchybot omarchybot added the bug Something isn't working label Nov 22, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Compared this head (2a9584b70e08b60080d96232cd90fe8210f551f7), its tests and the surrounding menu code with the competing fix in #19836. Two source-level regressions remain here:

  • Menu.qml:597 walks parents without a limit. A user extension with a self-parented action keeps returning the same visible entry and makes search loop on the shell's UI thread.
  • The walk always reaches root. Opening a guarded submenu directly still shows its children, but typing a search then hides all of them when the walk reaches that submenu's failed guard.

#19836 bounds the walk and stops at the menu search started in, avoiding both cases. These are competing implementations of #19807, so this stays open awaiting the maintainer's choice. No branch changes or worker tests were made in this comparison; #19836 still needs its own verification. The new comments here also need correcting: MenuModel.isVisible checks a failed when: before its provider shortcut.

Codex High reviewed the source; Opus 5.5 High and muse-wonder via pi, thinking high, reviewed both diffs and agreed on pursuing #19836. Their independence is not guaranteed.

@ancientastronauttheorist

Copy link
Copy Markdown

Hi! I opened #19836 for the same issue three minutes after this one, without seeing it, and I've closed it in favour of yours. A few things from it in case they help, take or leave any of them:

  • A second case: outside the floating layout, Appearance › Dock is hidden, but searching "dock" lists six of its rows (Dock Position, Auto-hide Dock, and Top/Bottom/Left/Right Dock). Dock is a static submenu, and the four position rows sit two levels below it.
  • omarchybot's comparison on Keep menu search out of submenus their guard hides #19836 pointed at two details of the ancestor walk: stopping it at the menu search started in, so a search started inside a hidden submenu (opened by route) still lists that submenu's own rows, and putting a bound on it.
  • Keep menu search out of submenus their guard hides #19836 also had loadProvidersForSearch skip the providers of unreachable submenus. If you do that, the guard callback has to start them again when fresh guard answers land mid-search. Greptile caught that on Keep menu search out of submenus their guard hides #19836, and I reproduced it on screen with a delayed guard.

The branch is ancientastronauttheorist:menu-search-hidden-parents (1757632) if you want to look at any of it.

Filed by Claude Opus 5.5 via Claude Code.

omarchybot and others added 3 commits November 23, 2026 00:56
Stop the ancestor walk at the submenu where search began so directly opened guarded routes retain their rows. Limit malformed parent chains to 32 steps to keep user extensions from hanging the shell. Correct the guard explanation and cover static descendants, direct routes and parent cycles.

Co-Authored-By: GPT-6.2 (Codex, high) <noreply@openai.com>
Fail only when the parent walk exceeds a loose lookup budget. This catches an unbounded loop without printing a passing assertion on every lookup or tying the test to the exact number of helper calls.

Co-Authored-By: Codex High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Visibility ignores guard results for entries without a when condition. Give the Update fixture the condition that the hidden-ancestor assertion relies on so it catches a walk that continues above the active menu.

Co-Authored-By: Codex High <noreply@openai.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Nov 23, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Pushed fixes through 328acbea0b8a7e2ec12240cbfc53d3ccd4bcf646: the ancestor walk now stops at the active menu and is bounded, so directly opened guarded submenus keep their searchable rows and malformed parent cycles cannot freeze the shell. The guard explanation and regression fixtures are corrected. With #19836 closed by its author, the earlier competing-fix comparison no longer blocks this PR.

Codex High reproduced the hidden Dock row on a disposable Omarchy worker: root search showed “Top Dock” on the base, excluded it on this head, and showed it again with the fix reverted. Search inside the directly summoned Dock menu still finds it. The original PR's direct-route failure and cyclic-parent timeout are covered by the fixes. All 321 assertions passed across the CLI, menu, guard and keybinding tests; the worker was destroyed afterward. CI is also green on this head.

Opus 5.5 High contributed the two regression-test corrections. Opus 5.5 High and muse-wonder via pi, thinking high, found no actionable findings on the final head; their independence is not guaranteed. Both Greptile findings are fixed and answered, and its review of this head is 5/5. This now waits on the maintainer.

Before, on the base: root search lists a row below the hidden Dock submenu.

Before: Top Dock leaks into root search while Dock is hidden

After, on this head: the same root search has no matching row. This pair proves the static submenu case; provider rows are covered by the regression test.

After: root search excludes the hidden Dock row

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Nov 23, 2026
Keep the ancestor visibility tests alongside the menu payload tests added on quattro. The runtime fix merges without changes.

Co-Authored-By: Codex High <noreply@openai.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Nov 25, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Resolved the conflict with quattro in bae3bcc3c99062515e8866c1a16f3cb54c6becc3, retaining both the ancestor-visibility regression tests and the newly added menu payload tests. The search fix still checks visible parents up to the active menu, preserving search inside a directly opened submenu.

Codex High repeated the reproduction on a fresh disposable Omarchy worker: root search exposes “Top Dock” below a hidden Dock submenu on the current base, excludes it on this head, and exposes it again with the fix reverted. Directly opening Dock still makes its rows searchable, and the parent-cycle probe terminates. All 330 assertions passed across the CLI, menu, guard and keybinding tests. The worker was destroyed.

Opus 5.5 High and muse-wonder via pi, thinking high, reviewed this exact head and found no actionable defects; their independence is not guaranteed. Evidence recording initially refused GitHub's briefly stale pre-push head, then succeeded once the pushed SHA appeared.

All CI checks pass on this head. Greptile completed its review at 5/5 with no new findings; the earlier findings remain fixed and answered. This waits on the maintainer.

Base, with the fix reverted: root search exposes a row beneath the hidden Dock submenu.

Base: root search exposes Top Dock beneath the hidden Dock submenu

This head: the same search excludes that row. These captures show the static submenu case; provider rows are covered by the regression tests.

Head: root search excludes Top Dock beneath the hidden Dock submenu

omarchybot and others added 2 commits November 26, 2026 13:05
Verify the search fix with the current menu provider loading and system snapshots code.

Co-Authored-By: Codex High <noreply@openai.com>
Use the active-menu reachability boundary when scheduling search providers, folding the useful provider-pruning change from omacom#20252. Restart eligible providers when fresh guard answers arrive during a search, so a provider skipped under an earlier false guard can appear without another keystroke.

Co-Authored-By: Alessio Attilio <attilio.alessio@protonmail.com>

Co-Authored-By: Codex High <noreply@openai.com>
@omarchybot omarchybot removed the ready Good to merge label Nov 26, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Assessed the provider-pruning idea handed over from #20252. Providers beneath a hidden ancestor can still be enumerated by this head. An unpublished candidate adapts @kairosci’s idea to this PR’s active-menu boundary and reloads eligible providers after fresh guard answers, so a provider skipped while its ancestor was hidden can appear during the same search. The candidate credits @kairosci as co-author.

Codex High tested the candidate on a fresh disposable Omarchy worker. All 340 assertions passed across the CLI, menu, guard, keybinding and menu-open checks. Root search excluded the hidden Dock row, while directly opened Dock remained searchable. Reverting provider pruning or the guard-refresh callback made its respective regression fail. In the running UI, a delayed guard becoming true exposed the kernel row without another keystroke; removing the callback left the search empty. The worker was destroyed.

The candidate has not been pushed: both full Opus 5.5 High review invocations ended with SIGTERM (exit 143) and empty reports. The availability check answered from Opus 5.5 High and muse-wonder via pi, thinking high, but no second opinion completed on this candidate. Only Codex High completed this review. The published head remains bae3bcc3c99062515e8866c1a16f3cb54c6becc3; ready is withdrawn while the provider fold remains incomplete. This waits on the maintainer.

Without the candidate’s guard-refresh callback: the same search remains empty after the ancestor guard turns true. This uses a controlled user-menu extension with the real kernel provider.

Without refresh callback: kernel search remains empty

Unpublished candidate: the kernel row appears after the guard answer changes, without another keystroke. This proves the controlled guard transition, not the original reporter’s machine.

Unpublished candidate: kernel row appears after the guard becomes true

@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge and removed verified Omarchy Triage has verified that this issue is ready for final review labels Nov 29, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Pushed 03acc22ad6ff112e90a2bf8b6ceed721cb999968 with @kairosci’s provider-pruning change from #20252. Search skips providers beneath a hidden ancestor and starts them when fresh guard results make them reachable during the same search.

Codex High reproduced #19807 on a disposable Omarchy worker with one installed kernel. After opening Kernel directly, root search leaked the cached linux-omarchy row on quattro and excluded it on this head. A separate worker check showed that a provider under a guard that turns true can populate the current search without another keystroke. 366 CLI and shell assertions passed. The menu-open timing check missed once in the grouped run and passed alone on both revisions.

Opus 5.5 High reviewed this exact head and found no actionable defects. That review could access this session’s transcript.

All CI checks passed on this head and Greptile scored it 5/5 with the earlier findings addressed. The pull request now waits for maintainer review.

On quattro, root search shows the cached kernel row under Update › Kernel. On this head the same search returns no matches.

Base shows the cached kernel result

Candidate hides the cached kernel result

With the refresh callback reverted, the controlled guard turns true and the search stays empty. On this head, the real kernel provider fills the search as soon as the guard answer arrives.

The search stays empty with the refresh reverted

The kernel appears after the guard update on the candidate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu search lists rows from submenus hidden by a when: guard (linux-omarchy under Update > Kernel)

3 participants