fix(admin): per-row check-in toggle; feat(db): front-desk gate + badge copies
Registrations table felt buggy because both row actions did setBusy(true) -> write -> reloadRegistrations() -> setBusy(false): the list is sorted by points, so a reload made the row you just touched jump (or vanish under a Checked-in filter), and the single `busy` flag disabled every control in the table for the whole request. The fix is per-row in-flight state (busyIds + withRowBusy) and no reload at all: the toggle patches its own row's checked_in plus the points delta the RPC returns, the type change patches `type`; a rejected write rolls both back. Only the touched row is disabled, shows a "Saving…" pulse, and two rows can save at once. Toggle hit area is now 40x41 px with a focus-visible ring. Front-desk gate: checkin_attendee reads registrations.checked_in and raises "This attendee needs to be checked in at the front desk first." when it is not true, and no longer sets checked_in as a side effect. checkins has no INSERT policy, so the RPC is the only write path and the gate cannot be bypassed. The scanner shows a dedicated "Not checked in yet" sheet instead of a toast. Badge copies: events.badge_copies (1..4, default 1). welcome_checkin sends that many pgmq jobs in one transaction (the Pi prints one label per job, so N jobs = N labels; no worker change) and clamps the value again itself. preview_welcome_checkin gained a `copies` column (drop + recreate) so the popup states the real count. Manual reprint still prints exactly one. Set from Settings -> Badge printing (active event) and the Events form, always as a single-column update; the Settings badge section now renders even when the LLM settings call fails. Tests: badge_print 113 (+6), leaderboard 47 (+1), new registration-checkin-toggle (6), front-desk-gate (3), welcome-badge-copies (3); the stale registrations-PATCH mock in registration-ticket-merge now targets set_registration_checked_in, the ambiguous Save button is "Save copies", and the print-copy assertion tolerates the typographic apostrophe. Docs updated (rpcs, schema, printing, tests, admin-app, screens) with a release record; NOT deployed - see docs/releases/2026-10-19.md.
This commit is contained in:
1 parent
c857204cfe
commit
c49a94fe80
27 files changed
+1378
-73
No files matched your search
+49
-1
@@ -1,3 +1,50 @@
|
||||
# Front-Desk Gate + Badge Copies Regression
|
||||
|
||||
After applying `20261019110000_front_desk_gate_and_badge_copies.sql`, run the
|
||||
SQL suite **combined with the migration** in one transaction (the migration is
|
||||
`create or replace`, so the same stream also re-verifies an already-applied
|
||||
database):
|
||||
|
||||
```sh
|
||||
(echo 'begin;'; \
|
||||
cat supabase/migrations/20261019110000_front_desk_gate_and_badge_copies.sql; \
|
||||
sed '/^begin;$/d' supabase/tests/badge_print_tests.sql) \
|
||||
| docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres -v ON_ERROR_STOP=1
|
||||
docker exec -i supabase_db_Convivo psql -X -U postgres -d postgres \
|
||||
-v ON_ERROR_STOP=1 < supabase/tests/set_registration_checked_in_tests.sql
|
||||
CONVIVO_BASE_URL=http://127.0.0.1:3000 npm test --prefix e2e -- front-desk-gate.spec.ts --project=chromium
|
||||
CONVIVO_BASE_URL=http://127.0.0.1:3000 npm test --prefix e2e -- welcome-badge-copies.spec.ts --project=chromium
|
||||
CONVIVO_ADMIN_URL=http://127.0.0.1:3001 npm test --prefix e2e -- registration-checkin-toggle.spec.ts --project=chromium
|
||||
```
|
||||
|
||||
The SQL fixture is rollback-only: **113 assertions** — six of them added with the
|
||||
gate and the copies (the badge-print suite owns both functions) — cover the gate
|
||||
refusing a session check-in for an attendee with no front-desk check-in
|
||||
(`session check-in requires a front-desk check-in`), the copies loop
|
||||
(`badge_copies = 3` queues three more labels) and the savepoint that returns the
|
||||
queue to one so the rest of the run is unaffected, plus
|
||||
`preview_welcome_checkin`'s new `copies` column: `1` by default, `0` when nothing
|
||||
would print, `3` after the event is changed. The pre-existing "session check-in
|
||||
records / enqueues nothing" case now flips `checked_in` on first, because the
|
||||
gate makes it a precondition.
|
||||
`set_registration_checked_in_tests.sql` (**15 assertions**) covers the admin
|
||||
toggle that grants and revokes the same flag, with its points accounting.
|
||||
|
||||
`front-desk-gate.spec.ts` and `welcome-badge-copies.spec.ts` are real-browser
|
||||
suites against the local stack (real Auth + PostgREST + pgmq): they provision a
|
||||
disposable attendee, assert the scanner shows its **"Not checked in yet"** sheet
|
||||
while recording no check-in, that a session check-in no longer sets the
|
||||
front-desk flag by itself, that the same scan succeeds once the welcome check-in
|
||||
is done, that the queue grows by exactly `badge_copies` messages, and
|
||||
that a re-welcome prints nothing. They delete their own rows and restore
|
||||
`badge_copies = 1`. `registration-checkin-toggle.spec.ts` is API-mocked and
|
||||
covers the table behaviour the old build got wrong: no refetch on a toggle or a
|
||||
type change, row order preserved, only the touched row busy while its checkbox
|
||||
is disabled, other rows still usable, rollback on a rejected RPC, and the
|
||||
Settings copies picker saving and reloading.
|
||||
|
||||
See [release record](../releases/2026-10-19.md) for the bug this started with.
|
||||
|
||||
# Badge Print Queue Regression
|
||||
|
||||
After applying `20261018170000_badge_print_queue`, run the SQL suite **combined
|
||||
@@ -13,7 +60,8 @@ CONVIVO_ADMIN_URL=http://127.0.0.1:3001 npm test --prefix e2e -- printing.spec.t
|
||||
pytest apps/printer/tests # worker unit tests (no hardware, no browser)
|
||||
```
|
||||
|
||||
The SQL fixture is rollback-only: **101 assertions** cover queue creation and
|
||||
The SQL fixture is rollback-only: **113 assertions** (six of them the front-desk
|
||||
gate and badge copies, covered in the section above) cover queue creation and
|
||||
migration idempotency, pgmq/API isolation, the self-contained payload shape and
|
||||
layout resolution (default-with-elements, fallback, none → no job), first-scan
|
||||
enqueue inside `welcome_checkin` (re-scan enqueues nothing), station token
|
||||
|
||||
Reference in new issue
Block a user