Skip to content

fix(pgwire): classify the streamed and DDL shaping failures - #341

Closed
EnRaiha wants to merge 1 commit into
fix/shaper-mapperfrom
fix/shaper-error-class
Closed

EnRaiha wants to merge 1 commit into
fix/shaper-mapperfrom
fix/shaper-error-class

Conversation

@EnRaiha

@EnRaiha EnRaiha commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

Two surfaces still hardcoded the class after the routed sites went through the mapper and the mapper table was completed (PR stacked below):

  1. The streamed responder (decode and shape) rendered a class the error already carried as XX000.
  2. The DDL dispatch (RETURNING shape) did the same.

Stacked on #359, which fixes #338. Top of the two-PR stack.

What

  • Streamed surface: decode and shape failures render through error_to_sqlstate with the same shaping_error_message hygiene; the two "payload was not a row array" invariants keep XX000 by decision.
  • DDL dispatch: the RETURNING shape failure renders through the mapper instead of a literal XX000.

Validation

  • cargo check -p nodedb --all-targets — clean.
  • cargo test -p nodedb --lib error_map — 35 passed.
  • cargo test -p nodedb-types — 750 passed.
  • cargo clippy -p nodedb -p nodedb-types --all-targets -- -D warnings — clean.
  • cargo fmt --all -- --check — clean.
  • Wire tests: not run in isolation for this PR (no wire case changes).

Notes for review

Read the mapper PR first; this one only moves the two remaining surfaces onto it.

Tradeoffs

Tradeoff: the two "payload was not a row array" invariants keep XX000 by decision.

Copilot AI lite review requested due to automatic review settings September 19, 2026 01:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@EnRaiha EnRaiha added the run-ci Opt this PR into the full test suite; re-add to force a re-run label Sep 19, 2026
@EnRaiha EnRaiha changed the title fix(pgwire): complete the shaper error classification and keep internal detail in the log fix(pgwire): classify the streamed and DDL shaping failures Sep 20, 2026
@EnRaiha
EnRaiha changed the base branch from main to fix/shaper-mapper September 20, 2026 11:50
@EnRaiha
EnRaiha force-pushed the fix/shaper-error-class branch from 92ed12f to d7190b3 Compare September 20, 2026 14:45
The streamed path rendered decode and shape failures as XX000 with a raw
message, and the DDL dispatch did the same over a RETURNING shape failure, so
a class the error already carried reached the client as an internal fault.
Both now render through the classified path (error_to_sqlstate for the
stream's crate::Error, numeric_code_to_sqlstate for the shaper's NodeDbError)
with shaping_error_message hygiene. The two 'payload was not a row array'
invariants keep XX000 by decision.
@EnRaiha
EnRaiha force-pushed the fix/shaper-error-class branch from d7190b3 to c625004 Compare September 20, 2026 14:48
@EnRaiha
EnRaiha added this pull request to stack #363 September 20, 2026 14:54
@EnRaiha EnRaiha added run-ci Opt this PR into the full test suite; re-add to force a re-run and removed run-ci Opt this PR into the full test suite; re-add to force a re-run labels Sep 20, 2026
@farhan-syah

Copy link
Copy Markdown
Member

Closing: stacked on #359, which conflicts with main, and CI fails here. Resubmit against main once the mapper PR lands.

@EnRaiha
EnRaiha removed this pull request from stack #363 September 21, 2026 02:37
@farhan-syah
farhan-syah deleted the fix/shaper-error-class branch September 23, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Opt this PR into the full test suite; re-add to force a re-run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Routed response-shaper errors flatten to XX000; the numeric SQLSTATE mapper covers 20 of 81 codes

3 participants