VE-21573: poll HEAD after PUT upload before signalling success#617
Merged
Conversation
After a PUT to a signed S3 URL completes, the object may not be immediately readable due to S3 eventual consistency. This adds a HEAD request to the getUrl after PUT success, with exponential backoff retries (up to 5), so that createTDOWithAsset is only called once the file is confirmed readable — eliminating the race condition. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers: PUT success + HEAD confirms readability, exponential backoff retries, max retries exhausted (proceeds anyway), PUT failure skips HEAD, abort (status 0), multi-file END only after all lifecycles complete, and requestMap population/cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add eslint-env node,jest so `global` is recognised - Drop unused `channel` binding in requestMap test - Remove spurious `async` on test with no await Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
forEach creates all PUT XHRs before any callbacks fire, so instances[1] is PUT b (not HEAD a). HEAD XHRs only appear after their PUT completes. Also interleave takes with puts to avoid overflowing the sliding(2) channel buffer in sync test code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
pollForFileAvailabilityfunction inuploadFilesChannel.jsthat issues a HEAD request todescriptor.getUrlafter PUT successcreateTDOWithAssetis now only called after the HEAD confirms the file is readable, eliminating the race conditiondescriptor.getUrlis absent, emits success immediately (existing behaviour)Test plan
npm run start:storybookinpackages/veritone-widgets)getSignedWritableUrl→ PUT to signed URL → HEAD togetUrl→createTDOWithAssetcreateTDOWithAssetproceeds after max retriesCloses VE-21573
🤖 Generated with Claude Code