fix(points): welcome check-in awards +10; add Sessions view, AI connection test, silent reload

The front-desk check-in set checked_in and printed badges but awarded nothing,
so the +10 depended on which check-in a person happened to get. Every award
path was reviewed:

- welcome_checkin awards +10 (category checkin) on a genuine first check-in and
  returns points + points_awarded; checkin_attendee and preview_welcome_checkin
  return points_awarded too.
- set_registration_checked_in(false) deleted all checkin points while keeping
  the checkins rows, and switching back on awarded nothing -- one mistaken
  toggle destroyed those points permanently. ON now recomputes from the rows
  that still exist and awards only the shortfall: reversible, still unfarmable.
- The staff/Admin/@appe.at exclusion stays (product decision) but is no longer
  silent: three-way points sheets in the scanner, "no points" with a tooltip in
  Registrations, and the Contacts points modal refuses to apply rather than
  letting adjust_points (void) no-op quietly.

Also in this change:
- admin silent refresh (5s poll + 500ms after writes) across all data views;
  Registrations patches in place so rows never slide under the cursor
- Settings "Validate AI connection" via a new sidecar POST /llm-test verdict
  endpoint (never leaks the key, distinguishes "no usage block" from "off")
- new Sessions view between Schedule and Activity: speakers, attendance,
  ratings, attendee filter, and one button that summarises every session with
  feedback (one request each, concurrency 3, UI blocked until all settle)
- provider requests disable thinking through one shared body builder sending
  both reasoning_effort:"none" and chat_template_kwargs.enable_thinking

SQL: 113 / 57 / 24 assertions (set_registration_checked_in section 3 was
rewritten, it asserted the bug). Sidecar 34 unit tests. Full e2e 202 passed,
0 failed. Migration applied locally only -- not deployed.
This commit is contained in:
Lago committed 2026-10-19 20:14:03 +02:00
1 parent 96e4e6a6ea
commit fdb6045966
35 files changed
+2778 -154

No files matched your search

+37
View File
@@ -51,6 +51,7 @@ declare
talk_two uuid := 'a0150000-0000-0000-0000-000000000012';
excluded_email text;
feedback_result record;
welcome_result record;
begin
perform pg_temp.assert_board((select bool_and(points = 0) from public.registrations
where contact_email in ('[email protected]','[email protected]','[email protected]')), 'excluded inserts force zero');
@@ -82,6 +83,42 @@ begin
perform pg_temp.assert_board(
(select not exists (select 1 from public.checkins where contact_email = '[email protected]')),
'front-desk gate blocks session check-in');
-- The front-desk welcome check-in is a real check-in: it awards the same +10
-- as a session scan, once per person, and says whether it paid out.
select * into welcome_result from public.welcome_checkin('[email protected]');
perform pg_temp.assert_board(
welcome_result.already = false and welcome_result.points_awarded
and welcome_result.points = 10,
'welcome check-in awards ten');
perform pg_temp.assert_board(
(select points = 10 and checked_in from public.registrations where contact_email = '[email protected]'),
'welcome check-in lands on the registration');
select * into welcome_result from public.welcome_checkin('[email protected]');
perform pg_temp.assert_board(
welcome_result.already and welcome_result.points = 10,
'welcome check-in is idempotent');
-- The gate is open for that attendee now, and both awards stack.
perform public.checkin_attendee(talk_one, '[email protected]');
perform pg_temp.assert_board(
(select points = 20 from public.registrations where contact_email = '[email protected]'),
'session scan after welcome totals twenty');
-- Staff and Admin-domain contacts are welcomed too, but earn nothing and the
-- RPC must not claim otherwise (that silence is what made points look broken).
-- Clear the flag first so this exercises the award branch, not the
-- already-checked-in shortcut.
update public.registrations set checked_in = false
where contact_email in ('[email protected]','[email protected]','[email protected]');
foreach excluded_email in array array['[email protected]','[email protected]','[email protected]'] loop
select * into welcome_result from public.welcome_checkin('LB-' || excluded_email);
perform pg_temp.assert_board(
welcome_result.already = false and welcome_result.points_awarded = false
and welcome_result.points = 0,
excluded_email || ' welcome awards zero and reports it');
perform pg_temp.assert_board(
(select checked_in from public.registrations where contact_email = excluded_email),
excluded_email || ' is still marked checked in');
end loop;
perform set_config('request.jwt.claims', '{"email":"[email protected]"}', true);
foreach excluded_email in array array['[email protected]','[email protected]','[email protected]'] loop
perform set_config('request.jwt.claims', json_build_object('email', excluded_email)::text, true);
select * into feedback_result from public.submit_feedback(talk_one, 5, 'Review');