fix(desktop): don't persist ephemeral preview-proxy URLs (CODE-373) - #241
Conversation
Greptile SummaryThis PR prevents temporary preview URLs from surviving desktop restarts. The main changes are:
Confidence Score: 4/5The preview-host predicate can erase unrelated local browser URLs and needs a narrower namespace check.
What T-Rex did
Important Files Changed
Reviews (1): Last reviewed commit: "fix(desktop): exclude preview URLs from ..." | Re-trigger Greptile |
AprilNEA
left a comment
There was a problem hiding this comment.
The behavior is right and it still merges clean on current master. One blocking item: the predicate duplicates one we already have.
isPreviewBrowserUrl is a verbatim copy of isPreviewOrigin in packages/foundation/transport/src/preview-routes.ts — same suffix constant, same label regex, same try { new URL(url).hostname }. Importing it instead of re-deriving it costs nothing here: transport re-exports preview-routes from its root entry, that entry is browser-safe (the node-only pieces sit behind the ./server subpath), apps/desktop already depends on @linkcode/transport, and client-core already pulls it into the renderer bundle. It is also the boundary-correct home for the check — packages/presentation/ui is not allowed to import transport, so this belongs at the desktop edge rather than as a second copy in the UI package.
That also settles the review bot's P1 about http://my--app.localhost:3000: reusing the shared predicate makes the client agree with the daemon's own definition of the preview namespace by construction, instead of maintaining a parallel heuristic that can drift from it.
Things I verified that are fine, so you don't need to revisit them:
- The separate
blob:check must stay —new URL('blob:…').hostnameis empty, soisPreviewOrigincannot see it. - Coverage is complete.
web--,file--andartifact--are all registered on demand by the engine, so after a restart the route table is empty and every one of them 404s. BrowserPanehas aurl === nullempty state, so dropping to null does not leave a blank pane.
Summary
<kind>--<id>.localhostpreview namespaceTesting
devenv shell -- pnpm check:cidevenv shell -- pnpm test(213 files, 1657 tests)Linear: https://linear.app/arcbox/issue/CODE-373/fixdesktop-dont-persist-ephemeral-preview-proxy-urls-in-the-browser