Skip to content

fix: merge .percy.yml config into serialize options (PER-8053 regression)#250

Merged
rishigupta1599 merged 1 commit into
masterfrom
fix/per8053-config-merge-serialize
Jul 10, 2026
Merged

fix: merge .percy.yml config into serialize options (PER-8053 regression)#250
rishigupta1599 merged 1 commit into
masterfrom
fix/per8053-config-merge-serialize

Conversation

@rishigupta1599

Copy link
Copy Markdown
Contributor

Problem

get_serialized_dom serialized only the raw per-call kwargs — the global .percy.yml snapshot config (enableJavaScript, percyCSS, discovery.*, widths, …) never reached PercyDOM.serialize. This is a regression: the config-merge added in #223 (PER-8053) was silently dropped when the CORS-iframe refactor (#226) rewrote this path.

Found by an end-to-end sanity harness that captures the exact options handed to PercyDOM.serialize across all SDKs — selenium-python was the only one where config-only keys didn't arrive (the sibling percy-playwright-python merges correctly via _deep_merge).

⚠️ Shipped in v2.2.1-beta.1 — a new beta (2.2.1-beta.2) will follow this merge.

Fix

Deep-merge config.snapshot into the serialize kwargs (per-call wins at the leaves) after the readiness gate (which intentionally reads the raw per-call kwargs) and before serialize. Because the merged kwargs also feed the CORS-iframe context (serialize_options) and the responsive-capture path routes through get_serialized_dom, config now reaches nested-frame and per-width serialize too.

Mirrors the known-good _deep_merge semantics already used in percy-playwright-python.

Tests

New TestConfigMergeIntoSerialize:

  • a config-only key (enableJavaScript) reaches serialize
  • per-call option wins over config
  • deep-merge keeps config siblings while per-call nested wins (discovery.*)
  • no config leaves per-call untouched
  • helper degrades to raw kwargs on malformed config (non-dict config / snapshot / empty)

All new lines covered; maintains the repo's fail_under = 100 gate.

get_serialized_dom serialized only the raw per-call kwargs, so global
.percy.yml `snapshot` config (enableJavaScript, percyCSS, discovery.*, etc.)
never reached PercyDOM.serialize. The config-merge that PR #223 introduced was
dropped when the CORS-iframe refactor (#226) rewrote this path.

Restore it: deep-merge config.snapshot into the serialize kwargs (per-call wins
at the leaves) after the readiness gate and before serialize, so it also flows
to the CORS-iframe context (serialize_options) and the responsive-capture path.

Adds unit tests asserting a config-only key reaches serialize, per-call wins,
deep-merge keeps config siblings, and the helper degrades gracefully on
malformed config — a regression guard the unit suite previously lacked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rishigupta1599 rishigupta1599 requested a review from a team as a code owner July 10, 2026 14:07
@rishigupta1599 rishigupta1599 merged commit a980124 into master Jul 10, 2026
9 checks passed
@rishigupta1599 rishigupta1599 deleted the fix/per8053-config-merge-serialize branch July 10, 2026 14:41
rishigupta1599 added a commit that referenced this pull request Jul 10, 2026
Bumps past the published v2.2.1-beta.1 (which shipped the config-merge
regression, PR #250) — PyPI versions are immutable so the fix ships as a new
beta.

Co-authored-by: Claude Opus 4.8 <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.

2 participants