Skip to content

WPB-22970: migrate activation-keys to PostGreSQL - #5417

Open
blackheaven wants to merge 1 commit into
developfrom
gdifolco/WPB-22970-migration-postgres-activation-keys
Open

WPB-22970: migrate activation-keys to PostGreSQL#5417
blackheaven wants to merge 1 commit into
developfrom
gdifolco/WPB-22970-migration-postgres-activation-keys

Conversation

@blackheaven

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-22970

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

Add Postgres, DualWrite, and Migration interpreters for the
ActivationCodeStore effect (brig service). The migration follows the
canonical dual-write + background-worker pattern:

- Layer A: PostgresMarshall instances for ActivationKey/ActivationCode
- Layer B: Postgres interpreter with TTL鈫抏xpires_at conversion
- Layer C: DualWrite interpreter (reads鈫扖assandra, writes鈫抌oth)
- Layer D: Migration loop copying ttl(code)鈫抏xpires_at
- Layer E: activationKeys StorageLocation config field
- Layer F: Brig interpreter selection + second-writer refactor
- Layer G-H: Background-worker migration wrapper + flag
- Layer I-R: SQL migration, helm values, config docs, integration test

The key design decision: the second writer
(Brig.Data.Activation.verifyCode) that bypassed the effect is now routed
through a new VerifyActivationCode effect constructor. This preserves the
brute-force protection (3 max retries, TTL-preserving countdown, delete on
exhaustion) while allowing each interpreter to implement it natively.

ActivationCodeStore was moved before the Error block in
BrigLowerLevelEffects to ensure Error Hasql.UsageError is available when
the Postgres interpreter runs.

Bead: ws-migrate-postgresql-ec0
@blackheaven
blackheaven requested review from a team as code owners August 4, 2026 18:10
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