Make monerium vs mykobo flows distinguishable#1176
Merged
Conversation
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vortexfi ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
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_variantcolumn + index on both tables, backfilled tomoneriumvia migration 028. - Config: introduces
FlowVarianttype,readFlowVariant(), andconfig.flowVariant, required in production env. - Services/workers: stamps new quotes/ramps with
config.flowVariant, filters worker queries by flow, and usesassertOwnedByThisFlow(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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.