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.

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 20:14:03 +02:00
1 parent cdb4793273
commit d3083b7940
35 files changed
+2778 -154

No files matched your search

+49
View File
@@ -45,6 +45,55 @@ an existing `@appe.at` contact). They return `Cache-Control: no-store`.
| `GET /sidecar/llm-settings` | Read redacted configuration. |
| `PUT /sidecar/llm-settings` | Save `{ endpoint, model, api_key? }`. |
| `POST /sidecar/feedback-summary` | Generate `{ scope: "event", event_id }` or `{ scope: "session", event_id, session_id }`. |
| `POST /sidecar/llm-test` | Make one real chat request with the **stored** settings and return a verdict. |
### Connection validation (`POST /sidecar/llm-test`)
Always answers **`200 OK` with a verdict** (only the auth layer returns 401/403,
and 405 for `GET`), because the reason a connection fails is the useful part:
```json
{"ok":true,"model":"Qwen3.8","endpoint":"https://ai.lago.dev/v1/chat/completions",
"latency_ms":412,"reasoning_disabled":true,"reasoning_tokens":0,"content":"OK",
"warning":null,"error":null}
```
- `reasoning_tokens` is the provider's own
`usage.completion_tokens_details.reasoning_tokens`, or **`null` when the
provider sent no `usage` block**. `null` is not "off"; `reasoning_disabled` is
`true` only when it is exactly `0`.
- `ok` answers "would generating a summary work?" — transport, auth and parsing
all fine. A working connection whose provider still reports reasoning tokens is
therefore `ok: true` with `reasoning_disabled: false` and a `warning`, so the
honest signal about cost stays separate from the pass/fail answer. The Admin UI
colours that case amber, not green.
- It never writes to the database, and the API key never appears in any field:
provider error text is flattened, truncated to 300 characters and the stored key
is replaced with `[redacted]` (a provider that echoes the Authorization header
in its own error body is covered by a test).
- An endpoint that fails the SSRF/DNS guard is reported **without ever contacting
it**.
### Disabling model thinking
Both requests (summaries and the test) are built by one helper,
`buildChatCompletionsBody`, so they cannot drift apart. It sends
`stream: false`, `reasoning_effort: "none"` **and**
`chat_template_kwargs: { enable_thinking: false }`. Measured against the
`ai.lago.dev` gateway (Bifrost → vLLM) serving `Qwen3.8`:
- Either field alone takes reasoning tokens from ~235 to `0`, about **3.5×
faster**. Both are sent because they cover different OpenAI-compatible
gateways and each silently drops the other; they agree, so the precedence rule
never matters.
- `thinking: { type: "disabled" }` (the Anthropic-style spelling) is **silently
ignored** by this endpoint and still cost ~235 reasoning tokens, so it is
deliberately not used.
- `max_tokens` is accepted and ignored, so it is not sent.
- **A `200 OK` proves nothing**: this endpoint ignores unknown fields entirely.
Only `usage.completion_tokens_details.reasoning_tokens === 0` is evidence.
Reasoning *levels* are validated though — `reasoning_effort: "banana"` is an
HTTP 400 `unsupported_value`, which is how the field was confirmed to be live.
The sidecar checks that the event exists and that a selected session belongs to
it. It reads all feedback in ordered 500-row pages, selecting only `rating` and