feat(client/sdk-utils): additive support for @percy/playwright-dropin baseline seed + sync verdict#2275
Open
Sriram567 wants to merge 3 commits into
Open
feat(client/sdk-utils): additive support for @percy/playwright-dropin baseline seed + sync verdict#2275Sriram567 wants to merge 3 commits into
Sriram567 wants to merge 3 commits into
Conversation
…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.
… 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).
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
Two additive, backward-compatible changes in support of the new
@percy/playwright-dropindrop-in SDK (which reroutes PlaywrighttoHaveScreenshot()through Percy). No behavior change for existing SDKs/flows.@percy/clientcreateBuildgains optionalparallelNonce/parallelTotal/sourceparams. 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-utilspostComparisonnow surfacesresponse.body.data(the sync-cli per-comparison verdict /{error}) when the global.percy.yml snapshot.syncis on, so the drop-in's sync classifier can read the verdict. Non-sync responses omitdata→ 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: newcreateBuildparam specs (override-set + env-fallback paths); 24 existing createBuild specs unchanged/green;@percy/cli-build84/84 green (createBuild signature unaffected).@percy/sdk-utils:postComparisonchange covered; 168 tests, 100% NYC coverage maintained.Post-Deploy Monitoring & Validation
@percy/clientbuild-create /postComparisondebug logs — confirm no new error rate.@percy/cypress) build to confirmcreateBuild/postComparisonbehave identically (no params passed).Note
This is the CLI half of a 3-repo change (percy-api + the
@percy/playwright-dropinpackage). 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