feat(points): staff auto-connect never scores; event feedback pays +5

- Migration 20261020120000: staff (type staff / Admin / @appe.at) are
  auto-connected to every participant of the event via connections.auto
  rows inserted directly as accepted - never through accept_connection,
  so zero points by construction; backfill + idempotent helper + trigger.
- Migration 20261020130000: submit_event_feedback awards +5 on the first
  submission per participant x event (edits earn 0), gated by
  _points_eligible; response gains earned column; ACL restored.
- Admin: points move from Contacts to Registrations (active-event rows
  only, in-place save); Dashboard Top points drops emails; Dashboard and
  Activity hide auto connections.
- Attendee: leaderboard masks surnames (Max M.); EventFeedback toast
  shows +5 pts on paid submissions.
- Tests: staff_auto_connections_tests.sql (14 assertions), rpc_tests
  section 11 (4 assertions). Docs + release record 2026-10-20.
- README: document the git-ignored .env provisioning step (missing key
  = white screen).
This commit is contained in:
lago committed 2026-10-20 22:15:29 +02:00
1 parent b7c2abb73b
commit 35b88d50ca
22 files changed
+809 -166

No files matched your search

+35
View File
@@ -740,7 +740,42 @@ configured API endpoint includes the services missing from Excel.
## Files
- [`supabase/tests/rpc_tests.sql`](../../supabase/tests/rpc_tests.sql) — the test
script (fixtures + assertions + summary).
- [`supabase/tests/run-rpc-tests.js`](../../supabase/tests/run-rpc-tests.js) — the
runner (executes the script, parses the summary, sets the exit code).
# Staff Auto-Connect + Leaderboard Masking Regression
Migration `20261020120000_staff_auto_connections.sql` (staff are auto-paired
with every non-exempt registration of the event as `accepted` + `auto = true`,
**never** through `accept_connection`, so **never for points**), plus the
Contacts → Registrations points move and the leaderboard name mask
(first name + last-name initial + dot). Re-verify the migration and run its
SQL suite — both safe on an already-applied database (everything rolls back):
```sh
docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres \
-v ON_ERROR_STOP=1 < supabase/migrations/20261020120000_staff_auto_connections.sql
docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres \
-v ON_ERROR_STOP=1 < supabase/tests/staff_auto_connections_tests.sql # 14 assertions
CONVIVO_BASE_URL=http://127.0.0.1:3000 npm test --prefix e2e -- leaderboard-live.spec.ts --project=chromium
CONVIVO_BASE_URL=http://127.0.0.1:3000 npm test --prefix e2e -- connections.spec.ts --grep CONV-CONN-007 --project=chromium
npm run test:rpc # section 11 covers submit_event_feedback: first submit +5, edit earns nothing, one points_log row, staff earns nothing (self-contained fixtures — green even with the seed drift below)
```
`leaderboard-live.spec.ts` pins the masked display: podium names are exactly
`Board P. / Board P. / Board T.` (rendering order 2nd-1st-3rd), the list shows
`Board F.`, and full names (`Board Player`, `Board Fourth`) must have count 0.
**CONV-CONN-007 was rewritten** by the feature itself: the old spec drove
*manual* staff networking (request → accept → decline), which the auto-pair
made impossible — scanning a staff lanyard now lands on an already-accepted
pair. The rewrite asserts pre-connected lists on both sides, the instant
"You're connected!" toast, `accepted|true` for the pair in the DB (`status`
and the new `auto` flag), and unchanged points plus zero `points_log` rows for
both parties. Its demo identities still ride the seed drift described in
[Full E2E Suite Status](#full-e2e-suite-status) (the whole connections file is
in that known-red list), so the SQL suite above is the real gate for the
backend guarantee.