Surface GraphQL response errors when GetUser returns no data - #14562
Open
warp-agent-staging[bot] wants to merge 1 commit into
Open
Surface GraphQL response errors when GetUser returns no data#14562warp-agent-staging[bot] wants to merge 1 commit into
warp-agent-staging[bot] wants to merge 1 commit into
Conversation
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>
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
When the
GetUserGraphQL query returnsdata: null,fetch_user_propertiesraised a bareanyhow!("Expected valid response.data")and discarded the response'serrorsarray. The caller wrapped it withFailed 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:
send_graphql_requestinto a sharedmissing_response_data_error(operation_name, errors)helper incrates/warp_server_client/src/graphql_helpers.rs, and additionally includes each error's responsepathwhen the server provides one.fetch_user_propertiesnow keeps the fullGraphQlResponseand builds its error via that helper (through a small, unit-testableAuthClientImpl::user_output_from_response), so the GraphQLerrorsmessages/paths are surfaced instead of dropped.Out of scope (deliberately unchanged): the server-side cause of
data: null, the other REMOTE-2298 signatures, thenamespace.gocollapse, and all success / other auth paths.Example error before:
Failed to fetch user response data: Expected valid response.dataAfter:
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_errors—data: None+ non-emptyerrorsmust surface every GraphQL message, the error path, and the operation name. This test fails against the previous implementation (which produced onlyExpected 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 existingUnable to fetch userpath is unchanged.Validation (scoped to the touched crate; PR CI is the full-suite backstop):
cargo fmt -p warp_server_clientcargo clippy -p warp_server_client --all-targetscargo test -p warp_server_client auth::Agent Mode
Rework changes
factory-agentPR 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.