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

Abierto
#2,007 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
postgres, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
HTML
Estrellas
33
Forks
107
Merge medio
14 h 6 min
PR fusionados (30 d)
19

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de USRSE/usrse.github.io

Todos los issues de USRSE/usrse.github.io

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.