Skip to content

✨ Resolve screenshot SHAs before byte upload#299

Merged
Robdel12 merged 1 commit into
mainfrom
rd/screenshot-sha-create-resolve
Jun 17, 2026
Merged

✨ Resolve screenshot SHAs before byte upload#299
Robdel12 merged 1 commit into
mainfrom
rd/screenshot-sha-create-resolve

Conversation

@Robdel12

Copy link
Copy Markdown
Contributor

Why

Screenshot upload is one of Vizzly's hottest SDK paths. When a build captures thousands of screenshots, sending image bytes for files we already have in storage is wasted work for the CLI, API, and object storage.

The paired Vizzly API change lets the screenshot create endpoint accept sha256 without image_data, resolve reusable storage server-side, and only ask for bytes when the image is missing. This CLI change moves the per-screenshot upload path to that contract.

Approach

  • Compute the screenshot SHA before upload and first call the screenshot create endpoint with name, metadata, and SHA only.
  • Skip the byte upload when the API returns upload_required: false, preserving the existing skipped/fromExisting result shape for callers.
  • Fall back to the normal byte upload path when SHA resolution is unavailable, returns a server error, or talks to an older server that still requires image_data.
  • Continue surfacing auth and ownership failures instead of retrying them as byte uploads, so the fallback does not hide real access-control errors.
  • Document that skipped uploads mean Vizzly reused existing storage, and that --upload-all still forces screenshots through.

This keeps the CLI simple: no SDK-side batching, no client-side cache, and no extra state to recover from. The API stays authoritative about whether a screenshot can reuse existing storage.

Confidence

The API payload helper now has a pure test proving SHA resolution omits image bytes. The upload endpoint tests cover resolve misses, resolve hits, old-server fallback, auth failure, and --upload-all. The full CLI test suite and Biome lint pass locally.

Related

  • Coordinates with vizzly-testing/vizzly#543, which adds the server-side create-with-SHA behavior.

Use the screenshot create endpoint as the CLI upload primitive so existing storage can be reused without sending image bytes. Keep byte upload as the fallback for old servers and transient failures while still surfacing auth and ownership errors.
@vizzly-testing

vizzly-testing Bot commented Jun 17, 2026

Copy link
Copy Markdown

Vizzly - Visual Test Results

CLI Reporter - Waiting for build

No builds received yet for this pull request.

CLI TUI - Approved

5 comparisons, no changes detected.

View build


rd/screenshot-sha-create-resolve · 68f5d1b4

@Robdel12 Robdel12 marked this pull request as ready for review June 17, 2026 05:11
@Robdel12 Robdel12 merged commit 6a6b28b into main Jun 17, 2026
52 checks passed
@Robdel12 Robdel12 deleted the rd/screenshot-sha-create-resolve branch June 17, 2026 05:33
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.

1 participant