fix(adapter-drizzle): an error names its operation whatever the table is called - #1811
mobeenabdullah wants to merge 2 commits into
Conversation
… is called handleQueryError added the operation prefix only when the message lacked the operation's word. A PostgreSQL or MySQL message carries the failed SQL, so a table named int_txpg_update_table satisfied that check and the error went out without its context; main's postgres and mysql legs fail on exactly that. The check is now for the prefix itself.
…hoed statement A PostgreSQL error for an unknown column can name the relation in the server's own text rather than echo the statement; both put the table name, and so the operation's word, in the message. SQLite's text for the same failure names no table, which is why only it kept its context.
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. |
|
Warning Review limit reachedNext included review available in 39 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
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. Comment |
|
@codex review |
|
Closing as a duplicate of #1807, which landed the same fix (check handleQueryError's context by the text it writes, not the operation's bare word) while this was open. Root-cause notes for the record: sqlite's message for the failure is "no such column: ghost" with no table in it, which is why only that leg passed; postgres and mysql messages carry the table name. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What
main's Integration fails on the postgres and mysql legs since #1787 (run 34629104960 at 746a714):Root cause
Not the test.
DrizzleAdapter.handleQueryErroraddsupdate operation failed on table '<table>':only when the message does not already contain the bare wordupdate. The fixture table isint_txpg_update_table, and the postgres and mysql messages contain the table name (the echoed statement in this run; the relation name in the server's own text for the same failure), so the check read the prefix as already present and skipped it. SQLite's message for the same failure isno such column: ghost, with no table in it (measured), which is why only that leg passed. So any table or column whose name contains the operation's word (updated_at,*_update_*,inserts,selections) has been losing its operation context on those dialects.Fix
Check for the exact prefix the method adds. That keeps what the substring check was reaching for (no double prefix when an error is handled twice on its way out) without the false positive. Renaming the fixture table would also have turned the legs green while leaving the bug in place; the unit cases pin the message shapes instead.
Tests
adapter.test.ts: the prefix is added when an echoed statement names a table containing the word, when the server's message names such a relation, and when a column name contains it; it is not added twice. The first two fail onmain.adapter-drizzle(184) andadapter-sqlite(66 unit, 12 integration) pass locally; the postgres and mysql legs run on this PR's CI.Patch changeset, every package (the error text of a published package changes).