feat(scan): confirm before welcome check-in, with print warning

The staff scanner checked attendees in silently, and the default session
mode never prints — so a welcome-desk scan could check someone in with no
badge and no confirmation.

- new read-only RPC preview_welcome_checkin(qr): resolves the attendee and
  reports already + will_print (mirrors the exact welcome_checkin enqueue
  condition: first check-in AND a layout exists). Staff/admin only; checks
  nobody in, enqueues nothing.
- attendee Scan screen previews first and shows a Yes/No sheet: "You are
  checking in [Name]. By confirming, you will print this person's label."
  Only Yes runs welcome_checkin. Session check-in unchanged (never prints).
- badge_print_tests.sql +8 assertions (109 total); ScanPage + welcome specs
  drive the confirm step; new CONV-CHECKIN-003 (No cancels, Yes checks in).
- docs: rpcs.md, printing.md, releases/2026-10-19.md.

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]>
This commit is contained in:
committed 2026-10-19 09:45:20 +02:00
1 parent 00c89c1b48
commit 65dcf64c4e
11 files changed
+348 -7

No files matched your search

+10
View File
@@ -125,6 +125,16 @@ worker) and stamps `last_seen_at`.
behaviour, plus the `badge_print` enqueue for a **genuine first check-in** only,
inside the same transaction (see [rpcs.md](./rpcs.md#welcome_checkinp_attendee_qr--attendee_email-attendee_name-already)).
The staff scanner (attendee app → Scan → Welcome check-in) does **not** fire
`welcome_checkin` directly. It first calls the read-only
`preview_welcome_checkin(qr)` and shows a confirmation — *"You are checking in
[Name]. By confirming, you will print this person's label."* — with **Yes/No**.
Only **Yes** runs `welcome_checkin`. The preview's `will_print` mirrors the exact
enqueue condition (first check-in **and** a layout exists), so the popup never
promises a print that won't happen; when it is `false` the popup says the person
is checked in without mentioning a label. Session check-in is unchanged and never
prints. (Added in `20261019090000_welcome_checkin_preview.sql`.)
## 5. Station tokens & security model
- Token format `cvp_…` (256 bits of entropy), generated server-side, shown
+15
View File
@@ -147,6 +147,21 @@ from `checkin_attendee`, which checks someone into a specific session).
- Sets `registrations.checked_in = true` (no points — that's the session
check-in's job).
- `already` is `true` if the attendee was already checked in to the event.
- On a **first** check-in (and only when the event has a badge layout), enqueues
a `badge_print` job in the same transaction (see [printing.md](printing.md)).
### `preview_welcome_checkin(p_attendee_qr)` → `(attendee_email, attendee_name, already, will_print)`
Read-only preview shown by the staff scanner **before** a welcome check-in is
committed, so the confirmation popup can name the attendee and be honest about
printing.
- **Role check:** `is_staff_or_admin()` or it raises `staff or admin only`
(same guard as `welcome_checkin`).
- Resolves the attendee by `qr_token` for the active event; raises
`no attendee found for that QR code` otherwise.
- `will_print` is `true` only for a genuine first check-in **and** when the
event has a badge layout with elements — exactly the condition under which
`welcome_checkin` enqueues a job.
- Checks nobody in and enqueues nothing; it is a pure lookup.
### `merge_tickets(p_source_id, p_target_id)` -> `jsonb`
+63
View File
@@ -0,0 +1,63 @@
# Welcome Check-In Confirmation (2026-10-19)
## Symptom
At the welcome desk, a staff member scanned an attendee's lanyard in the Convivo
app and the attendee was checked in — but **no badge printed**. Reported against
production.
## Root cause
Two things, one a genuine bug and one a UX gap:
1. **The scanner defaults to *session* check-in.** The staff Scan screen has a
"Check-in type" toggle. In the default **session** mode it calls
`checkin_attendee`, which records session attendance and points but — by
design — never enqueues a badge. Only **welcome** check-in (`welcome_checkin`)
enqueues a print. A scan left in session mode therefore checks the person in
without printing.
2. **Welcome check-in fired silently.** Even in welcome mode the scan checked the
person in and queued a print with no confirmation, so staff had no idea a
label was about to come out (or that the wrong mode was selected).
## Fix
A confirmation step on the **welcome** path only (session check-in is unchanged
and still never prints, per the product decision):
- New read-only RPC `preview_welcome_checkin(p_attendee_qr)`
(`20261019090000_welcome_checkin_preview.sql`) resolves the scanned token to
the attendee and reports `already` + `will_print`. `will_print` mirrors the
exact enqueue condition in `welcome_checkin` (a genuine first check-in **and**
the event has a badge layout), so the popup never promises a print that won't
happen. It checks nobody in and enqueues nothing. Staff/admin only.
- The attendee app (`apps/convivo/src/screens/Scan.tsx`) now previews first and
shows a sheet: **"You are checking in [Name]. By confirming, you will print
this person's label."** with **Yes / No**. Only **Yes** runs `welcome_checkin`.
When `will_print` is `false` (already checked in, or no layout) the copy drops
the print sentence.
## Tests
- `supabase/tests/badge_print_tests.sql`: **+8 assertions** (109 total) — preview
resolves the name, reports `will_print` for an unchecked attendee, enqueues
nothing, checks nobody in, reports no print for a checked-in attendee or a
layout-less event, and is staff/admin-only (non-staff + anon rejected).
- `e2e/src/pages/ScanPage.ts` + welcome specs drive the new confirm step; added
`CONV-CHECKIN-003` (popup shows the name + print copy; **No** leaves the
attendee unchecked; **Yes** checks in).
- Real-browser smoke against a local build: **No** → not checked in, queue empty;
**Yes** → checked in and one `badge_print` job queued with the right name.
## Deployment
**Deployed to production 2026-10-19** (attendee app + DB migration).
- Migration `20261019090000_welcome_checkin_preview.sql` applied to prod in one
transaction with `ON_ERROR_STOP=1` and recorded in the ledger (39 → 40).
Backup `/home/APPE/convivo-backups/wprev-…` (counts before/after). Counts and
the print queue unchanged; `preview_welcome_checkin` present.
- `convivo-app` rebuilt from HEAD behind a baseline drift guard (the three
changed files — `api.ts`, `types.ts`, `Scan.tsx` — were byte-identical to the
deployed baseline, so whole-file copy was safe). Only `convivo-app` recreated;
admin, sidecar and every unrelated container ID preserved.