Skip to content

fix: route a statement's diagnostics in driver order (#478) - #491

Merged
TimelordUK merged 1 commit into
masterfrom
fix/diagnostics-order
Oct 18, 2026
Merged

TimelordUK merged 1 commit into
masterfrom
fix/diagnostics-order

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Fixes #478.

Problem: dispatchInfoReturnErrors routed a set's info messages at once and returned only its errors, which were routed later. So 3621 "The statement has been terminated." came before the 2627 it belongs to. Case D already came out in order because it takes another path.

Fix (lib/reader.js)

  • A set of diagnostics that contains an error is routed whole, in driver order, by the error path. A set with only info is routed at once, as before.
  • routeStatementError counts more over errors only: an error has more when another error follows it, or when the batch goes on. It used to count info too. That was latent while info and errors were routed separately, and would have given the 2627 more=true.
  • In callback mode, info that follows an error in the same set is emitted a tick later, so it still comes after the user's callback, which the connection defers by a tick.
  • asCancelled ignores info when deciding whether failures are side effects of a cancel.

Corpus

Found, not fixed (in HANDOVER): info from some DDL statements (1756) is mostly lost, on master too. It is probably native.

Local (Windows): full suite 1072 passing, replay 148 passing.

🤖 Generated with Claude Code

A set of diagnostics with an error in it had its info routed at once and
only its errors handed back, so 3621 "The statement has been terminated."
came before its 2627. Now such a set is routed whole, in driver order, by the
error path; a set of info only is routed at once, as before.

'more' is counted over errors only. It also counted info before, which was
latent while info and errors were routed apart. In callback mode, info that
follows an error is emitted a tick on, after the deferred callback.

New scenario errors/two-errors-one-statement. All dup-key-* and
scripts/issue-478 are agreed; the Linux pins are reordered and stay
known-bug for #483.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@TimelordUK
TimelordUK merged commit f9ac1e4 into master Oct 18, 2026
11 checks passed
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.

5.6.0: a failed statement's info messages are emitted before its error (3621 "The statement has been terminated." arrives before 2627)

1 participant