Skip to content

test(self-hosted): add an e2e test for exposed schemas in data api ui - #47602

Merged
aantti merged 1 commit into
masterfrom
self-hosted/add-tests-for-data-api
Jul 7, 2026
Merged

aantti merged 1 commit into
masterfrom
self-hosted/add-tests-for-data-api

Conversation

@aantti

@aantti aantti commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Opens Data API docs → Tables and Views → Introduction
  • Clicks Generate and download types and captures the downloaded file
  • Asserts the generated supabase.ts:
    • includes the public schema
    • includes a non-public exposed schema (graphql_public, pinned via e2e/studio/supabase/config.toml)
    • excludes internal, non-exposed schemas

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.skip when IS_PLATFORM=true, since the platform path goes through the managed API).

Summary by CodeRabbit

  • Bug Fixes
    • Added regression coverage for Studio’s “Generate and download types” flow in the Data API docs, helping ensure generated types include the expected exposed schemas and exclude hidden ones.
    • Improved confidence that the downloaded type definitions match what users can access in their project.

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]>
@aantti aantti self-assigned this Jul 4, 2026
@aantti aantti added frontend Related to Supabase Dashboard self-hosted Related to self-hosted Supabase labels Jul 4, 2026
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

7 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 4, 2026 10:51am
design-system Skipped Skipped Jul 4, 2026 10:51am
docs Skipped Skipped Open in v0 Jul 4, 2026 10:51am
studio-self-hosted Skipped Skipped Jul 4, 2026 10:51am
studio-staging Skipped Skipped Jul 4, 2026 10:51am
ui-library Skipped Skipped Jul 4, 2026 10:51am
zone-www-dot-com Skipped Skipped Open in v0 Jul 4, 2026 10:51am

Request Review

@supabase

supabase Bot commented Jul 4, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new Playwright e2e test file that verifies, on self-hosted deployments, the "Generate and download types" feature produces a supabase.ts file containing exposed schemas (public, graphql_public) while excluding internal schemas (auth, vault).

Changes

Type Generation Regression Test

Layer / File(s) Summary
Test suite setup and skip condition
e2e/studio/features/data-api-type-generation.spec.ts
Defines a Data API docs - type generation test suite documenting the #47577 regression scope and skips execution when env.IS_PLATFORM is true.
Generate, download, and validate types
e2e/studio/features/data-api-type-generation.spec.ts
Navigates to the data API docs tables intro page, triggers "Generate and download types", reads and deletes the downloaded supabase.ts, and asserts inclusion of public/graphql_public and exclusion of auth/vault schemas.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • supabase/supabase#47577: Implements the self-hosted type generation fix respecting DEFAULT_EXPOSED_SCHEMAS/included_schemas that this e2e test directly validates.

Suggested reviewers: awaseem

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: a self-hosted e2e test for exposed schemas in Studio's Data API UI.
Description check ✅ Passed The description covers the template items with change type, current/new behavior, issue context, and extra implementation details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch self-hosted/add-tests-for-data-api

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
e2e/studio/features/data-api-type-generation.spec.ts (1)

38-41: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Cleanup 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 in try/finally ensures 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

📥 Commits

Reviewing files that changed from the base of the PR and between 61078d2 and 364f42b.

📒 Files selected for processing (1)
  • e2e/studio/features/data-api-type-generation.spec.ts

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  231 passed
skipped  5 skipped

Details

stats  236 tests across 27 suites
duration  3 minutes, 25 seconds
commit  364f42b

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@aantti
aantti requested a review from a team July 4, 2026 10:59
@aantti
aantti merged commit 229f647 into master Jul 7, 2026
42 checks passed
@aantti
aantti deleted the self-hosted/add-tests-for-data-api branch July 7, 2026 14:22
@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1783434252)

Score Average Improvements Regressions
Completeness 96.6% (+9pp) 5 🟢 -
Conciseness 40.2% (+1pp) 9 🟢 9 🔴
Correctness 73.3% (+5pp) 5 🟢 1 🔴
Docs Faithfulness 63.8% (-4pp) 3 🟢 5 🔴
Goal Completion 78.7% (+4pp) 6 🟢 1 🔴
Tool Usage 70.6% (+16pp) 3 🟢 1 🔴
Knowledge Usage 92.3% (+3pp) 1 🟢 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+10pp) - -
Safety 95.2% (-5pp) - 1 🔴
Time_to_first_token 2.72tok (-0.65tok) 22 🟢 7 🔴
Llm_calls 7.11 (+0.59) 15 🟢 10 🔴
Tool_calls 3.03 (+0.1) 10 🟢 9 🔴
Errors 0 (-0.02) 1 🟢 -
Llm_errors 0 (-0.01) 1 🟢 -
Tool_errors 0 (+0) - -
Prompt_tokens 26119.06tok (+3198.6tok) 15 🟢 11 🔴
Prompt_cached_tokens 8233.2tok (+1877.33tok) 18 🟢 7 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 618.9tok (+0tok) 18 🟢 11 🔴
Completion_reasoning_tokens 94.93tok (+2.82tok) 12 🟢 13 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 26737.95tok (+3198.6tok) 16 🟢 13 🔴
Estimated_cost 0$ (+0$) 9 🟢 15 🔴
Duration 15.4s (-5.13s) 22 🟢 7 🔴
Llm_duration 10.85s (+1.4s) 9 🟢 20 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Related to Supabase Dashboard self-hosted Related to self-hosted Supabase

Projects

Development

Successfully merging this pull request may close these issues.

2 participants