Skip to content

LT-22691: Share the detail-view help-topic rule between WinForms and Avalonia - #1151

Open
mark-sil wants to merge 1 commit into
mainfrom
LT-22691-help-topic-engine
Open

mark-sil wants to merge 1 commit into
mainfrom
LT-22691-help-topic-engine

Conversation

@mark-sil

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

Copy link
Copy Markdown
Contributor

The first shared engine for retiring the hidden DataTree command adapter: the rule that turns a detail field into a help topic id, moved out of Slice into a folder both detail views call. It prepares the Help command to be answered natively by the Avalonia detail view in the follow-on PR that gives mnuDataTree-Object its authority. Nothing user-visible changes in this PR.

The shared rule. FdoUi gains a DetailRules folder, namespace SIL.FieldWorks.Common.DetailRules, for rules both views share. Nothing there may depend on WinForms, Avalonia, or a slice or control type, so the rules keep working once WinForms is removed. Two tests enforce the boundary: one over every signature in the namespace, one over the folder's using directives.

FieldHelpTopics.Resolve takes the layout's authored id, a prefix, a HelpTopicSubject (field, raw label, class, owner class, sort key, the Targets entry-or-sense flag, area, tool) and a topic-exists predicate. An authored id returns before the subject is described. Slice describes its subject from its configuration node, object and property table and passes its existing validity check as the predicate, so the WinForms result is unchanged, including when a slice has no mediator.

The Avalonia side. The layout's helpTopicID rides ViewNode through the importer, the JSON round trip and the override applier's clones. The composer stamps every row with it plus a DetailHelpTopicSource built from the node being walked; lexical-relation rows set their own, as Targets rows. RecordEditView.ResolveHelpTopic adds the area, tool and help provider and returns the id. No menu consumes it yet.

Tests. FdoUiTests cover the fallback chain level by level against a provider that knows chosen topics. xWorksTests compare, for every composed row that has a WinForms slice twin in the hidden tree, the id the slice generates with the one the host resolves, with a provider that knows nothing and one that knows every tool-scoped topic; a lexical relation in the fixture covers the Targets rule.

Known, not in this PR. In the Avalonia view today, Help on Publish Sense In and on Reversal Entries opens the Sense topic, because the hidden adapter cannot match those rows to a slice and falls back to the sense's summary slice. The native Help in the follow-on PR answers from the row and removes that dependence.

🤖 Generated with Claude Code


This change is Reviewable

The Avalonia detail view will offer the Help command natively once the
shared object menu leaves the hidden DataTree adapter. Its topic id must
match the one the WinForms slice generates, so the generator moves out of
Slice into a rule both views call.

FdoUi gains a DetailRules folder, namespace
SIL.FieldWorks.Common.DetailRules, for rules both detail views share.
Nothing there may depend on WinForms, Avalonia, or a slice or control
type, so the rules keep working once WinForms is removed. Two tests
enforce that boundary, one over every signature in the namespace and one
over the folder's using directives.

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

Copy link
Copy Markdown

NUnit Tests

    1 files  ± 0      1 suites  ±0   9m 50s ⏱️ - 3m 8s
6 223 tests +15  6 138 ✅ +15  85 💤 ±0  0 ❌ ±0 
6 232 runs  +15  6 147 ✅ +15  85 💤 ±0  0 ❌ ±0 

Results for commit 85e60f0. ± Comparison against base commit 23965cd.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.82682% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.94%. Comparing base (2f1d9db) to head (85e60f0).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
Src/FdoUi/DetailRules/FieldHelpTopics.cs 87.95% 4 Missing and 6 partials ⚠️
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs 76.19% 2 Missing and 3 partials ⚠️
Src/xWorks/Avalonia/Composer/DetailComposer.cs 87.50% 2 Missing and 2 partials ⚠️
Src/Common/Controls/DetailControls/Slice.cs 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1151      +/-   ##
==========================================
+ Coverage   38.89%   38.94%   +0.04%     
==========================================
  Files        1518     1519       +1     
  Lines      352262   352382     +120     
  Branches    40597    40615      +18     
==========================================
+ Hits       137005   137219     +214     
+ Misses     185976   185891      -85     
+ Partials    29281    29272       -9     
Files with missing lines Coverage Δ
Src/Common/FwAvalonia/Detail/DetailModel.cs 78.50% <100.00%> (+0.25%) ⬆️
Src/Common/FwAvalonia/Detail/LexiconFirstSlice.cs 76.34% <100.00%> (ø)
...nia/ViewDefinition/ViewDefinitionJsonSerializer.cs 96.61% <100.00%> (+0.03%) ⬆️
...n/FwAvalonia/ViewDefinition/ViewDefinitionModel.cs 89.30% <100.00%> (+0.10%) ⬆️
...ia/ViewDefinition/ViewDefinitionOverrideApplier.cs 93.66% <100.00%> (+0.05%) ⬆️
...mon/FwAvalonia/ViewDefinition/XmlLayoutImporter.cs 86.03% <100.00%> (+0.05%) ⬆️
Src/Common/Controls/DetailControls/Slice.cs 58.97% <94.11%> (-0.24%) ⬇️
Src/xWorks/Avalonia/Composer/DetailComposer.cs 69.43% <87.50%> (+0.24%) ⬆️
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs 60.37% <76.19%> (+0.53%) ⬆️
Src/FdoUi/DetailRules/FieldHelpTopics.cs 87.95% <87.95%> (ø)

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