Skip to content

Surface GraphQL response errors when GetUser returns no data - #14562

Open
warp-agent-staging[bot] wants to merge 1 commit into
masterfrom
factory/remote-2424-surface-auth-graphql-errors
Open

Surface GraphQL response errors when GetUser returns no data#14562
warp-agent-staging[bot] wants to merge 1 commit into
masterfrom
factory/remote-2424-surface-auth-graphql-errors

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

When the GetUser GraphQL query returns data: null, fetch_user_properties raised a bare anyhow!("Expected valid response.data") and discarded the response's errors array. The caller wrapped it with Failed to fetch user response data, so the actual server-reported reason (e.g. an ID-token/auth failure) never reached logs or error reports — the fatal-error signature investigated under REMOTE-2298.

This change is diagnostic surfacing only:

  • Extracts the missing-data error construction already used by send_graphql_request into a shared missing_response_data_error(operation_name, errors) helper in crates/warp_server_client/src/graphql_helpers.rs, and additionally includes each error's response path when the server provides one.
  • fetch_user_properties now keeps the full GraphQlResponse and builds its error via that helper (through a small, unit-testable AuthClientImpl::user_output_from_response), so the GraphQL errors messages/paths are surfaced instead of dropped.

Out of scope (deliberately unchanged): the server-side cause of data: null, the other REMOTE-2298 signatures, the namespace.go collapse, and all success / other auth paths.

Example error before: Failed to fetch user response data: Expected valid response.data
After: Failed to fetch user response data: missing response data for GetUser: failed to mint ID token: token is expired (at user)

Linked Issue

REMOTE-2424 (parent umbrella: REMOTE-2298)

Testing

Headless, backend-only Rust change — no UI surface, so no screenshots apply.

Added regression unit tests in crates/warp_server_client/src/auth/mod_tests.rs:

  • missing_user_data_surfaces_graphql_response_errorsdata: None + non-empty errors must surface every GraphQL message, the error path, and the operation name. This test fails against the previous implementation (which produced only Expected valid response.data) and passes with the fix.
  • missing_user_data_without_response_errors_falls_back_to_generic_message — generic fallback preserved when there are no errors.
  • unknown_user_result_preserves_existing_error — the existing Unable to fetch user path is unchanged.

Validation (scoped to the touched crate; PR CI is the full-suite backstop):

  • cargo fmt -p warp_server_client
  • cargo clippy -p warp_server_client --all-targets
  • cargo test -p warp_server_client auth::

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Rework changes

  • Added the required factory-agent PR metadata block (the PR↔task mapping for REMOTE-2424) to this description. No code changes — the review found no code issues and CI is green.

Task: REMOTE-2424

Conversation: https://staging.warp.dev/conversation/bc51c16d-cb93-4378-842a-af6259422a34
Run: https://oz.staging.warp.dev/runs/019fb544-2de3-758e-b4e8-bcd58b3788c1

This PR was generated with Oz.

When the GetUser query comes back with data == null, the client raised a
bare "Expected valid response.data" error and dropped the GraphQL
response.errors array, hiding the real auth failure reason from logs and
error reports (REMOTE-2424, part of REMOTE-2298).

Extract the missing-data error construction already used by
send_graphql_request into a shared missing_response_data_error helper
(now also including the error path when the server provides one) and use
it from fetch_user_properties, so the underlying GraphQL error messages
are surfaced.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jul 30, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review July 30, 2026 23:14
@warp-agent-staging
warp-agent-staging Bot requested a review from seemeroland July 30, 2026 23:15
@dmichelin
dmichelin requested review from dmichelin and removed request for seemeroland July 31, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant