Files
CatoandClaude Fable 5.1 fb10722852 feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#205)
* feat(chat): the answer feedback loop — thumbs, transcript export, nightly review

Every answer in Heidi's chat now carries chatkit 0.14's thumbs. A thumb down
asks why in one tap (the reasons in all seven site languages) and the thumb
is kept in a new `chat_feedback` table through `POST /api/chat/feedback`
(zod, chat-rate limited, same-origin; a saved conversation's thumb needs its
owner, the browser-only draft's needs nobody). `GET /api/chat/review-export`
hands the fleet's nightly reviewer the saved conversations of the last day —
bearer `CHAT_REVIEW_TOKEN` compared in constant time, 401/503 as the spec
says, at most 50 conversations of 30 turns, no deleted ones, the gate's
verdicts as steps, the thumbs beside them, never an actor id, a name or an
address — with Heidi's scope read from her own system prompt rather than
typed twice.

The fleet's one row under an answer (Copy · Listen · thumbs) replaces the
second Speak Heidi drew on the explanation; her own Speak and its caveat stay
on the dialect lines, where which voice the device has is a claim worth
making. Migration 0009 via drizzle-kit; the export is tested against an
in-memory Postgres with Heidi's migrations applied.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* test(chat): the no-database cases take DATABASE_URL away, not assume it

CI runs the unit tests against a Postgres service with every migration
applied, so the two "no database on this deployment" cases met a database
and got the 201 and the 200 they guard against. Each now removes
DATABASE_URL for its own duration and restores it; the routes read it at
call time, so the 503 path is what runs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 14:33:53 +02:00
..