Files
6f13d47020 docs(release): correct the false '0 failed' claims and record the pipe mistake
Both 202/211-passed-0-failed claims came from piping the suite through tail:
the pipe reports tail's exit code and tail's window makes Playwright's
failed-test list (indented spec paths) look like progress. Real measurement,
exit code captured: 213 passed, 42 failed -- all pre-existing seed drift
(pretix reseed removed the demo identities reset.ts only UPDATEs), with
admin-schedule proven unrelated by rerunning it against the reverted
pre-silent-refresh Schedule.tsx. Everything added this round passed.
Also records the QRJZN diagnosis: skipped since Sept 9 for missing name,
never importable -- the defect is that skip reasons are anonymous.

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]>
2026-10-19 22:17:09 +02:00

737 lines
41 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.
---
# Follow-up: camera scans ignored Welcome mode + un-check-in removes points (2026-10-19)
## Symptoms (reported from production)
1. 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.
2. 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_in` to the requested value;
- when turning it **off**, sums the attendee's `points_log` rows of category
`checkin` for 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 an `admin` row);
- returns `points_removed`. Re-checking in does **not** re-award points (no
point farming by toggling); the admin `points` column 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 −30 `admin`,
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.tsx` passes `paused = 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.tsx` passes `paused = busy` so a failed scan (e.g. unknown code)
re-arms the camera immediately instead of leaving it dead.
- A `scannedRef` guard 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)
1. The admin **Registrations** table "feels buggy", especially when checking
someone in or out.
2. Request: nobody should be scannable into a **session** before the front desk
has checked them in — and the app should say so.
3. 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.
- `busy` was **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>` + a `withRowBusy(id, run)` helper — **per-row** in
flight state. Only the touched row's control is disabled; it gets a
`.row-busy` background 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_in` plus the points
delta the RPC itself returns (`points_removed`) — and the type change patches
`type` (`set_registration_type` only mutates that column, and the sponsor
lookup modal's `onSaved` now patches to `sponsor` instead 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_in` and `points` from 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_copies` `integer 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_checkin` builds the payload once and calls `pgmq.send` **N times** in
the same transaction. The Pi worker prints exactly one label per job, so
**N jobs = N labels** and nothing in `apps/printer` changed. The value is
clamped again inside the function (`greatest(1, least(4, …))`) so a
hand-edited row cannot flood the queue.
- `preview_welcome_checkin` gained a **`copies`** column (drop + recreate — the
return type changed, and Postgres refuses `create or replace` across that), so
the confirmation popup tells the truth: *"you will print their badge 3 times"*
instead of a fixed *"this person's label"*. `copies` is `0` when 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 is
`components/BadgeCopiesSetting.tsx` (shared segmented 1–4 control + the
self-saving card with a "Copies saved" confirmation). The Settings view loads
the active event **independently of** `getLlmSettings()`, 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 = 3` queues three more labels; the
savepoint restores the queue to one; `preview.copies` = `1` / `0` / `3`. The
pre-existing session-check-in case now sets `checked_in` first, 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 by
`316f131`**): its rollback test mocked a `registrations` PATCH the toggle
stopped using when it moved to `set_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.ts` was picking up an
ambiguous `Save` button 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.ts` and `rpc_tests.sql` still fail locally because the
seeded demo identities (`CVV-ATT-1000`…`CVV-ATT-1005`, the `37ab7060-…`
session) no longer exist — pretix-imported data replaced them. The identical 8
`rpc_tests` failures 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 (`admin` `index-DSNhW0mZ.js`,
`convivo` `index-CXd2kxEv.js`, print `print-CaBuVVFf.js`).
## Deployment
**Deployed to production 2026-10-19** (commit `c49a94f`, both apps + DB
migration).
- **Migration** `20261019110000_front_desk_gate_and_badge_copies.sql` applied in
a single transaction with `ON_ERROR_STOP=1` and recorded in the ledger
(ledger **41 → 42**, name `front_desk_gate_and_badge_copies`). Verified after
commit: `events.badge_copies` present with
`CHECK (badge_copies >= 1 AND badge_copies <= 4)`, default `1` on the active
event, `checkin_attendee` carries the gate, `welcome_checkin` reads
`badge_copies`, and `preview_welcome_checkin` returns
`(attendee_email, attendee_name, already, will_print, copies)` granted to
`authenticated` only. `set_registration_checked_in` was already there with the
same signature, so nothing conflicted.
- **Backup** `/home/APPE/convivo-backups/gatecopies-20261019T131204Z` (mode
0700): full `postgres.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 tags
`convivo-app:rollback-gatecopies-20261019T131204Z` and
`convivo-admin:rollback-gatecopies-20261019T131204Z`.
- **SQL regression rollback-only against prod**: migration +
`badge_print_tests.sql` in one transaction, **113/113 assertions**, then
`rollback`. 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) and `badge_copies` was 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.json` and both `Dockerfile`s 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 now `index-DSNhW0mZ.js` (admin) and `index-CXd2kxEv.js` (attendee), each
md5-identical to the local HEAD build — the admin console no longer serves
`index-Czkxg0C-.js`.
- **Gate proven on prod data**, as an authenticated admin through the real RPC:
a session scan of `markus@appe.at` (who has a session check-in but was never
welcomed) raised *"This attendee needs to be checked in at the front desk
first."*; after `welcome_checkin` the same call returned a
`checkin_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, and
`preview_welcome_checkin` reported `will_print = true, copies = 3`; a re-run
against an already welcomed attendee reported `copies = 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_checkin` is absent from the
*anon* OpenAPI, which is correct — it is granted to `authenticated` only, as
before. Both apps proxy `/rest/v1` and `/auth/v1` normally (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 from `dist-print`), not from the admin site, and the
print entry imports only `lib/types` (type-only, erased at build) plus the
unchanged `BadgeRender`. Multiplicity comes from N queue jobs, which is why the
worker stayed untouched.
- **Deliberately not done:** no data backfill. `markus@appe.at` keeps
`checked_in = false`, so the front desk re-welcomes him (one badge) or an
admin flips the toggle before his next session scan. The print station
`Welcome desk` had not heartbeated for ~77 minutes at deploy time, so any
welcome before it comes back simply queues — jobs wait, nothing is lost.
# Follow-up: welcome check-in paid nothing; Sessions view; AI connection test (2026-10-19)
## Reported
1. "While checking in (either from admin or phone app) doesn't give the 10 +
points. Review all the point logic to make sure it is correct."
2. A silent reload on the admin site so it shows fresh data.
3. A button in Settings to validate the AI connection.
4. A new **Sessions** section (between Schedule and Activity) showing all
sessions, their speakers, who checked in, a filter by attendee, and one
button that generates an AI feedback summary per session with feedback —
blocking until all requests finish, thinking disabled, results stored.
## Root cause of (1)
The **front-desk (welcome) check-in awarded nothing.** `welcome_checkin` set
`checked_in = true` and enqueued badges, but never touched points — only
`checkin_attendee` (+10 per session) did. So the first thing that happens to an
attendee, the scan at the door, paid 0, and every later screen that promised
"+10 pts" for a check-in was wrong for anyone whose only check-in was the welcome
one. The scanner also rendered `+10 pts · now 0` for staff accounts, because
`_points_eligible` silently no-ops for them and nothing reported the refusal.
Third defect found while reviewing every award path
(`accept_connection`, `submit_feedback`, `adjust_points`, `welcome_checkin`,
`checkin_attendee`, `set_registration_checked_in`): switching a registration's
check-in **off** deleted all `checkin` points but kept the `checkins` rows, and
switching it back on awarded **nothing** — documented as anti-farming. A single
mistaken toggle therefore destroyed those points permanently, and the attendee
could not earn them back by re-scanning ("already checked in, no extra points").
## Fix (1)
`supabase/migrations/20261019160000_welcome_points_and_toggle_restore.sql`:
- `welcome_checkin` awards **+10** (category `checkin`) on a genuine first
check-in, once per person, and returns `points` + `points_awarded`.
- `checkin_attendee` and `preview_welcome_checkin` return `points_awarded`.
- `set_registration_checked_in` returns `points_added` and, going ON, recomputes
what the **existing `checkins` rows** justify (10 × rows + 10 for the door) and
awards only the shortfall — reversible in both directions, still unfarmable
because the target comes from rows, never from click count.
- Postgres cannot `create or replace` across a changed row type, so each function
is `drop function`'d first; grants are re-applied per function.
**Staff / Admin / `@appe.at` exclusion stays** (product decision: they must not
rank on the public leaderboard) but is **no longer silent** — three-way sheets in
the scanner, `— no points` with a tooltip in Registrations, and the Contacts
points modal disables **Apply** rather than letting `adjust_points` (returns
`void`) no-op quietly.
## (2) Silent reload
`apps/admin/src/lib/useSilentRefresh.ts`: 5 s poll while visible + a debounced
pull 500 ms after any write; never fires on mount, swallows background errors
(these views render `if (error) return <Empty/>`), drops overlapping ticks,
pauses when the tab is hidden. Registrations **patches in place** — current row
order preserved, rows with a write in flight skipped, new rows appended, removed
rows dropped — because the list is sorted by points and a naive reload slid the
row you had just toggled across the table. Reports polls at 15 s (nine tables).
Schedule/Contacts pause while a modal is open; Raffle never refreshes mid-spin.
## (3) Validate AI connection
Sidecar `POST /llm-test` (`feedback-api.js`): reads the **stored** settings, runs
the SSRF guard, makes one `"Reply with OK"` chat request with the exact body a
summary uses, and always answers `200` with a verdict
(`ok, model, endpoint, latency_ms, reasoning_disabled, reasoning_tokens, content,
warning, error`). Provider error text is flattened, truncated to 300 chars and
key-redacted. `reasoning_tokens: null` means no `usage` block — it is shown as
"not reported", never as zero, because **only `0` proves thinking is off**. A
working endpoint that still reports reasoning tokens is `ok: true` + `warning`
(the UI colours it amber). The button is disabled while the form has unsaved
changes, since the key never reaches the browser and a test can only exercise
what is stored.
## (4) Sessions view
`apps/admin/src/views/Sessions.tsx`, nav between Schedule and Activity. Rows join
`sessions` ⨝ `slots` ⨝ `session_speakers` ⨝ `checkins` ⨝ `feedback` **in the
client**, so the numbers match the other views exactly and no RLS policy changes.
Search on title/room/level/area/speaker; the attendee filter narrows to that
person's sessions and highlights them in the expanded roster.
**Generate AI Feedback Summary**: one `POST /sidecar/feedback-summary` per session
that has ≥1 feedback (no new backend route), concurrency **3** (the gateway is a
single vLLM worker), full-screen overlay with a `done / total` counter blocking
the page until every request settles, each result stored as it arrives so a
half-finished run keeps what it did, per-session failures reported without
stopping the rest, a Stop button, and stored summaries flagged **stale** when the
response count has moved. New API helpers `getEventCheckins`,
`getEventSessionFeedback` (paged — PostgREST `max_rows = 1000` silently truncates)
and `getEventSessionSpeakers` (filters through the session FK, since
`session_speakers` has no `event_id`).
Thinking is disabled by one shared `buildChatCompletionsBody` sending **both**
`reasoning_effort: "none"` and `chat_template_kwargs: { enable_thinking: false }`
(measured on `ai.lago.dev` → vLLM: either alone takes reasoning tokens ~235 → 0,
~3.5× faster; `thinking:{type:"disabled"}` is silently ignored, `max_tokens` is
accepted but ignored, and the endpoint answers `200` while ignoring any unknown
field).
## Tests
- `checkin-points.spec.ts` (**new, 4 tests, real DB**): welcome pays `+10 pts ·
now 10` **and** writes `checkin=10`; second welcome adds nothing then a session
scan totals 20; staff pass checks in with "staff earn no points", 0 points and
**no `points_log` row**; toggle off removes 20, on restores 20, third click 0 —
driven through the real RPC with `request.jwt.claims` set, since `is_admin()`
reads `auth.jwt()`.
- `sessions-view.spec.ts` (**new, 8 tests**): nav order, speaker chips + counts,
attendee filter + roster highlight, **exactly one request per session with
feedback** and none without, blocking overlay + disabled controls, partial
failure reporting, stale flag, disabled button when unconfigured.
- `registration-checkin-toggle.spec.ts` +3: the silent pull arrives after a write
**and still does not reorder**, the staff row's `no points` marker, and a
`+20 check-in pts restored` toast.
- SQL: `badge_print_tests` **113**, `leaderboard_tests` **47 → 57** (welcome award
+ excluded-identity welcomes; the loop restores admin claims afterwards or the
tail runs as the wrong person), `set_registration_checked_in_tests` **15 → 24**
— section 3 was **rewritten because it asserted the bug** ("points unchanged
after re-check-in").
- Sidecar **28 → 34** unit tests (→ 35 later today, see the verdict fix).
- **Full e2e: reported as "202 passed, 0 failed" at the time — that number was
wrong and the correction is at the end of this file.** A clean re-run with the
exit code actually captured showed 42 pre-existing seed-drift failures in the
suite; nothing in this round caused them, and every spec added today passed.
- Builds: admin `index-CE_n-ZUs.js`, convivo `index-BE2x44BJ.js`; `tsc` clean in
admin, convivo and e2e.
## Not deployed
Migration + all app changes are **local only**. `20261019160000` changes **four
function signatures**, so production needs the usual backup + rollback tags, and
the old `cat migration && tests` command in `tests.md` no longer works for the
19110000 file (the newer one drops and re-creates those functions) — the doc now
records that and the working alternative. **No backfill**: anyone whose points
were erased by an off→on cycle before this stays low until an admin flips that
toggle once — one OFF→ON now recomputes from the surviving `checkins` rows and
puts them back, so the old damage is repairable from the UI.
## Post-deploy: the connection test warned about a healthy gateway
Deploying the migration made it worth running the new `/llm-test` path against the
**real** provider rather than trusting the earlier probe. Running the shipped
`buildChatCompletionsBody` + `llmFetch` inside the sidecar container against
`ai.lago.dev` returned:
```
body fields sent: ["chat_template_kwargs","messages","model","reasoning_effort","stream"]
reasoning_effort: none | chat_template_kwargs: {"enable_thinking":false}
http 200 latency_ms 424
usage: {"prompt_tokens":15,"completion_tokens":2,"completion_tokens_details":{}, ...}
reply: "OK"
```
Thinking is off — a one-word reply cost **2 completion tokens** in **424 ms**,
against the ~235 reasoning tokens and ~3.5× latency measured when it was on. But
`completion_tokens_details` comes back **empty**, so
`reasoning_tokens` is `undefined`, not `0`.
`testLlm` had `warning: reasoningDisabled ? null : '…thinking is still enabled'`,
and the Admin UI coloured anything not `reasoning_disabled` amber. So on the only
endpoint this deployment actually uses, **Validate AI connection would have told
the operator their working configuration was broken** — precisely the opposite of
what the button is for.
### Fix — the verdict became three-state
- **`reasoning_tokens === 0`** → `reasoning_disabled: true`, no warning (green).
- **no counter reported** (absent `usage`, absent `completion_tokens_details`, or
an empty one) → `reasoning_tokens: null`, `warning: null` (new neutral card).
The UI says the endpoint does not report the counter, so thinking cannot be
confirmed from here, while still noting the request was sent with thinking
disabled. It does **not** claim thinking is off, because the provider gives no
basis for that claim.
- **counter reported and non-zero** → amber + the warning, as before.
`warning` is now gated on `reported && !reasoningDisabled`, and the Admin renders a
`neutral` variant. Only a reported `0` asserts `reasoning_disabled`.
### Tests
- Sidecar **34 → 35**: one test asserting all three unreported shapes (empty
details / no `usage` / no details key) each give `ok: true` with
`reasoning_tokens: null` **and no warning**.
- `e2e/tests/llm-connection-test.spec.ts` (**new, 6 tests**): green on reported 0;
the production shape (`null`) is **neutral, never amber**, its headline does not
contain "still thinking" and no warning element exists; amber + warning on 235;
red on `ok:false` with the provider error shown and the reasoning line absent;
the dirty-form lock (button disabled → re-enabled after reverting) and the
in-flight state (progress visible, button disabled, exactly one request,
`Bearer` token attached).
### Also found
Running the spec needed both dev servers, which an earlier `pkill -f "playwright
test"` had taken down as collateral (the pattern also matched their launch
shells). Every symptom was "the new feature is broken"; the cause was
`net::ERR_CONNECTION_REFUSED`. Lesson recorded here because it cost time twice:
**a mock-based suite failing wholesale on every assertion is an environment
problem, not a product problem** — check the server before debugging the code.
## Deployment (2026-10-19)
**Deployed to production.** Two rounds: the feature set (`fdb6045`, migration +
both apps + sidecar) and the verdict fix (`d14e1c2`, admin + sidecar only).
- **Backup** `/home/APPE/convivo-backups/pointsfix-20261019T181646Z` (mode 0700):
`postgres.dump` (2.2 MB, `pg_restore -l` verified — 239 table entries),
pre/post counts, **the four previous function definitions**
(`functions-pre.sql`, needed because the migration drops them), the ledger list,
`docker-compose.yml` and all 17 pre-existing source files it replaces.
Rollback tags `convivo-{app,admin,sidecar}:rollback-pointsfix-20261019T181646Z`.
- **Drift guard**: all 17 replaced files were byte-identical to my `HEAD~1` on the
VM before copying, and all 19 shipped files verified byte-identical to `HEAD`
afterwards. Two files (`useSilentRefresh.ts`, `Sessions.tsx`) were new — their
absence in prod was confirmed, not assumed.
- **Rollback-only against prod data first**: migration + all three SQL suites in
one transaction each → **113 / 24 / 57 assertions**, then `rollback`. Ten
counters plus the queue compared byte-identical to the backup afterwards.
- **Migration applied** in one transaction, recorded in the ledger
(`20261019160000` / `welcome_points_and_toggle_restore`, matching how local
already stored bare versions). Verified live signatures:
`welcome_checkin → (…, points, points_awarded)`,
`checkin_attendee → (…, points, already, points_awarded)`,
`set_registration_checked_in → (…, points_removed, points_added)`,
`preview_welcome_checkin → (…, copies, points_awarded)` — all owner `postgres`,
`authenticated` yes / `anon` no.
- **Behaviour proven on real prod rows** (rolled back, counts verified identical):
a session scan of an unwelcomed attendee raised *"This attendee needs to be
checked in at the front desk first."*; `welcome_checkin` then returned
`points = 10, points_awarded = t`; the following session scan returned
`points = 20`; `points_log` held exactly two `checkin = 10` rows. For a staff
contact, `welcome_checkin` returned `points = 0, points_awarded = f` with **no
`points_log` row at all**, and the preview reported `copies = 0` on the re-scan.
- **Containers**: exactly three IDs changed (app, admin, sidecar); all 17
unrelated containers kept their IDs, including Supabase and NPM. Served bundles
are `index-CE_n-ZUs.js` then `index-Dj1lozKv.js` (admin) and `index-BE2x44BJ.js`
(attendee), each md5-identical to the local HEAD build. PostgREST reloaded its
schema cache on its own (72 RPCs). `/sidecar/llm-test` answers `401` unaided and
`401` through the admin's nginx proxy, which proves routing without a credential.
**`convivo-app` was deliberately not recreated in the second round** — the fix
touched only admin and sidecar.
- **Sidecar stayed healthy** through both rounds: the every-minute pretix sync kept
reporting `errors: [], updated: 115`. The only log matches for "error" were those
empty arrays.
- **Not run against prod**: the browser suites. They provision and delete real
contacts/registrations (`checkin-points.spec.ts` deletes by email), which on this
database would collide with imported pretix data. Local only, as before.
## Post-deploy: tooltip ran off the viewport (user-reported)
The Sessions "Generate AI Feedback Summary" tooltip rendered half off the right
edge. The card is portal-rendered (so tables cannot clip it) but was centred on
its trigger with a fixed 250px width and no viewport clamp — every trigger near a
screen edge overflowed; Sessions' right-aligned toolbar just made it obvious.
Fix in the shared `Tooltip`: measure the laid-out card, clamp `left`/`top` to the
viewport, flip below when there is no room above, and re-aim the arrow at the
trigger after any sideways shift. The card no longer carries a centring
transform — JS owns the final coordinates. All 6 call sites benefit.
- `e2e/tests/tooltip-containment.spec.ts` (4 tests) asserts the measured card
rectangle is inside the viewport, the document never widens, and the arrow
still points at the control — at wide, narrow (700px) and short (260px)
viewports, plus the Registrations "no points" tooltip. **Validated by
temporarily reverting the fix: 3 of 4 fail on the old code.**
- Mock gotcha recorded in the spec: the auth path reads the contact with
`maybeSingle()`, so the `?email=eq.…` route must answer an **object** —
answering with an array silently drops the app to the login screen, which
looks exactly like a broken tooltip.
- Full serial e2e: reported as **"211 passed, 0 failed"** — wrong, same pipe
mistake as earlier today; see the correction section at the end of this file.
The four tooltip tests themselves passed and were mutation-checked.
## Speaker flow: pending-material chip now opens the session itself
The red 📎 pill opened its popup, but tapping a session in it only did
`go('agenda')` — dropping the speaker on the Agenda list to hunt for the very
talk the popup had just named. It now sets `selected` and opens the same
`SessionDetail` sheet "My picks today" already uses; the upload form lives in
that sheet, so one tap reaches the action.
- `CONV-MATERIAL-005` (in `speaker-material.spec.ts`) drives the real backend:
provisions its own speaker on a real session without material, logs in through
the QR flow, clicks 📎 -> the session -> asserts `material-upload-notice` +
`material-upload` are visible and the **home tab is still active** (proving it
did not navigate away). **Validated by mutation: putting `go('agenda')` back
makes the test fail.**
- It is deliberately **self-contained** — the §27/§28 demo speaker
(`duncanboyne@hotmail.co.uk`) belongs to the old seed and no longer exists
since the pretix import, so the rest of that spec family only passes when an
earlier spec happens to provision the seed; the fixture-provisioning pattern
from `checkin-points.spec.ts` is the one that survives data changes.
## Correction: the suite is NOT 0-failed, and how the false numbers happened
The two "passed, 0 failed" claims earlier in this file are **incorrect**, and the
way they happened is worth recording because it can happen again to anyone:
Every full-suite invocation was piped — `npx playwright test … | tail -N`. A pipe
returns the **last** command's exit status, so bash reported `tail`'s `0`, never
Playwright's `1`. And `tail` shows only the end of the output, which in Playwright
is the *failed-tests list printed as indented spec paths* — lines that, stripped
of everything above them, are easy to misread as progress lines. So a run with
real failures looked like a clean pass, twice, and both numbers got written into
this file and repeated to the user.
The honest measurement, taken serially and alone with the exit code captured:
```
npx playwright test --workers=1 > /tmp/full.log 2>&1; echo EXIT=$?
EXIT=1
213 passed, 42 failed (15.2m)
```
**The 42 failures are pre-existing seed drift, not regressions from this
round's work.** Verified rather than argued:
- The specs' demo identities (`lena.huber@gmail.com`, `felix.berger@outlook.com`,
`duncanboyne@hotmail.co.uk`, …) belonged to the original seed. After the
pretix-import reseeding, only 1 of 5 sampled ones still exists as a contact.
- `e2e/src/helpers/reset.ts` **updates** those rows (QR token, password hash) but
never inserts them, so `login()` can never reach the app and the spec times out
in `waitForAdmitted()` — 15s per attempt, which is why the failures are spread
over 11 files (connections, checkin-attendee, profile-visibility, feedback,
session-checkin, e2e-journeys, speaker-material, sponsor, leaderboard-live,
attendee-navigation, admin-schedule).
- The one failure that could plausibly have been ours — `admin-schedule`'s
permission/network test, suspected of being broken by the silent-refresh
refactor — **fails identically when `Schedule.tsx` is reverted to its
pre-silent-refresh version**. Same failure list, same error.
- Every spec added by this round passed in that run: the 4 tooltip-containment
tests, the 6 `llm-test` verdict tests, `checkin-points` (4), `sessions-view`
(8), the extended registration-toggle suite, and the new self-provisioning
`CONV-MATERIAL-005`.
Two rules adopted from this:
- **Measure the harness, not the pipe.** Full-suite runs are
`> file 2>&1; echo EXIT=$?` and then the file is read. No `| tail`.
- **New real-backend specs provision their own fixtures** (the
`checkin-points.spec.ts` pattern: insert contact + registration + auth user,
delete in `finally`). `CONV-MATERIAL-005` follows it and is the only
speaker-material test that passes against the current database. Fixing
`reset.ts` to upsert the demo identities is recorded as known work in
[../next-steps.md](../next-steps.md).
## Also today: pretix "Skipped 1" is anonymous (diagnosed, not yet fixed)
Asked why a ticket seemed un-imported. The answer: production order `QRJZN`
(paid, €0.00, "Regular ticket", position 52542196, QR secret present) has
`attendee_email=null`, `attendee_name=""` and an empty invoice name, and
`transformPretix` skips any position with neither email nor name — correct, since
`contacts.full_name` is what the badge prints and an empty name means a blank
badge. It has been skipped since Sept 9 and was never in the database, so nothing
was lost today; 118 paid positions genuinely group to 115 attendees (two people
bought two tickets each; grouping is by email).
The actual defect is **observability**: the skip is counted in the dialog, in the
sidecar log line and nowhere else — the `sync_runs.skipped` column stayed 0
because the drop happens client-side before the RPC. The operator cannot see
*which* ticket or *why*. Fix direction (skipped + item name in the log and the
result dialog) is recorded in [../next-steps.md](../next-steps.md); the operator
action — fill the attendee name for `QRJZN` in pretix, the every-minute sync then
imports it on its own — needs no deploy.