mirror of
https://github.com/bitbaum/vitareba.git
synced 2026-12-05 19:18:29 +01:00
* fix(bookings): confirm bar only pins once there is something to confirm At 390px the sticky confirm bar was pinned from the moment the picker rendered, so an empty, disabled bar parked a white slab over "2 · Pick a day" — covering the step the patient still had to reach. It now sticks only after a slot is selected, which is when following the thumb is actually worth the screen it costs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(clinic): every patient is told their own doctor's name, not one from config COMPANY.clinicianName was a second source of truth for "who treats this patient". care_team is the first. The config answer was wrong for every patient who is not Manuel's — which is the whole point of signing up more clinicians — and it appeared in 20+ places: every onboarding email, the dashboard, the check-in page, the profile form, programme phase copy. Killing the property makes the compiler enumerate every site. Each one now resolves the real name via clinicianLabelFor(patientId), falling back to a neutral "your clinician" when nobody treats them yet. Copy that says "your clinician" is never wrong; copy that names the wrong doctor destroys trust in a clinical product. Where the actor is not the primary clinician, it now says who actually acted: newDocumentEmail names the uploader, programmeAssignedEmail names the admin who enrolled. Where the actor is unknowable — an unread reply can come from any care-team member — the copy stays unattributed rather than guessing. Also fixed along the way: - the public Inflection Edge results CTA interpolated an English name into German/French/Italian copy; the four message files now carry a localised "our clinical team" and the placeholder is gone - phase descriptions said "you will hear from him"; now "from them" - /checkin was a client route with no way to reach the database, so it is split into a thin server page + CheckinForm Never-Twice: lib/domain/clinician-discipline.test.ts fails CI if config regrows a clinician*Name key, or if any shared copy hardcodes a name from TEAM_MEMBERS. It caught two leaks this sweep had missed (programmes.ts, next-step.ts). pnpm verify green: lint, typecheck, 940 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(auth): a deleted or demoted account stops working within 5 minutes JWT sessions are self-contained. The jwt callback only touched the database at sign-in, so nothing afterwards knew the row it came from had changed: deleting a user left their session fully working, and revoking an admin left them admin — both until the cookie happened to expire. The callback now re-reads the users row when the token is older than SESSION_REVALIDATE_MS (5 min), and returns null when the row is gone, which ends the session. Role and email verification are refreshed from the row on the same pass, so a demotion also takes effect within one interval. A failed lookup deliberately does NOT end the session: an unreachable database is not evidence a user was deleted, and treating it that way would sign the whole clinic out during a blip. The token is returned unstamped so the check retries on the next request. The decision logic is a pure function pair in lib/domain/auth.ts rather than inline in the NextAuth factory, so it is testable: 10 cases cover deletion, demotion, the promote-only ADMIN_EMAILS recovery path, a backwards clock, and the database-down path. Middleware (lib/auth/edge.ts) still reads the token without a database — it cannot reach one from the Edge runtime. That is only coarse routing; every data path goes through requireSession()/requireAdmin() in the Node runtime, which is where this check now runs. pnpm verify green: lint, typecheck, 950 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>