fix: merge .percy.yml config options with snapshot options for serializeDOM#223
fix: merge .percy.yml config options with snapshot options for serializeDOM#223rishigupta1599 wants to merge 4 commits into
Conversation
|
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. |
…izeDOM Config options from .percy.yml (like widths, minHeight, enableJavaScript, etc.) were not being passed to PercyDOM.serialize(). Only per-snapshot options were used. Now merges both, with per-snapshot options taking priority. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d1aefb6 to
b9758c6
Compare
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.
Claude Code PR ReviewPR: #223 • Head: b9758c6 • Reviewers: stack:code-review SummaryInline-merges global Review Table
Findings
Verdict: FAIL |
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: Passed.
| cookies = driver.get_cookies() | ||
|
|
||
| # Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| config_options = data['config'].get('snapshot') or {} |
There was a problem hiding this comment.
[Medium] Guard config itself against null, not just `config['snapshot']
This fixes snapshot being null, but data['config'] itself can be None: is_percy_enabled() does data.get('config', {}), which only defaults when the key is absent — a healthcheck returning {"config": null} makes data['config'] None, and .get('snapshot') then raises AttributeError. The codebase's own _resolve_readiness_config defends against exactly this (config = percy_config or {}, see snapshot.py:198-200).
Suggestion:
| config_options = data['config'].get('snapshot') or {} | |
| config_options = (data['config'] or {}).get('snapshot') or {} |
Reviewer: stack:code-review
|
|
||
| # Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| config_options = data['config'].get('snapshot') or {} | ||
| merged_kwargs = {**config_options, **kwargs} |
There was a problem hiding this comment.
[Medium] Missing tests for the new config-merge behavior
No test covers that config-level snapshot options flow into serializeDOM, that per-call kwargs override config options, or that a null snapshot config degrades to {} on the percy_snapshot path. The existing null-config test (test_snapshot.py:505) only exercises _resolve_readiness_config, a different function.
Suggestion: Add percy_snapshot tests with mocked healthcheck config {'snapshot': {...}} asserting the option reaches the serialize path, a kwargs-override case, and a {'snapshot': None} (and config: None) case.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #223 • Head: 4e94aef • Reviewers: stack:code-review SummaryMerges Review Table
Findings
Verdict: PASS — the null-config guard resolves the prior FAIL and the core merge logic is correct; remaining items are Medium/Low (test coverage and a latent null-config edge) and do not block. |
Claude Code PR ReviewPR: #223 • Head: 178d599 • Reviewers: stack:code-review SummaryMerges Review Table
Findings
Verdict: PASS — focused, well-tested config/kwargs merge with correct precedence; only minor documentation/test-coverage nits. |
Claude Code PR ReviewPR: #223 • Head: d2339f9 • Reviewers: stack:code-review SummaryReplaces the shallow Review Table
FindingsNo blocking findings. Non-blocking notes below (none introduced by this diff as a regression).
Verdict: PASS — the deep merge is correct (recurses only when both sides are dicts, lists/scalars replace, null-safe on all reachable paths) and is covered by new tests. No new correctness regression in this diff; remaining items are an adjudicated false positive and non-blocking coverage notes. |
Summary
.percy.yml(likewidths,minHeight,enableJavaScript, etc.) were not being passed toPercyDOM.serialize()Changes
data['config']['snapshot']withkwargsbefore callingget_serialized_dom()andcapture_responsive_dom()Test plan
.percy.ymlconfig options are applied during DOM serialization🤖 Generated with Claude Code