Skip to content

fix(e2e): fix shard DB isolation and flaky test selectors#123

Merged
ryota-murakami merged 1 commit intomainfrom
fix/e2e-shard-isolation-flaky-tests
Feb 17, 2026
Merged

fix(e2e): fix shard DB isolation and flaky test selectors#123
ryota-murakami merged 1 commit intomainfrom
fix/e2e-shard-isolation-flaky-tests

Conversation

@ryota-murakami
Copy link
Contributor

Summary

  • Root cause: NEXT_PUBLIC_SUPABASE_URL is inlined at build time by Next.js, so all 12 parallel E2E shards shared the same database (port 54321) instead of their shard-specific PostgREST instances — causing massive cross-test contamination (column renames, card deletes, board renames leaking across shards)
  • Fix: Added runtime SUPABASE_URL server env var that server.ts prefers over the build-time NEXT_PUBLIC_SUPABASE_URL, restoring true per-shard database isolation
  • Also fixed: getByText(/project note/i) strict mode violation (matched both dialog heading and editor content) and NoteModal typing test not clearing existing content

Changes

File Change
src/lib/env.ts Added optional SUPABASE_URL server env var
src/lib/supabase/server.ts Added getSupabaseUrl() helper; all 4 client creators use runtime URL
scripts/e2e-parallel.sh Pass SUPABASE_URL to each Next.js server instance
e2e/logged-in/note-modal.spec.ts getByTextgetByRole('heading'); clear editor before typing
e2e/logged-in/project-info-links.spec.ts getByTextgetByRole('heading')

Test plan

  • pnpm typecheck — pass
  • pnpm lint — pass
  • pnpm test — 1282/1282 pass
  • pnpm build — pass
  • pnpm e2e:parallel12/12 shards pass (was 3/12 before fix)

NEXT_PUBLIC_SUPABASE_URL is inlined at build time by Next.js, so all 12
parallel shards shared the same database (port 54321) instead of their
own PostgREST instances. Add runtime SUPABASE_URL env var that server
code prefers, restoring true per-shard isolation.

Also fix strict mode violation where /project note/i matched both the
dialog heading and editor content, and clear editor before typing tests.
@vercel
Copy link
Contributor

vercel bot commented Feb 17, 2026

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

Project Deployment Actions Updated (UTC)
gitbox Ready Ready Preview, Comment Feb 17, 2026 3:43pm

Request Review

@morph-subagents
Copy link

🤖 Morph Preview Test

Looks like you hit your rate limits!

Please upgrade your limits here, or wait a few minutes and try again.

If you need help, reach out to support@morphllm.com.


Automated testing by Morph

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.12%. Comparing base (dc73326) to head (0615f89).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #123   +/-   ##
=======================================
  Coverage   72.12%   72.12%           
=======================================
  Files         143      143           
  Lines        4233     4233           
  Branches     1137     1137           
=======================================
  Hits         3053     3053           
  Misses       1159     1159           
  Partials       21       21           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

🧪 E2E Coverage Report (Sharded: 12 parallel jobs)

Metric Coverage
Lines 94.45%
Functions 17.74%
Branches 16.98%
Statements 30.53%

📊 Full report available in workflow artifacts

@ryota-murakami ryota-murakami merged commit 18e5a90 into main Feb 17, 2026
19 checks passed
@ryota-murakami ryota-murakami deleted the fix/e2e-shard-isolation-flaky-tests branch February 17, 2026 15:55
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.

2 participants