One app wrapper, components/shared/TextBox.tsx, around chatkit's
DictationField. Every textarea in the portal and the admin now uses it:
profile, clinical context, check-in notes, new message, booking notes,
cancellation reason, clinician bio, programme notes, clinical notes,
goal notes and admin profile edits. The two thread reply boxes (patient
and clinician) are now chatkit's Composer.
The microphone is off (voice={false}). These fields hold health data.
Without a transcribeUrl, chatkit falls back to the browser's speech
recogniser, which sends audio to the browser vendor, and AGENTS.md lets
health data go only to an EU/CH provider under a DPA. Turn it on in
TextBox once a consent-gated transcription route exists.
Textarea, compose-row and send-button CSS that nothing uses any more
is removed.
Claude-Session: https://claude.ai/code/session_019MDtmrZVd3q4PDcqQwfLT9
Co-authored-by: Claude <noreply@anthropic.com>
* chore: add a formatter, matching the style this repo already writes
singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.
Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* style: format with prettier (304 files)
Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: teach git blame to skip the reformat
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* style: format the two files the reformat pass missed
prettier --check flagged app/shared.module.css and lib/domain/clinicians.test.ts
on a branch whose whole point was that everything had been formatted. Re-running
the same command with the same version fixes both, so the rollout's write step
did not finish what it reported.
The rollout now runs --check straight after --write and refuses to open a PR
unless it comes back clean, so a partial reformat fails at the source instead of
in CI.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* 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>
Both admin note fields lacked maxLength enforcement on the client despite
server Zod schemas using PATIENT_NOTE_MAX_LENGTH. Now consistent.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Network error handling:
- DocumentAddForm, ProgrammeAssignmentForm, InlineMessageCompose,
AdminNotesForm all lacked try/catch — buttons stuck on network failure
SSOT fix:
- Added DOCUMENT_MAX_FILE_SIZE_MB = 20 to lib/config/portal.ts
- Upload route now derives MAX_BYTES from the constant instead of
hardcoding 20 * 1024 * 1024
- DocumentAddForm label now reads the constant instead of 'max 20 MB'
— changing the limit in one place updates validation + UI label
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>