fix: merge .percy.yml config options with snapshot options for serializeDOM#35
fix: merge .percy.yml config options with snapshot options for serializeDOM#35rishigupta1599 wants to merge 4 commits into
Conversation
…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>
…onfig-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.
| Object domSnapshot = null; | ||
|
|
||
| // Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| Map<String, Object> mergedOptions = new HashMap<>(); |
There was a problem hiding this comment.
[Critical] Merged config not forwarded to the CLI POST payload
mergedOptions is built here and used for DOM capture, but the call at the end of snapshot() still reads return postSnapshot(domSnapshot, name, page.url(), options); with the original un-merged options. postSnapshot builds the /percy/snapshot body entirely from the map it receives (new JSONObject(options)), so any global .percy.yml key absent from the per-call map (widths, minHeight, percyCSS, etc.) is captured in the DOM but silently dropped from the payload sent to the CLI agent.
Suggestion: Pass mergedOptions to postSnapshot instead of options:
return postSnapshot(domSnapshot, name, page.url(), mergedOptions);Reviewer: stack:code-review
|
|
||
| // Merge .percy.yml config options with snapshot options (snapshot options take priority) | ||
| Map<String, Object> mergedOptions = new HashMap<>(); | ||
| if (cliConfig != null && cliConfig.has("snapshot") && !cliConfig.isNull("snapshot")) { |
There was a problem hiding this comment.
[Low] Redundant cliConfig != null guard
cliConfig is initialized to new JSONObject() and only ever reassigned to another non-null JSONObject, so cliConfig != null is always true. Harmless but slightly misleading.
Suggestion: Drop the != null check (or document the non-null invariant); do not flip the field to null without auditing the other cliConfig.has(...) call sites.
Reviewer: stack:code-review
Claude Code PR ReviewPR: #35 • Head: 52cd4d7 • Reviewers: stack:code-review SummaryMerges global Review Table
Findings
Verdict: FAIL — the config merge is not wired through to the CLI POST payload ( |
Claude Code PR ReviewPR: #35 • Head: e108a71 • Reviewers: stack:code-review SummaryMerges Review Table
FindingsNo Fail items. One non-blocking observation:
Verdict: PASS — focused, correctly-ordered config/options merge with a targeted precedence test; security lens intentionally out of scope. |
Claude Code PR ReviewPR: #35 • Head: e2b174c • Reviewers: stack:code-review SummaryReplaces the previous flat/shallow handling of Review Table
FindingsNo blocking findings. Notes (non-blocking, intentional/pre-existing per adjudication):
Verdict: PASS — deep-merge implementation is correct, focused, and well-tested; no new regression. |
Summary
.percy.ymlwere not being passed toPercyDOM.serialize()cliConfig.snapshotinto options Map before callinggetSerializedDOM(), with per-snapshot options taking priorityTest plan
.percy.ymlconfig options are applied during DOM serialization🤖 Generated with Claude Code