Files
c84bf110e9 feat(schema): the practice is a row, seeded from COMPANY and asserted equal (#89)
`COMPANY` is a const, and 0 of 24 tables carry an org column — so "the clinic"
is a literal you must fork, not a value you can vary. That is the same shape
this repo already corrected twice one level down: `COMPANY.clinicianName` and
the hand-authored per-email scheduling map both stopped being true the moment
there were two of the thing they named.

Adds `organizations`, seeded with this deployment's practice (migration 0016),
and `getOrganization()` so reading the practice is a function call rather than
a module constant. The ~109 existing `COMPANY.x` reads are correct for a
single-practice deployment and are deliberately untouched: surfaces convert
one at a time when a second practice arrives. That is the difference between
a later refactor and a later rewrite, which is the whole point.

`COMPANY` stays the source of the seed rather than the reverse, because the
manifest, OG image and sitemap render at build time with no database — a
clinic whose name exists only in a row cannot render its own favicon.

Two expressions of one fact is the arrangement that rots, and this repo has an
instance that did: `--muted` was darkened for WCAG AA on 2026-04-15 and
`COLOR_MUTED` in lib/config/theme.ts only caught up on 2026-04-28, shipping
the contrast-failing grey in every OG image, manifest and email for 13 days.
That file still says "update both manually" and still has no test. This one
has one, and it needs no database — the seed is parsed out of the migration.

Proved by mutation, not by passing: a drifted value fails the matching field,
and deleting `ON CONFLICT` fails the idempotency assertion. The first draft of
that second case reported "no tests" instead, because the parser was keyed to
the clause it was testing — a gate whose breakage looks like silence is not a
gate, so it now terminates on the statement's own semicolon.

No tenancy column, by decision: separate database per deployment cannot leak
between practices, whereas `org_id` on 24 tables makes every WHERE clause
load-bearing for confidentiality, and user-isolation.test.ts guards patient
isolation, not practice isolation. Recorded in CLAUDE.md.

pnpm verify: 88 files, 1321 tests, green.


Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 08:33:45 +00:00
..