Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
11 KiB
Session Persistence Regression
Run the rollback-only fixture after applying
20261010183614_preserve_sessions_on_unchanged_ticket:
docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres \
-v ON_ERROR_STOP=1 < supabase/tests/session_persistence_tests.sql
It verifies unchanged repeated imports preserve the existing password hash and session, changed ticket passwords revoke sessions, and admin password precedence survives ticket changes. No fixture accounts remain after rollback.
The production Auth policy was additionally verified with a disposable confirmed test account: actual refresh succeeded at six days, failed after the seven-day lifetime, and failed after eight-day inactivity. Cleanup removed the test account; no real email was sent. See release record.
Backend — RPC Test Suite
A self-contained, idempotent test suite for the transactional points RPCs, role guards, and the speaker auto-promote trigger. It runs directly against the local Supabase Postgres container.
Run it
Assigned-speaker/Pretix role regression tests (rollback-only):
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/migrations/20261010102828_registration_ticket_merge.sql supabase/migrations/20261010111607_preserve_assigned_speaker_role.sql supabase/tests/assigned_speaker_role_tests.sql; } | docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
Covers purchased attendee tickets becoming assigned speakers, assignment before ticket creation, repeated Pretix updates, Excel/Pretix replay, assignment updates, staff/sponsor precedence, service-session exclusion and other-event isolation. QR, ticket ID, check-in and points are preserved.
Ticket merge regression tests (rollback-only, including prior date-guard functions when the local database has not installed that migration):
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/migrations/20261010102828_registration_ticket_merge.sql supabase/tests/registration_ticket_merge_tests.sql; } | docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
CONVIVO_ADMIN_URL=http://127.0.0.1:3001 npm test --prefix e2e -- registration-ticket-merge.spec.ts --project=chromium
Coverage includes ticket-only totals, authorization, cross-event isolation, last-speaker-safe transfers, duplicate assignments, staff precedence, retained ticket points/QR/check-in, source activity rejection, import provenance and Excel/API replay. Browser tests cover immediate check-in feedback and failure rollback, imported-only merge buttons, suggestions, manual choice, cancel/retry.
npm run db:start # the Supabase core must be running
npm run test:rpc # runs supabase/tests/rpc_tests.sql, exits non-zero on failure
Or manually:
docker exec -i supabase_db_Convivo psql -U postgres < supabase/tests/rpc_tests.sql
How it works
- No seed mutation. Everything runs in a single transaction that rolls back at the end, so the seed data is never changed. Safe to run repeatedly.
- Current user = PostgREST-style JWT claim. Each test sets the user the same
way PostgREST does:
set_config('request.jwt.claims', '{"email":"..."}', false), which is whatpublic.current_email()andpublic.is_admin()read. - Every test always runs. Each test is a
DOblock that catches its own exceptions and records a pass/fail row into a temp table, so one failure never aborts the rest. A summary is printed before the rollback. - The runner fails the process (
npm run test:rpc) if any test failed, so it can be wired into CI.
What it covers
| Area | Tests |
|---|---|
checkin_attendee |
awards +10, marks checked_in, idempotent re-check-in, service-session guard, non-admin role guard |
submit_feedback |
+5 rating-only, idempotent re-submit, requires check-in |
accept_connection |
+5 to both parties |
adjust_points |
admin-only role guard |
| Speaker auto-promote trigger | attendee → speaker, never overrides staff |
| Leaderboard | excludes staff |
Speaker Portal
speaker_portal_tests.sql is an
independent fail-fast suite (ON_ERROR_STOP) with generated contacts/events/talks,
temporary snapshots and a single transaction ending in ROLLBACK. It needs the
speaker portal migration
and staff overlap migration
on the local database. Apply without resetting existing data:
docker exec -i supabase_db_Convivo psql -U postgres -d postgres -v ON_ERROR_STOP=1 --single-transaction < supabase/migrations/20261006175631_speaker_portal.sql
docker exec -i supabase_db_Convivo psql -U postgres -d postgres -v ON_ERROR_STOP=1 --single-transaction < supabase/migrations/20261007153957_speaker_portal_staff_overlap.sql
docker exec -i supabase_db_Convivo psql -U postgres -d postgres -v ON_ERROR_STOP=1 < supabase/tests/speaker_portal_tests.sql
This direct migration application reloads the local API schema but does not write CLI migration history. It is not a production deployment command. No database reset is needed; fixture sequence state is not advanced.
The suite checks assigned speaker, non-admin staff and Admin staff access,
unassigned staff, mismatched same-event registrations, attendee assignments,
unregistered assignments, automatic service-session exclusion, active/inactive past/future
events, malformed and cross-session paths, required uploaded objects, Storage
INSERT/UPDATE/DELETE (including UPDATE WITH CHECK) and unchanged registration,
points-log, check-in and leaderboard state. Storage policy checks use the
authenticated database role, not a superuser that bypasses RLS. A failed
assertion exits non-zero and connection closure rolls back the transaction.
speaker-portal.spec.ts uses mocked Auth, REST and Storage responses, without real credentials or mail delivery:
cd e2e
CONVIVO_BASE_URL=http://127.0.0.1:3000 npx playwright test tests/speaker-portal.spec.ts --project=chromium --reporter=list --output=/tmp/convivo-speaker-results
Start Convivo's dev server first. Coverage includes both routes, existing-users-only link requests, URL scrubbing, callback errors/rejections, StrictMode single-use implicit/PKCE callbacks, local logout, empty access, upload/replace/remove across desktop/mobile, failed attachment cleanup and the normal app's check-in gate after portal login. Mocked tests do not validate live mail delivery, deployment redirect allowlists or real Storage behavior; the SQL suite validates database authorization separately. See screen contract, API client, RLS and RPCs.
Sessionize Date Guard
sessionize_date_guard_tests.sql
is an independent fail-fast rollback-only suite for the Sessionize API and Excel
RPC date guard. It creates generated event/contact/auth fixtures, precreates
explicit negative slot IDs so successful imports do not allocate sequence values,
and ends with ROLLBACK.
To verify the migration and suite together on the local database without persisting either change:
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009225632_guard_sessionize_dates.sql supabase/tests/sessionize_date_guard_tests.sql; printf '\nROLLBACK;\n'; } | docker exec -i supabase_db_Convivo psql -U postgres -d postgres -v ON_ERROR_STOP=1
The nested BEGIN warning from the suite is harmless in this rollback-only
check. This command is local validation only; it does not write CLI migration
history and is not a production deployment. Historical rows outside the newly
configured event range are retained by successful imports and need a separately
approved reconciliation if they should be removed or changed.
Delete Event Schedule
delete_event_schedule_tests.sql
is an independent fail-fast rollback-only suite for the admin schedule-clear RPC.
It creates generated contacts/events/auth fixtures, uses explicit negative slot
IDs so fixture setup does not advance slots_id_seq, and ends with ROLLBACK.
To verify the migration and suite together on the local database without persisting either change:
{ printf 'BEGIN;\n'; cat supabase/migrations/20261009231817_delete_event_schedule.sql supabase/tests/delete_event_schedule_tests.sql; printf '\nROLLBACK;\n'; } | docker exec -i supabase_db_Convivo psql -U postgres -d postgres -v ON_ERROR_STOP=1
The suite checks authenticated admin execution, non-admin rejection, anon execute denial, missing-event rejection, exact delete counts, unchanged event selection, registrations, contacts, auth users, sponsors, connections, points, event feedback, leaderboard and other-event schedule rows. It also proves cross-event slot/dependent mismatches fail atomically instead of cascading foreign-event rows. This is local validation only; it does not write migration history or deploy anything.
Sessionize Excel Transform
The sidecar's Excel transform tests
use Node's built-in test runner and the installed xlsx dependency. They
generate synthetic workbooks in memory, without real personal data, server
startup, HTTP calls, or database access:
npm test --prefix apps/sidecar
node --check apps/sidecar/src/transform-excel.js
node --check apps/sidecar/src/server.js
Coverage includes the localized topic header, trimmed/case-insensitive header matching, nonempty Area/Topic fallback, complete comma-separated topic strings, flattened multi-speaker session grouping, duplicate speaker IDs/emails, singular Speaker Id fallback, legacy two-sheet plural Speaker Ids, scheduled time and metadata preservation, service-session classification, and unscheduled-row filtering. Generated XLSX service regressions also cover an explicit service sheet alongside flattened talks, a service-only workbook, missing-ID service classification, duplicate service rows, stable generated IDs across repeated parses and row reordering, unchanged IDs after duration/description edits, distinct identities by title/room/date/start, preservation of explicit source IDs, and exclusion of untitled, invalid-time and ID-less talk rows. See service export limitations and accepted service format.
Read-only validation of the supplied 2026-10-09 workbook compared its complete parsed payload against the committed parser: unchanged 21 sessions, 24 speakers, 21 speaker links and zero service sessions. Parsing twice produced identical payloads. No HTTP import or database writes were performed. Parser repeatability and the existing RPC external-ID upsert contract support idempotent imports; these database-free checks do not verify a live import or prove that any configured API endpoint includes the services missing from Excel.
Files
supabase/tests/rpc_tests.sql— the test script (fixtures + assertions + summary).supabase/tests/run-rpc-tests.js— the runner (executes the script, parses the summary, sets the exit code).