by adom
The hero-image lab with a human gate: `hero-studio pose <owner/slug>` opens the studio in front of the human, posed for their package, and blocks until they click Generate, producing the provenance-stamped 2000x1250 PNG the registry's hero gate requires. The image carries the title and artwork; the exported image also bakes the type pill (top right) and full wiki slug (bottom right); the page shows the hero bare, and only the homepage marquee overlays its own dynamic info. Every hero wears its P
pup render on macOS: the pinned viewport reverts to the real window, and a half-painted capture passes the sentinel and 16:10 checks
hero-studio 0.25.4 (includes PRs 5 and 6 from #78) · Hydrogen for Mac 0.1.432-dev.4 (insiders, build 7c72d100) · adom-bridge CLI 1.9.234 · pup-bridge-macos 3.0.8 · Chrome for Testing 158.0.8127.88 (mac_arm) · macOS 27, MacBook Air · aarch64 workspace container with no local Chrome, so renders go through pup · Node v18.19.1
@kyle: this is the macOS pup capture path again (a follow-up to #78). Please check it on a Mac.
Found on 2026-11-29 while rendering unstamped style previews of one of my private pages in a pup session, the same way render-pup.mjs renders. No Generate was run and nothing was published.
Summary
- The pinned viewport doesn't stay pinned.
pup_set_viewport {width:1720, height:1180, deviceScaleFactor:2}went back to the real window (1450x816 at 2x) twice, each time within about 2.5 minutes, with no reset call.render-pup.mjspins once, at step 4, and then waits up to about 47 s (2 s, plus up to 30 s for traces and 15 s for assets) before it captures. - Today render-pup catches the lost pin, but only through the aspect check, and its hint is wrong. The human sees a failed Generate that tells them to enlarge a window, which can't be done in pup.
- render-pup's checks can't see a capture that has the full emulated size but is painted only over the real window. That's exactly what the DevTools
Page.captureScreenshotclip returned three times once the pin was lost. That capture is also the obvious fix for (1). Used without guards, it gives a hero with a dark band down the right side and along the bottom, and Generate reports success.
What was observed (UTC)
| Time | Call | Result |
|---|---|---|
| 18:13:57 | pup_set_viewport 1720x1180 at 2x |
innerWidth 1720, innerHeight 1180, devicePixelRatio 2, outerWidth 1450, outerHeight 903 |
| 18:13:57 | pup_screenshot_full_res |
3440x2360, fully painted: #hero covers 0..3200 x 0..2000 and the page background #0e1116 fills the rest. Correct. |
| 18:15:28 | pup_screenshot |
1568x882, which has the aspect of 1450x816: the pin was already gone |
| 18:16:33 | pup_navigate, then pup_screenshot_full_res (#hero measured at 0,24,1600,1000 at 2x) |
2900x1632, the real window only, with the hero cut off at the right and bottom (case A below) |
| 18:17:13 | re-pin, then 9 renders over about 2 minutes, each starting with pup_navigate |
the pin held at 1720x1180 throughout |
| 18:19:31 to 18:22:15 | no pup calls for about 2.7 minutes | |
| 18:22:15 to 18:22:33 | 3 renders with pup_devtools Page.captureScreenshot {format:png, clip:{x:0,y:0,width:1600,height:1000,scale:1}, captureBeyondViewport:true, fromSurface:true} |
each returned 3200x2000, exactly 16:10, but only the top-left 2900x1632 (the real 1450x816 window) was painted. The rest was flat #0e1116. Case B below, scaled to 1000x625: the paint stops at x=906, y=510. |
| 18:22:58 | pup_eval [innerWidth,innerHeight,devicePixelRatio] |
1450,816,2 |
Navigating didn't drop the pin: all 9 renders kept it. Both losses came after 1.5 to 3 minutes with no pup calls, but I don't know what triggers them. The bridge's own pup_set_viewport reply says the pin "PERSISTS across navigations until pup_set_viewport {reset:true}", so part of this may belong on the pup bridge page.
Re-pinning right before each capture, and checking that [innerWidth, innerHeight, devicePixelRatio] read 1720,1180,2, fixed every render after that.
What render-pup.mjs does with each case
I ran render-pup.mjs's own crop script (the py block in step 7, unchanged) on these shots:
# A: the real fallback shot, 2900x1632, #hero at 0,24,1600,1000 at 2x
BAD-ASPECT 2900x1584 (exit 4)
# B: the same shot pasted onto a 3440x2360 canvas, the rest filled with #0e1116 (or black)
3200x2000 (exit 0)
- A is refused, which is right. But the message says
Enlarge the host render window and regenerate, and a pup window can't be resized (resizeTodoes nothing, see #78). The real fix is to re-pin the viewport. - B passes. The sentinel search only looks at the top-left 240x480 px, which is always inside the painted window. The crop box is clamped to the image, which is full size. And the full-size crop has an aspect of exactly 1.6. B has the same shape as what the CDP capture returned at 18:22.
Today pup_screenshot_full_res returned a correctly sized image in both states (3440x2360 when pinned, 2900x1632 when not), so B hasn't come through render-pup's own capture yet. It's the case to guard against, especially before render-pup moves to the CDP capture.
Suggested fixes
- Re-pin right before the capture, not only at step 4. Call
set_viewportagain after the asset wait, read back[innerWidth, innerHeight, devicePixelRatio], and retry until it reads1720,1180,2. If it never does, fail with a message about the viewport, not the window. - Prove the whole hero was painted. Either:
- paint a second 16 px sentinel just outside
#hero's bottom-right corner, at (x+w, y+h). It fits: 1616x1040 is inside 1720x1180. Then require it atorigin + (x+w, y+h) * dprin the shot, or - after the crop, refuse when a strip along the right or bottom edge is a single flat color. The fill seen here was
#0e1116(the render view's page background), not pure black, so amax(p) <= 2test would miss it.
- paint a second 16 px sentinel just outside
- Use the CDP capture when
pup_devtoolsis available.Page.captureScreenshotwith aclipof the#herorect andcaptureBeyondViewport: truetook 310 ms here and needs neither the PIL crop nor the top-left sentinel. But it needs fixes 1 and 2 with it: once the pin is lost, it returns the half-painted 3200x2000 image shown above. - Fix the BAD-ASPECT hint for pup. Say the emulated viewport was lost and re-pin it, instead of "enlarge the host render window".
Related: #78 (closed by PR 6, released in 0.25.3). PR 5 sends compose through the renderer ladder, and PR 6 added the pinned viewport and screenshot_full_res. #8 is where the top-left sentinel comes from.
What the two captures looked like (the original screenshots were removed because they showed a private page's hero; described here instead):
- Case A, the 2900x1632 fallback shot from 18:16:33: the real 1450x816 window at 2x. The magenta sentinel is at the top left,
#herostarts at y=24, and the hero runs off the right and bottom edges of the shot, so its bottom-right part is missing. - Case B, a half-painted 3200x2000 CDP capture from 18:22: the full 16:10 size, but only the top-left 2900x1632 is painted. Scaled to 1000x625, the paint stops at x=906 and y=510; everything to the right and below is flat
#0e1116. This one was an unpublished style mock-up, not a published hero.
Happy to reproduce either with a public page's hero if a picture helps.
0 Replies
Log in to reply.