RawBrowseCommitMapper's fallback comment cites a parity guard (RawBrowseCommitMapperParityTests) that does not exist #555

Closed
opened 2026-08-10 01:24:31 -04:00 by dohertj2 · 1 comment
Owner

Found during #552. RawBrowseCommitMapper.BuildTagConfig's unknown-driver fallback comment claims: "Every BROWSABLE driver is handled above — guarded by RawBrowseCommitMapperParityTests, which enumerates DriverTypeNames.All rather than trusting this comment." No such test class exists anywhere under tests/ (verified by grep). RawTagConfigGateTests covers 9 driver types by hand-written InlineData, not by enumeration — so a newly-added browsable driver whose leaves fall into the generic {"address": …} shape would not be caught.

Fix: write the test the comment describes, DriverTypeNames.All-driven (the pattern exists in DriverFormMapParityTests / DriverDispatchMapParityTests), asserting every browsable driver type has a dedicated BuildTagConfig branch (or is deliberately exempted with a reason). Alternatively correct the comment — but the enumeration guard is the better close, since the comment's claim is exactly the invariant worth pinning.

Found during #552. `RawBrowseCommitMapper.BuildTagConfig`'s unknown-driver fallback comment claims: "Every BROWSABLE driver is handled above — guarded by RawBrowseCommitMapperParityTests, which enumerates DriverTypeNames.All rather than trusting this comment." No such test class exists anywhere under `tests/` (verified by grep). `RawTagConfigGateTests` covers 9 driver types by hand-written `InlineData`, not by enumeration — so a newly-added browsable driver whose leaves fall into the generic `{"address": …}` shape would not be caught. Fix: write the test the comment describes, `DriverTypeNames.All`-driven (the pattern exists in `DriverFormMapParityTests` / `DriverDispatchMapParityTests`), asserting every browsable driver type has a dedicated `BuildTagConfig` branch (or is deliberately exempted with a reason). Alternatively correct the comment — but the enumeration guard is the better close, since the comment's claim is exactly the invariant worth pinning.
Author
Owner

FIXED — merged to master as 4f1c83a7 (branch commit 0e9d977f).

RawBrowseCommitMapperParityTests now exists and holds the mapper to what the comment used to merely claim, with the browsable set DERIVED, not hand-listed: the test runs the production AddAdminUI() registration and reads back every registered IDriverBrowser.DriverType — the exact set BrowserSessionService indexes — and asserts each gets a typed (non-generic) BuildTagConfig branch. The universal DiscoveryDriverBrowser arm is NOT derivable from the AdminUI assembly (it needs the runtime drivers + the Host's IDriverFactory; AdminUI deliberately has no runtime-driver edge since #526), so it is covered by enumerating DriverTypeNames.All with a GenericKeyExemptions list (Modbus, Calculation — each with its reason) plus a fact that mechanically refutes any exemption the derived arm contradicts. The stale comment is rewritten to state exactly these two claims and the residual trust.

Falsified three ways: disabling the Sql branch → red naming Sql (the DI derivation is not vacuous); disabling the MTConnect branch → red naming MTConnect (the enumeration half earns its place — no bespoke registration would catch it); adding a bogus Sql exemption → the contradiction fact red quoting the reason. AdminUI.Tests 1430 green on the merged tree.

Residuals found en route, filed: #558 (parity-guard consolidation + browser DriverType literals).

**FIXED** — merged to master as `4f1c83a7` (branch commit `0e9d977f`). `RawBrowseCommitMapperParityTests` now exists and holds the mapper to what the comment used to merely claim, with the browsable set DERIVED, not hand-listed: the test runs the production `AddAdminUI()` registration and reads back every registered `IDriverBrowser.DriverType` — the exact set `BrowserSessionService` indexes — and asserts each gets a typed (non-generic) `BuildTagConfig` branch. The universal `DiscoveryDriverBrowser` arm is NOT derivable from the AdminUI assembly (it needs the runtime drivers + the Host's `IDriverFactory`; AdminUI deliberately has no runtime-driver edge since #526), so it is covered by enumerating `DriverTypeNames.All` with a `GenericKeyExemptions` list (Modbus, Calculation — each with its reason) plus a fact that mechanically refutes any exemption the derived arm contradicts. The stale comment is rewritten to state exactly these two claims and the residual trust. Falsified three ways: disabling the Sql branch → red naming Sql (the DI derivation is not vacuous); disabling the MTConnect branch → red naming MTConnect (the enumeration half earns its place — no bespoke registration would catch it); adding a bogus Sql exemption → the contradiction fact red quoting the reason. AdminUI.Tests 1430 green on the merged tree. Residuals found en route, filed: #558 (parity-guard consolidation + browser DriverType literals).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#555