Skip to content

test: fix and future-proof the darwin blog-index baselines - #363

Merged
Ducksss merged 3 commits into
devfrom
claude/modest-einstein-8593a2
Jul 27, 2026
Merged

Ducksss merged 3 commits into
devfrom
claude/modest-einstein-8593a2

Conversation

@Ducksss

@Ducksss Ducksss commented Jul 27, 2026 •

Copy link
Copy Markdown
Owner

Three commits: fix the stale baselines, remove the duplication that made the guards hard to reason about, and write down the rule that would have caught it.

1. test: re-mint the darwin blog-index visual baselines

pnpm test:release fails locally on macOS with two failures in tests/e2e/blog-visual.e2e.spec.ts (blog-index-desktop, ratio 0.35 different; blog-index-mobile).

35e92c6 ("blog: turn the index into a Payload guide gateway", #348) redesigned /blog but its snapshot update touched only the linux baselines — its stat is linux:2 darwin:0. The darwin pair kept the pre-redesign rendering ("Build notes and release stories" + post grid). CI is linux, so pr-gate has been green throughout; only local macOS runs fail.

Re-minted with --update-snapshots=changed, which rewrites only mismatching cases — the blog-article-* baselines and every *-linux.png are untouched.

Verified by inspecting the PNGs rather than accepting the diff blind: both depict the current guide-gateway index (eyebrow, Payload CMS block and installer guides H1, dark installation-guide card carrying npx payload-components add hero-basic, block-wiring / troubleshooting cards), matching the committed linux baselines modulo macOS font rasterization. Sizes now sit alongside the linux pair (118 KB / 67 KB vs 116 KB / 70 KB) instead of the old 274 KB / 85 KB.

2. test: share the platform-baseline guards across the visual specs

components-visual, templates-visual, and blog-visual each carried the same logic: derive the -<project>-<platform>.png suffix, treat all/changed as updating, skip a case whose current-platform baseline is absent, fail the coverage guard once the platform is minted. Three copies, three slightly different messages, the rationale duplicated in three header comments.

Extracted into tests/e2e/support/visual-baselines.ts as expectCompletePlatformBaselines + skipWithoutPlatformBaseline, with each spec passing a VisualBaselines descriptor. Behaviour is unchanged — blog keeps its requireMinted escalation (linux CI must fail rather than skip an empty baseline set); the other two keep skipping. Each spec now derives both its screenshot name and its guarded stem from one baselineStem, so the name the guard checks can't drift from the name Playwright writes.

Two knock-on updates, both intentional:

  • tests/int/blog-visual-system.int.spec.ts pinned the old inline requiresMintedBaselines line. Re-pinned to both halves of the moved behaviour rather than dropped.
  • The Field Journal figure for visual-regression-component-registry embeds a live 14-line excerpt of components-visual, so it was regenerated with pnpm blog:visuals:figures. Only the hidden data-evidence attribute moved — the visible figure and the article prose are unchanged, and the other 26 figures regenerated byte-identically.

3. docs: require paired darwin/linux baseline mints

Nothing in CI can catch a half-minted visual change: the coverage guard fails on a missing baseline, never a stale one, and pr-gate only renders linux. Added a "Visual baselines" section to CONTRIBUTING.md with the rule, the mint commands, and the reviewer heuristic — a diff touching *-chromium-linux.png without the matching *-chromium-darwin.png (or vice versa) is suspect — plus a line in the PR checklist.

Verification

  • Full release gate on dev + commit 1: green (GATE_EXIT=0 read from the log, not tail's code) — int 341 passed, e2e 39 + 69 + 62 + 93 passed across the four batches.
  • After commits 2–3: lint, tsc --noEmit, test:int (341 passed, unchanged), and all three visual specs (69 + 62 + 5 passed — identical counts to the pre-refactor gate).
  • Guards proven to still guard: held one baseline PNG back and re-ran, and the coverage guard failed naming blog-index-desktop with the new actionable hint while the affected case skipped. Baseline restored.
  • Baselines proven port-independent: minted and verified on different ports (siteUrl only feeds metadata/JSON-LD/RSS on these routes).

Note for reviewers: commit 1 is unverifiable by CI — pr-gate is linux and never renders the changed files. It was validated on macOS.

35e92c6 ("blog: turn the index into a Payload guide gateway", #348)
redesigned /blog but its snapshot update only refreshed the linux
baselines, so the darwin pair kept the pre-redesign rendering. CI is
linux, so pr-gate stayed green while local macOS `pnpm test:release`
failed both blog-index cases (~35% pixel diff on desktop).

Re-minted with `--update-snapshots=changed` against the production
server, so only the two mismatching darwin files were rewritten — the
blog-article baselines and every `*-linux.png` are untouched. Verified
the new PNGs depict the current guide-gateway index (eyebrow, dark
installation card, two guide cards) and that the suite passes clean.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 27, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel

vercel Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview, Comment Jul 27, 2026 8:24am
payload-components-97bf Ready Ready Preview, Comment Jul 27, 2026 8:24am

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Ducksss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a3502ac-e6ca-4364-9017-d1e109b6fe96

📥 Commits

Reviewing files that changed from the base of the PR and between 4665901 and 64b02f6.

⛔ Files ignored due to path filters (3)
  • public/blog/visual-regression-component-registry/figure-01-regression-pipeline.svg is excluded by !**/*.svg
  • tests/e2e/blog-visual.e2e.spec.ts-snapshots/blog-index-desktop-chromium-darwin.png is excluded by !**/*.png
  • tests/e2e/blog-visual.e2e.spec.ts-snapshots/blog-index-mobile-chromium-darwin.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • CONTRIBUTING.md
  • tests/e2e/blog-visual.e2e.spec.ts
  • tests/e2e/components-visual.e2e.spec.ts
  • tests/e2e/support/visual-baselines.ts
  • tests/e2e/templates-visual.e2e.spec.ts
  • tests/int/blog-visual-system.int.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/modest-einstein-8593a2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Ducksss and others added 2 commits July 27, 2026 15:09
components-visual, templates-visual, and blog-visual each carried their
own copy of the same dance: derive the `-<project>-<platform>.png`
suffix, treat `all`/`changed` as updating, skip a case whose
current-platform baseline is absent, and fail the coverage guard once
the platform is minted. Three copies, three slightly different
messages, and the shared rationale duplicated in three header comments.

Extract `expectCompletePlatformBaselines` and
`skipWithoutPlatformBaseline` into tests/e2e/support/visual-baselines.ts
and give each spec a `VisualBaselines` descriptor instead. Behaviour is
unchanged: blog keeps its `requireMinted` escalation (linux CI must fail
rather than skip an empty baseline set), and the other two keep skipping.
Each spec now derives its screenshot name and its guarded stem from one
`baselineStem` helper, so the name the guard checks can't drift from the
name Playwright writes.

The helper's doc comment also records what neither guard can catch — a
baseline that exists but is stale, which is how the blog index kept a
pre-redesign darwin image through a green pr-gate.

Two knock-on updates:

- tests/int/blog-visual-system.int.spec.ts pinned the old inline
  `requiresMintedBaselines` line. Re-pinned to both halves of the moved
  behaviour (the spec declaring `requireMinted`, the helper acting on
  it) rather than dropped.
- The Field Journal figure for visual-regression-component-registry
  embeds a live 14-line excerpt of components-visual, so it was
  regenerated with `pnpm blog:visuals:figures`. Only the hidden
  data-evidence attribute moved; the visible figure and the article
  prose are unchanged, and the other 26 figures regenerated
  byte-identically.

Verified: lint, tsc, test:int (341 passed), and all three visual specs
(69 + 62 + 5 passed, same counts as before). Also forced the missing-
baseline path by holding one PNG back — the coverage guard failed naming
the stem and the affected case skipped, so the guards still guard.

Co-Authored-By: Claude Opus 5 <[email protected]>
Nothing in CI can catch a half-minted visual change: the specs' coverage
guard fails on a missing baseline but never a stale one, and pr-gate
only renders linux. A linux-only mint therefore leaves the darwin image
showing the old design — green on every PR, failing only for whoever
next runs the gate on a Mac (exactly what 35e92c6 did to the blog index).

Add a "Visual baselines" section to CONTRIBUTING.md stating the rule,
how to mint each platform, and the reviewer heuristic: a diff touching
`*-chromium-linux.png` without the matching `*-chromium-darwin.png` (or
vice versa) is suspect. Add the paired update to the pull-request
checklist.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Ducksss Ducksss changed the title test: re-mint the darwin blog-index visual baselines test: fix and future-proof the darwin blog-index baselines Jul 27, 2026
@Ducksss
Ducksss merged commit cb4acc6 into dev Jul 27, 2026
12 checks passed
@Ducksss
Ducksss deleted the claude/modest-einstein-8593a2 branch July 27, 2026 08:25

This branch was successfully deployed

2 active deployments
Preview – payload-components — 64b02f6c Deployed Jul 27, 2026 by vercel[bot]
Preview – payload-components-97bf — 64b02f6c Deployed Jul 27, 2026 by vercel[bot]
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