Skip to content

feat(patchy): see a look on the specimen before publishing it - #578

Merged
allisonmahmood merged 6 commits into
mainfrom
look/566-look-preview
Oct 7, 2026
Merged

allisonmahmood merged 6 commits into
mainfrom
look/566-look-preview

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

People judge a look from a picture, not from CSS, and an agent needs to know what look publish would refuse before it shows a look to anyone. Until now a look couldn't be seen before it was published.

patchy look preview [<dir>] [--compare] writes the specimen as one HTML file and prints its path. Under --json it returns { ok, path, failures, warnings? }.

  • The specimen is a fixed page bundled into the CLI (packages/patchy/src/lookPreview.ts), so every release renders the same one. It has companies: a company look, so new patches look like their company by default #547's contents plus a badge per status, and hover, focus, invalid, disabled and busy states. Its own CSS comes after the look's, unlayered, and styles only its own classes, so every plain element shows the look. It puts text only on bg or surface, where the checks verify every text colour; badges keep the status-colour text on that ground and carry the status in their border (neutral uses muted). The page says that it checks look.css, not the brief's recipes, and that it can't show how a look collides with a patch's own components. The single-look page passes patchy validate, so a member's agent can publish it to show an admin.
  • Hover and focus show without interaction. Each :hover, :focus and :focus-visible in look.css, wherever it sits (inside :not() and :is() too), is replaced in place by :is() of itself and a stand-in class. Specificity is unchanged, and :focus:not(:focus-visible) can't match the keyboard-focus stand-in. A screenshot therefore shows those states as the look has them.
  • Offline and honest. Fonts and the logo are embedded. A CSP allows only inline styles and data: fonts and images, so the page never makes a request. A candidate with a remote @import renders the way a patch would, without the fetch.
  • --compare puts each look in its own labelled <iframe srcdoc>, so one look's element styles can't reach the other. With no current look it renders the candidate alone and says the company has no look yet.
  • failures is checkLook's output, line for line what look publish prints. Preview always renders.
  • The file is look-preview.html in the state dir (PATCHY_STATE_DIR, default ~/.patchy). That directory is writable wherever the CLI works, it avoids a fixed filename in a shared /tmp, and reloading the tab shows the latest preview. State writes it like its other files: an owner-only directory, then a sibling temp file and a rename, so a link at that path is replaced rather than followed. A folder alone needs no login and sends nothing; only the company's look is read with getLook().

The Patchy fixture, which becomes Patchy's default look in #567, also gets a visible disabled field: muted text in a dashed frame.

Tests: the CLI contract in cliLook.test.ts (including that the single-look page validates), the state stand-ins in lookPreview.test.ts, the link-safe write in State.test.ts, and a Chromium spec. The spec runs the four fixture looks through the bundled CLI, covering forced states, real keyboard focus, a 375px viewport with long labels and non-Latin names, no requests, and an embedded font with remote URLs refused (it fails without the CSP). It also renders a compare page, checking each frame keeps its own look, the frames make no requests and nothing overflows.

Closes #566

Built by Claude Opus 5.5 in Claude Code, running in T3 Code.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:l 501-1,000 changed lines labels Oct 7, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round 1 (stack orchestration for #547): one Claude Opus 5.5 reviewer and three GPT-6.1 Sol reviewers (page correctness, YAGNI + spec + CLI, and a rendered-page pass in Chromium at 1280 and 375px), read-only against de06896.

Agreed sound: all three acceptance criteria; the command logic for every <dir> / --compare combination; escaping of look text into the page and the srcdoc panes; the page's CSP (zero network requests for every fixture); exit codes and the --json shape per ADR-0004; shared checkLook messages identical to publish; every item on #547's specimen list present, badges from the status tokens with neutral in muted; README, ADR-0004, product.md and the glossary; focused tests, with the browser spec running in CI's browser job. The builder's five flagged decisions (state-dir file, CSP, forced states, no login for a folder, Specimen glossary entry) are all kept.

Sent to the builder:

  • forceStates misrepresents valid looks (:not(:hover), :is(:hover), :focus:not(:focus-visible)): substitute pseudo-classes in place with :is(:hover, .specimen-hover) recursively.
  • @layer specimen beneath the look lets the look's element styles beat the specimen's own layout (misaligned amount column under every fixture): specimen CSS unlayered after the look, as the prototype did.
  • The badge tint lowers status-text contrast below what the checks guarantee, so a passing look looks deficient on the specimen.
  • The specimen must validate as a tier 0 page (<form> is blocked), for the member path in companies: a company look, so new patches look like their company by default #547.
  • State dir created without 0o700; the preview write follows symlinks.
  • Compare page 1px overflow; docs listing the state dir's files; visible invalid and disabled states in the Patchy fixture, which becomes the default look.

Posted by Claude Fable 5.1 (orchestrator) in Claude Code, running in T3 Code.

@github-actions github-actions Bot added the area:core Touches the core area label Oct 7, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review round 2: a GPT-6.1 Sol verifier re-checked all eight fixes at 57eb7ca in source and Chromium. The three selector shapes now show correct stand-in states and real Tab focus still works; amounts right-align and the error message has no stray margin under all four looks; badge text contrast equals the look's own token-on-surface contrast; every single-look file passes patchy validate; the state dir is created 0700 and the write never follows a symlink; the compare page no longer overflows; the Patchy fixture's invalid and disabled fields are visible and within the verdict's rule 10. Two rare selector forms (escaped pseudo-class names, ::file-selector-button:hover) are left as-is: honest looks don't write them.

Verdict from the orchestrator: ready to merge after #577.

Posted by Claude Fable 5.1 (orchestrator) in Claude Code, running in T3 Code.

allisonmahmood and others added 6 commits October 7, 2026 16:51
The specimen is one fixed page that ships in the CLI, styled only by a
look. look preview writes it as a self-contained file in the state dir,
for a candidate folder, the company's look, or both with --compare, and
lists every failure look publish would report without refusing to render.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The state dir is created 0700 and the page goes through a sibling temp
file and a rename, as State's other files do, so a link at
look-preview.html is replaced instead of truncating its target.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… has them

- hover and focus stand-ins replace each pseudo-class in place with :is(),
  inside :not() and :is() too, so negations and :focus:not(:focus-visible)
  behave as the real state would
- the specimen's own CSS follows the look unlayered, so its amount column
  and error spacing aren't overridden by the look's element styles
- badges keep text on the verified ground and carry status in the border
- no <form>, so the single-look page publishes as a tier 0 page
- compare frames are border-box, ending a 1px overflow; a browser test
  renders a compare page

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… as a page

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@allisonmahmood
allisonmahmood merged commit 881686e into main Oct 7, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the look/566-look-preview branch October 7, 2026 15:03
allisonmahmood added a commit that referenced this pull request Oct 7, 2026
Release 8 of What's new, written for the deploy of the company look
stack (#547, first build). It covers everything merged after release 7's
`through`.

- **New: Your tools can look like your company** — #577, #579
- **New: Preview a look before you publish it** — #578
- **New: Setting up Patchy sets up your look** — #598 (the rebased
replacement for #582)
- **Improved: Patches hear when the look changes** — #581
- **Improved: Static pages can use embedded fonts** — #576
- Behind the scenes: the personal style file retires (#598)

Written by Claude Fable 5.1 in Claude Code, running in T3 Code.

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:server Touches the server area size:l 501-1,000 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(patchy): patchy look preview shows a look on the specimen

1 participant