- migration 20261018170000: pgmq badge_print/badge_print_dlq, print_stations, token-gated printer RPCs (claim/complete/fail/heartbeat), admin RPCs, welcome_checkin enqueue; badge_print_tests.sql (101 assertions) - apps/printer: Python worker (Playwright render -> brother_ql via pyusb), comitup captive-portal (Wi-Fi + HTTPS endpoint + anon key + token), arm64 image build + idempotent Pi setup/install scripts, 77 pytest - apps/admin: Printing view, station management/DLQ, global printer status pill, Print button on Registrations, standalone print renderer entry (print.html -> dist-print) with bundled fonts - docs: printing.md + architecture/schema/rpcs/tests/admin-app updates, apps/printer/AGENT.md operating manual - e2e: printing.spec.ts
203 lines
11 KiB
Markdown
203 lines
11 KiB
Markdown
# Attendee Feedback Polish (2026-10-18)
|
|
|
|
Three fixes requested by Sabrina after hands-on testing of `convivo.appe.at`.
|
|
All presentation-layer (attendee app only) — no migration, no RPC, no admin or
|
|
sidecar change.
|
|
|
|
## 1. Session description collapsed into one block
|
|
|
|
**Symptom.** The session detail sheet rendered multi-paragraph descriptions as a
|
|
single unreadable wall of text.
|
|
|
|
**Root cause.** The feed carries real line breaks: the sidecar passes Sessionize
|
|
`s.description` through untouched (`apps/sidecar/src/server.js`), so the DB
|
|
holds `\n` / `\n\n` (19 of the 33 seeded local sessions are multi-line). The
|
|
sheet's description `<div>` used a plain inline style, and default CSS collapses
|
|
newlines into spaces.
|
|
|
|
**Fix.** New `.sd-desc` class (`apps/convivo/src/styles.css`):
|
|
`white-space: pre-line; line-height: 1.55; overflow-wrap: anywhere`, applied to
|
|
the `#sd-desc` block in `apps/convivo/src/components/SessionDetail.tsx`. The
|
|
AI feedback summary got the same treatment via
|
|
`.feedback-review .fr-text`. No markdown parser added — the feed is plain text.
|
|
|
|
## 2. "Your session feedback" shown on service sessions
|
|
|
|
**Symptom.** Staff opened a Break/Lunch card and saw the speaker feedback review
|
|
("⭐ Your session feedback", stars, AI summary) — nonsense on a break.
|
|
|
|
**Root cause.** `_assign_service_session_speakers` links **every staff
|
|
registration** as a speaker of **every service slot** (by design, so service
|
|
sessions have a speaker set). `SessionDetail` showed the review whenever
|
|
`isSpeaker && status === 'done'`, so any staff member hit it on every finished
|
|
service card. Attendees can't check in to service sessions, so the
|
|
"You weren't checked in" note was equally noise there.
|
|
|
|
**Fix.** `const showFeedback = !isService;` in `SessionDetail.tsx`; all three
|
|
feedback surfaces (review block, **Give feedback ⭐** button, "not checked in"
|
|
note) are gated on it. The sheet itself stays — service cards remain openable
|
|
(title, time, room, "No pick needed for this slot.").
|
|
|
|
## 3. "🎬 Demo clock" badge removed from Home
|
|
|
|
The simulated clock (`use_realtime_clock = false`, the default) is an internal
|
|
demo aid; attendees were never meant to see it. The badge is gone from the Home
|
|
header (`apps/convivo/src/screens/Home.tsx`, `clockMode` dropped from the
|
|
`useEvent()` destructure — `noUnusedLocals` requires it). `useEvent()` still
|
|
exposes `clockMode`; the admin Events toggle is unchanged.
|
|
|
|
## Already fixed before this round (no code change)
|
|
|
|
- **Pick → detail instead of routing to Agenda** and **duplicated "Slot" time** —
|
|
shipped in `ef0446d`, live since the 2026-10-16 deploy.
|
|
- **Filters keep service sessions** — on purpose (confirmed with the user):
|
|
Level/Area filters apply to talks; service slots always show. Documented in
|
|
[screens.md](../frontend/screens.md#agenda).
|
|
- **"No picks" text next to existing picks** — shipped in `999527b`, live since
|
|
2026-10-17 (verified present in the served bundle `index-CRttiV1E.js`). The
|
|
screenshot predates that deploy; `index.html` is served `no-cache` and there
|
|
is no service worker, so a reload picks it up.
|
|
|
|
## Verification
|
|
|
|
- `convivo-admin-entry.spec.ts`: three new API-mocked cases —
|
|
*service session detail shows no feedback UI for a staff speaker*,
|
|
*keeps the paragraph breaks of a multi-line description* (asserts
|
|
`white-space: pre-line`, exact `textContent` newlines preserved, and that the
|
|
block renders taller than the same text with collapsed whitespace —
|
|
`toHaveText` normalises whitespace and would pass trivially), and a
|
|
no-"Demo clock"-badge assertion appended to each existing demo-clock
|
|
scenario. **45/45** against the local dev server (`:3000`).
|
|
- `npm run build --prefix apps/convivo` clean; bundle grep confirms `Demo
|
|
clock` absent and `.sd-desc`/`.fr-text` in the CSS.
|
|
- Docs synced in the same commit: [screens.md](../frontend/screens.md),
|
|
[app-structure.md](../frontend/app-structure.md),
|
|
[tests.md](../backend/tests.md), [next-steps.md](../next-steps.md).
|
|
|
|
## Deployment (2026-10-18)
|
|
|
|
Attendee-only deploy of commit `6bde90a` — three files (`SessionDetail.tsx`,
|
|
`Home.tsx`, `styles.css`). No migration, no admin/sidecar/DB change, no data
|
|
touched.
|
|
|
|
- Drift guard: all three prod files matched the `1e3c969` baseline exactly
|
|
(`caecaf06…`, `15f5059f…`, `5b2f531a…`) → whole-file copy from HEAD was safe;
|
|
applied files matched `6bde90a` (`1e03aa2e…`, `a46cb004…`, `88ff0b55…`).
|
|
- Backup `/home/APPE/convivo-backups/fbpolish-6bde90a-20261018T162520Z`
|
|
(baseline source, payload, before/after sha, container inventory, build log) +
|
|
rollback tag `convivo-app:rollback-fbpolish-6bde90a-20261018T162520Z`.
|
|
- Build-before-`up`; only `convivo-app` recreated (new container
|
|
`48d7c1c024b5`). `UNRELATED_CONTAINERS_UNCHANGED` — admin, sidecar and every
|
|
`supabase_*` container kept their IDs. `nginx -t` ok; both apps HTTPS 200.
|
|
- Live bundle `index-DRSsD1hj.js` / `index-4X1LaDjo.css` — **byte-identical** to
|
|
a clean local build of `6bde90a` (sha256 `07723429…` / `82324185…`), proving a
|
|
faithful production build. The previous bundle `index-CRttiV1E.js` now 404s.
|
|
Note: assets are served gzip'd by nginx, so compare with `curl --compressed`.
|
|
- Markers: `.sd-desc` and `.fr-text` present in the served CSS, `Demo clock`
|
|
absent from the served JS, `give-feedback` still present (non-service path).
|
|
- **45/45** mocked Playwright checks against `https://convivo.appe.at`.
|
|
|
|
---
|
|
|
|
# Badge Printing End-to-End (2026-10-18)
|
|
|
|
Welcome-desk badge printing on a Raspberry Pi: scan a lanyard QR, the badge
|
|
prints seconds later. Full reference: [backend/printing.md](../backend/printing.md).
|
|
**Status: local only — production deployment pending at the time of writing.**
|
|
|
|
## What shipped
|
|
|
|
- **Database** — migration
|
|
[`20261018170000_badge_print_queue.sql`](../../supabase/migrations/20261018170000_badge_print_queue.sql):
|
|
`pgmq` queues `badge_print` / `badge_print_dlq`, the `print_stations` table
|
|
(SHA-256 token digests, RLS with no policies), the self-contained
|
|
`convivo.badge-print/v1` payload, `welcome_checkin` re-created to enqueue the
|
|
badge on a **first** check-in in the same transaction, seven admin RPCs
|
|
(reprint, station create/rename/revoke, overview, DLQ requeue/discard) and
|
|
four token-gated printer RPCs (claim / complete / fail / heartbeat).
|
|
- **Admin** — the **Printing** view (stations, queue counters, recent jobs with
|
|
Reprint, dead letters with Requeue/Discard), the always-visible sidebar
|
|
**printer status pill** with staff-facing hints, the **Print** button on
|
|
Registrations rows, and the standalone print renderer entry (`print.html` →
|
|
`window.renderBadge`, built by `npm run build:print`) sharing the editor's
|
|
`BadgeRender` code and **bundled @fontsource fonts**, so preview = print on
|
|
any machine.
|
|
- **Worker** — `apps/printer/`: Python in Docker (repo-root build; a Node stage
|
|
builds the renderer into the Playwright Chromium runtime image). Long-polls
|
|
the queue with the station token, screenshots the badge at 300 dpi, composes
|
|
it onto the **detected** roll (die-cut exact canvas / endless cut-to-length /
|
|
auto-rotate / `LayoutTooLarge` → DLQ), prints on a Brother QL-1110NWB over
|
|
USB with status read-back, and heartbeats every 10 s (the station name comes
|
|
from the heartbeat response, so renames apply without re-provisioning).
|
|
- **Station rename** — `rename_print_station` RPC + inline rename in the
|
|
Printing view.
|
|
- **Pi provisioning + Wi-Fi portal** — `apps/printer/pi/setup.sh` +
|
|
`install.sh` (idempotent, staged): Docker, watchdog, `usblp`/`ipp-usb`
|
|
handling, the worker container, and **comitup** providing the open AP
|
|
`Convivo-Printer-<nnnn>` with a captive portal at **http://10.41.0.1**:
|
|
**pick any Wi-Fi + optional Convivo settings** (URL / anon key / station
|
|
token) from a phone. A comitup callback writes `/run/convivo/network.json`
|
|
for the worker. Operational detail:
|
|
[`apps/printer/AGENT.md`](../../apps/printer/AGENT.md).
|
|
- **Status labels (opt-in)** — `STATUS_LABELS=1` (default off) prints
|
|
locally-drawn "ready" / "needs Wi-Fi" labels on the printer itself, since
|
|
the Pi has no screen.
|
|
- **Fixes found on real hardware** — claim long-poll clamped to **2 s**
|
|
(Supabase `anon` has a 3 s `statement_timeout`; 10 s caused HTTP 500
|
|
`57014`); setup re-execs systemd only on config change and restarts comitup
|
|
after (a bare `daemon-reexec` broke the hotspot's DHCP); Docker restarted
|
|
only on `daemon.json` change (a bounce re-ran the worker on the old image);
|
|
install uploads to `/var/tmp` (the Pi's `/tmp` is a ~1 GB tmpfs); `ipp-usb`
|
|
masked (it grabbed the printer's USB interfaces — "Resource busy").
|
|
|
|
## Validation
|
|
|
|
- **SQL:** `supabase/tests/badge_print_tests.sql` — rollback-only, run combined
|
|
with the migration: **101/101 assertions** (payload shape, layout resolution,
|
|
first-scan enqueue, token lifecycle, retry/backoff/DLQ, heartbeat, role
|
|
guards, idempotent re-apply).
|
|
- **Worker:** pytest `apps/printer/tests` — **77 passing** (56 test
|
|
functions, 77 with parametrized label cases; no hardware or browser required).
|
|
- **Browser:** `e2e/tests/printing.spec.ts` — **15/15** API-mocked Playwright
|
|
tests (pill states + mobile, token-shown-once, rename, requeue/discard,
|
|
reprint, Print button, 5 s polling).
|
|
- **Real Pi end-to-end:** a provisioned Pi 4 with a QL-1110NWB printed live
|
|
badges against the local Supabase stack — welcome check-in → queue → print →
|
|
archive, plus reprint, revoke (token rejected immediately), rename visible on
|
|
the next heartbeat, and the DLQ path.
|
|
- **Portal:** joined the open `Convivo-Printer-<nnnn>` AP from a phone, picked
|
|
a Wi-Fi network at http://10.41.0.1, and the worker reconnected and resumed
|
|
claiming on the new network.
|
|
- Neighbour regression green: `badge_layout_tests.sql` (15 assertions — the
|
|
print payload reuses badge layouts).
|
|
|
|
## Deployment
|
|
|
|
**Deployed to production 2026-10-18** (commit `a2fe724`, admin-only + DB migration).
|
|
|
|
- **Migration** `20261018170000_badge_print_queue.sql` applied to prod in a
|
|
single transaction with `ON_ERROR_STOP=1` and recorded in the ledger
|
|
(ledger 38 → 39). `pgmq 1.5.1` was already available on the prod image (no
|
|
`shared_preload_libraries` change needed); the queues `badge_print` /
|
|
`badge_print_dlq`, `print_stations`, and all admin/printer RPCs are present.
|
|
Backup `/home/APPE/convivo-backups/printqueue-20261018T201701Z` (pg_dump,
|
|
counts, runtime admin source, rollback tag `convivo-admin:rollback-printqueue-…`).
|
|
- **SQL regression** `badge_print_tests.sql` run rollback-only against prod in
|
|
the same transaction as the migration: **101/101 assertions**, then rolled
|
|
back — `print_stations`/queues/events/counts unchanged afterwards.
|
|
- **Admin** rebuilt from HEAD with a baseline drift guard (all 9 changed prod
|
|
files byte-identical to `HEAD~1` → whole-file copy safe). Only
|
|
`convivo-admin` recreated; every unrelated container ID preserved. Live
|
|
bundle `index-pPo7RVlo.js` is byte-identical to the local HEAD build.
|
|
- **Station** `Welcome desk` provisioned in prod (token shown once, only its
|
|
SHA-256 stored). `printer_heartbeat` returns 200 over PostgREST with the
|
|
anon key + bearer token.
|
|
- **Pi** reconfigured from the local dev stack to `https://convivo.appe.at`
|
|
(`BADGE_CHECKIN_ORIGIN=https://admin.appe.at`); the running worker image
|
|
already matched HEAD, so no rebuild was needed — only `.env` swap +
|
|
`docker compose up -d --force-recreate`. The station now heartbeats to prod
|
|
(`last_seen_at` fresh, `last_status` reporting printer ready).
|
|
|
|
Troubleshooting lessons are collected in [printing.md §11](../backend/printing.md#11-troubleshooting-lessons-learned).
|
|
|