feat(domain): equine legacy importer (packages/anatomy) + generated official equine sheet seed as draft
This commit is contained in:
1 parent
f4682cdba5
commit
52bfc11553
43 files changed
+18466
-33
No files matched your search
@@ -14,8 +14,12 @@ supabase/
|
||||
│ ├─ 20261008100100_profiles.sql profiles + auth.users trigger + RLS
|
||||
│ ├─ 20261008100200_platform_roles.sql platform_role, profile_roles, helpers, RPCs
|
||||
│ ├─ 20261008110000_anatomical_sheets.sql species, sheets, immutable versions, assets, lifecycle RPCs
|
||||
│ └─ 20261008110100_private_execute_hardening.sql EXECUTE revoked from PUBLIC on the Step 3 helpers
|
||||
│ ├─ 20261008110100_private_execute_hardening.sql EXECUTE revoked from PUBLIC on the Step 3 helpers
|
||||
│ └─ 20261009100000_sheet_asset_storage.sql bucket anatomical-sheet-assets + read policy through the sheet
|
||||
├─ seed.sql LOCAL dev accounts + first owner (never run in prod)
|
||||
├─ seed/anatomical-sheets/equine/v1/ official equine sheet as a DRAFT, generated by `pnpm import:equine`
|
||||
│ ├─ equine_v1.sql idempotent seed (sheet, 2 asset rows, draft v1), applied by db reset and by PGlite
|
||||
│ └─ document.json, legacy-id-map.json, assets.json, assets/*.svg, IMPORT-REPORT.md
|
||||
└─ tests/ pgTAP, one file per concern, allowed AND denied paths
|
||||
packages/supabase/
|
||||
├─ src/client.ts createBrowserClient() (anon key, PKCE)
|
||||
@@ -62,6 +66,33 @@ Local endpoints (`config.toml`):
|
||||
`pnpm db:start` prints the `anon` and `service_role` keys. Only the anon key
|
||||
ever reaches the browser.
|
||||
|
||||
Two kinds of seed (`config.toml [db.seed] sql_paths`):
|
||||
|
||||
| File | Scope | Content |
|
||||
| --------------- | ----------------- | ---------------------------------------------------------------------------------- |
|
||||
| `seed.sql` | local only | dev accounts + first owner |
|
||||
| `seed/**/*.sql` | every environment | versioned reference data, idempotent (today: the official equine sheet as a draft) |
|
||||
|
||||
The PGlite harness applies `seed/**` after the migrations, `seed.sql` never
|
||||
(it needs the real auth schema). On another environment, apply a versioned
|
||||
seed with `psql -f` from a privileged session, then upload its assets (§3.1).
|
||||
|
||||
### 3.1 Sheet assets (Storage)
|
||||
|
||||
SVG files live in the private bucket `anatomical-sheet-assets`, keyed by
|
||||
content (`<sha256>.svg`). Reading goes through the sheet (policy
|
||||
`anatomical_sheet_assets_read`): a published version of a usable sheet, or
|
||||
any version for its editors. No API role uploads; the operator does, with
|
||||
the service key, from the generated seed folder:
|
||||
|
||||
```bash
|
||||
SUPABASE_URL=http://127.0.0.1:54321 SUPABASE_SERVICE_ROLE_KEY=<service key> \
|
||||
pnpm assets:upload supabase/seed/anatomical-sheets/equine/v1
|
||||
```
|
||||
|
||||
The script verifies each file against `assets.json` (sha256, size) before
|
||||
uploading and skips objects already present.
|
||||
|
||||
Seed accounts (local only, password `LocalDev-only-password-1`):
|
||||
|
||||
| Email | Role |
|
||||
@@ -93,10 +124,10 @@ RLS enabled, no `using (true)` / `with check (true)` policy for `anon` or
|
||||
|
||||
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; publish gate |
|
||||
| `pnpm db:test` | `supabase test db` (pg_prove in the local stack) | yes | the same pgTAP files against the real Supabase image |
|
||||
| Command | Engine | Needs Docker | What runs |
|
||||
| -------------------------------------------- | ------------------------------------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `pnpm --filter @faunosteo/supabase test:run` | PGlite (PostgreSQL 17 in WASM) | no | shim of the Supabase base schema (auth + storage tables) + all migrations + `seed/**` + 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
|
||||
suite. The shim (`packages/supabase/tests/db/supabase-shim.sql`) recreates
|
||||
|
||||
Reference in new issue
Block a user