Skip to content

feat(persistence): Prisma adapters, DI unification, Docker prod docs - #337

Open
Good-Coded wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
Good-Coded:feat/persistence-adapters-and-docker-docs
Open

feat(persistence): Prisma adapters, DI unification, Docker prod docs#337
Good-Coded wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
Good-Coded:feat/persistence-adapters-and-docker-docs

Conversation

@Good-Coded

Copy link
Copy Markdown

Closes #143 — Docker production deployment docs
Expanded the Docker section in README.md with a table separating variables
that must be set in production (DATABASE_URL, CORS_ORIGIN, SOROBAN_SIGNING_KEY,
contract IDs, NODE_ENV=production) from safe-to-default ones. Also adds
INTENTS_PERSISTENCE and SOLVERS_PERSISTENCE to the table.

closes #215 — Unify IntentsService with repository-injection pattern

  • INTENTS_REPOSITORY Symbol DI token + IIntentsRepository interface in
    intents.repository.ts, mirroring SOLVERS_REPOSITORY exactly.
  • InMemoryIntentsRepository consolidated from the deleted
    in-memory-intents.repository.ts — no separate file, one canonical adapter.
  • IntentsService injects IIntentsRepository; private Map removed.
    Idempotency cache and audit log remain in-service (non-durable concerns).
  • IntentsModule uses useFactory to select adapter via INTENTS_PERSISTENCE env var.

closes #214 — PrismaIntentsRepository with atomic conditional updates

  • src/intents/prisma-intents.repository.ts
  • acceptIfOpen: single prisma.intent.updateMany({ where: { intentId, state:'open' }})
    — 0 rows = race lost, no separate read-then-write.
  • fillIfAccepted: updateMany guards on state='accepted' AND solver atomically.
  • Safe for horizontal scaling. Selected via INTENTS_PERSISTENCE=prisma.

closes #216 — PrismaSolversRepository

  • src/solvers/prisma-solvers.repository.ts
  • save() uses upsert keyed on unique address — register/deactivate/reactivate/
    recordFailedFill all work unmodified.
  • bondAmount/totalVolume stay strings; never coerced through JS number.
  • Selected via SOLVERS_PERSISTENCE=prisma (default: memory).

Docs

  • docs/architecture/onchain-settlement.md: added Persistence layer section.
  • CONTRIBUTING.md: updated Module and file structure with canonical pattern.

Tests

  • All specs updated for async service methods (await).
  • intents.service.spec.ts rebuilt around Test.createTestingModule + DI token.
  • Pre-existing failures in http-exception.filter.spec, logging.interceptor.spec,
    soroban.controller.spec (18 tests on main before this PR) are not introduced
    by this change — verified by stash test.

Closes stellar-vortex-protocol#143 — document Docker production deployment env vars in README
Closes stellar-vortex-protocol#214 — PrismaIntentsRepository with atomic conditional updates
Closes stellar-vortex-protocol#215 — unify IntentsService with INTENTS_REPOSITORY DI pattern
Closes stellar-vortex-protocol#216 — PrismaSolversRepository adapter for SolversModule
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Good-Coded Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant