test(raw): write the browse-commit parity guard the mapper's comment cites (#555)
RawBrowseCommitMapper.BuildTagConfig's unknown-driver fallback claimed to be guarded by RawBrowseCommitMapperParityTests, which did not exist anywhere under tests/. The claim it made — "every BROWSABLE driver is handled above" — is the exact claim that stopped being true when SqlDriverBrowser registered (deferment.md G-6), so the comment was asserting the invariant instead of pinning it. The guard now exists and enumerates DriverTypeNames.All: - Browsability's bespoke arm is DERIVED from production, not hand-listed: the test runs AddAdminUI() and reads back every registered IDriverBrowser's DriverType — the same set BrowserSessionService.CanBrowse indexes. A driver that gains or loses a bespoke browser moves the guard with it. - The universal arm (DiscoveryDriverBrowser -> ITagDiscovery) is NOT derivable from the AdminUI assembly: it references driver Contracts/Browser projects, never the runtime drivers, and IDriverFactory is composed in the Host. Covered instead by requiring every declared driver type to be typed or explicitly exempted with a reason (Modbus, Calculation), with a third fact mechanically refuting any exemption the derived arm contradicts — the Sql failure mode. Falsified three ways, each red naming the offender: disabling the Sql branch trips the derived-arm fact; disabling the MTConnect branch trips the enumeration fact (the universal-arm half, which no bespoke registration would have caught); adding Sql to the exemption list trips the contradiction fact. Comment corrected to state what the test actually asserts, including the residual trust the universal arm leaves.
This commit is contained in:
@@ -267,9 +267,14 @@ public static class RawBrowseCommitMapper
|
||||
return BuildSqlTagConfig(address, addressFields);
|
||||
|
||||
// Unknown/flat-address driver (e.g. Modbus is not browsable): record the reference under a generic
|
||||
// "address" key so nothing is lost. Every BROWSABLE driver is handled above — guarded by
|
||||
// RawBrowseCommitMapperParityTests, which enumerates DriverTypeNames.All rather than trusting
|
||||
// this comment.
|
||||
// "address" key so nothing is lost. RawBrowseCommitMapperParityTests enumerates DriverTypeNames.All
|
||||
// and holds this line to two claims rather than to the assertion the comment used to make:
|
||||
// - a driver type with a bespoke IDriverBrowser registered by AddAdminUI() — read back from the
|
||||
// real registration, not a list — must NOT reach here; and
|
||||
// - any type that does reach here must be named in that test's GenericKeyExemptions with a reason.
|
||||
// The universal DiscoveryDriverBrowser's arm is not derivable from the AdminUI assembly (it needs
|
||||
// the runtime drivers + the Host's IDriverFactory), so it is covered by the exemption list rather
|
||||
// than mechanically — see the test's remarks for the residual trust that leaves (Gitea #555).
|
||||
return WriteSingleKey("address", address);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user