feat(api): switch createDb to WebSocket Pool driver to enable applyTransition transactions

Aperta
#2,007 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
postgres, typescript

Direzione di ricerca

Start by reading packages/api/src/db/index.ts and packages/api/src/lib/lifecycle/applyTransition.ts, then verify the nodejs_compat setting in wrangler.jsonc. Compare the current neon-http latency with neon-serverless, check the Cloudflare Workers integration and HTTP-only feature constraints, and run the 216+ test integration suite against staging. Done means the driver choice is validated, applyTransition is transactional if switched, and the comment and measurements are updated.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

packages/api/src/lib/lifecycle/applyTransition.ts documents itself as "sequential, not transactional" because @neondatabase/serverless HTTP driver (via drizzle-orm/neon-http) does not support db.transaction(). A crash between insertReview and updateArtifactStatus could leave a stranded review row that bumps the count toward a future publish without flipping the artifact.

Requirements

  • Evaluate switching createDb (packages/api/src/db/index.ts) from neon-http to neon-serverless (WebSocket Pool driver)
  • If switching, measure cold/warm latency impact (current is ~360ms cold / <200ms warm on neon-http)
  • Wrap applyTransition body in db.transaction(async tx => { ... }) once Pool driver is in place
  • Update the comment in applyTransition.ts to remove the TODO
  • Re-run the full integration test suite (216+ tests) against staging to confirm no regressions

Context

Flagged in the Plan 1 final review. At v1 admin write volumes the non-atomicity is acceptable; this issue gets more urgent as concurrent write volumes grow.

Implementation Notes

The Cloudflare Workers + neon-serverless integration requires nodejs_compat flag in wrangler.jsonc — verify before committing to the swap. Some HTTP-only Neon features may not be available via WebSocket.

Lingua principale
HTML
Stelle
33
Fork
107
Merge medio
14h 6m
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di USRSE/usrse.github.io

Tutte le issue di USRSE/usrse.github.io

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.