TE-27460: read the 404 a pdf poll gets before rendering finishes - #559
Merged
Conversation
Found by running the flow against stage. A pdf's counter only exists once rendering has produced the page count, so the first polls legitimately get a real HTTP 404, which axios throws on. The poller treated any throw as terminal and failed both documents immediately with "[object Object]". getSnapshotStatus now takes an opt-in that accepts 404 as a readable response. Only the pdf poller passes it. Web seeds its counter when the snapshot is accepted, never sees this state, and keeps the default behaviour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4Hy9BKNiBTDThi87RYSqX
Covers the --sync flag on upload-pdf, merged in LambdaTest#558 without a bump, and the 404 handling fix in this PR. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V4Hy9BKNiBTDThi87RYSqX
parthlambdatest
approved these changes
Sep 4, 2026
parthlambdatest
approved these changes
Sep 4, 2026
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.
Follow-up to #558, which is merged. Found by running
upload-pdf --syncend to end against stage for the first time, with the backend counterparts deployed.Problem
Both documents failed instantly with a useless message:
A pdf's sync counter is only seeded once rendering has produced the page count, so the first polls legitimately hit the "key does not exist" branch of
/snapshot/status, which returns a real HTTP 404. Axios throws on it, andhttpClient.requestrethrows a plainErrorwith noresponse, so the poller could not see the status and treated every throw as terminal.The
[object Object]came from the same place:requestbuilds its message fromerror.response.data.error?.message || error.response.data.message || error.response.data, and that 404 body has neither message field, so an object was passed tonew Error.Web never reaches this state.
ProcessSnapshotseeds the counter when the snapshot is accepted, so by the time the SDK polls, the key exists and the endpoint answers 202.Change
getSnapshotStatustakes an opt-in that accepts 404 as a readable response rather than a thrown error. Only the pdf poller passes it. The web call site is unchanged and keeps the default axios behaviour.Terminal errors are still terminal: anything that is not 200, 202 or 404 stops polling and reports the real error, as before.
Verification
Re-ran against stage with the fix. Both builds returned full results:
success;Changes foundat 3.01% and page 2Approvedat 0%, each page resolving to its own baseline image.🤖 Generated with Claude Code
https://claude.ai/code/session_01V4Hy9BKNiBTDThi87RYSqX