Skip to content

feat(client/sdk-utils): additive support for @percy/playwright-dropin baseline seed + sync verdict#2275

Open
Sriram567 wants to merge 3 commits into
masterfrom
feat/playwright-dropin
Open

feat(client/sdk-utils): additive support for @percy/playwright-dropin baseline seed + sync verdict#2275
Sriram567 wants to merge 3 commits into
masterfrom
feat/playwright-dropin

Conversation

@Sriram567

Copy link
Copy Markdown
Contributor

Summary

Two additive, backward-compatible changes in support of the new @percy/playwright-dropin drop-in SDK (which reroutes Playwright toHaveScreenshot() through Percy). No behavior change for existing SDKs/flows.

  • @percy/client createBuild gains optional parallelNonce / parallelTotal / source params. These let the drop-in's first-build baseline-seed path create a separate parallel build with its own deterministic nonce — engaging percy-api's named-lock dedup independently of the head build. When unset, they fall back to the env-derived parallel identity and source exactly as before. The only two existing callers (core/src/snapshot.js, cli-build/src/finalize.js) pass none of them → unchanged.
  • @percy/sdk-utils postComparison now surfaces response.body.data (the sync-cli per-comparison verdict / {error}) when the global .percy.yml snapshot.sync is on, so the drop-in's sync classifier can read the verdict. Non-sync responses omit data → fire-and-forget unchanged.

Why

The drop-in (separate package) needs (a) a deterministically-nonced baseline build to seed first-build diffs across CI shards, and (b) the per-comparison verdict for opt-in sync-assertion mode. Both are implemented as minimal, additive hooks rather than forking the head/snapshot flow.

Testing

  • @percy/client: new createBuild param specs (override-set + env-fallback paths); 24 existing createBuild specs unchanged/green; @percy/cli-build 84/84 green (createBuild signature unaffected).
  • @percy/sdk-utils: postComparison change covered; 168 tests, 100% NYC coverage maintained.
  • ESLint clean on both changed files.

Post-Deploy Monitoring & Validation

  • What to monitor/search
    • Logs: existing @percy/client build-create / postComparison debug logs — confirm no new error rate.
    • Metrics: build-create success rate unchanged for non-drop-in SDKs.
  • Validation checks
    • Run any existing SDK (e.g. @percy/cypress) build to confirm createBuild/postComparison behave identically (no params passed).
  • Expected healthy behavior: existing SDK builds create + upload exactly as before; only the drop-in passes the new params.
  • Failure signal / rollback trigger: any change in build-create behavior for existing SDKs → revert this PR (additive-only, safe to revert).
  • Validation window & owner: one release cycle; Percy SDK owner.

Note

This is the CLI half of a 3-repo change (percy-api + the @percy/playwright-dropin package). Per KD10, these packages must publish before the drop-in works against published @percy/*.


🤖 Generated with Claude Opus 4.8 via Claude Code + Compound Engineering

…ine seed (Unit 4b)

createBuild gains optional parallelNonce/parallelTotal/source so the playwright-dropin
baseline-seed path can create a separate parallel build with its own deterministic nonce
(engaging the percy-api named-lock dedup) independent of the head build. Fully backward-
compatible: params default to null and fall back to the env-derived parallel identity and
source; the head/snapshot flow passes none and is unchanged.
… sync mode (Unit 5b)

Additive: when the global .percy.yml snapshot.sync is on, the /percy/comparison handler
already returns the sync-cli per-comparison result; postComparison now surfaces
response.body.data so the playwright-dropin sync classifier can read the verdict/{error}.
Backward-compatible: non-sync responses omit data, fire-and-forget unchanged. 100% coverage.
@Sriram567 Sriram567 requested a review from a team as a code owner June 11, 2026 03:48
… PERCY_BUILD_SOURCE

Two fixes surfaced by live E2E:
- snapshot.js: the 'app' (BYOS) comparison flow now accepts generic (screenshot-type)
  projects, not just app — @percy/playwright-dropin uploads raw images into a framework-
  agnostic generic project. Only rendering-type projects (web/scanner/lca) are still rejected.
- client.js: createBuild reads PERCY_BUILD_SOURCE so an SDK can tag the head build it doesn't
  create directly (precedence: explicit param > PERCY_BUILD_SOURCE > legacy env > default).

Verified live against percy-api: a generic-project run ingests the comparison and the head
build is tagged source=playwright-dropin (build.playwright_dropin? = true).
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