fix: merge .percy.yml config options with snapshot options for serializeDOM#141
fix: merge .percy.yml config options with snapshot options for serializeDOM#141rishigupta1599 wants to merge 5 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>
20f98d7 to
7cf477e
Compare
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.
|
|
||
| # Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| config_options = data["config"].get("snapshot", {}) | ||
| merged_kwargs = {**config_options, **kwargs} |
There was a problem hiding this comment.
[Medium] No test for the config/kwargs merge
The new merge (config snapshot options + per-call kwargs, kwargs winning) has no test coverage — not the happy path, the precedence rule, nor config-only forwarding. The PR's own test-plan checkboxes are unchecked.
Suggestion: Add a percy_snapshot test mocking _is_percy_enabled to return {"config": {"snapshot": {"enableJavaScript": True, "percyCSS": ".x{}"}}, ...}, pass an overriding kwarg, and assert the args in page.evaluate("PercyDOM.serialize(...)") reflect the merge with the kwarg winning.
Reviewer: stack:code-review
| cookies = page.context.cookies() | ||
|
|
||
| # Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| config_options = data["config"].get("snapshot", {}) |
There was a problem hiding this comment.
[Low] data["config"] assumed non-null
data["config"].get("snapshot", {}) will raise AttributeError if the healthcheck body has an explicit "config": null (then data["config"] is None). Not a regression — pre-existing code assumes config is dict-like — but this line widens the surface and is inconsistent with the data.get("config") form used at line 509.
Suggestion: Use (data.get("config") or {}).get("snapshot", {}) for null safety and consistency.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #141 • Head: 7cf477e • Reviewers: stack:code-review SummaryMerges the global Review Table
Findings
Verdict: PASS |
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.
Claude Code PR ReviewPR: #141 • Head: 4bf72e0 • Reviewers: stack:code-review SummaryMerges Review Table
Findings
Verdict: FAIL — config-derived options silently dropped from the CLI POST body, plus an unupdated existing test that this change breaks. |
…tions 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: Passed.
| cookies = page.context.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.
[Low] Null-config guard branch is untested
The ... or {} guard handles config.snapshot being present-but-None, which is the stated motivation of this revision, but no test exercises that branch — only the populated-config path is covered.
Suggestion: Optionally add a case where config = {"snapshot": None} and assert percy_snapshot serializes/posts without raising. Non-blocking; the guard is a well-understood one-line idiom.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #141 • Head: 468c5db • Reviewers: stack:code-review SummaryMerges Review Table
FindingsNo Critical/High findings.
Note on prior-review false positive (verified non-issue, not counted): the POST body intentionally uses Verdict: PASS — correct, focused merge with per-call precedence; null-config guard is sound and tests cover the meaningful paths. |
Claude Code PR ReviewPR: #141 • Head: 712f97f • Reviewers: stack:code-review SummaryMerges Review Table
Findings
Verdict: PASS — core merge logic is correct and well-tested; findings are Medium/Low refinements, none blocking. |
Claude Code PR ReviewPR: #141 • Head: a7f512f • Reviewers: stack:code-review SummaryReplaces the config↔per-call snapshot-options merge with a recursive Review Table
FindingsNo blocking findings. Note (non-blocking, adjudicated false positive): Verdict: PASS — deep-merge is correct, well-scoped, and well-tested. |
Summary
.percy.ymlwere 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