Keep the server's ErrorResponse on ReplicationError #163
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 255 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.332
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #163"
general
weight: 0.35
LucaCappelletti94
Summary
Every server ErrorResponse goes through
from_sqlstate, which uses the SQLSTATE once to choose the variant and then folds it into the message text, so the fieldsparse_error_fieldsalready parsed (severity, code, message, detail, hint, routine) are thrown away.A consumer that needs a code outside the few that
from_sqlstatepromotes can only recover it by parsing[42883]out of the string.The five variants a server error can land in (
Protocol,TransientConnection,PermanentConnection,AuthenticationandReplicationSlot) now carry the parsed response as a second field, read throughReplicationError::sqlstate()andReplicationError::server_error(). Their message becomes aBox<str>, soReplicationError, and with it everyResultthe parser returns, stays 32 bytes. The variant choice and theDisplaytext are unchanged, so retry classification behaves as before.The code is a
sqlstate::SqlStatefrom thesqlstatecrate that Diesel publishes. It isno_stdwith no dependencies, so it also fits the parser-only build, and pg_walstream re-exports it. I am one of the maintainers there, so if changes need to be made I can do them reasonably quickly.Most of the diffs in this PR consist of trivial replacements and cargo locks.
Type of change
Checklist
make before-git-pushpasses locally (check, build, format, audit, test, doc-check)--features rustls-tlsif connection/streaming code changed)Performance notes
The messages are
Box<str>to keepReplicationErrorat 32 bytes. AStringmessage next to the new field makes it 40 bytes, and CodSpeed measured that as a slowdown onzero_copy_path. WithBox<str>it reports no change on all 50 benchmarks.