Repository navigation
feat(studio): TanStack app shell — root + auth/org routes (stack 3/6, from #46424) - #47112
Conversation
…RAMEWORK flag (1/6, from #46424) Foundation of the TanStack Start migration (#46424), split into a reviewable stack. Next remains the default and only active framework after this PR — the TanStack build pipeline is wired up but has no routes yet, so it isn't functional or tested until later PRs flip the feature flag. - package.json: dev/build/start now dispatch via scripts/dispatch.js (defaults to next); add :next/:tanstack variants, vite/tanstack deps. - scripts: dispatch.js, serve.js, smoke-server.mjs, generateLocalEnv.js. - vite.config.ts, turbo.jsonc, tsconfig.json (jsx: react-jsx, Bundler). - next.config.ts + redirects.shared.ts (shared redirect rules with vercel.ts), proxy.ts/start.ts middleware + hosted-api-allowlist.ts. - companion adaptations the tsconfig change requires to keep typecheck green (BufferSource casts, packages/ui unused-React import removals, etc.). Verified: frozen install, studio typecheck, Next build, and lint ratchet all green; Next stays the default build.
…46424) Adds compat/next/* — drop-in shims for next/link, next/router, next/navigation, next/head, next/image, next/script, next/dynamic, next/server, and a toWebHandler (compat/next/api.ts) that lets pages-router API handlers run as TanStack server routes. Under TanStack these are wired in via Vite aliases (next/* -> @/compat/next/*); Next never imports them, so this is purely additive. No routes consume them yet — that starts in the next stack PR. Stacked on #47107. Verified: studio typecheck + lint (0 errors).
…outes (stack 3/6, from #46424) Adds the TanStack Start app skeleton: routes/__root.tsx (root layout + redirect beforeLoad), router.tsx, and the _auth (sign-in/up, forgot/reset password, SSO/MFA/partner, CLI login) and _app (account, org/$slug, support) route trees. These are thin wrappers that render the existing pages-router page components via the compat shims from #47110. routeTree.gen.ts is REGENERATED by the tanstackStart vite plugin for exactly the routes present in this PR (not copied from the migration branch, whose tree references all ~300 routes) — so it typechecks standalone. API routes and project routes (and a full regenerated tree) land in the next stack PRs. Stacked on #47110. Verified: studio typecheck + lint (0 errors). Next is unaffected (it builds pages/, ignores routes/).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/studio/routes/_app/org/`$slug/billing.tsx:
- Around line 12-14: The OrgBilling route component is missing the
OrganizationSettingsLayout wrapper that other org settings routes use. Wrap the
OrgBillingSettingsPage component inside OrganizationSettingsLayout in the
OrgBilling function's return statement to maintain consistency with sibling org
settings routes and preserve the expected settings UI and navigation layout.
In `@apps/studio/routes/_app/org/`$slug/integrations.tsx:
- Around line 12-14: The OrgIntegrations function in integrations.tsx is missing
the OrganizationSettingsLayout wrapper around OrgIntegrationSettingsPage, which
breaks the org settings route contract and removes shared navigation. Wrap the
OrgIntegrationSettingsPage component with OrganizationSettingsLayout following
the same pattern used in sibling org settings routes (security, sso, webhooks).
Apply this same wrapper pattern to team.tsx and usage.tsx routes as well to
maintain consistency across all org settings pages.
In `@apps/studio/routes/_auth/sign-in.tsx`:
- Around line 12-18: The SignInLayout component is missing the inboundFlow prop,
which is required for the focused-provider interstitial and destination-branded
heading logic to work correctly (as defined in the SignInLayout.tsx component
where these features are gated by the inboundFlow condition). Add the
inboundFlow prop to the SignInLayout component in the sign-in.tsx route file,
passing the appropriate inbound flow value from the route parameters or context.
Apply the same fix to sign-up.tsx and sign-in-sso.tsx route files where
SignInLayout is used without this prop.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: bc2797a5-60ca-4236-89a1-d110011d764a
📒 Files selected for processing (39)
apps/studio/routeTree.gen.tsapps/studio/router.tsxapps/studio/routes/__root.tsxapps/studio/routes/_app/account.tsxapps/studio/routes/_app/account/audit.tsxapps/studio/routes/_app/account/me.tsxapps/studio/routes/_app/account/security.tsxapps/studio/routes/_app/account/tokens/index.tsxapps/studio/routes/_app/account/tokens/scoped.tsxapps/studio/routes/_app/new/index.tsxapps/studio/routes/_app/org.tsxapps/studio/routes/_app/org/$slug/apps.tsxapps/studio/routes/_app/org/$slug/audit.tsxapps/studio/routes/_app/org/$slug/billing.tsxapps/studio/routes/_app/org/$slug/documents.tsxapps/studio/routes/_app/org/$slug/general.tsxapps/studio/routes/_app/org/$slug/index.tsxapps/studio/routes/_app/org/$slug/integrations.tsxapps/studio/routes/_app/org/$slug/private-apps/index.tsxapps/studio/routes/_app/org/$slug/security.tsxapps/studio/routes/_app/org/$slug/sso.tsxapps/studio/routes/_app/org/$slug/team.tsxapps/studio/routes/_app/org/$slug/usage.tsxapps/studio/routes/_app/org/$slug/webhooks/$endpointId.tsxapps/studio/routes/_app/org/$slug/webhooks/index.tsxapps/studio/routes/_app/org/index.tsxapps/studio/routes/_app/organizations.tsxapps/studio/routes/_app/support/link.tsxapps/studio/routes/_app/support/new.tsxapps/studio/routes/_auth/cli/login.tsxapps/studio/routes/_auth/forgot-password-mfa.tsxapps/studio/routes/_auth/forgot-password.tsxapps/studio/routes/_auth/partners/stripe/projects/login.tsxapps/studio/routes/_auth/reset-password.tsxapps/studio/routes/_auth/sign-in-mfa.tsxapps/studio/routes/_auth/sign-in-partner.tsxapps/studio/routes/_auth/sign-in-sso.tsxapps/studio/routes/_auth/sign-in.tsxapps/studio/routes/_auth/sign-up.tsx
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › queue-table-operations.spec.ts › Queue Table Operations › reverted cell edit clears the pending change Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
Iterating response.headers and calling res.setHeader collapses duplicate keys; for set-cookie the Headers iterator joins every cookie into one comma-separated value, corrupting auth/session cookies. Pull cookies out via getSetCookie() and set them as an array. Addresses PR review feedback.
The navigate() shim overloaded Next's `shallow` option as the
push-vs-replace signal, but the ternary was inverted so replace() did a
push. Inverting it naively would also break the 5 push(url, { shallow:
true }) call sites, since shallow is a real Next option (no-op here) and
has nothing to do with push vs replace. Use a dedicated internal
`_replace` flag instead, matching Next's pages-router where push always
pushes and replace always replaces regardless of shallow.
Addresses PR review feedback.
The Next pages pass inboundFlow to SignInLayout (sign-in -> 'sign-in', sign-up -> 'sign-up'), which gates the focused-provider interstitial and destination-branded heading for inbound auth links. The TanStack route wrappers dropped it. sign-in-sso intentionally left unchanged — its Next page doesn't pass inboundFlow either. Addresses PR review feedback.
Extract the .env parser into scripts/lib/env.js so dispatch.js and serve.js use one implementation instead of duplicating the regex. dispatch.js now reads .env as well as .env.local (matching serve.js / vite precedence: shell > .env.local > .env), so STUDIO_FRAMEWORK set in .env is picked up — previously only .env.local was read, which is why setting it in .env silently did nothing. Addresses PR review feedback.
readEnvFiles swallowed every readFileSync error, so an existing-but- unreadable env file (bad permissions, IO error) was silently treated as absent — dropping its values and potentially booting serve.js without secrets like POSTGRES_PASSWORD. Skip only ENOENT and rethrow the rest. Addresses PR review feedback.
The Vercel SPA catch-all rewrite (`${prefix}/(.*)` -> /_shell) swallowed
missing extensioned paths, so a stale hashed chunk (e.g. requested after a
redeploy) returned text/html 200 instead of 404. The browser then threw
'Failed to load module script ... MIME type text/html', and because /assets/*
is cached immutable the bogus HTML poisoned the edge cache under the asset URL
(defeating skew protection, which is served after the cache).
Make the shell rewrite match only extensionless paths via a negative lookahead
so a missing file with an extension 404s cleanly — letting skew protection's
__vdpl routing serve the chunk from the deployment that still has it, or the
client's vite:preloadError backstop recover.
New org settings page added to master after the initial migration sweep; wraps OrganizationSettingsLayout like the sibling audit route. Route tree regenerated.
useUrlState (table sort/filter) pushes { pathname: router.pathname, query }
where router.pathname is the bracketed route pattern (/project/[ref]/...).
Next's pages-router fills [ref]/[id] from query and drops them from the query
string; the compat shim just concatenated, so TanStack navigated to a LITERAL
/project/[ref]/... — no project matched (ref === '[ref]') and it bounced to a
'project not found' redirect. Most visible on column rename, which rewrites
sort/filter URL state after a successful (correct) rename.
resolveUrl now interpolates [name] / [...name] / [[...name]] from query and
removes the consumed keys, mirroring Next. String URLs and bracket-free
pathnames are unchanged.
Fixes the redirect and the database.spec column-CRUD e2e on the tanstack build.
Adds a unit test guarding the dynamic-param interpolation in the next/router shim (the fix for the column-rename redirect), since the shim has been fragile to changes. Exports resolveUrl for testing only.
Braintrust eval report
|
… from #46424) (#47113) **Stack 4/6** of the TanStack Start migration (#46424). Stacked on **#47112** (S3). > [!NOTE] > Mechanical and homogeneous — every file is the same shape: a `createFileRoute(...)` whose `server.handlers` delegate to the existing `pages/api` handler via `toWebHandler` (the compat shim from S2). The pages-router handlers are unchanged; Next still serves them directly and ignores `routes/`. ## What's in this PR - `routes/api/**` (~104 files): platform (`pg-meta`, auth, storage, integrations, profile, telemetry, organizations, projects…), `ai/*`, `v1/*`, `connect`, `content`/`mcp`, and standalone endpoints (`deployment-mode`, `get-ip-address`, etc.). - `routeTree.gen.ts` — **regenerated** for the routes present so far (root + auth/app + api). ## Review tip The route files are near-identical wrappers, so this is fast to skim. The generated `routeTree.gen.ts` isn't meaningful review surface. ## Verification On top of S1–S3: `studio` typecheck ✓, lint (0 errors) ✓. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Model Context Protocol (MCP) API endpoint with configurable feature support and read-only mode * Added function artifact streaming capability for self-hosted functions * **Chores** * Migrated API route infrastructure for improved system architecture <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <[email protected]> Co-authored-by: Ivan Vasilov <[email protected]>
Stack 3/6 of the TanStack Start migration (#46424). Stacked on #47110 (S2) → review that first; this PR's diff is the app shell.
Note
Thin route wrappers that render the existing pages-router page components through the compat shims (S2). Next is untouched — it builds
pages/and ignoresroutes/. The app doesn't function end-to-end on TanStack until the API + project routes land (S4/S5) and the flag is flipped.What's in this PR
routes/__root.tsx— root layout + abeforeLoadthat runs the shared redirect rules;router.tsx.routes/_auth/*— sign-in/up, forgot/reset password, SSO/MFA/partner sign-in, CLI login, Stripe-projects login.routes/_app/*— account (me/security/audit/tokens),org/$slug/*(general/billing/team/usage/…), support.routeTree.gen.ts— regenerated by the tanstackStart vite plugin for exactly the routes in this PR (the migration branch's tree references all ~300 routes, so it can't be copied verbatim here). It's a generated artifact; the meaningful review surface is the route files.Verification
On top of S1+S2:
studiotypecheck ✓, lint (0 errors) ✓.Summary by CodeRabbit