Repository navigation
fix(patchy): look preview --compare shows both whole looks in one screenshot - #696
Merged
Merged
Conversation
…eenshot Each compare frame was 100vh and scrolled on its own, so a full-page screenshot showed only the top of each look. A small hashed script now sizes each frame to its specimen; the single-look page stays script-free. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
force-pushed
the
fix/595-compare-frames
branch
from
October 15, 2026 20:56
5068834 to
f2db870
Compare
allisonmahmood
added a commit
that referenced
this pull request
Oct 15, 2026
… none (#697) Stacked on #696 With no company look, `patchy look preview` (no folder) refused with exit 1, and `--compare` showed the candidate alone. Yet `GET /api/look` already returns `patchyLook`, the look the company's tools actually render while it has none. So an admin couldn't compare a first look against what people see today, and the skill's advice to preview the company's look failed in a company without one. Preview now reads `patchyLook` when `current` is null: - With a company look, nothing changes: the pane is "Revision N, the company's look". - With none, the company-side pane is the Patchy look's files, labelled "The Patchy look" with the note "The company has no look yet. New tools start from this one." It gets no logo, as `patchyLook` carries none, so the masthead falls back to the brief's heading as a wordmark. - `patchy look preview` with no folder renders that single pane, exit 0, and the file passes `patchy validate`. `--compare` frames the candidate beside it, and the candidate pane no longer carries a "no look yet" note. - Unchanged: the `--json` shape `{ ok, path, failures, warnings? }`, `failures` listing only the candidate's publish failures, a candidate alone previewing offline with no request, and `--compare` without a folder failing locally before any request. A response with neither `current` nor `patchyLook`, which the server never sends, still gets the local refusal. No API, server, generation or renderer change. `Pane` and `previewPage` are reused as they are. ## It works Run by hand against a `pnpm dev up team` environment (Acme Co, no company look), through its CLI, with each file opened offline in Playwright at 1280×720: - `patchy look preview --json` exited 0 with `{"ok":true,…,"failures":[]}`. The page is labelled "The Patchy look" with the note, its wordmark is "Patchy's look", it has no logo `<img>`, and its full-page screenshot is 1280×2961. `patchy validate` on it returned `{"ok":true,"warnings":[]}`. - `patchy look preview linear --compare --json` exited 0 with `failures: []`, and wrote two frames titled "Candidate" and "The Patchy look", the second with the note. The full-page screenshot is 1280×3611 with both whole looks (frames 2651px and 3611px). No requests. - After `patchy look publish duolingo`, the same `--compare` shows "Candidate" beside "Revision 1, the company's look", as before. Tests, in `packages/patchy/src/cliLook.test.ts`: - With no company look, `look preview --json` exits 0 with `{ ok: true, failures: [] }`. The file shows "The Patchy look" and the note, has no `data:image/svg+xml`, and passes `validateHtml`. - With no company look, `look preview <dir> --compare` writes frames "Candidate" and "The Patchy look". - A response with neither look still exits 1, and `--compare` without a folder still exits 1 with no request. The existing company-look and offline-candidate cases are unchanged. - Both new cases fail against the old `commands.ts`. `cliLook`, `lookPreview` and `skillLock` vitest pass 13/13, `look-preview.spec.ts` passes 6/6 after a fresh build, and lint, prettier and the typechecks are clean. `pnpm verify` is queued behind the machine's shared lock; CI is the gate. - GPT 6.1 Sol review at xhigh found nothing at any level. ## Surfaces - The command's help strings: the `dir` argument, `--compare` and the command description name the Patchy-look fallback. These are the only `commands.ts` edits, all inside `look preview`. - CLI README's look section: the command table row, the `--compare` paragraph (the Patchy look stands in, labelled, no logo), the `failures` sentence, the exit-1 paragraph (only `--compare` without a folder), and the `--compare` flag line. - ADR-0004's look preview contract: the table row and paragraph. The `--json` shape and exit codes are unchanged; only the no-look behaviour moved. - `docs/product.md`'s specimen paragraph, and the comment on the browser-tier compare spec (comparing needs an instance, not "a current look"). - Global `patchy` skill, "Changing the look": `--compare` shows the candidate beside the company's look, or the Patchy look when there is none. `skills-lock.json` hash refreshed. Closes #593 Made by Claude Opus 5.5 in Claude Code, running in T3 Code.
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
…u when they fail (#720) Release 13's What's new entry, written from `c9b8fc4`, ahead of deploying it. `patchy` and `CURRENT_RELEASE` move to `0.13.0`, so CLIs and patch repos installed before this deploy are told to upgrade. | Change | PRs | | --- | --- | | New: Home puts the patches you use first | #713, #716, #719 | | New: Every patch in one list | #715 | | Improved: Each patch's page leads with Open | #717 | | New: See when your tools are failing | #718 | | Fixed: Everyone has a name | #687 | | Improved: Your company's look is easier to get right | #697, #696, #703, #688 | | Improved: Forms follow your look's error states | #691, #692 | | Improved: Clearer answers when a publish goes wrong | #686, #685, #689 | | Fixed: Your agent's Patchy commands are steadier | #695, #704, #680, #681 | | Behind the scenes: stricter checks on static pages and tools' database requests; malformed requests are logged | #682, #693, #683 | | Behind the scenes: usage numbers count every publish, sharing change and restore | #698, #699, #700, #690 | | Test and tooling only, no line | #705, #702, #701, #694, #684, #607 | Made by Claude Opus 5.5 in Claude Code, running in T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
patchy look preview <dir> --compareputs each look in its own frame, and each frame was100vhand scrolled on its own. A full-page screenshot, which is what an agent takes, came out one screen tall: each look's masthead and headings, and none of its cards, table, form, states or swatches. The global skill worked around it by telling agents to screenshot each look alone.The compare page now sizes each frame to its specimen, so the page scrolls as one and one screenshot holds both whole looks:
script-src 'sha256-…'entry computed from its exact text. After load it reads each frame's.specimen(srcdoc frames are same-origin), resets itsmin-height/heightso a look's ownmain { min-height: 100vh }ormain { height: 100vh }can't tie it to the frame, and sets the frame's height from aResizeObserveron it. That covers the first fit, late fonts and window resizes, and frames shrink as well as grow.100vh, as before. The single-look page, including the--comparefallback, stays script-free and passes tier 0validateHtml. Each specimen keeps its own CSP, and the frames still keep each look's styles and fonts to itself. The CLI's flags,--jsonshape and exit codes don't change.#677 had landed a check in the same compare test: a specimen's
#vendorslink scrolls instead of loading the page into the frame. That still holds. With the frame fitted, Chromium scrolls the page around it instead, and the test's comment now says so.It works
Run by hand through a
pnpm dev up teamenvironment's CLI, with the company look set to the Duolingo fixture and the Linear fixture as the candidate.patchy look preview linear --compareopened offline in Playwright at 1280×720 with every request refused. The full-page screenshot is 1280×3903 and shows both whole specimens, swatches included. The Linear frame is 2651px and the Duolingo frame 3903px. Each frame's documentscrollHeightequals its frame height, so neither scrolls on its own, and no requests were made.test/browser-tier1/look-preview.spec.tsnow gives one lookmain { min-height: 100vh }, and the othermain { height: 100vh }plusbody { position: relative; margin: 32px; padding-bottom: 64px }. At 1280px it polls until each frame is at least as tall as its specimen's bottom and the frame document'sscrollHeightfits the frame. Then it checks they grow at 375px and return to the exact same heights at 1280px. It fails on the old code (no frame ever fits). It also fails with the specimen height reset removed: theheightlook clips, and themin-heightlook sticks at 3600px instead of 2651px. It fails again if the top is measured withoffsetTop, which a positioned body makes 0, or if the space below is assumed to mirror the space above. The existing checks stay: each frame shows its own look, there's no horizontal overflow, and no request is made.--comparefallback also assertsvalidateHtml(page)is ok.look-preview.spec.tspasses 6/6 after a fresh build on the rebased branch.cliLook,lookPreviewandskillLockvitest pass 13/13. Lint, prettier and both typechecks are clean.pnpm verifyis queued behind the machine's shared lock (10+ runs deep), so CI is the gate here.offsetTopreads 0 under a positioned body, so the frame clipped. It also found a low one: the observer watched the content box, not the border box. Both are fixed and the first is now in the test. Round 2 found a low issue: assuming the space below mirrors the space above left uneven trailing spacing a little inner scroll. It's fixed by measuring that spacing, and it's in the test too. Round 3 found nothing.Surfaces
look preview: the compare frames fit their looks, so one full-page screenshot shows both.patchyskill, "Changing the look": the "screenshot each look alone" workaround is replaced by "a full-page screenshot shows both looks whole".skills-lock.jsonhash refreshed.docs/product.md, glossaries: no change. The CLI contract and the product's shape are unchanged.Closes #595
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.