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

Đang mở
#2,007 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
postgres, typescript
Lĩnh vực
backend, cloud, database

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
HTML
Star
33
Fork
107
Merge trung bình
14 giờ 6 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của USRSE/usrse.github.io

Tất cả issue của USRSE/usrse.github.io

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.