Skip to content

Guidance: how to render UI image goldens (engine per surface) - #179

Merged
missingbulb merged 2 commits into
mainfrom
claude/ui-golden-testing-guidance
Jul 8, 2026
Merged

Guidance: how to render UI image goldens (engine per surface)#179
missingbulb merged 2 commits into
mainfrom
claude/ui-golden-testing-guidance

Conversation

@missingbulb

Copy link
Copy Markdown
Owner

Why

Extracted from a spec-driven-product session (missingbulb/CrosswordChat). The spec-driven-product pack's §7 says "embed regenerated renders of the real states" but gives no method — the golden-image rendering technique had to be reverse-engineered from a sibling repo. The writing-tests skill has excellent golden discipline (drive through real code, fixed clock, re-baseline approval) but nothing on how to produce the image. This fills that gap and routes it to the owning doc.

What

  • writing-tests — two bullets on rendering a UI image golden:
    • Match the engine to the surface. Inline-styled SVG / flexbox-only surfaces authored for it render bit-exact through a headless rasterizer (satori→SVG, resvg→PNG) with bundled fonts — demand a zero-pixel diff. A full shipped page using CSS grid, var(), @media, emoji, or form widgets is beyond that rasterizer — screenshot it with a headless browser (small tolerance, since it isn't bit-exact), self-skipping where no browser is present. Never reshape the product to fit the rasterizer.
    • Host-injected surfaces: render against a committed capture of the real host DOM with computed styles flattened inline, mounted by the shipped injector, with the model's boundary named.
  • spec-driven-product §7 — points at that method (the pack owns the what: approving the gallery is approving the product; the skill owns the how).
  • git-github-advanced — a session process-lesson: phantom conformance findings on history you didn't author (a squash-merge-history, a pre-existing warning-suppression) mean a stale diff base in a cloud sandbox — git fetch origin <default> and re-run; never rewrite merged history or edit pre-existing code to clear them.

Tests

Corpus self-checks green (node --test checks/test/*.test.mjs → 75/75); checks/run.mjs clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SnZWShMEa5fu5QkGbLhY1v


Generated by Claude Code

Extracted from a spec-driven-product session where the pack's §7 ("embed
regenerated renders") gave the *what* but no *how* — the golden-image rendering
method had to be reverse-engineered. Route the method into its owner and point
the pack at it.

- writing-tests: two bullets on rendering a UI image golden — match the engine to
  the surface (a bit-exact rasterizer like satori+resvg for inline-styled/SVG or
  flexbox-only surfaces with bundled fonts; a headless browser, small tolerance,
  for pages using grid/vars/@media/emoji/form-widgets, self-skipping where absent),
  and capturing a host-page-injected surface with computed styles flattened inline.
- spec-driven-product §7: point at that method (the pack owns the *what*, the
  writing-tests skill owns the *how*).
- git-github-advanced: a new rule — phantom conformance findings on history you
  didn't author (squash-merge-history, a pre-existing suppression) mean a stale
  diff base in a cloud sandbox; fetch origin/<default> and re-run, never rewrite
  merged history or edit pre-existing code to clear them.

Corpus self-checks green (75/75); checks/run.mjs clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SnZWShMEa5fu5QkGbLhY1v
Refs #181

Per review: a finding that persists against a fresh base may be a genuine new
rule or someone else's addition — 'never satisfy them' was wrong. Reframe to
refresh-first, then fix whatever is real.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SnZWShMEa5fu5QkGbLhY1v
@missingbulb
missingbulb force-pushed the claude/ui-golden-testing-guidance branch from a0cd038 to 89ca0c1 Compare July 8, 2026 16:53
@missingbulb
missingbulb merged commit 5b81abb into main Jul 8, 2026
1 check passed
@missingbulb
missingbulb deleted the claude/ui-golden-testing-guidance branch July 8, 2026 16:54
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