Repository navigation
fix(supabase, postgres): bind what was asked, survive an ended session, and never report a rolled-back commit - #70
Conversation
…ommits the review of 0.7.16 found wrong With its cache on, SupabaseAdapter binds a read's parameters after it has checked out a client, so values the caller changed after the call were bound and the answer kept under the key of the old ones; named parameters were keyed by their own enumerable fields, not the values bound; a Date by its time, not the text pg binds; and a -- comment ended only at \n. A session the server ends while the cache's read or a transaction holds it, or while it sits idle, emits an error nothing hears, which ends the process. A read or transaction whose ROLLBACK could not run, as when pg's query_timeout drops it, went back to the pool inside its transaction. batchWrite ran its operations without savepoints, so one failure aborted the rest and its COMMIT rolled all of them back. And a transaction whose callback caught a failed statement resolved, in both adapters, although PostgreSQL answered its COMMIT with ROLLBACK.
|
Warning Review limit reached
This review includes 7 billable files and costs up to $1.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 40 minutes for your next included review. View limit details
Comment |
Reviewer's GuideThis test-focused PR adds integration regressions for SupabaseAdapter and PostgresAdapter around aborted-transaction COMMITs, batch-write isolation, terminated or timed-out sessions, and cache parameter/comment handling. The suite uses dedicated adapters, administrative backend termination, query timeouts, and post-failure usability checks to pin the defects described in the PR. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…n, and never report a rolled-back commit (0.7.17) transaction() on the PostgreSQL adapter, on a held connection and on SupabaseAdapter rejects when PostgreSQL answers its COMMIT with ROLLBACK, as it ends an aborted transaction: a callback that caught a failed statement's error and went on resolved with nothing written. SupabaseAdapter.batchWrite runs each operation under a savepoint, so a failed one no longer aborts the rest and rolls the batch back at COMMIT. SupabaseAdapter listens for connection errors on the clients it checks out and on its pool, so the server ending a session no longer ends the process, and closes a client whose ROLLBACK could not run, as when pg's query_timeout drops it, instead of pooling it inside the transaction. With its cache on, a SELECT it may keep is sent the values pg's own prepareValue writes when the call is made, and keyed by them: the values bound, named ones included, and a Date as the text pg binds. A -- comment ends at a carriage return too. run, get and all answer a string of statements as the PostgreSQL adapter does.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
PR Summary by QodoFix PostgreSQL commit reporting and Supabase session, batch, and cache handling
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo
1.
|
… failed batchWrite read each operation's values outside the operation's own error boundary, so a getter or proxy that threw ended the whole batch and rolled back the operations before it. The statement is built inside it now: such an operation fails at its index and the batch goes on.
Summary
Fixes for the defects a review of 0.7.16 found, red first (bf2497a: 11 of the new cases failed, 1501 passed, and vitest caught 3 uncaught
Connection terminatederrors), released as 0.7.17 with the mutation sync merged in #65.transaction()onPostgresAdapter, on a connectionwithConnection()holds, and onSupabaseAdapterrejects when PostgreSQL answers its COMMIT with ROLLBACK. PostgreSQL ends the COMMIT of an aborted transaction that way, with no error (utility.c), so a callback that caught a failed statement's error and went on resolved while nothing was written.SupabaseAdapter.batchWriteruns each operation under a savepoint, asPostgresAdapter.batchdoes, so one failed operation no longer aborts the rest and rolls the whole batch back at COMMIT.SupabaseAdapterlistens for connection errors on the clients it checks out (transaction()and the cache's read) and on its pool. A session the server ended emitted anerrorevent nothing heard, which ends a Node process. The statement now rejects with its own error and code (57P01), the client is closed, and an idle client's failure is logged.query_timeoutdrops it, closes its client instead of pooling it inside the transaction.SELECTthe cache may keep is sent the values pg's ownprepareValuewrites when the call is made, and keyed by them. It used to bind the caller's values only once it had a client, key named parameters by the object's own enumerable fields, and key a Date by its time. On pg before 8.15.0, whose main export has noutils, aSELECTwith parameters runs each time.--comment ends at\ras well as\n, as PostgreSQL reads it.run,getandall, and the transaction handle'sgetandall, answer a string of several statements asPostgresAdapterdoes (getnull,allan empty list). pg answers such a string with a list of results, sogetandrunthrew aTypeErrorafter every statement had run, andallansweredundefined.package.jsonis 0.7.17. #68 also writes 0.7.17: whichever merges second takes 0.7.18.Checklist
Related
None.
Summary by Sourcery
Harden PostgreSQL and Supabase transaction, connection, batch-write, result, and query-cache behavior so failures cannot be reported as successful or leave unsafe pooled sessions behind.
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: