Deployed to prod: migration 20261019110000 (ledger 41 -> 42) applied with the
badge_print suite run rollback-only in the same transaction (113/113), both
images rebuilt and recreated, live bundles now index-DSNhW0mZ.js (admin) and
index-CXd2kxEv.js (attendee) md5-identical to the HEAD build.
Gate and copies verified against real prod data inside rolled-back transactions:
a session scan of an un-welcomed attendee raised the front-desk message, the same
call returned a checkin_id after welcome_checkin, and refused again once the flag
was cleared; with badge_copies = 3 one welcome enqueued exactly 3 pgmq jobs and
preview reported copies = 3. Counts match the backup afterwards (119 contacts,
115 registrations, 2 checkins, queue 0, 173 auth users).
Backup /home/APPE/convivo-backups/gatecopies-20261019T131204Z with rollback tags
convivo-{app,admin}:rollback-gatecopies-20261019T131204Z. No data backfill:
[email protected] keeps checked_in = false, so the front desk re-welcomes him or an
admin flips the toggle. No printer change - the Pi renders from its own bundled
dist-print, and multiplicity is N queue jobs. .design-audit/ is ignored now.
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]>
19 KiB
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:
- 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. - 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 reportsalready+will_print.will_printmirrors the exact enqueue condition inwelcome_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 runswelcome_checkin. Whenwill_printisfalse(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, reportswill_printfor 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; addedCONV-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_printjob queued with the right name.
Deployment
Deployed to production 2026-10-19 (attendee app + DB migration).
- Migration
20261019090000_welcome_checkin_preview.sqlapplied to prod in one transaction withON_ERROR_STOP=1and recorded in the ledger (39 → 40). Backup/home/APPE/convivo-backups/wprev-…(counts before/after). Counts and the print queue unchanged;preview_welcome_checkinpresent. convivo-apprebuilt 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). Onlyconvivo-apprecreated; admin, sidecar and every unrelated container ID preserved.
Follow-up: camera scans ignored Welcome mode + un-check-in removes points (2026-10-19)
Symptoms (reported from production)
- With the "Check-in type" toggle switched to Welcome, a camera scan still produced the session result sheet ("Already checked in / No extra points") and no confirmation popup.
- Feature request: when an admin flips the checked-in toggle OFF in the admin Registrations view, the points that person earned from check-ins should be removed too.
Root cause of (1)
Scanner (apps/convivo/src/components/ui.tsx) registers the html5-qrcode
success callback once in a useEffect(…, []). That callback captured the
onResult prop from the first render, so it kept calling a handleScan
closure in which welcomeMode was still false (and the session selector
still empty). Toggling Welcome afterwards had no effect on camera scans — every
scan ran the session branch. The manual-entry field called the current prop,
which is why keyboard-driven tests and the earlier smoke test passed.
Fix: keep onResult in a ref refreshed on every render and invoke
onResultRef.current(text) from the camera callback.
Design of (2)
New admin RPC set_registration_checked_in(p_registration_id, p_checked_in)
(20261019100000_set_registration_checked_in.sql), the single admin path for
the toggle:
- admin-only (
is_admin()), locks the registration row; - sets
checked_into the requested value; - when turning it off, sums the attendee's
points_logrows of categorycheckinfor that event, deletes them, and applies the negative delta through_award_points(…, 'admin')— so the leaderboard mirror and the audit trail stay consistent (the reversal itself is logged as anadminrow); - returns
points_removed. Re-checking in does not re-award points (no point farming by toggling); the adminpointscolumn refreshes after the call and a toast reports the removal.
Tests
supabase/tests/set_registration_checked_in_tests.sql: 15 assertions — un-check removes exactly the checkin points (40 → 10, other categories untouched), leaderboard syncs, reversal logged once as −30admin, no-checkin-points un-check is a no-op, re-check awards nothing, unknown id rejected, non-admin and anon rejected.- Existing suites re-run clean: leaderboard 46, badge_print 109, rpc_tests.
Deployment
Deployed to production 2026-10-19: migration applied + ledger (40 → 41);
convivo-app and convivo-admin rebuilt from HEAD behind the drift guard (all
three changed files byte-identical to the deployed baseline).
Follow-up: camera stays dead after a scan (2026-10-19)
Symptom (reported from production)
After a successful scan the camera stopped working — staff had to navigate to another tab and back to re-activate it before scanning the next lanyard.
Cause
Scanner deliberately stops the camera after decoding one code (so the same
lanyard cannot fire twice), but it only ever started the camera once, on mount.
Nothing restarted it afterwards.
Fix
The camera lifecycle is now driven by a paused prop owned by the parent:
Scan.tsxpassespaused = busy || a sheet is open(connect, session result, welcome confirm, welcome result). The camera stops while a sheet is up and restarts automatically the moment the sheet closes — "Scan next" or ✕ is all it takes now.Login.tsxpassespaused = busyso a failed scan (e.g. unknown code) re-arms the camera immediately instead of leaving it dead.- A
scannedRefguard ignores duplicate callbacks in the frames between the decode and the camera actually stopping.
Tests
Real-browser smoke against a local build: staff login → Welcome mode → scan →
confirm popup → Yes → result sheet → Scan next → sheet closes and the
camera effect re-runs (fresh Html5Qrcode instance starts; the library clears
the element in its constructor, so re-attaching to the same div is safe).
Badge queued correctly; test data cleaned afterwards.
Deployment
Deployed to production 2026-10-19: attendee app only (convivo-app
rebuilt; no migration, admin/sidecar untouched).
Follow-up: Registrations toggle feels buggy; front-desk gate; badge copies (2026-10-19)
Symptoms (reported from production)
- The admin Registrations table "feels buggy", especially when checking someone in or out.
- Request: nobody should be scannable into a session before the front desk has checked them in — and the app should say so.
- Request: an admin setting for how many badge copies a welcome check-in prints (default 1, up to 4).
Root cause of (1)
Not a render bug — a regression the previous change introduced, and it was never deployed, which is why "it doesn't work" at all.
Commit 316f131 (un-check-in removes points) made both row actions do:
setBusy(true) → write → await reloadRegistrations(event_id) → setBusy(false)
Two things went wrong from there:
- The list is sorted by points. Reloading after a toggle re-sorts it, so the row you just clicked moves, and with a Checked in filter applied it disappears entirely. Clicking the same place again hits a different person.
busywas one flag for the whole table, so during every request the event selector, every type dropdown, every checkbox and the Merge buttons all went dead at once, with no indication of which row was working. A second click in that window either did nothing or fired a second write for the same row.
Fix (apps/admin/src/views/Registrations.tsx):
busyIds: Set<string>+ awithRowBusy(id, run)helper — per-row in flight state. Only the touched row's control is disabled; it gets a.row-busybackground and a "Saving…" pulse (data-testid="saving-<id>", motion-respecting). Other rows stay live, and two rows can be saved at the same time. A double click on the same row is ignored while its write runs.- No reload. The toggle patches its own row —
checked_inplus the points delta the RPC itself returns (points_removed) — and the type change patchestype(set_registration_typeonly mutates that column, and the sponsor lookup modal'sonSavednow patches tosponsorinstead of reloading). Rows therefore keep their place; the leaderboard and totals are untouched because the server is the source of truth either way. - Rollback on failure restores both
checked_inandpointsfrom the row that was clicked, so the checkbox never lies.
Accessibility/ergonomics in the same pass (apps/admin/src/styles.css): the
toggle's hit area is now 40×41 px (padding: 9px 0; margin: -9px 0) instead of
the bare track, the hidden checkbox gets a :focus-visible ring on the track,
and a disabled track reads as disabled.
Design of (2) — the front-desk gate
checkin_attendee now reads the attendee's registrations.checked_in and
raises This attendee needs to be checked in at the front desk first. when
it is not true. It also stopped setting checked_in = true as a side
effect, which is what let a session scan make someone "checked in to the
event" without anyone welcoming them. The welcome check-in (and the admin
Registrations toggle, i.e. the front desk acting from the console) are now the
only ways to earn that flag.
Enforced in the database on purpose: checkins has no INSERT policy, so the
RPC is the only write path and the gate cannot be bypassed from the API.
The scanner (apps/convivo/src/screens/Scan.tsx) treats this as a state, not
a transient error: instead of a toast it opens its own sheet — 🛑 "Not checked
in yet" / "This attendee needs to be checked in at the front desk before they
can be scanned into a session." with OK (data-testid="front-desk-required"
/ front-desk-ok). The camera stays paused behind it and re-arms on OK.
Design of (3) — badge copies
- New column
events.badge_copiesinteger not null default 1 check (badge_copies between 1 and 4). Per-event is the right data model; the setting is surfaced in Settings → Badge printing for the active event because that is where admins expect one global knob, and also on the Events form. welcome_checkinbuilds the payload once and callspgmq.sendN times in the same transaction. The Pi worker prints exactly one label per job, so N jobs = N labels and nothing inapps/printerchanged. The value is clamped again inside the function (greatest(1, least(4, …))) so a hand-edited row cannot flood the queue.preview_welcome_checkingained acopiescolumn (drop + recreate — the return type changed, and Postgres refusescreate or replaceacross that), so the confirmation popup tells the truth: "you will print their badge 3 times" instead of a fixed "this person's label".copiesis0when nothing would print.- Manual reprint (
enqueue_badge_print) still prints exactly one label — reprinting a lost badge must not produce a stack. - Saving uses
setBadgeCopies(eventId, copies), a single-column update, so it can never clobber the rest of the event row. The picker iscomponents/BadgeCopiesSetting.tsx(shared segmented 1–4 control + the self-saving card with a "Copies saved" confirmation). The Settings view loads the active event independently ofgetLlmSettings(), so the badge section still renders when the LLM/sidecar call fails.
Tests
supabase/tests/badge_print_tests.sql: +6 assertions → 113 — gate refuses an un-welcomed session scan;badge_copies = 3queues three more labels; the savepoint restores the queue to one;preview.copies=1/0/3. The pre-existing session-check-in case now setschecked_infirst, since the gate made it a precondition.supabase/tests/leaderboard_tests.sql: +1 assertion → 47, fixtures checked-in (plus a fresh, un-checked-in attendee to drive the gate).supabase/tests/rpc_tests.sql: fixtures checked-in so the session path is reachable.- New
e2e/tests/registration-checkin-toggle.spec.ts— 6 mocked-admin tests: toggle fires exactly one request and zero refetches, row order unchanged, the busy row shows "Saving…" with its checkbox disabled while other rows stay enabled, a second row saves concurrently, un-check reports−30, a rejected write rolls back, type change without refetch, and the Settings picker persisting 1–4. - New
e2e/tests/front-desk-gate.spec.ts— 3 real-browser tests (CONV-GATE-001..003): the refusal sheet with no check-in recorded, the same scan succeeding after the welcome, and a session check-in not setting the event flag by itself. - New
e2e/tests/welcome-badge-copies.spec.ts— 3 real-browser tests (CONV-COPIES-001..003):badge_copies = 3→ exactly 3 queue messages for that attendee,1→ 1 with the singular wording, re-welcome → +0. e2e/tests/registration-ticket-merge.spec.ts(pre-existing, broken by316f131): its rollback test mocked aregistrationsPATCH the toggle stopped using when it moved toset_registration_checked_in; the mock now targets the RPC, so the test exercises what the UI actually calls.- Also fixed by this work:
feedback-ai-summary.spec.tswas picking up an ambiguousSavebutton once the badge card added one — the card's button is labelled "Save copies" / "Copies saved", which resolves the collision for both screen-reader users and the test.checkin-attendee.spec.ts's print-copy assertion now tolerates the typographic apostrophe in the popup text. - Pre-existing, not caused by this change set:
session-checkin.spec.ts,checkin-attendee.spec.tsandrpc_tests.sqlstill fail locally because the seeded demo identities (CVV-ATT-1000…CVV-ATT-1005, the37ab7060-…session) no longer exist — pretix-imported data replaced them. The identical 8rpc_testsfailures occur at HEAD, and the same specs failed with everything stashed. The new specs deliberately provision their own fixtures so they do not depend on that drift; the fixtures should be re-seeded separately. - Both apps typecheck clean and build (
adminindex-DSNhW0mZ.js,convivoindex-CXd2kxEv.js, printprint-CaBuVVFf.js).
Deployment
Deployed to production 2026-10-19 (commit c49a94f, both apps + DB
migration).
- Migration
20261019110000_front_desk_gate_and_badge_copies.sqlapplied in a single transaction withON_ERROR_STOP=1and recorded in the ledger (ledger 41 → 42, namefront_desk_gate_and_badge_copies). Verified after commit:events.badge_copiespresent withCHECK (badge_copies >= 1 AND badge_copies <= 4), default1on the active event,checkin_attendeecarries the gate,welcome_checkinreadsbadge_copies, andpreview_welcome_checkinreturns(attendee_email, attendee_name, already, will_print, copies)granted toauthenticatedonly.set_registration_checked_inwas already there with the same signature, so nothing conflicted. - Backup
/home/APPE/convivo-backups/gatecopies-20261019T131204Z(mode 0700): fullpostgres.dump(7.6 MB), pre/post counts, the three previous function definitions, the ledger list,docker-compose.yml, and a copy of all nine runtime source files the deploy touches. Rollback tagsconvivo-app:rollback-gatecopies-20261019T131204Zandconvivo-admin:rollback-gatecopies-20261019T131204Z. - SQL regression rollback-only against prod: migration +
badge_print_tests.sqlin one transaction, 113/113 assertions, thenrollback. Counts afterwards matched the backup exactly (contacts 119, registrations 115, checkins 2, events 1, badge_layouts 1, print_stations 1, queue 0, auth users 173) andbadge_copieswas still absent. - Baseline drift guard: all 8 modified prod source files were byte-identical
to
HEAD~1, so whole-file copies were safe. The 9 shipped files (8 modified +BadgeCopiesSetting.tsx) verified byte-identical to HEAD on the VM;package.json,package-lock.jsonand bothDockerfiles already matched, so no dependency or manifest change was involved. - Both images rebuilt on the VM and recreated with
docker compose up -d --force-recreate; healthy in both cases, every unrelated container ID preserved (sidecar kept its 2-day uptime). Live bundles are nowindex-DSNhW0mZ.js(admin) andindex-CXd2kxEv.js(attendee), each md5-identical to the local HEAD build — the admin console no longer servesindex-Czkxg0C-.js. - Gate proven on prod data, as an authenticated admin through the real RPC:
a session scan of
[email protected](who has a session check-in but was never welcomed) raised "This attendee needs to be checked in at the front desk first."; afterwelcome_checkinthe same call returned acheckin_id; re-clearing the flag refused again. All inside a rolled-back transaction — queue and checkin counts unchanged. - Copies proven on prod data: with
badge_copies = 3, one welcome enqueued exactly 3 pgmq jobs for that attendee, andpreview_welcome_checkinreportedwill_print = true, copies = 3; a re-run against an already welcomed attendee reportedcopies = 0. Rolled back (queue = 0,badge_copies = 1). - PostgREST cache picked the change up on its own: the served OpenAPI
already contains
badge_copies.preview_welcome_checkinis absent from the anon OpenAPI, which is correct — it is granted toauthenticatedonly, as before. Both apps proxy/rest/v1and/auth/v1normally (200 + GoTrue health), and both SPAs render on the new bundles. - No printer change was needed. The Pi renders badges from its own bundled
/app/renderer(built fromdist-print), not from the admin site, and the print entry imports onlylib/types(type-only, erased at build) plus the unchangedBadgeRender. Multiplicity comes from N queue jobs, which is why the worker stayed untouched. - Deliberately not done: no data backfill.
[email protected]keepschecked_in = false, so the front desk re-welcomes him (one badge) or an admin flips the toggle before his next session scan. The print stationWelcome deskhad not heartbeated for ~77 minutes at deploy time, so any welcome before it comes back simply queues — jobs wait, nothing is lost.