test(integration): self-create the protect-ci fixture table#400
test(integration): self-create the protect-ci fixture table#400
Conversation
The integration suites under packages/{drizzle,protect,stack} all
INSERT into a `protect-ci` table that was previously assumed to exist
(originally created by hand on the shared CI Supabase project). On a
fresh database — e.g. a new Supabase instance for Dependabot CI runs
— the tests fail with `relation "protect-ci" does not exist`.
Add an idempotent `CREATE TABLE IF NOT EXISTS "protect-ci" (...)` to
each suite's beforeAll, mirroring the pattern already used in
packages/{protect,stack}/__tests__/searchable-json-pg.test.ts.
The schema is the union of every column the three suites read or
write: id, email, age, score, profile, encrypted, created_at,
test_run_id. All encrypted columns are nullable so each suite only
populates the subset it needs.
The two supabase suites open a postgres-js connection just for the
DDL (and a `NOTIFY pgrst, 'reload schema'` so PostgREST sees the new
table without waiting for its polling interval), then close it before
running tests via the supabase client. The drizzle suite already had
a postgres-js connection, so the DDL goes inline.
DATABASE_URL is now also required by the supabase suites for the
fixture-setup step. The CI workflow already populates it in those
packages' .env files.
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ 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. Review rate limit: 0/1 reviews remaining, refill in 16 minutes and 4 seconds.Comment |
Summary
The integration suites under `packages/{drizzle,protect,stack}` all INSERT into a `protect-ci` table that was previously assumed to exist (originally created by hand on the shared CI Supabase project). On a fresh database — e.g. the new Supabase instance now provisioned for Dependabot CI runs — these suites fail with:
```
PostgresError: relation "protect-ci" does not exist
```
This PR makes the suites self-create their fixture, mirroring the pattern already used in `packages/{protect,stack}/tests/searchable-json-pg.test.ts` for the `protect-ci-jsonb` table.
What changed
Added an idempotent `CREATE TABLE IF NOT EXISTS "protect-ci" (...)` to the `beforeAll` of:
The two supabase suites also send `NOTIFY pgrst, 'reload schema'` after the DDL so PostgREST picks up the new table immediately rather than waiting for its polling interval. No-op on plain Postgres.
The two supabase suites now also require `DATABASE_URL` (for the DDL step). The CI workflow already populates it in those packages' `.env` files; local devs running these suites need it set.
Schema
The CREATE TABLE covers the union of every column the three suites read or write:
```sql
CREATE TABLE IF NOT EXISTS "protect-ci" (
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
email eql_v2_encrypted, -- drizzle suite
age eql_v2_encrypted, -- drizzle + supabase
score eql_v2_encrypted, -- drizzle + supabase
profile eql_v2_encrypted, -- drizzle suite
encrypted eql_v2_encrypted, -- supabase suites
created_at TIMESTAMPTZ DEFAULT NOW(),
test_run_id TEXT
)
```
All encrypted columns are nullable, so each suite only populates the subset it needs.
Out of scope