Skip to content

Make monerium vs mykobo flows distinguishable#1176

Merged
ebma merged 1 commit into
stagingfrom
monerium-fallback
May 29, 2026
Merged

Make monerium vs mykobo flows distinguishable#1176
ebma merged 1 commit into
stagingfrom
monerium-fallback

Conversation

@ebma
Copy link
Copy Markdown
Member

@ebma ebma commented May 29, 2026

Adds a new column to the ramp and quotes table that denotes the flow for which the quote/ramp was created. The flow_variant will be assigned by the respective backend, thus we need to set the env variables accordingly. In the future, all backends will use the Mykobo flow, but for now, it's still the Monerium variant. While this flow variant is only relevant for the respective onramps, we'll add it for all quotes/ramps for now and remove it later once the fallback is no longer needed.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit a9f1353
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a195ccb72f2c5000809fb1e
😎 Deploy Preview https://deploy-preview-1176--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ebma ebma requested a review from Copilot May 29, 2026 09:30
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit a9f1353
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a195ccb3acf0b0008d4a7b3
😎 Deploy Preview https://deploy-preview-1176--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a flowVariant column ("monerium" | "mykobo") to quote_tickets and ramp_states so two backend instances can share one database while each only operating on its own flow's records. The backend's own flow is read from the FLOW_VARIANT env var and used to filter reads in workers/services and to 404 on cross-flow access.

Changes:

  • Schema/model: new non-null flow_variant column + index on both tables, backfilled to monerium via migration 028.
  • Config: introduces FlowVariant type, readFlowVariant(), and config.flowVariant, required in production env.
  • Services/workers: stamps new quotes/ramps with config.flowVariant, filters worker queries by flow, and uses assertOwnedByThisFlow (404) for register/update/start/status/error-log/timeout/phase-transition paths.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/api/src/models/rampState.model.ts Adds flowVariant attribute, field mapping, and index.
apps/api/src/models/quoteTicket.model.ts Adds flowVariant attribute, field mapping, and index.
apps/api/src/database/migrations/028-add-flow-variant.ts Adds nullable column, backfills 'monerium', makes non-null, indexes.
apps/api/src/config/vars.ts Adds FlowVariant type, validation, and required env in production.
apps/api/src/api/workers/unhandled-payment.worker.ts Filters stale initial/failed ramps by current flow.
apps/api/src/api/workers/ramp-recovery.worker.ts Filters recovery candidates by current flow.
apps/api/src/api/workers/cleanup.worker.ts Filters post-complete ramps by current flow.
apps/api/src/api/services/ramp/ramp.service.ts Adds assertOwnedByThisFlow and per-endpoint flow checks; stamps new ramps.
apps/api/src/api/services/quote/index.ts Returns null for cross-flow getQuote.
apps/api/src/api/services/quote/engines/finalize/index.ts Persists flowVariant on quote creation.
apps/api/src/api/services/phases/phase-processor.ts Skips processing ramps belonging to the other flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@Sharqiewicz Sharqiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ebma ebma merged commit 1d7b6b9 into staging May 29, 2026
8 checks passed
@ebma ebma deleted the monerium-fallback branch May 29, 2026 13:43
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.

3 participants