Skip to content

LT-22691: Let a menu authority answer a whole menu id, submenus included - #1153

Open
mark-sil wants to merge 1 commit into
mainfrom
LT-22691-owned-menu-bridge
Open

mark-sil wants to merge 1 commit into
mainfrom
LT-22691-owned-menu-bridge

Conversation

@mark-sil

@mark-sil mark-sil commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Second step of retiring the hidden WinForms DataTree adapter behind the Avalonia detail view (LT-22691), following #1143. Nothing renders differently today: the only owned id is mnuReorderVector, which has no submenus. This PR makes the bridge able to own a menu id that carries submenus, which mnuDataTree-Object, the next id to move across, does.

What changed

XCoreMenuBridge populated the merged context menu through the mediator even when a native authority owned an id: ChoiceGroup asked the colleagues whether each submenu had a visible item, so the hidden DataTree adapter still took part in every owned menu that carried a submenu.

The bridge now builds one ChoiceGroup per menu id, so each id's ownership is known, and populates an owned group through the new ChoiceGroup.PopulateNow(querySubmenuVisibility: false), which keeps every submenu instead of asking the colleagues. Every leaf under an owned id, submenus included, is answered by the authority. A submenu whose leaves are all hidden is omitted, an inline choice list is spliced as on the mediator path, and a list-populated submenu under an owned id is refused with NotSupportedException, since no authority can answer one yet. Edge separators are trimmed once on the merged menu rather than per group, so the separator between a row's own menu and mnuDataTree-Object survives.

The host's Field Visibility and Move Field item builders (VisibilityItem, MoveItem, ShowAllWritingSystemsItem) now take the item's label as a parameter, so the coming mnuDataTree-Object authority can call them without display properties from the mediator. Locating a row's override target is split out as TryLocateOverrideTarget, which logs why a row has no target instead of failing silently.

Tests

New tests cover the owned path: an owned menu with submenus is built without a single mediator display query, while an unowned menu still asks. An owned submenu whose leaves are all hidden is omitted. An owned list-populated submenu is refused. The merged Subentries menu keeps its separator before Field Visibility.

Runs: build.ps1 -CommentHygiene -TokenHygiene clean; xWorksTests DetailObjectCommandExecutionTests 32/32; xCoreInterfacesTests 19/19. Manually tested in Lexicon Edit: Subentries and Complex Forms label menus, Field Visibility and Move Field on plain rows, the Writing Systems submenu on multi-string rows, item right-click moves, Help, and a second tool's label menus.

Next

PR C: the mnuDataTree-Object authority (Field Visibility and Move Field through these builders, Help through the help-topic rule from #1151) plus mnuDataTree-Help, with contract and all-rows equivalence tests.

🤖 Generated with Claude Code


This change is Reviewable

XCoreMenuBridge populated the merged context menu through the mediator
even when a native authority owned an id: ChoiceGroup asked the colleagues
whether each submenu had a visible item, so the hidden DataTree adapter
still took part in every owned menu that carried a submenu.
mnuDataTree-Object, the next id to move across, is made of submenus.

The bridge now builds one ChoiceGroup per menu id, so each id's ownership
is known, and populates an owned group through the new
ChoiceGroup.PopulateNow(querySubmenuVisibility: false), which keeps every
submenu instead of asking the colleagues. Every leaf under an owned id,
submenus included, is answered by the authority. A submenu whose leaves
are all hidden is omitted, an inline choice list is spliced as on the
mediator path, and a list-populated submenu under an owned id is refused
with NotSupportedException, since no authority can answer one yet. Edge
separators are trimmed once on the merged menu rather than per group, so
the separator between a row's own menu and mnuDataTree-Object survives.

The host's Field Visibility and Move Field item builders (VisibilityItem,
MoveItem, ShowAllWritingSystemsItem) now take the item's label as a
parameter, so the coming mnuDataTree-Object authority can call them
without display properties from the mediator. Locating a row's override
target is split out as TryLocateOverrideTarget, which logs why a row has
no target instead of failing silently. Nothing renders differently today:
the only owned id is mnuReorderVector, which has no submenus.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

NUnit Tests

    1 files  ±0      1 suites  ±0   10m 24s ⏱️ +35s
6 222 tests +5  6 137 ✅ +5  85 💤 ±0  0 ❌ ±0 
6 231 runs  +5  6 146 ✅ +5  85 💤 ±0  0 ❌ ±0 

Results for commit cd45736. ± Comparison against base commit e278320.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.82418% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.91%. Comparing base (e278320) to head (cd45736).

Files with missing lines Patch % Lines
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs 60.60% 10 Missing and 3 partials ⚠️
Src/xWorks/Avalonia/Hosting/XCoreMenuBridge.cs 86.66% 3 Missing and 3 partials ⚠️
Src/XCore/xCoreInterfaces/ChoiceGroup.cs 76.92% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1153   +/-   ##
=======================================
  Coverage   38.91%   38.91%           
=======================================
  Files        1519     1519           
  Lines      352403   352447   +44     
  Branches    40622    40627    +5     
=======================================
+ Hits       137122   137156   +34     
- Misses     185992   186004   +12     
+ Partials    29289    29287    -2     
Files with missing lines Coverage Δ
Src/XCore/xCoreInterfaces/ChoiceGroup.cs 60.28% <76.92%> (+0.16%) ⬆️
Src/xWorks/Avalonia/Hosting/XCoreMenuBridge.cs 84.49% <86.66%> (+4.49%) ⬆️
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs 58.43% <60.60%> (-1.03%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants