chore(localdb): adopt LocalDb 0.1.1 and drop the directory shim

LocalDb 0.1.1 creates the parent directory of LocalDb:Path itself, so the
SiteLocalDbDirectory shim this repo carried through Phase 2 is deleted along
with its call site. The gap was found here but was never ScadaBridge's alone —
every LocalDb consumer had it — so the fix moved to the library.

SiteLocalDbDirectoryTests is RETAINED and retargeted rather than deleted with
the shim. It was already written against the site registration path, not the
mechanism, so it needed only its Ensure() call removed: what a site node
requires is that resolving ILocalDb not fail on a fresh machine, regardless of
who provides that. Verified it still earns its place — pinned back to LocalDb
0.1.0 it fails inside SqliteLocalDb..ctor -> SqliteConnection.Open(), so it
genuinely depends on the library behaviour and not on a coincidence.

Also corrects the coverage-split note in StoreAndForwardStorageTests, which
asserted that directory creation is "NOT LocalDb's" — true when written, wrong
as of 0.1.1.

Build 0 warnings; Host 330, StoreAndForward 130, LocalDb integration 20 pass.

Claude-Session: https://claude.ai/code/session_01BL2Vu1ESDQ9SCN4gVKkdts
This commit is contained in:
Joseph Doherty
2026-07-20 04:58:20 -04:00
parent 9ec7966dac
commit 166f07fa68
5 changed files with 26 additions and 87 deletions
@@ -10,12 +10,14 @@ namespace ZB.MOM.WW.ScadaBridge.Host.Tests;
/// </summary>
/// <remarks>
/// <para>
/// This guarantee used to live in <c>StoreAndForwardStorage.EnsureDatabaseDirectoryExists</c>,
/// which created the parent directory for its own SQLite file. LocalDb Phase 2 moved that
/// file into the consolidated database — but the LocalDb library does <b>not</b> create the
/// directory, and <c>SqliteLocalDb</c> opens the file eagerly in its constructor, so a
/// missing directory is a hard boot failure ("SQLite Error 14: unable to open database
/// file") rather than a degraded start.
/// The guarantee has now had three owners: <c>StoreAndForwardStorage</c> created the
/// directory for its own SQLite file, LocalDb Phase 2 folded that file into the
/// consolidated database and the Host took it over as a <c>SiteLocalDbDirectory</c> shim,
/// and LocalDb 0.1.1 took it into the library itself. This test survived all three moves
/// unchanged in intent, because what a site node needs is the OUTCOME — resolving
/// <c>ILocalDb</c> from the site registration must not fail on a fresh machine — not any
/// particular implementer of it. It is deliberately written against the registration path
/// rather than the mechanism, so a future move costs nothing here.
/// </para>
/// <para>
/// This is not hypothetical: the default site configuration points at the <i>relative</i>
@@ -44,9 +46,9 @@ public class SiteLocalDbDirectoryTests
.Build();
// The registration path under test. Resolving ILocalDb is what actually opens
// the file, so this fails with SQLite Error 14 if the directory step regresses.
// the file, so this fails with SQLite Error 14 if the directory step regresses
// — wherever it lives.
var services = new ServiceCollection();
SiteLocalDbDirectory.Ensure(config);
services.AddZbLocalDb(config);
using var provider = services.BuildServiceProvider();