Log PostgreSQL server failures as errors - #5882
Open
UllasSHR wants to merge 1 commit into
Open
Conversation
UllasSHR
marked this pull request as ready for review
September 8, 2026 07:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Log failed PostgreSQL responses according to their HTTP status: 5xx responses now use
error!, while 4xx responses continue to usewarn!. This lets internal failures classified upstream as server errors remain visible at the appropriate log level.Adds a regression test that passes representative 400 and 500 responses through
response(), checks the emitted log level, and verifies that the original error text is still returned.Addresses #5695.
Interaction with #5869
#5869 classifies SQL execution failures as 400 or 500 in the client API and does not modify the PostgreSQL adapter. This change consumes that HTTP classification at the PostgreSQL boundary. It can merge independently; #5869 would increase the SQL execution failures that reach the 5xx branch.
Error responses can already be logged both where they originate and again at the PostgreSQL boundary. This change only corrects the severity of the PostgreSQL log for 5xx responses.
API and ABI breaking changes
None.
Rollback safety impact
n/a
Expected complexity level and risk
1 - The behavior change is limited to PostgreSQL response logging.
Testing
cargo test --locked --offline -p spacetimedb-pg --libcargo fmt --check -p spacetimedb-pg