[Claude, autonomous]
LcmCrdt.Tests fixtures (MiniLcmApiFixture, DataModelSnapshotTests, several inline setups) hand-roll project init (SetupProjectContextForNewDb + InitProjectDb) because CreateProject opens and closes its own DbContext, which would drop the shared-cache in-memory DB. The copied init has already drifted from the real path once (the extra "trigger data migrations" step).
Fix:
- Hold one keep-alive
SqliteConnection to the named in-memory DB (file:x?mode=memory&cache=shared) for the fixture's lifetime — the DB survives while any connection stays open, so CreateProject's open/close no longer wipes it. (Today this mostly works by accident via connection pooling.)
- Add an optional
DbPath to CreateProjectRequest, used verbatim, so it can target the URI instead of computing {Path}/{code}.sqlite. Everything downstream already handles URIs.
Then fixtures run the real CreateProject/OpenCrdtProject init (migrations, ProjectData seeding, data migrations), and the initializedNewDb hack in LcmCrdtTestsKernel likely drops out.
Keep the Debugger.IsAttached real-file trick. SnapshotAtCommitServiceFileBasedTests stays file-based on purpose.
[Claude, autonomous]
LcmCrdt.Testsfixtures (MiniLcmApiFixture,DataModelSnapshotTests, several inline setups) hand-roll project init (SetupProjectContextForNewDb+InitProjectDb) becauseCreateProjectopens and closes its own DbContext, which would drop the shared-cache in-memory DB. The copied init has already drifted from the real path once (the extra "trigger data migrations" step).Fix:
SqliteConnectionto the named in-memory DB (file:x?mode=memory&cache=shared) for the fixture's lifetime — the DB survives while any connection stays open, soCreateProject's open/close no longer wipes it. (Today this mostly works by accident via connection pooling.)DbPathtoCreateProjectRequest, used verbatim, so it can target the URI instead of computing{Path}/{code}.sqlite. Everything downstream already handles URIs.Then fixtures run the real
CreateProject/OpenCrdtProjectinit (migrations, ProjectData seeding, data migrations), and theinitializedNewDbhack inLcmCrdtTestsKernellikely drops out.Keep the
Debugger.IsAttachedreal-file trick.SnapshotAtCommitServiceFileBasedTestsstays file-based on purpose.