docs(docs): Step 4 sheet model in CLAUDE.md, SUPABASE.md, WORKSPACE, README, plan note, changelog

This commit is contained in:
bchanot committed 2026-10-08 23:45:01 +02:00
1 parent 8cac8b1a68
commit 6966c54a2e
7 files changed
+51 -13

No files matched your search

+22 -6
View File
@@ -13,7 +13,9 @@ writes conclusion, and exports an A4 PDF. PDF carries the full JSON state as a n
attachment so importing it restores the session for a follow-up.
SPA deployed via Docker + nginx on Scaleway VPS. Backend foundation on Supabase
(PostgreSQL + Auth + RLS) since Step 3 of the SaaS plan: profiles, platform roles and
audit log exist; the UI does not use the client yet (local-only flows unchanged).
audit log exist; Step 4 added the canonical anatomical sheet model (`packages/domain`,
tables `species`, `anatomical_sheets` / `_versions` / `_assets`). The UI does not use
the client yet (local-only flows unchanged).
MVP species: equine only. Open-source MIT.
---
@@ -43,8 +45,9 @@ MVP species: equine only. Open-source MIT.
## Build commands
pnpm workspace: `apps/app` = the private application, `packages/supabase` =
Supabase access layer (see `docs/development/WORKSPACE.md`). Every command
pnpm workspace: `apps/app` = the private application, `packages/domain` = pure
Zod domain model (anatomical sheet document), `packages/supabase` = Supabase
access layer (see `docs/development/WORKSPACE.md`). Every command
below runs from the repository root and delegates to the packages.
```bash
@@ -192,12 +195,15 @@ faunosteo/
├─ eslint.config.js, index.html, package.json (@faunosteo/app)
├─ tsconfig*.json, vite.config.ts, vitest.config.ts
│ (end of apps/app)
├─ packages/domain/ ← @faunosteo/domain (pure, no DOM, zod only)
│ ├─ src/anatomical-sheet/{schema,validate,create}.ts ← canonical sheet document + integrity rules
│ └─ tests/{fixtures/horse-slice.ts,*.test.ts}
├─ packages/supabase/ ← @faunosteo/supabase
│ ├─ src/{index,client,database.types}.ts ← typed browser client + generated types
│ └─ tests/{client.test.ts,db/} ← PGlite harness, shim, pgTAP runner, schema↔types test
│ ├─ src/{index,client,database.types,anatomical-sheets}.ts ← typed client, generated types, publish gate
│ └─ tests/{client,anatomical-sheets}.test.ts, tests/db/ ← PGlite harness, shim, pgTAP runner, schema↔types test
├─ supabase/
│ ├─ config.toml, seed.sql ← CLI config (public schema only), local dev accounts
│ ├─ migrations/*.sql ← forward-only; foundation, profiles, platform_roles
│ ├─ migrations/*.sql ← forward-only; foundation, profiles, platform_roles, anatomical_sheets
│ └─ tests/*.sql ← pgTAP: allowed + denied paths per policy
├─ packages/README.md ← shared packages index
├─ .gitea/workflows/ci.yml ← CI: install, typecheck, test, lint, build, docker
@@ -320,6 +326,16 @@ Database (Supabase)
- A migration is never edited once applied. Each migration ships its pgTAP file with
allowed AND denied cases, and a regenerated `database.types.ts`.
- The browser holds the anon key only. `service_role` never appears in env.js, .env.example or code.
- pgTAP files run on PGlite and on the real image: scope counts to fixture ids, pin `collate "C"` on text ordering.
### Anatomical sheet model (packages/domain + migration 20261008110000)
- `docs/development/ANATOMICAL_SHEET_MODEL.md` is the source of truth: document shape, issue codes, tables, RPCs.
- Ids are stable slugs never derived from labels; labels are `{ fr, en }` objects. Annotation → findings is the
explicit `finding_zone_id`; vertebral regions are ordered data with free codes. No label matching at runtime.
- A published version is immutable (trigger, every role). Change = new draft (`create_sheet_draft`) then
`publish_sheet_version`. Integrity rule codes are shared by `validateSheetDocument` (TS) and
`private.sheet_document_issues` (SQL); add a rule on both sides and in the spec table.
- Document schema change → bump `SHEET_DOCUMENT_SCHEMA_VERSION`, extend the SQL CHECK on `document_schema_version`.
### Component stubs
- Scaffold stubs render <div>ComponentName placeholder</div>