Skip to content

feat(frames): forward-port frame culling, stored preview and first-paint signal (CHE-8976) [squash] - #108

Merged
congvc-bot-x99[bot] merged 3 commits into
cheese/mainfrom
agent/x99-claude-sonnet-200k/che-8976-aef4dfceaed0
Nov 22, 2026
Merged

congvc-bot-x99[bot] merged 3 commits into
cheese/mainfrom
agent/x99-claude-sonnet-200k/che-8976-aef4dfceaed0

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Iframe-count check (first)

v0.15.0 / cheese/main before this PR: one unconditional <iframe> per frame in FrameView.tsx, no culling, no stored preview, no paint marks. The port was needed. After this PR a frame holds an iframe only when framesToMount keeps it (near the camera, at least 160 px wide on screen, among the 24 nearest the stage centre, or selected, or ever edited). Other frames keep their box and show the stored /i/<id>.jpg?preview.

Refs CHE-8976 (sub-issue of CHE-7328).

What was ported (re-implemented, not cherry-picked)

Fork main commits Result on cheese/main
a8a60099 579d46a3 7188353e 93ce9415 4626f1d9 88ff188d (culling chain) src/lib/frameCulling.ts, src/components/useCulledFrames.ts, mounted prop on FrameView, wired in Stage.tsx FrameStack; everEdited keeps an edited frame's iframe
92d48c05 0e7aa14e 46bdf3d2 (PR 65: stored preview, measure-lag) preview block in FrameView (FramePreview gets quietFail), scripts/perf/measure-lag.ts + paintValidation.ts, referenceRender.ts, throttle-proxy.ts
b2bb1b03 16cf33d6 26749817 c6dc1c25 4a01393a 99e1fea4 (first-paint signal) doop:paint from frameRuntime.ts, performance.mark in FrameView and ws.ts (doop:ws-open, doop:init-*, doop:html-result)

Adapted for the cheese/main structure that main lacks: on cull the runtimeReady, runtimeDocument, bleed, localHtml and the key MessagePort are reset so the next document starts clean.

Tests ported: frameCulling, frameCullEditBrowser (fixture elementPanel.html gets setMounted / unselectFrame), framePaintSignal, paintValidation, throttleProxy.

Tests

bunx vitest run tests/frameCulling.test.ts tests/frameCullEditBrowser.test.ts tests/framePaintSignal.test.ts tests/paintValidation.test.ts tests/throttleProxy.test.ts
 Test Files  5 passed (5)
      Tests  41 passed (41)

Also green on this head: bun run typecheck, bun run lint, bun run build, prettier check on touched files. Regression run of 14 FrameView-related browser files: 175 passed, 10 failed, all 10 in tests/elementPanelBrowser.test.ts ("aligns children to the physical bottom right ..." and one flex-direction case, 5 s timeouts). The same 10 fail on the untouched base 1784adf9 (verified in a clean worktree), so they are not caused by this PR.

Notes

CI follow-up on head 00f15fef

CI on 8d27539f failed 2 tests in shard 4, both cheese/main-only browser tests that use frames under 160 px on screen. The ported rule culls those frames, so no iframe exists to find:

  • tests/frameEdgeBrowser.test.ts: the dark frame is now 1700 wide (160 px at the lowest zoom, 10%); the plain frame moved to x=3400.
  • tests/standalonePanelBrowser.test.ts: shapes are 200 and 240 wide (were 120 and 160); widths asserted to match.

The culling rule and the kept frameCulling cases are unchanged. Local: both files plus frameCullEditBrowser pass (7 tests); shard 4 (bun run test -- --shard=4/4) 954 of 955 pass, the one miss is imageDescriptionsMigration (PGlite 5 s timeout under load; passes alone; file untouched). bun run lint, format:check and typecheck pass. CI on the new head is pending.

Follow-up risk: a standalone shape under 160 px on screen now shows a stored preview until selected. That follows the ported rule; say if canvas elements should be exempt.

Head e1f17850: measure-lag helpers (review P2)

Review of 00f15fef found that scripts/perf/measure-lag.ts imports three helpers the first port left out, so the script could not start. Ported from fork main:

  • scripts/perf/import-canvas-export.ts, scripts/perf/measure-local.ts, scripts/perf/measure-canvas-load.ts
  • tests/importCanvasExport.test.ts, tests/measureCanvasLoad.test.ts: the export-order assertion now compares frames page by page, because cheese/main stacks frames per page.
  • tests/measureLag.test.ts (new): imports the script, so a missing helper fails the test run.
bunx vitest run tests/measureLag.test.ts tests/importCanvasExport.test.ts tests/measureCanvasLoad.test.ts
 Test Files  3 passed (3)
      Tests  14 passed (14)

Real run of the script (bun run build, then npx tsx scripts/perf/measure-lag.ts --erus-like with 80 frames, 1 run): exit 0, iframesAtFitAll: 0 (limit 24). longTasks 51, frameP50 33 ms, frameP95 67 ms, paintedMs 1154.

Also green locally: typecheck, lint, format check. CI on e1f17850 is pending; not awaited here.

congvc-bot[bot] added 2 commits November 22, 2026 00:59
…int signal (CHE-8976)

Re-implements fork main's culling chain (PR 8), stored preview and measure-lag (PR 65)
and the doop-load first-paint marks on the cheese/main FrameView and Stage.
Adds playwright-core as a devDependency for the perf scripts.
Two tests that exist only on cheese/main used frames under 160 px on screen. The
ported culling rule shows those as a stored preview with no iframe, so the tests
could not find the iframe they click or measure.

frameEdgeBrowser: the dark frame is 1700 wide, so it is still 160 px at 10%.
standalonePanelBrowser: the shapes are 200 and 240 wide at the page's 100% zoom.

The culling rule and its tests are unchanged.

Refs CHE-8976
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review November 21, 2026 19:24
@congvc-bot-x99
congvc-bot-x99 Bot requested a review from congvc-dev November 21, 2026 19:33
measure-lag.ts imported import-canvas-export, measure-local and
measure-canvas-load, which the first port left out, so the command could not
start. Port the three from fork main with their tests (importCanvasExport,
measureCanvasLoad) and add measureLag.test.ts, which imports the script and so
fails when a helper is missing again.

importCanvasExport compares frames page by page: cheese/main lists a canvas's
frames stacked per page, so the export order is not kept across pages.

Run for real on this head: 80 frames, 0 iframes mounted at fit-all, exit 0.

Refs CHE-8976
@congvc-bot-x99
congvc-bot-x99 Bot merged commit 1b9119d into cheese/main Nov 22, 2026
11 checks passed
@congvc-bot-x99
congvc-bot-x99 Bot deleted the agent/x99-claude-sonnet-200k/che-8976-aef4dfceaed0 branch November 22, 2026 09:48
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.

0 participants