Skip to content

Log driver API request deserialization errors#4358

Open
squadgazzz wants to merge 2 commits intomainfrom
feat/driver-warn-on-request-deser-errors
Open

Log driver API request deserialization errors#4358
squadgazzz wants to merge 2 commits intomainfrom
feat/driver-warn-on-request-deser-errors

Conversation

@squadgazzz
Copy link
Copy Markdown
Contributor

@squadgazzz squadgazzz commented Apr 22, 2026

Description

Axum returns a terse 400 when a request body or query string fails to deserialize, which makes malformed caller payloads invisible in production.

Changes

  • Added LoggingJson and LoggingQuery extractors that emit a tracing::warn! with the serde error and the target type, then delegate to axum's stock rejection (HTTP response shape unchanged).
  • Wired the new extractors into /settle, /reveal, and /quote.
  • Added a tracing::warn! on /solve body parse failures in pre_processing.rs.

How to test

Existing tests.

Axum returns a terse 400 when a request body or query string fails to
deserialize, which makes malformed caller payloads invisible in
production. Add `LoggingJson` and `LoggingQuery` extractors that emit a
`warn` with the serde error and the type being decoded, then delegate to
axum's stock rejection so the HTTP response shape is unchanged. Wire the
new extractors into `/settle`, `/reveal`, and `/quote`. Also warn on
`/solve` body parse failures in `pre_processing.rs`.
@squadgazzz squadgazzz requested a review from a team as a code owner April 22, 2026 11:02
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces custom Axum extractors, LoggingJson and LoggingQuery, to provide warning logs when request deserialization fails across the quote, reveal, and settle API routes. Additionally, it adds error logging for solve request parsing within the pre-processing logic to improve observability of malformed requests. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

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

LGTM just add a brief doc

serde::de::DeserializeOwned,
};

pub struct LoggingJson<T>(pub T);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Something like this

Suggested change
pub struct LoggingJson<T>(pub T);
/// Json extractor wrapping Axum's native one but logs deserialization errors
pub struct LoggingJson<T>(pub T);

}
}

pub struct LoggingQuery<T>(pub T);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as above but applied to query

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.

2 participants