Skip to content

feat: opt-in Storybook bundle upload for per-build hosting (PER-8973) - #1341

Draft
Shivanshu-07 wants to merge 5 commits into
masterfrom
feat/per-8973-storybook-hosting
Draft

feat: opt-in Storybook bundle upload for per-build hosting (PER-8973)#1341
Shivanshu-07 wants to merge 5 commits into
masterfrom
feat/per-8973-storybook-hosting

Conversation

@Shivanshu-07

Copy link
Copy Markdown
Contributor

Summary

SDK side of per-build Storybook hosting (PER-8973). Part of a 4-repo feature — API + edge worker: percy/percy-api#6506; web: percy/percy-web (linked below).

Adds opt-in upload of the built storybook-static bundle to Percy for hosting:

  • storybook.uploadBundle config + --upload-bundle flag, default off, directory mode only (no behavior change on upgrade)
  • After the snapshot run, zips and uploads the bundle to percy-api
  • 200 MB cap (injectable) with an actionable error; capped exponential-backoff retries (~65s horizon, transient-only — a 4xx like feature_disabled is terminal); failure beacon (state_hint=failed) so client-side failures surface on the review page and in the success metric
  • Best-effort throughout: never throws, never exits non-zero

Testing

  • 9/9 jasmine specs passing ✅ (happy path, input guards, terminal-4xx-no-retry, 5xx-retry-then-beacon, network-retry, size-cap beacon)
  • eslint clean

Post-Deploy Monitoring & Validation

No additional operational monitoring required beyond the API-side metrics — the SDK change is opt-in and best-effort; upload outcomes are tracked server-side (see the API PR).

🤖 Generated with Claude Code

Shivanshu-07 and others added 5 commits July 15, 2026 21:38
Adds storybook.uploadBundle config + --upload-bundle flag (default off; directory mode
only). After the snapshot run, zips storybook-static and uploads to percy-api for hosting.
Best-effort: 200 MB cap (injectable) with an actionable error, capped exponential-backoff
retries (~65s horizon, transient-only — a 4xx like feature_disabled is terminal), and a
failure beacon (state_hint=failed) so client-side failures surface on the review page and
in the success metric. 9 jasmine specs pass. Adds archiver + form-data deps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…8973)

Replaces zip+POST with the CAS handshake: walk storybook-static, SHA-256 every file, POST
/check (one call -> missing shas + signed PUT URLs with replay headers), PUT each missing
blob DIRECTLY to GCS (bounded parallelism, replaying the signed x-goog-content-sha256 etc.),
then POST /commit with the manifest. Dedup falls out of the missing-set; bytes never touch
percy-api. Keeps opt-in gate, injectable caps, failure beacon (size_cap/client_failed),
best-effort (never throws). Drops the archiver dep (no more zipping). 8/8 jasmine, eslint clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
POST each missing blob to the verifier upload URL returned by /check (with the
X-Upload-Token + X-Expected-Sha), instead of PUT to a GCS signed URL. The
verifier re-hashes and writes the CAS blob only if it matches. Tests updated
(8/8 jasmine pass).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The final snapshot map already computes the Storybook-encoded args/globals
query values for the capture URL; carry them (plus the story id) on the
snapshot as the storybook property so @percy/client sends them to the API
and the review UI can deep-link the hosted bundle to the exact captured
variant (including additionalSnapshots args overrides).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…k args

Storybook's URL parser decodes !true/!false to real booleans; a plain
false would apply as the truthy string "false" and reproduce the wrong
variant. Capture URLs are unchanged (capture applies args via channel
events, not the URL).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.

1 participant