Skip to content

LT-22691: Answer the per-object and Help menus natively - #1161

Open
mark-sil wants to merge 1 commit into
mainfrom
LT-22691-object-menu-authority
Open

mark-sil wants to merge 1 commit into
mainfrom
LT-22691-object-menu-authority

Conversation

@mark-sil

@mark-sil mark-sil commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Third step of retiring the hidden WinForms DataTree adapter behind the Avalonia detail view (LT-22691), after #1143 and #1153, consuming the help-topic engine from #1151.

What changed

Every detail row's label menu merges mnuDataTree-Object (Field Visibility, Move Field, Help), and 329 rows bind the empty mnuDataTree-Help. Both ran through the mediator, so the hidden DataTree adapter took part in every label menu, and Help was answered from the adapter's current slice. A row with no slice twin, such as Publish Sense In or Reversal Entries, left the adapter pointed at another slice, so Help opened that slice's topic.

ObjectMenuAuthority owns both ids. Field Visibility and Move Field use the host's existing item builders through a lazily located override target; a row whose target cannot be located keeps them disabled, per the agreed no-veto fallback. Help resolves the row's own topic through ResolveHelpTopic, is hidden when the help provider has no string for it, and opens through ShowHelp. CompositeMenuAuthority joins this authority with the reorder-vector one, so an ordinary row's label menu is fully owned: the adapter is not pointed at the row and the override interceptor is not built. The WinForms adapter menu remains the fallback when the native menu fails, pointed at the row first.

One rule changed on the way, from the note on #1151: ResolveHelpTopic no longer returns null. A row with no object generates from its field and label alone, so every row ends at a topic, the generic one at worst, as a WinForms slice does.

Interim notes

  • Help on the multi-string menu (mnuDataTree-MultiStringSlice) still comes from the adapter's current slice until the writing-systems authority owns that menu.
  • On that same menu an unlocatable row's Field Visibility and Move Field still fall to mediator dispatch, where the owned object menu disables them. Same resolution.

Tests

Contract test over every leaf of both owned ids, and its twin that an unknown leaf throws. Ownership test: a Subentries label menu and a Help-bound row are fully owned; a multi-string row is not. A spy colleague proves an ordinary row's label menu is built without a single mediator display query. Equivalence for every row the adapter can target, against the interceptor path this replaces, with unlocatable rows asserted disabled. Publish Sense In Help resolves its own topic. Help is hidden with the null provider, offered for the generic topic on a row with no object, and kept on a row without class and layout while its field commands disable. A visibility change through the authority writes the override; the Move Field root-row test now runs through the authority.

Runs: build.ps1 -CommentHygiene -TokenHygiene clean; xWorksTests DetailObjectCommandExecutionTests 46/46. Manually tested in Lexicon Edit: Field Visibility and Move Field on plain rows, Help on plain rows and on Publish Sense In and Reversal Entries, the empty Example prompt, the Subentries label menu, a multi-string row's Writing Systems submenu, and a second tool's label menus.

🤖 Generated with Claude Code


This change is Reviewable

Every detail row's label menu merges mnuDataTree-Object (Field Visibility,
Move Field, Help), and 329 rows bind the empty mnuDataTree-Help. Both ran
through the mediator, so the hidden DataTree adapter took part in every
label menu, and Help was answered from the adapter's current slice. A row
with no slice twin, such as Publish Sense In or Reversal Entries, left the
adapter pointed at another slice, so Help opened that slice's topic.

An ordinary row's label menu is now answered natively in full, so the hidden
adapter no longer takes part in it; it is still pointed at the row when the
WinForms menu has to stand in. A row whose override target cannot be located
shows Field Visibility and Move Field disabled instead of running them
through the mediator.

One rule changed on the way: ResolveHelpTopic no longer returns null. A row
with no object generates from its field and label alone, so every row ends
at a topic, the generic one at worst, as a WinForms slice does.

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

Copy link
Copy Markdown

NUnit Tests

    1 files  ± 0      1 suites  ±0   13m 27s ⏱️ + 2m 26s
6 288 tests +10  6 203 ✅ +10  85 💤 ±0  0 ❌ ±0 
6 297 runs  +10  6 212 ✅ +10  85 💤 ±0  0 ❌ ±0 

Results for commit 4ed7b00. ± Comparison against base commit b6cbf8e.

This pull request removes 1 and adds 11 tests. Note that renamed tests count towards both.
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ LabelMenu_StillNeedsTheAdapter_WhileTheSharedObjectMenuHasNoAuthority
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ FieldVisibility_ThroughTheAuthority_WritesTheOverride
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ GhostRow_LocatesItsSequenceNode_AndItsVisibilityWritesThatNode
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ Help_OnARowWithoutAnObject_OffersTheGenericTopic
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ Help_OnPublishSenseIn_OpensTheRowsOwnTopic
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ LabelMenu_IsFullyOwned_UnlessItCarriesTheWritingSystemsList
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ ObjectMenuAuthority_AnswersEveryLeafOfItsMenus
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ ObjectMenuAuthority_RejectsALeafItDoesNotAnswer
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ ObjectMenu_HidesHelp_WhenTheProviderHasNoTopic
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ ObjectMenu_NativeAuthority_RendersWhatTheInterceptorPathRendered_ForEveryRowTheAdapterCanTarget
SIL.FieldWorks.XWorks.DetailObjectCommandExecutionTests ‑ ObjectMenu_OfAnOrdinaryRow_IsBuiltWithoutTheAdapterOrTheMediator
…

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.53846% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.01%. Comparing base (b6cbf8e) to head (4ed7b00).

Files with missing lines Patch % Lines
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs 45.83% 22 Missing and 4 partials ⚠️
Src/xWorks/Avalonia/Hosting/ObjectMenuAuthority.cs 70.83% 5 Missing and 9 partials ⚠️
.../xWorks/Avalonia/Hosting/CompositeMenuAuthority.cs 76.19% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1161   +/-   ##
=======================================
  Coverage   39.01%   39.01%           
=======================================
  Files        1520     1522    +2     
  Lines      352805   352902   +97     
  Branches    40692    40714   +22     
=======================================
+ Hits       137632   137695   +63     
- Misses     185879   185905   +26     
- Partials    29294    29302    +8     
Files with missing lines Coverage Δ
.../xWorks/Avalonia/Hosting/CompositeMenuAuthority.cs 76.19% <76.19%> (ø)
Src/xWorks/Avalonia/Hosting/ObjectMenuAuthority.cs 70.83% <70.83%> (ø)
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs 61.19% <45.83%> (+1.61%) ⬆️

... and 8 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.

@thejambi thejambi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@thejambi reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on mark-sil).

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.

3 participants