Skip to content

fix: fix neon-http sync issue by updating balances#6

Merged
ECWireless merged 1 commit into
mainfrom
codex/neon-http-sync-fix
May 30, 2026
Merged

fix: fix neon-http sync issue by updating balances#6
ECWireless merged 1 commit into
mainfrom
codex/neon-http-sync-fix

Conversation

@ECWireless
Copy link
Copy Markdown
Member

This pull request refactors the way treasury balance snapshots and their associated assets are inserted into the database. The main improvement is the introduction of batch insertion when supported, making the snapshot creation process more efficient and reliable.

Database insertion improvements:

  • Generates a snapshotId using crypto.randomUUID() and uses it to associate assets with their snapshot, instead of relying on a returned value from the database.
  • Adds support for batch insertion of both the snapshot and its assets when the database supports batching, falling back to a transaction otherwise for compatibility.

These changes improve performance and consistency in how snapshot data is stored.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
raidguild-accounting Ready Ready Preview, Comment May 30, 2026 5:29pm

Request Review

Copilot AI review requested due to automatic review settings May 30, 2026 17:29
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@ECWireless, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 22 minutes and 19 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2643419a-8ece-4dd9-b8a1-a458cdc2624e

📥 Commits

Reviewing files that changed from the base of the PR and between 213cecc and 37ff23d.

📒 Files selected for processing (1)
  • src/lib/treasury/balances.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/neon-http-sync-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a sync failure on the Neon HTTP Drizzle driver (which doesn't support transaction()) by pre-generating the snapshot UUID client-side and using db.batch() when available, falling back to a transaction for the node-postgres driver used in local development.

Changes:

  • Generate snapshotId via crypto.randomUUID() so assets can reference it without depending on .returning().
  • Use db.batch([...]) when the driver supports it (Neon HTTP); otherwise wrap inserts in db.transaction().
  • Refactor snapshot/asset payloads into shared local variables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ECWireless ECWireless merged commit 6b4ebda into main May 30, 2026
4 checks passed
@ECWireless ECWireless deleted the codex/neon-http-sync-fix branch May 30, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants