Skip to content

dotnet: carve backend-neutral analytics abstractions (HOL-25)#105

Merged
BrewingCoder merged 1 commit into
mainfrom
issue-25-storage-abstractions
May 9, 2026
Merged

dotnet: carve backend-neutral analytics abstractions (HOL-25)#105
BrewingCoder merged 1 commit into
mainfrom
issue-25-storage-abstractions

Conversation

@BrewingCoder
Copy link
Copy Markdown
Owner

Summary

Phase 1 of the Postgres-migration EPIC: introduce HoldFast.Analytics, a new project holding seven domain-store interfaces (and their DTOs) carved out of the legacy 25-method IClickHouseService. The seam unblocks HOL-26+ (Postgres impl) without touching any of the 12 caller projects again.

What this PR does

  • New project HoldFast.Analytics, depends only on HoldFast.Domain — no client SDKs (the whole point of the seam)
  • Seven domain-store interfaces:
    • ILogStore (6 methods)
    • ITraceStore (5)
    • ISessionAnalyticsStore (5)
    • IErrorAnalyticsStore (6)
    • IMetricStore (2)
    • IEventFieldStore (2)
    • IAlertStateStore (4)
  • All read/write models + CursorHelper + pagination types moved from HoldFast.Data.ClickHouseHoldFast.Analytics. Mechanical namespace update across 32 caller files.
  • ClickHouseService now implements all 8 interfaces (legacy IClickHouseService + the 7 new ones). Same 1060 lines of SQL verbatim, no behavior change.
  • DI registers a single ClickHouseService singleton, wired to all 8 interfaces via sp.GetRequiredService<ClickHouseService>().
  • New mockability tests (tests/HoldFast.Shared.Tests/Analytics/MockableStoreTests.cs): prove a fake ILogStore can substitute the real impl without any ClickHouse dependency. This was the missing test capability before HOL-25 — IClickHouseService's 25-method surface made mocking impractical.

What this PR explicitly does NOT do

  • No Postgres code — deferred to HOL-26 onward
  • No schema or query rewrites — ClickHouseService is byte-identical
  • No removal of IClickHouseService — it stays alongside the new interfaces. Callers migrate incrementally in follow-up PRs; legacy interface is deleted in HOL-32

Test plan

  • dotnet build — 0 errors, 0 new warnings (only pre-existing HotChocolate CVE warning)
  • dotnet test3,031 pass (was 3,027; +4 new mockability tests)
  • No tests modified except for mechanical using HoldFast.Data.ClickHouse.Models;using HoldFast.Analytics.Models; updates
  • MockableStoreTests proves: fake ILogStore substitutes real impl, writes are recorded, all 7 interfaces compile independently, abstractions live in the right assembly
  • Smoke test (compose up, ingest a synthetic event, query it back) — recommend reviewer run before merge

Stats

51 files changed, +543 / -54

Closes HOL-25. First step of the Postgres-migration EPIC; HOL-26 (PG schema port) is next.

🤖 Generated with Claude Code

Introduces HoldFast.Analytics, a new project that holds the seven
domain-store interfaces and their associated DTOs:

- ILogStore               (6 methods)
- ITraceStore             (5 methods)
- ISessionAnalyticsStore  (5 methods)
- IErrorAnalyticsStore    (6 methods)
- IMetricStore            (2 methods)
- IEventFieldStore        (2 methods)
- IAlertStateStore        (4 methods)

Together these cover the same 30-odd-method surface as the legacy
IClickHouseService, just split along domain lines so a future Postgres
backend (HOL-26+) can replace one slice at a time without touching the
12 caller projects.

What this PR explicitly does NOT do:

- No Postgres code (deferred to HOL-26 onward)
- No schema or query rewrites - ClickHouseService keeps its 1060 lines
  of SQL verbatim and now just implements all eight interfaces; DI hands
  back the same instance for every request
- No removal of IClickHouseService - it stays as a working API alongside
  the seven new interfaces; call sites migrate incrementally in follow-up
  PRs and the legacy interface gets deleted in HOL-32

What this PR does change:

- New project HoldFast.Analytics, depends only on HoldFast.Domain
- All read/write models, CursorHelper, and pagination types moved from
  HoldFast.Data.ClickHouse to HoldFast.Analytics (namespace updated
  across 32 callers; mechanical sed)
- HoldFast.Data.ClickHouse now references HoldFast.Analytics
- Program.cs registers ClickHouseService as the singleton for all eight
  interfaces (legacy IClickHouseService + the seven new domain stores)
- New mockability tests in HoldFast.Shared.Tests/Analytics/ proving the
  seam: a fake ILogStore can substitute for the real impl without any
  ClickHouse dependency

Test coverage: 3,031 tests pass (was 3,027; +4 mockability tests).
Smoke: solution builds with 0 errors / 0 new warnings.

Refs HOL-25.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@BrewingCoder BrewingCoder merged commit 3657a01 into main May 9, 2026
8 checks passed
@BrewingCoder BrewingCoder deleted the issue-25-storage-abstractions branch May 9, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant