Skip to content

[claude] Let test fixtures use the normal CreateProject/OpenProject paths with in-memory sqlite #2495

Description

@myieye

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions