Repository navigation
feat(open): warm a recent project's preview before its card is clicked - #1768
Merged
gregpriday merged 8 commits intoNov 28, 2026
Merged
Conversation
- Welcome reads a pointer at rest on a card, or keyboard focus that stays on one - The main process starts that project's preview under a fresh-only lock lease - The open takes the lease as its own session and the server as its early one
… benchmark - Unit tests for the intent rules, the warm start's conditions, takeover and discard - perf:run --lead rests on the card before the click; open.lead and open.warmTaken
… preview is taken over
- Check trust again under the lock, right before the fork, and note what the server read - Wait for every replaced warm server to exit; let an open wait for a lock being taken - Count a warm server an open has taken until its preview takes it, so quitting waits - Notice an unlock from another app within a second; never take a dead or stale server - Decline projects whose open starts no preview (unreadable documents, missing theme) - Hand intent back to the card focus or the pointer stays on; leave on window blur
… only for a lock being taken in the folder opened
…, and read no document through a link before a warm start
gregpriday
deleted the
feature/issue-1767-warm-recent-project-preview
branch
November 28, 2026 18:18
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.
Resolves #1767
Pointing at a recent project on Welcome now starts its preview, so the click takes over a server that is already starting or ready instead of forking one after the open has read the project.
What changed
src/renderer/src/lib/recent-preview-intent.ts, wired inWelcome.tsx). A pointer at rest on a card (100 ms within 4 px), or keyboard focus that stays on one, sends that project over a newprojects:warmIPC. Moving down the list sends nothing, a card that comes to rest replaces the one before, and nothing pointed at or focused for 2 s (or the window losing focus, or the card being filtered out) sendsnull. Missing cards, touch and pressed-button moves never count. Nothing is sent while an open runs.Controller.warmand friends insrc/main/controller.ts). One at a time, only while Welcome is showing with nothing else under way. It starts only for a project the open would preview without asking: listed in Recent projects, folder there and servable, the same trust check as today, website tools installed (never an install), no component previews left over, nothing to recover, readable documents and an available theme, not from a newer version (ProjectSession.previewBeforeOpen). It waits until every warm server it replaced has exited, then takes a fresh-only lock lease (ProjectSession.lease: only when no lock file exists at all, and no folders are made). Under the lock it checks trust again and notes what the server reads at start (the config hash and the.env*files), then forks the sameDevServerthe open would fork, in place.warmForOpen,src/main/runtime/warm-preview.ts). The lease session is passed toProjectSession.openasOpenOptions.lease, so the open uses that session and its lock, and the lock stays this app's throughout.prepareRuntimeadopts the server as the opening's early server, and today's rule decides as before (earlyTakeable: the publication was seen and landed no file, the project is writable, the server is starting or ready). A warm server whose configuration or environment files changed since it started is also discarded, as is one that failed before the takeover. Anything else stops it and opens as today: a different card, the Open dialog, a moved or deleted folder, a trust prompt, a read-only open.before-quitno longer takes its fast path while one runs or is being handed to an open).npm run perf:run -- --scenario open --lead <ms>rests on the card that long before clicking.open.canvasReadyis still timed from the click. The preview's phases are searched from the pointing (open.pointed) and can be negative.open.leadandopen.warmTakensay what happened. Results with different leads are never compared, and percent change on a negative baseline now reads a later time as an increase.tests/e2e/design/project-open.mjsnow also opens the project after resting 800 ms on its card. It checks that exactly one preview process started during the rest and that the open took that same process over, and writes a second filmstrip.Known limits
.svelte-kit,node_modules/.vite), and trusted project code (a config plugin, a server hook on the home route's first render) runs. A project's documents, generated files, lock and local state are left as they were. A private copy was considered and rejected: copying the tools cannot fit a 300 ms lead, and the issue's takeover rule only has meaning for a server reading the project's own files.lock.jsonwith it, as renaming an open project's folder does. A later open in this app takes it over, and another instance sees it as stale once it stops changing.Benchmark
npm run perf:run -- --scenario open --iterations 3 --lead <ms>, both fixtures, medianopen.canvasReadyfrom the click. The serving server was the warm one in every leaded iteration (open.warmTaken1).No lead against
develop(built fromorigin/developand measured with this harness via--app): small 1472 → 1481 ms (+0.6%, noise band ±147 ms), large 2216 → 2212 ms (−0.1%, ±222 ms). A no-lead open is no slower than today. These runs used the build ata7146a009; the two later commits add a lock check before a warm fork and lock-wait bookkeeping, neither on the no-lead path.Testing
tests/unit/recent-preview-intent.test.ts: 21 cases. Sweeps, drift, replacement, grace, keyboard, pointer and focus together, window blur, filtered cards, opening and disposal.tests/unit/warm-preview.test.ts: 36 cases on the real controller and session with a fake preview process. Takeover, discard on a changed publication or.env, one at a time across three cards with a slow exit, untouched files, a different project, a moved folder, an early click, unlock (before the fork and while running), a lock still being written, quit, window close, handover counted for quit, and 16 never-warmed conditions.open-outline-browser.test.ts: the Welcome wiring in Chromium, including window blur.perf-scenarios.test.ts/perf-results.test.ts: lead metrics, protocol, and percent change on a negative baseline.a7146a009: 80 files, 2052 tests, all green. After the later fixes, the 41 controller tests in that set,session/read-only-open/project-switch, andwarm-previewwere all green.DESIGN_CAPTURE=1 node tests/e2e/design/project-open.mjson the built app (a7146a009) passed. Resting 800 ms on the card started one preview process, the open took that same process over, and the page was ready 616 ms after the click, against 1387 ms clicked straight away (both inside the capture's screenshot loop). The capture's sheet step needs Python's Pillow.open.leadincludes Playwright's hover and click dispatch.