Repository navigation
fix(serving): same-page links on a static page scroll instead of breaking it - #677
Merged
Merged
Conversation
…king it A tier 0 page sits in a sandboxed srcdoc frame. Its URL is about:srcdoc, but without a base of its own its relative URLs resolve against the shell's, so a contents link like href="#sellers" named the patch's own address. Following it loaded the shell inside the frame, which frame-ancestors 'none' refuses, and the page became a browser error. Every framed static page now leads with <base href="about:srcdoc">, PatchPage's fix for the same bug, so a same-page link is a fragment navigation: a scroll, with no request. The tier 0 policy's base-uri moves from 'none' to about: to admit that base and nothing on the network. The look preview's compare frames get the same base. The global skill stops suggesting HTTPS links on a static page: they never opened from one, and still don't. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 14, 2026
… Patchy is smoother (#679) Release 12's What's new entry, written from `b58b899`, ahead of deploying it. `patchy` and `CURRENT_RELEASE` move to `0.12.0`, so CLIs and patch repos installed before this deploy are told to upgrade. | Change | PRs | | --- | --- | | Fixed: Links within a page jump to their section | #677 | | Improved: Set up Patchy however you ask | #672, #674 | | Improved: Claude Code can know Patchy is your company's own | #676 | | Fixed: Your agent remembers Patchy after a Node.js update | #673 | | Fixed: Sign-in codes say how many minutes they have left | #675 | | Behind the scenes: uploaded pages and logos are checked within strict limits | #678 | Made by Claude Opus 5.5 via Claude Code in T3 Code Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 15, 2026
…eenshot (#696) `patchy look preview <dir> --compare` puts each look in its own frame, and each frame was `100vh` and 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: - A small inline script on the two-pane page only, allowed by a `script-src 'sha256-…'` entry computed from its exact text. After load it reads each frame's `.specimen` (srcdoc frames are same-origin), resets its `min-height`/`height` so a look's own `main { min-height: 100vh }` or `main { height: 100vh }` can't tie it to the frame, and sets the frame's height from a `ResizeObserver` on it. That covers the first fit, late fonts and window resizes, and frames shrink as well as grow. - It measures the specimen's border box, not the frame's document, which is never shorter than the frame. The frame's height is the specimen's offset in its document, its height, and the bottom padding, border and margin a look puts on the body and root, plus the 1px divider between panes. - Without JavaScript the frames stay `100vh`, as before. The single-look page, including the `--compare` fallback, stays script-free and passes tier 0 `validateHtml`. Each specimen keeps its own CSP, and the frames still keep each look's styles and fonts to itself. The CLI's flags, `--json` shape and exit codes don't change. #677 had landed a check in the same compare test: a specimen's `#vendors` link 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 team` environment's CLI, with the company look set to the Duolingo fixture and the Linear fixture as the candidate. `patchy look preview linear --compare` opened 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 document `scrollHeight` equals its frame height, so neither scrolls on its own, and no requests were made. - The Chromium compare case in `test/browser-tier1/look-preview.spec.ts` now gives one look `main { min-height: 100vh }`, and the other `main { height: 100vh }` plus `body { 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's `scrollHeight` fits 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: the `height` look clips, and the `min-height` look sticks at 3600px instead of 2651px. It fails again if the top is measured with `offsetTop`, 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. - The CLI test for the no-current-look `--compare` fallback also asserts `validateHtml(page)` is ok. - `look-preview.spec.ts` passes 6/6 after a fresh build on the rebased branch. `cliLook`, `lookPreview` and `skillLock` vitest pass 13/13. Lint, prettier and both typechecks are clean. - `pnpm verify` is queued behind the machine's shared lock (10+ runs deep), so CI is the gate here. - GPT 6.1 Sol review at xhigh, three rounds. Round 1 found a medium issue: `offsetTop` reads 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 - CLI README, `look preview`: the compare frames fit their looks, so one full-page screenshot shows both. - Global `patchy` skill, "Changing the look": the "screenshot each look alone" workaround is replaced by "a full-page screenshot shows both looks whole". `skills-lock.json` hash refreshed. - ADR-0004, `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.
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.
A user's first static page had a table of contents. Clicking any of its links (
href="#sellers") made the report vanish and left a browser error inside the Patchy page. Their agent worked around it by rewriting every link toabout:srcdoc#sellers. Every static page with a contents list or a back-to-top link had the same problem.A tier 0 page is served inside the shell as
<iframe sandbox="" srcdoc="…">. The framed document's URL isabout:srcdoc, but without a base of its own its relative URLs resolve against the shell's. So#sellersnamed the patch's own address, and the frame tried to load the shell inside itself, whichframe-ancestors 'none'refuses.PatchPage hit the same bug and fixed it (allisonmahmood/PatchPage#207). This ports that fix:
framedDocumentputs<base href="about:srcdoc">ahead of the page and drops a leading byte order mark. A same-page link is then a scroll within the frame, with no request. The shell and the look preview's--compareframes, which had the same bug, both use it.base-urimoves from'none'toabout:. A srcdoc document inherits its embedder's CSP, so this admits that base and nothing that reaches the network.docs/product.mdstop suggesting HTTPS links on a static page. They never opened from one: before and after this change the shell'sframe-srcblocks them, andtarget="_blank"needs popups the sandbox doesn't grant.The one casualty, as in PatchPage, is the attributes on a page's own
<head>tag. The parser drops them once the base has implied a head.It works
#targetin a framed static pagechrome-error://, requests the shell's URLabout:srcdoc#target, scrolled, no requestabout:srcdoc#target, scrolled, no requestWebKit wasn't available on the test machine, so Safari is unverified here.
test/browser-tier1/static.spec.ts: publishes a real tier 0 page, clicks its contents link, and checks that the section scrolls into view with no request. It fails with either half of the fix reverted.#vendorslink and checks the scroll. It fails without the fix.pnpm verify: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, tier2-smoke and browser (59/59) passed. Three timing tests in the offline stage failed while the machine was at load 25, and all three passed when rerun alone.pnpm testthen passed in full (1741/1741).<head>-attribute casualty is now documented in the helper.Made by Claude Opus 5.5 via Claude Code in T3 Code