Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLI
AssigneesNone

Relationships

#858 Epic #847 · Unit 6: Document the Mongo-vs-ClickHouse storage-architecture split in scoring.md

Opened by keeb · 6/27/2026

Part of epic #847. Unit 6 of 6. Prerequisite: #857 (the split is real once projections live in ClickHouse). May fold into the Unit 5 PR if convenient.

Problem

scoring/scoring.md fully specs the monotonic XP ledger but is Mongo-only — it has no ClickHouse projection layer and no statement of the Mongo-vs-CH boundary. Epic #847's acceptance requires the doc to gain a storage-architecture section reflecting the split.

Scope

Add a "Storage architecture" section to scoring/scoring.md covering:

  • Mongo = system of record: append-only score_grants (unique grantId), authoritative running balance, exclusive-badge claims, read-your-write balance / tier-up detection at the save boundary.
  • ClickHouse = projection / serving layer: score_grants (ReplacingMergeTree) + materialized views for every leaderboard / window / streak / category / tier / metric projection.
  • The three operations that MUST stay transactional in Mongo and why CH cannot serve them (no insert-time uniqueness, async-only dedup at merge, no read-your-write).
  • The stream-after-confirm invariant (CH never sees a duplicate in the normal path; ReplacingMergeTree is belt-and-suspenders).

Acceptance

  • scoring/scoring.md has the storage-architecture section.
  • The doc no longer implies projections are hand-rolled in Mongo.

Note

scoring/scoring.md lives in the sibling ~/git/swamp-club checkout (the planning/design repo), not in the app working tree.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

6/27/2026, 3:34:39 AM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.