docs(docs): Step 4 sheet model in CLAUDE.md, SUPABASE.md, WORKSPACE, README, plan note, changelog
This commit is contained in:
1 parent
8cac8b1a68
commit
6966c54a2e
7 files changed
+51
-13
No files matched your search
@@ -138,6 +138,12 @@ Tests: importer reproduces the Step 1 mapping table exactly; every audit 07 spec
|
||||
Manual validation: open IMPORT-REPORT.md: 27 annotations, 26 mapped, 1 detail trigger, 5 spine zones with region codes C/T/L/S/Cd, 9 bilateral, 2 views; diff document.json against docs/faunosteo-audit/anatomical-sheet-example.json for sanity.
|
||||
Definition of Done: seed document committed; packages/domain and packages/anatomy have no DOM import outside anatomy/dom/*; no runtime code imports zoneMatch outside legacy/.
|
||||
Risks: subtle divergences between parser and importer on the detail trigger (no name, category kept); Horse_head.svg id space overlaps if a future file reuses ids (mitigated by per-view id scoping in the importer).
|
||||
Adjustment 2026-10-08 (user brief for Step 4): the step is split. Step 4 = model, validation,
|
||||
persistence foundations and tests (packages/domain, migration 20261008110000_anatomical_sheets,
|
||||
pgTAP 005, docs/development/ANATOMICAL_SHEET_MODEL.md). Step 4b = legacy importer producing the
|
||||
official equine sheet as a DRAFT with an import report, published only after business review.
|
||||
packages/anatomy is created at Step 4b. Labels use `{ fr, en }` objects, annotation→findings is
|
||||
`finding_zone_id`, finding categories carry a `kind`; see the spec for the final field names.
|
||||
```
|
||||
|
||||
```text
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Supabase: local stack, migrations, tests
|
||||
|
||||
Status: Step 3 deliverable, 2026-10-08. Covers the foundation only (profiles,
|
||||
platform roles, audit log). Conventions: `BACKEND_ARCHITECTURE.md` §3–§9.
|
||||
Status: Step 3 deliverable, extended at Step 4 (2026-10-08). Covers the
|
||||
foundation (profiles, platform roles, audit log) and the anatomical sheet
|
||||
tables (`ANATOMICAL_SHEET_MODEL.md`). Conventions: `BACKEND_ARCHITECTURE.md` §3–§9.
|
||||
|
||||
## 1. Layout
|
||||
|
||||
@@ -11,13 +12,17 @@ supabase/
|
||||
├─ migrations/ forward-only SQL, <timestamp>_<name>.sql
|
||||
│ ├─ 20261008100000_foundation.sql schemas private/audit, updated_at, audit log
|
||||
│ ├─ 20261008100100_profiles.sql profiles + auth.users trigger + RLS
|
||||
│ └─ 20261008100200_platform_roles.sql platform_role, profile_roles, helpers, RPCs
|
||||
│ ├─ 20261008100200_platform_roles.sql platform_role, profile_roles, helpers, RPCs
|
||||
│ └─ 20261008110000_anatomical_sheets.sql species, sheets, immutable versions, assets, lifecycle RPCs
|
||||
├─ seed.sql LOCAL dev accounts + first owner (never run in prod)
|
||||
└─ tests/ pgTAP, one file per concern, allowed AND denied paths
|
||||
packages/supabase/
|
||||
├─ src/client.ts createBrowserClient() (anon key, PKCE)
|
||||
├─ src/database.types.ts `supabase gen types` output
|
||||
├─ src/anatomical-sheets.ts publishSheetVersion(): Zod + integrity gate before the RPC
|
||||
└─ tests/db/ PGlite harness: runs the pgTAP files without Docker
|
||||
packages/domain/
|
||||
└─ src/anatomical-sheet/ canonical sheet document (Zod), validateSheetDocument, createEmptySheetDocument
|
||||
```
|
||||
|
||||
## 2. Prerequisites
|
||||
@@ -89,7 +94,7 @@ Two runners, one SQL source of truth (`supabase/tests/*.sql`, pgTAP):
|
||||
|
||||
| Command | Engine | Needs Docker | What runs |
|
||||
|---|---|---|---|
|
||||
| `pnpm --filter @faunosteo/supabase test:run` | PGlite (PostgreSQL 17 in WASM) | no | shim of the Supabase base schema + all migrations + every pgTAP file; schema ↔ types check; client factory |
|
||||
| `pnpm --filter @faunosteo/supabase test:run` | PGlite (PostgreSQL 17 in WASM) | no | shim of the Supabase base schema + all migrations + every pgTAP file; schema ↔ types check; client factory; publish gate |
|
||||
| `pnpm db:test` | `supabase test db` (pg_prove in the local stack) | yes | the same pgTAP files against the real Supabase image |
|
||||
|
||||
`pnpm test:run` at the root runs the PGlite suite together with the app
|
||||
@@ -97,6 +102,10 @@ suite. The shim (`packages/supabase/tests/db/supabase-shim.sql`) recreates
|
||||
the API roles, `auth.users`, `auth.uid()` and the permissive default
|
||||
privileges of Supabase so that a forgotten `revoke` fails a test.
|
||||
|
||||
Two parity traps met so far: counts must be scoped to fixture ids (the real
|
||||
stack carries `seed.sql` rows), and `order by` on text must pin
|
||||
`collate "C"` (the real image sorts with a locale collation, PGlite with C).
|
||||
|
||||
How a test impersonates a user (same technique in both runners):
|
||||
|
||||
```sql
|
||||
|
||||
@@ -13,6 +13,7 @@ faunosteo/
|
||||
│ ├─ src/ public/ tests/ scripts/ index.html
|
||||
│ ├─ vite.config.ts vitest.config.ts tsconfig*.json eslint.config.js
|
||||
│ └─ package.json app dependencies and scripts
|
||||
├─ packages/domain/ @faunosteo/domain: canonical anatomical sheet document (Zod) + integrity rules
|
||||
├─ packages/supabase/ @faunosteo/supabase: typed client, generated types, PGlite SQL tests
|
||||
├─ supabase/ Supabase CLI config, migrations, seed, pgTAP tests (docs/development/SUPABASE.md)
|
||||
├─ docker/ nginx.conf, entrypoint.sh (unchanged)
|
||||
|
||||
Reference in new issue
Block a user