Skip to content

Remove dead Mediator code from the filter providers - #1230

Merged
mark-sil merged 1 commit into
mainfrom
adjust-filter-selection-rename
Nov 4, 2026
Merged

mark-sil merged 1 commit into
mainfrom
adjust-filter-selection-rename

Conversation

@mark-sil

@mark-sil mark-sil commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This is cleanup that should have been part of 1903f5d (#1227); it changes no behaviour and only removes the code and naming that commit left dead. RecordFilterListProvider is now a plain class that its owning clerk creates from a property table and calls AdjustFilterSelection on directly. Until now it implemented IxCoreColleague, stored a Mediator and a configuration node it never read, and named that method OnAdjustFilterSelection, returning false, although since #1227 no provider is added to the Mediator and no AdjustFilterSelection message is sent.

Reviewer notes

Start here: Src/XCore/xCoreInterfaces/RecordFilterListProvider.cs -- the whole class as it now stands; the other four files are callers following its new signatures.

What changes for callers. RecordFilterListProvider and its only subclass, WfiRecordFilterListProvider:

  • OnAdjustFilterSelection(object) : bool becomes AdjustFilterSelection(object currentFilter) : void
  • Create(Mediator, PropertyTable, XmlNode) becomes Create(PropertyTable, XmlNode)
  • Init(Mediator, PropertyTable, XmlNode) becomes Init(PropertyTable)
  • IxCoreColleague and its GetMessageTargets, ShouldNotCall and Priority are gone, as are the m_mediator and m_configuration fields

The unknown: does anything still reach these by name or by interface? No, and that is what makes the build sufficient validation.

  • No code registers a provider with the Mediator; RecordClerk adjusts the Filters menu by direct call #1227 removed the only AddColleague.
  • The clerk's GetMessageTargets never returns m_filterProvider.
  • Every non-test cast to IxCoreColleague applies to a control, slice, pane, app, list or configured listener; no configuration lists a provider as a listener.
  • OnAdjustFilterSelection was the only On/Display method on either class.
  • Create keeps its XmlNode: DynamicLoader.CreateObject needs it to build the provider.

Where to look. WordformFiltersTests.AdjustFilterSelection had no assertions since the 2012 initial commit; it now checks the Clear Wordform-Set Filter item is added for a word-set filter and removed for null.

Deliberately not here. WordformFiltersTests still creates a Mediator, because PropertyTable's constructor takes one.

Verification. build.ps1 -CommentHygiene -TokenHygiene: full solution with tests, 0 warnings, 0 errors. WordformFiltersTests 1/1 and RecordClerkFilterSelectionTests 5/5 pass. No manual test: there is no behaviour change to observe. No Jira ticket: nothing reaches a tester.

Next: approve, or tell me what to change.

Preflight review details

Code Review Summary

Branch: adjust-filter-selection-rename
Base: main (merge base 8afbeb5)
Date: 2026-11-04
Review model: Claude Opus 5.5
Files changed: 5 (1 commit)

Overview

Cleanup that should have been part of 1903f5d (#1227). That commit stopped
sending the AdjustFilterSelection Mediator message and stopped registering
WfiRecordFilterListProvider as a colleague, but left RecordFilterListProvider
shaped as a Mediator colleague. This branch removes that shape: the
IxCoreColleague implementation, the On prefix and bool return on
AdjustFilterSelection, and the Mediator and configuration node that Create and
Init stored but never read. No behaviour changes.

Contract/API Changes

All public, all on RecordFilterListProvider and its only subclass,
WfiRecordFilterListProvider; every caller is in this repository and was
updated.

  • OnAdjustFilterSelection(object argument) returning bool is now
    AdjustFilterSelection(object currentFilter) returning void.
  • The class no longer implements IxCoreColleague; GetMessageTargets,
    ShouldNotCall and Priority are removed.
  • Create(Mediator, PropertyTable, XmlNode) is now
    Create(PropertyTable, XmlNode).
  • Init(Mediator, PropertyTable, XmlNode) is now Init(PropertyTable).
  • The protected fields m_mediator and m_configuration are removed.

Findings

Critical - Must address before merge

None.

Important - Should address before merge

None.

Minor - Consider

  • WordformFiltersTests.AdjustFilterSelection asserted nothing (fixed
    during review: it now checks the Clear item is added for a word-set filter
    and removed for null)
  • RecordFilterListProvider still implemented IxCoreColleague with no
    registration
    (fixed during review: interface and members removed)
  • Parameter still named argument (fixed during review: renamed
    currentFilter)
  • m_mediator set but never read (fixed during review: field and
    parameter removed from Create and Init)
  • Empty propertyTable param tag on the Wfi Init doc (fixed during
    review)
  • m_configuration set but never read (fixed during review: field and
    Init parameter removed)

Required Validation / Evidence

  • ./build.ps1 -CommentHygiene -TokenHygiene: full solution, tests included,
    0 warnings, 0 errors.
  • ./test.ps1 -TestProject Src/Common/Filters/FiltersTests -TestFilter FullyQualifiedName~WordformFiltersTests: 1/1 passed.
  • ./test.ps1 -TestProject Src/xWorks/xWorksTests -TestFilter FullyQualifiedName~RecordClerkFilterSelectionTests: 5/5 passed.
  • No manual test: every change is compile-checked, and nothing reaches the
    removed members by name or by interface at runtime (checked below).

Positive Observations

  • Net removal: 30 lines added, 62 removed.
  • The one assert-free test now pins the override's behaviour directly.

Interview Notes

  • Runtime reach of IxCoreColleague, checked at the author's request: no code
    registers a provider, the clerk's GetMessageTargets never returns
    m_filterProvider, every non-test cast to IxCoreColleague applies to a
    control, slice, pane, app, list or configured listener, no configuration
    lists a provider as a listener, and OnAdjustFilterSelection was the only
    On or Display method on either class.
  • The base AdjustFilterSelection never runs in production: the class is
    abstract and its only subclass overrides it.
  • WordformFiltersTests has been an assert-free smoke test since the 2012
    initial commit; RecordClerk adjusts the Filters menu by direct call #1227 did not touch it.
  • WordformFiltersTests keeps its Mediator only because PropertyTable's
    constructor takes one; the author chose to leave it.
  • Developer-only, no ticket needed: no behaviour a tester could reach changes.
  • The author reviewed the code and the commit message.

Suggested Review Focus

  • RecordFilterListProvider.cs: the class as it now stands
  • WordformFiltersTests.cs: the two new assertions

🤖 Generated with Claude Code


This change is Reviewable

This is cleanup that should have been part of 1903f5d (#1227); it
changes no behaviour and only removes the code and naming that commit
left dead. RecordFilterListProvider is now a plain class that its
owning clerk creates from a property table and calls
AdjustFilterSelection on directly. Until now it implemented
IxCoreColleague, stored a Mediator and a configuration node it never
read, and named that method OnAdjustFilterSelection, returning false,
although since #1227 no provider is added to the Mediator and no
AdjustFilterSelection message is sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

NUnit Tests

    1 files  ±0      1 suites  ±0   14m 51s ⏱️ +21s
7 036 tests ±0  6 951 ✅ ±0  85 💤 ±0  0 ❌ ±0 
7 045 runs  ±0  6 960 ✅ ±0  85 💤 ±0  0 ❌ ±0 

Results for commit 231db9b. ± Comparison against base commit 8afbeb5.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
SIL.FieldWorks.Filters.WordformFiltersTests ‑ OnAdjustFilterSelection
SIL.FieldWorks.Filters.WordformFiltersTests ‑ AdjustFilterSelection

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 40.51%. Comparing base (8afbeb5) to head (231db9b).

Files with missing lines Patch % Lines
Src/Common/Filters/WordFormFilters.cs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1230   +/-   ##
=======================================
  Coverage   40.50%   40.51%           
=======================================
  Files        1559     1559           
  Lines      356085   356075   -10     
  Branches    41584    41584           
=======================================
+ Hits       144243   144264   +21     
+ Misses     182531   182499   -32     
- Partials    29311    29312    +1     
Files with missing lines Coverage Δ
.../XCore/xCoreInterfaces/RecordFilterListProvider.cs 69.23% <100.00%> (+16.84%) ⬆️
Src/xWorks/RecordClerk.cs 47.83% <100.00%> (ø)
Src/Common/Filters/WordFormFilters.cs 75.24% <66.66%> (+6.31%) ⬆️

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

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

@mark-sil
mark-sil merged commit e455002 into main Nov 4, 2026
9 checks passed
@mark-sil
mark-sil deleted the adjust-filter-selection-rename branch November 4, 2026 18:58
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