Repository navigation
test(self-hosted): add an e2e test for exposed schemas in data api ui - #47602
Conversation
Adds a Playwright e2e spec that clicks "Generate and download types" in the Data API docs and asserts the downloaded supabase.ts contains the exposed schemas (public, graphql_public) and excludes internal ones (auth, vault). This exercises the real Studio route -> pg-meta -> Postgres chain, which the unit test can't: mocking pg-meta encodes our assumptions about its param semantics, and #47577 was a wrong assumption (the generator returned every schema despite a green unit test). Only real pg-meta verifies the contract. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 7 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughAdds a new Playwright e2e test file that verifies, on self-hosted deployments, the "Generate and download types" feature produces a ChangesType Generation Regression Test
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (1)
e2e/studio/features/data-api-type-generation.spec.ts (1)
38-41: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCleanup skipped if assertions fail.
fs.unlinkSync(downloadPath)only runs if the code above it succeeds. If any assertion in lines 43-61 fails, the downloaded temp file is left behind. Wrapping the read/assert/cleanup intry/finallyensures cleanup runs regardless of test outcome.🤖 Prompt for 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. In `@e2e/studio/features/data-api-type-generation.spec.ts` around lines 38 - 41, The cleanup in the data API type generation test is not guaranteed to run when an assertion fails, so the downloaded temp file can be left behind. Update the test around the download/read/assert flow in the data-api-type-generation spec to use try/finally, keeping the fs.readFileSync and assertions in the try block and moving fs.unlinkSync(downloadPath) into the finally block so cleanup always happens.
🤖 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.
Nitpick comments:
In `@e2e/studio/features/data-api-type-generation.spec.ts`:
- Around line 38-41: The cleanup in the data API type generation test is not
guaranteed to run when an assertion fails, so the downloaded temp file can be
left behind. Update the test around the download/read/assert flow in the
data-api-type-generation spec to use try/finally, keeping the fs.readFileSync
and assertions in the try block and moving fs.unlinkSync(downloadPath) into the
finally block so cleanup always happens.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3ed093b5-bb8b-4681-a831-1a9626dfb297
📒 Files selected for processing (1)
e2e/studio/features/data-api-type-generation.spec.ts
🎭 Playwright Test ResultsDetails
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
Braintrust eval report
|
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
PR #47577 fixed a non-platform issue where "Generate and download types" emitted types for every database schema instead of only the exposed ones.
Adds
e2e/studio/features/data-api-type-generation.spec.ts, which:supabase.ts:publicschemapublicexposed schema (graphql_public, pinned viae2e/studio/supabase/config.toml)It runs the real Studio route → pg-meta → Postgres chain, so it verifies pg-meta's actual behavior rather than a mocked stand-in. Self-hosted only (
test.skipwhenIS_PLATFORM=true, since the platform path goes through the managed API).Summary by CodeRabbit