Skip to content

Serve the cloud console as an SPA with a prerendered shell - #1748

Merged
RhysSullivan merged 1 commit into
mainfrom
feat/cloud-spa-mode
Aug 26, 2026
Merged

Serve the cloud console as an SPA with a prerendered shell#1748
RhysSullivan merged 1 commit into
mainfrom
feat/cloud-spa-mode

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

The console is 100% authenticated UI — marketing is its own Astro app and docs are a proxy — so nothing needs per-request React SSR. This enables TanStack Start's SPA mode: the shell is prerendered once at build, and document requests run the same request-middleware chain (auth redirects, session cookie rotation, hint minting) but serve that static shell instead of rendering the app in the worker.

Why now: post-#1742/#1747 traces show the remaining latency tail is worker cold-start absorbed by document requests — warm SSR documents measured 730-950ms and cold ones 1.7-3.2s, all of it cfEdge time. A static shell removes the per-request render entirely and drops the React app from the worker's runtime graph.

Changes:

  • spa: { enabled: true } in the cloud vite config; the shell prerenders at build.
  • ssr-gate.tsdoc-gate.ts: same gate, same redirects, same single-use-refresh-token cookie rotation (that part is load-bearing for session lifetime and now documented as such); it no longer threads render context, since there is no per-request render.
  • __root.tsx drops the loader/dehydration seam. Auth seeds from the client-readable hint cookie one frame after mount (AuthProvider's existing fallback, same as self-host); origin-derived UI reads window.location.origin.
  • connect-card-ssr-origin e2e → connect-card-origin: the "real host, never 127.0.0.1:4000" contract is asserted on the rendered DOM now that there is no server-rendered HTML to inspect.
  • The signed-in root scenario asserts "no login detour" instead of pinning the pre-canonicalization URL, which was an SSR timing artifact.
  • e2e cloud boot wipes apps/cloud/.wrangler/state alongside the dev DB: miniflare persists the Workers Cache API across runs, and the JWKS L2 cache served run N's emulator keys to run N+1 (same port block ⇒ same cache key), making every session verify fail signature and race single-use refreshes into 401s. This poisoned every second-and-later local run regardless of branch.

Verified: 15/15 affected cloud e2e scenarios pass (auth-routing-flow, auth-hint, auth-session, unauthenticated-skeleton, org-slug-routing, connect-card-origin, logout-stale-session), including two consecutive runs to prove the cross-run poisoning fix. Browser recordings/traces in the runs artifacts. Typecheck/lint/format green.

Note: the deployed worker still ships the dead SSR chunks on disk (they are dynamic-import-only and never evaluated); trimming the build output is follow-up bundle work.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 912f90c Commit Preview URL

Branch Preview URL
Aug 25 2026, 11:58 PM

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 912f90c Aug 26 2026, 12:00 AM

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1748

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1748

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1748

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1748

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1748

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1748

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1748

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1748

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1748

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1748

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1748

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1748

executor

npm i https://pkg.pr.new/executor@1748

commit: 912f90c

@RhysSullivan
RhysSullivan marked this pull request as ready for review August 26, 2026 02:37
@RhysSullivan
RhysSullivan merged commit eb34d04 into main Aug 26, 2026
43 of 44 checks passed
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.

1 participant