PER-9142: fail snapshot when comparison tile upload fails after retries#2292
PER-9142: fail snapshot when comparison tile upload fails after retries#2292Shivanshu-07 wants to merge 3 commits into
Conversation
When a comparison tile fails to upload/verify after all retries, verify() throws — but sendComparison aborted before finalizeComparison, leaving the comparison unfinalized. The server's build-cleanup loop then swept it and surfaced a misleading "render_timeout" instead of a clean per-snapshot failure. Finalize the comparison on tile-upload failure so the server resolves it deterministically (marking that snapshot failed), then re-throw so the snapshot is reported failed to the caller. The build continues; other snapshots are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ttempted - Coerce finalizeError defensively in the inner catch so a non-Error rejection can't throw and mask the original tile-upload error being re-thrown. - Assert finalizeComparison was still called in the finalize-also-fails test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude Code PR ReviewPR: #2292 • Head: 819bf71 • Reviewers: stack:code-reviewer SummaryFails the affected snapshot when a comparison tile upload/verify fails after all retries: Review Table
FindingsReviewer raised no Critical/High issues. Two actionable items were flagged and have been addressed in 819bf71:
Remaining reviewer notes (optional-chaining consistency in the new log line vs neighbouring lines; redundant API-request assertion in test 1) are Low/cosmetic and left as-is. Verdict: PASS |
The defensive `finalizeError?.message || finalizeError` introduced a logical-or
branch whose fallback side the tests never exercised, tripping the repo's 100%
branch-coverage gate (client.js:896). Use plain template coercion `${finalizeError}`
— still null-safe, no added branch — and drop the now-inconsistent `options.tag?.name`
optional chain in favour of `options.tag.name` to match the surrounding logs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Problem
For App Percy / Percy-on-Automate comparisons,
client.verify()retries a tile up to 20× and thenthrowsUploading comparison tile failed(intended: "the comparison will be failed even if 1 tile gets failed").But that throw happens inside
uploadComparisonTiles, beforefinalizeComparison:So the comparison is left unfinalized. The server's build-cleanup loop then reinserts the stuck comparison up to 10× and finally marks the build
render_timeout— a misleading failure reason, and the snapshot is never cleanly reported as failed. (This is the CLI-side counterpart of the App Automate dropped-tile issue investigated in PER-9142 / browserstack/mobile-common#1197.)Fix
On tile-upload failure, finalize the comparison anyway so the server resolves it deterministically (and marks that snapshot failed) instead of leaving it to be swept as a
render_timeout, then re-throw so the snapshot is reported failed to the caller:errorhandler incore/src/snapshot.js, which logs the failure and (for sync snapshots) rejects that snapshot's promise — so failure is surfaced per-snapshot.Tests
Added to
#sendComparison():yarn test --node(client) → allsendComparisonspecs green; existing specs unaffected. ESLint clean on changed files. (The 2 failures intest/unit/proxy.test.json my machine are pre-existing/environmental — a local proxy + a Node-20Invalid URLmessage-format difference — unrelated to this change.)Related
🤖 Generated with Claude Code