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

Relationships

#1585 Retire the genesis_public flag and delete the dead cutover transcription scaffolding

Opened by keeb · 8/11/2026

Problem

The scoring cutover is long done (infrastructure/clickhouse/MIGRATION.md: "Status (2026-07-09) — the cutover is complete and the legacy engine is gone") and the GENESIS quest went public around 2026-07-16. Two artefacts of that period are still in the tree:

  1. genesis_public — a feature flag that is now permanently on, still threaded through 8 gate sites, an admin page, and 6 test files.
  2. The legacy transcription tooling — the one-shot machinery that moved pre-cutover scores out of Mongo. It is unwired dead code.

Together they also keep alive a documented naming hazard: seasons/genesis/implementation.md section 0 exists solely to warn that the scoring cutover genesis baseline and the GENESIS quest campaign are unrelated and "must not share identifiers".

WARNING: the flag cannot simply be deleted

genesis_public.enabledAt is the SOLE source of genesisEpoch() (lib/app/feature-flags.ts). Deleting the flag document deletes the epoch, and genesisEpoch() returning null does not mean "no gate" — it means COUNT LIFETIME ACTIVITY. The consequences:

  • Every operative is instantly regrandfathered to a high tier, directly contradicting the from-zero design of 3689d1f6 (feat(quest): GENESIS cutover — from-zero at the flip, no grandfathering, #897).
  • swamp.quest_signal_counts bakes the epoch into the materialized view WHERE clause. See infrastructure/clickhouse/CLAUDE.md: "The exact epoch is genesis_public.enabledAt (UTC ms), not the flip day." App-side lifetime counts and ClickHouse-side post-epoch counts would then disagree permanently.

So the GATE is vestigial, but the STAMP is load-bearing. Retiring the flag is a migration, not a delete.

Proposed work

Phase 1 — delete the dead transcription scaffolding (safe now, no migration)

  • lib/repositories/legacy-genesis.ts — the LegacyGenesisRow / LegacyGenesisArchive / GenesisTranscriptionGateway ports.
  • lib/infrastructure/clickhouse/clickhouse-genesis-gateway.ts — ClickHouseGenesisGateway. VERIFIED UNWIRED: a repo-wide grep across lib/, routes/, scripts/ and tests/ finds only the class definition itself. It is not in the composition root.
  • infrastructure/clickhouse/genesis-transcription.sql — labelled "Run ONCE at cutover". Already run.
  • infrastructure/clickhouse/init/04-genesis.sql — creates the STAGING table swamp.legacy_genesis_input, only ever populated by the now-deleted exporter.
  • The historical runbook in infrastructure/clickhouse/MIGRATION.md, which already labels itself "not a live dependency".
  • Orphaned comments in lib/infrastructure/mongo-metric-snapshot-repository.ts describing how it fed the deleted exporter.

Worth stating as motivation rather than a footnote: the gateway docstring claims a lockstep test enforces byte-equivalence between its embedded SQL and the .sql file. Both lib/app/legacy-genesis-export.ts and tests/infrastructure/genesis_transcription_lockstep_test.ts NO LONGER EXIST (verified). The file therefore documents a guarantee that nothing provides — it is actively misleading, not merely unused.

Phase 2 — retire genesis_public (needs the epoch pinned first)

  1. Read the production value of feature_flags.genesis_public.enabledAt and pin it as a constant, or via the existing GENESIS_STARTS_AT escape hatch already parsed by parseGenesisEpoch in lib/quest-catalog.ts. It must be the EXACT instant, not the flip day.
  2. Point genesisEpoch() at that constant and delete the flag read path, the 30s TTL cache, isGenesisVisible, setGenesisPublic and setGenesisPublicForTests.
  3. Remove the 8 gate sites: routes/leaderboard.tsx, routes/api/quest/genesis/claim.ts, routes/api/quest/genesis/ghost.ts, routes/api/u/[username]/genesis.ts, routes/u/[username]/genesis.tsx, routes/u/[username].tsx, routes/api/v1/u/[username]/card.ts, lib/app/quest/announce-quest-tier.ts.
  4. Remove routes/admin/genesis.tsx and its tab in components/admin/AdminTabs.tsx.
  5. Update the 6 test files that pin the flag.

Interaction with #1055 (just merged): quest_completion stores epochMs and treats a changed epoch as a seal invalidation. If Phase 2 pins a different instant than the flag currently yields, every sealed pass invalidates once. That is harmless — one recompute wave, which is simply the pre-1055 behaviour — but it should be a known consequence rather than a surprise, and it is a good reason to pin the exact stored value.

Explicit non-goals — do NOT delete these

Everything below is either live product or live data, and shares the word genesis only by the collision that section 0 warns about:

  • The GENESIS quest / battle pass — roughly 5,000 lines, live since around 2026-07-16: /quest, /u/NAME/genesis, the Season Journey card, the claim ceremony, swamp quest, the public card.
  • grant_type=genesis rows and their read path — the frozen pre-cutover score history for every operative. lib/infrastructure/clickhouse/clickhouse-score-reads.ts sums them in the live board/score/graph read. Deleting them zeroes every historical score.
  • SCORE_GRANTS_CUTOVER — live config that pins the activity projector so it never double-counts what the genesis grants already hold. Still validated at telemetry boot.
  • lib/app/genesis-leaderboard.ts and components/GenesisBoard.tsx — despite the name this is the QUEST tier board (it reads Mongo badge_awards), rendered on /leaderboard and /quest. tests/app/genesis_leaderboard_test.ts covers this, not the scoring baseline.

Suggested sequencing

Phase 1 is independent and can land on its own: it is pure deletion of unreachable code and carries no runtime risk. Phase 2 should be a separate PR precisely because it is a behaviour-preserving migration that only LOOKS like a deletion, and it deserves its own review.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

8/11/2026, 12:06:24 AM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.