fix: merge .percy.yml config options into serializeDOM#1151
fix: merge .percy.yml config options into serializeDOM#1151rishigupta1599 wants to merge 8 commits into
Conversation
…izeDOM Previously, only specific config options (pseudoClassEnabledElements) were manually forwarded from .percy.yml config. Now all config.snapshot options are merged as defaults, with per-snapshot options taking priority. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace inline config merge with centralized utility from sdk-utils. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This PR is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
|
This PR was closed because it has been stalled for 28 days with no activity. |
…-config-with-serialize-dom
rishigupta1599
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 2 inline finding(s). Full report in the PR comment below. Verdict: Failed - see PR comment.
|
|
||
| addPseudoClassEnabledELements(options); | ||
| // Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| const mergedOptions = utils.mergeSnapshotOptions(options); |
There was a problem hiding this comment.
[Critical] utils.mergeSnapshotOptions is not exported by @percy/sdk-utils
utils here is @percy/sdk-utils, whose index exports do not include mergeSnapshotOptions (it lives in @percy/core/src/snapshot.js). At runtime this is undefined(...) and throws TypeError: utils.mergeSnapshotOptions is not a function. The error is swallowed by the surrounding try/catch and logged as a generic "Could not take DOM snapshot", so every snapshot silently fails.
Suggestion: Either export mergeSnapshotOptions from @percy/sdk-utils (and bump the dependency), or merge inline: const mergedOptions = { ...(utils.percy?.config?.snapshot || {}), ...options };
Reviewer: stack:code-review
| domTransformation ? domTransformation(dom) : dom | ||
| )), | ||
| ...options | ||
| ...mergedOptions |
There was a problem hiding this comment.
[High] Merge applied only to serialize; readiness gate and post payload still use raw options
...mergedOptions is spread here, but the readiness block and const { readiness, ...forwardOpts } = options still read the un-merged options. The old addPseudoClassEnabledELements mutated options in place so config values reached postSnapshot; now config-level snapshot settings (including pseudoClassEnabledElements) are dropped from the post payload.
Suggestion: Derive forwardOpts and the readiness inputs from mergedOptions so merged config flows consistently to readiness, serialize, and post.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #1151 • Head: 53d450d • Reviewers: stack:code-review SummaryReplaces the manual Review Table
Findings
Verdict: FAIL — depends on a |
Ref: PER-8053
rishigupta1599
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 1 inline finding(s). Full report in the PR comment below. Verdict: Failed - see PR comment.
|
|
||
| addPseudoClassEnabledELements(options); | ||
| // Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| const mergedOptions = utils.mergeSnapshotOptions(options); |
There was a problem hiding this comment.
[High] Config-merged options never reach postSnapshot
mergedOptions is spread only into PercyDOM.serialize (L129). The posted payload is built from forwardOpts, which is destructured from the raw options (const { readiness: _readiness, ...forwardOpts } = options; at L149) — so .percy.yml config.snapshot keys not passed per-snapshot are dropped from the post body. On base master the old helper mutated options in place, so the merged value reached both serialize and post. The existing test uses pseudoClassEnabledElements from percy config when option is not passed (tests/acceptance/index-test.js:129-140) asserts the /percy/snapshot post body and will now fail. This is a genuine regression, separate from the sdk-utils publish ordering.
Suggestion: Derive the posted options from the merged set:
const { readiness: _readiness, ...forwardOpts } = mergedOptions;And base the readiness checks (L90, L96-98) on mergedOptions too for consistency.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #1151 • Head: f08fb0c • Reviewers: stack:code-review SummaryReplaces the narrow local helper Review Table
Findings
Verdict: FAIL — the config-merged options never reach |
…T body parity) Ref: PER-8053
Claude Code PR ReviewPR: #1151 • Head: ac11973 • Reviewers: stack:code-review SummaryReplaces the single-key Review Table
FindingsNo blocking findings. THIS diff introduces no new correctness regression. Notes below are non-blocking.
Verdict: PASS — config-merge-before-serialize + merged-options-to-postSnapshot is correct and restores POST-body parity; no new correctness regression. The |
…regen lockfile Ref: PER-8053
The lockfile regen for the @percy bump re-resolved the ember-cli/testem/ Embroider toolchain to current versions that require Node >=18/>=20 (testem 3.20.1 -> node >=20.19, pkg-entry-points 1.1.2 -> node >=20.19.5, chokidar@5, glob@13, express@5, ...). On Node 16 the `yarn` install hard-fails on the engine mismatch, breaking Test/Lint/Typecheck. Node 16 is EOL (Sept 2023) and modern ember tooling requires Node >=20.19, so bump all CI workflows from Node 16 to Node 20. No dependency pins needed — the committed lockfile installs cleanly on Node 20. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The @percy/cli ^1.32.0 bump brings @percy/dom 1.31.1 -> 1.32.0, which changed two canvas-serialization behaviours these (otherwise unchanged) specs asserted: - "serialize canvas when enableJavascript is not present": canvas is still correctly serialized to an <img data-percy-canvas-serialized>, but the serialized attribute order changed (data-percy-element-id now precedes src). Update the order-sensitive regex to match. - "removes canvas element when dom transformation is passed": the browser-side serialize now only honors camelCase enableJavaScript (snake_case enable_javascript was silently ignored, so the canvas got serialized to an <img> before domTransformation ran). Use enableJavaScript so the canvas stays a <canvas> for the transform to remove. (Test 9 already proves camelCase works.) Not related to the PER-8053 config-merge change; the config-merge specs pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
pseudoClassEnabledElementswas manually forwarded from.percy.ymlconfigconfig.snapshotoptions are merged as defaults, with per-snapshot options taking priorityaddPseudoClassEnabledElementscall is now superseded by the general mergeTest plan
enableJavaScript,disableShadowDOM) flow through to DOM serialization🤖 Generated with Claude Code