Skip to content

feat: retry transient S3 upload failures with richer telemetry#51

Merged
blimmer merged 1 commit into
mainfrom
harden-analysis-upload
Jun 26, 2026
Merged

feat: retry transient S3 upload failures with richer telemetry#51
blimmer merged 1 commit into
mainfrom
harden-analysis-upload

Conversation

@blimmer

@blimmer blimmer commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The analysis-bundle upload PUTs straight to a presigned S3 URL via raw fetch, so the AWS SDK (which only signs the URL) never retries it on a transient blip. This adds our own retry of the transient outcomes — 429/5xx/RequestTimeout and network errors — with exponential backoff capped at 4 attempts, while failing fast on 4xx signature/permission errors. It also parses the S3 XML error <Code>/<RequestId> and surfaces them through a privacy-safe uploadErrorTelemetry() that sharePrompt now reports to analytics and logs on failure.

Review focus

  • The retry is implemented natively with neverthrow's .orElse (recursive on #putToS3WithRetry) rather than a throw-based retry lib, to keep the typed UploadError in Result-land end-to-end. Worth a sanity check on the backoff math (retryMinTimeoutMs * 2 ** (attempt - 1)) and the isRetryableUploadError classification.
  • uploadErrorTelemetry() deliberately omits the raw S3 body and presigned URL because both embed the owner/email object key. Please confirm nothing privacy-sensitive leaks through the fields we do send (s3Code, requestId, truncated network error messages).

Commits

  • 899a008 — retry transient S3 upload failures with richer telemetry

The analysis-bundle PUT goes straight to a presigned S3 URL via raw fetch,
so nothing retries it on a transient blip. Retry the transient outcomes
(429/5xx/RequestTimeout, network errors) with exponential backoff, capped
at 4 attempts, while failing fast on 4xx signature/permission errors.

Parse the S3 XML error <Code>/<RequestId> and surface them through a
privacy-safe uploadErrorTelemetry() (never the raw body or presigned URL,
which embed the owner/email object key). sharePrompt now reports that
detail to analytics and logs the failure for o11y.
@blimmer blimmer marked this pull request as ready for review June 26, 2026 20:03
@blimmer blimmer requested a review from jcarver989 as a code owner June 26, 2026 20:03
@blimmer blimmer merged commit 02f4b9f into main Jun 26, 2026
7 checks passed
@blimmer blimmer deleted the harden-analysis-upload branch June 26, 2026 20:21
blimmer pushed a commit that referenced this pull request Jun 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.7.0](v0.6.0...v0.7.0)
(2026-06-26)


### Features

* retry transient S3 upload failures with richer telemetry
([#51](#51))
([02f4b9f](02f4b9f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: contextbridge-pr-automation[bot] <259134118+contextbridge-pr-automation[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants