mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
create-pull-request/patch
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
200cc3f65d |
[FE-3106] (part 1) – ci(studio): build and test tanstack start only (#53199)
First part of the FE-3106 cleanup (final pass of the TanStack Start migration): Studio now builds, runs and tests TanStack Start only. Retiring the Next build first is what lets the follow-up PRs in this stack delete `pages/**` files without breaking a still-built Next runtime, the Next E2E shard or Next previews. Part 1 of the stack, based on `master`. **Changed:** - `apps/studio/package.json` – `dev`/`build`/`start` run the Vite/Nitro build directly (the former `*:tanstack` scripts) - `apps/studio/vercel.ts` – always emits the TanStack Start config (`framework: null`, redirects, headers); no `STUDIO_FRAMEWORK` gate, so every Vercel project building Studio deploys the Nitro output - `apps/studio/Dockerfile` – single TanStack `build` stage; the image no longer defaults to Next - `.github/workflows/studio-e2e-test.yml` – one E2E run (2 shards) instead of a `next`/`tanstack` matrix; drops the `.next` cache step - `.github/workflows/studio-docker-build.yml` – one image build - `apps/studio/turbo.jsonc` – drops `STUDIO_FRAMEWORK` and the `.next` outputs - `apps/studio/AGENTS.md`, `apps/studio/TANSTACK_MIGRATION.md` – describe the TanStack-only runtime **Removed:** - `dev:next`/`build:next`/`start:next` scripts, `scripts/dispatch.js`, `scripts/lib/env.js`, the Turbopack cache `predev` script, and the root `build:studio:docker:tanstack` script Addresses [FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages). Before merging: branch protection lists `E2E tests (next, 1, 2)`/`(next, 2, 2)` and `E2E tests (tanstack, 1, 2)`/`(tanstack, 2, 2)` as required checks. The jobs are now `E2E tests (1, 2)`/`(2, 2)`, so the required checks need updating. Any Vercel project or self-hosted image still on Next switches to TanStack Start with this PR. ## To test - `pnpm dev:studio` without `STUDIO_FRAMEWORK` set – Vite dev server starts on :8082 - `pnpm build --filter=studio` – Vite/Nitro build succeeds, no `.next` output - Vercel previews (`studio`, `studio-self-hosted`, `studio-staging`) – build and serve the TanStack app - `Studio Docker Build` and E2E checks – pass with the single TanStack run Ran `vercel.test.ts`, studio typecheck, knip, ESLint on changed files, Prettier and the TanStack build locally. Docker and E2E are verified by CI only. --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
b0b443c4b3 |
fix(studio): don't redirect static assets in maintenance mode (#52307)
With `MAINTENANCE_MODE=true`, the catch-all redirect only exempted `/maintenance` and `/img`. Under a base path on the TanStack build, that also redirected the SPA's own JS/CSS (`/_vercel/immutable`, `/assets`), favicons and fonts, so the maintenance page couldn't load. The Next prod build was unaffected because its assets come from the CDN, but self-hosted Next was redirecting its `public/` files too. **Changed:** - `getMaintenanceRedirects` builds its exclusion from a shared `MAINTENANCE_PASSTHROUGH_SEGMENTS` list: the maintenance page, build output dirs (`_next`, `_vercel`, `assets`) and every top-level `public/` entry - Matches whole path segments, so `/maintenance-foo` or `/images/...` now redirect as expected - `matchRedirect` (the runtime check in `routes/__root.tsx`) uses the same list, so both runtimes stay in sync - `/api` and `/_serverFn` still redirect: maintenance takes the backend offline too, and the maintenance page doesn't need them **Added:** - Tests compiling the rule through Next's path matcher and `@vercel/routing-utils`, with and without `/dashboard` - A guard test that fails if a new top-level `public/` entry isn't added to the list ## To test The `studio-staging` preview for this branch has `MAINTENANCE_MODE=true` and `STUDIO_FRAMEWORK=tanstack` set, so it runs the TanStack build in maintenance mode. - Load any page, e.g. `/dashboard/project/<ref>` or `/dashboard/org`: it should 307 to `/dashboard/maintenance` - The maintenance page should render fully, with the logo, styles and favicon. In the Network tab, everything under `/dashboard/_vercel/immutable/...`, `/dashboard/favicon/...` and `/dashboard/img/...` is a 200 with no redirects - `/dashboard/api/...` requests should still redirect to the maintenance page - Optional: with only `MAINTENANCE_MODE=true` (Next build), pages still redirect and the maintenance page renders Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
60b51d74d5 |
Audit existing unit tests + Remove redundant ones (#52215)
## Context
_TLDR: Changes here speeds up unit tests on CI from ~14 minutes to ~3
minutes_ 😂
_TLDR 2: The file changes are solely only test files +
`studio-unit-tests.yml`_
We've currently got a lot of unit tests in the repository which while
great for coverage, hasn't been ideally written. There's a lot of
redundancy + overly specific tests that break easily, and our current
unit test takes about 15 minutes to run in the GHA per PR. Hence am
doing a audit clean up of all existing unit tests in the studio repo.
## Changes involved
- `.test.ts` files now run in `node`, `.test.tsx` in `jsdom`
- jsdom costs about 1s of setup per file. A `.ts` test that needs the
DOM opts in with `// @vitest-environment jsdom` (46 files do).
- Removed redundant and over-specific tests
- Duplicates are merged into `test.each`. Tests that only covered
libraries, existed for coverage, or asserted class names and snapshots
are deleted. 19 files are merged into a sibling or deleted.
- Fixed about 15 tests that couldn't fail
- Examples: unawaited assertions, fixtures equal to the default, and a
`semverGte` test calling `semverLte`.
- Sped up the slowest files
- Real sleeps are replaced with fake timers, `user.type` with paste, and
Radix option queries are scoped to the open listbox. For example,
`RestoringState` went from 18s to 0.3s and
`useTableEditorFiltersSort.navigation` from 20s to 3s.
- These ^ already shave down the unit tests time from 14 mins to 9 mins,
but am also sharding unit tests across 4 jobs to increase speed up
further which then shaves down time to 3 mins now
|
||
|
|
a8b2f23091 |
fix(studio): restore deployment update metadata (#51048)
Deployment update checks now receive a timestamp from GitHub’s documented commit API instead of silently falling back to `unknown` when its website response changes. Valid deployment metadata is cached for ten minutes; development and failed lookups are uncached so they can recover. **Changed:** - Validate and normalize the committer date in the shared Next/TanStack handler, preserving the existing response shape and `unknown` fallback. - Exclude only the exact deployment-metadata endpoint from TanStack’s private API cache default; authenticated APIs and server functions retain it. - Keep the client update query unpinned and its existing toast threshold unchanged. **Added:** - Shared-handler tests through both Next and the TanStack adapter for dates, malformed payloads, upstream failures, and recovery. - Tests using the installed Vercel route compiler for root and `/dashboard` cache rules, security headers, and empty Next configuration. ## To test - On the TanStack preview, request `/dashboard/api/get-deployment-commit`; compare its SHA and UTC timestamp with the deployed commit’s GitHub committer date. - Repeat the request to check CDN caching. Vercel consumes `s-maxage`, so use cache-hit/age evidence as well as client-visible headers. - Confirm another API route and a server-function path retain `private, no-store`. - Open an existing project, reload it while clean, and inspect the untouched support form for metadata-related errors. Validation: 60 focused tests, Studio typecheck, scoped ESLint, formatting, knip, and both framework production builds passed. Live unauthenticated GitHub lookup with the configured API version returned the expected committer date. Full source lint ratchet also passed, excluding only generated build directories. Local TanStack browser checks passed for clean project/reload, general settings, untouched support form, and naturally emitted development metadata formatting; no errors or unexpected update toast appeared. The positive two-deployment toast and submitted support-version formatting were not exercised. Deployed native Next previews returned the exact commit SHA and expected UTC timestamp; repeated metadata requests produced CDN HIT responses (ages 26 and 100 seconds). Build logs establish that the staging preview also ran Next, so it does not validate TanStack edge header behavior. A separate preview-only redeployment with a deployment-scoped TanStack override was confirmed to run Vite. It returned the same correct SHA/timestamp, a repeat CDN cache HIT, and private, no-store on the neighboring UTC API. No project settings or production aliases were changed. Installed Vercel compiler tests cover the remaining root/base-path and server-function rules. No new environment variable, token, or dependency is required. Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |