diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 214e293..0cf6048 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,10 +88,22 @@ jobs: supabase status -o env | grep -E '^(API_URL|PUBLISHABLE_KEY)=' > /tmp/sb.env . /tmp/sb.env printf 'VITE_SUPABASE_URL=%s\nVITE_SUPABASE_PUBLISHABLE_KEY=%s\nVITE_APP_URL=http://localhost:4173\n' "$API_URL" "$PUBLISHABLE_KEY" > .env.local + # The local Realtime tenant allows 100 Postgres change messages a second and drops the rest + # (MessagePerSecondRateLimitReached), which parallel journeys pass. Raise it, then restart + # Realtime so it rereads the tenant. + - name: Raise Realtime limits + run: | + docker exec supabase_db_potluck psql -U supabase_admin -d postgres -v ON_ERROR_STOP=1 -c "update _realtime.tenants set max_events_per_second = 1000, max_joins_per_second = 500 where external_id = 'realtime-dev'" + docker restart supabase_realtime_potluck + for i in $(seq 1 30); do + [ "$(docker inspect -f '{{.State.Health.Status}}' supabase_realtime_potluck)" = healthy ] && break + sleep 2 + done + docker inspect -f '{{.State.Health.Status}}' supabase_realtime_potluck - run: pnpm --filter @potluck/web exec playwright install --with-deps chromium webkit - run: pnpm e2e - # Live updates are silent when Realtime drops a change (a policy that errors or times out - # for the subscriber), so keep its log when a journey fails. + # Live updates are silent when Realtime drops a change (a rate limit, or a policy that errors + # or times out for the subscriber), so keep its log when a journey fails. - name: Realtime log if: failure() run: docker logs supabase_realtime_potluck 2>&1 | tail -n 400 diff --git a/docs/testing.md b/docs/testing.md index 1ad7494..2a93b13 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -130,7 +130,7 @@ pnpm --filter @potluck/web exec playwright test e2e/expenses.spec.ts --project=d pnpm --filter @potluck/web exec playwright show-report # after a failure ``` -Locally, a server already listening on :4173 is reused, even if another checkout or worktree started it, so the tests may run another branch's build. If you change app code while one is running, rebuild with `VITE_APP_URL=http://localhost:4173 pnpm --filter @potluck/web build` or stop it first. `E2E_PORT=4174` runs on another port beside it. `E2E_WORKERS` sets the local worker count (default 2). +Locally, a server already listening on :4173 is reused, even if another checkout or worktree started it, so the tests may run another branch's build. If you change app code while one is running, rebuild with `VITE_APP_URL=http://localhost:4173 pnpm --filter @potluck/web build` or stop it first. `E2E_PORT=4174` runs on another port beside it. `E2E_WORKERS` sets the local worker count (default 2). The local Realtime tenant drops Postgres changes past 100 a second (`MessagePerSecondRateLimitReached` in `docker logs supabase_realtime_potluck`), which looks like a live update that never arrives. CI raises it in the e2e job; locally, run the same `update _realtime.tenants` from `ci.yml` (as `supabase_admin`; `postgres` may not write it) and restart the Realtime container if live journeys fail only under load. Projects (`apps/web/playwright.config.ts`):