chore(chore): capitalize step 3 — BDR-026..029, LRN-035/036, BLK-006, EVAL-006, journal, TODO

This commit is contained in:
bchanot committed 2026-10-08 22:48:17 +02:00
1 parent 1e7d0327cc
commit d5a5a720a1
6 files changed
+68 -2

No files matched your search

+9
View File
@@ -49,3 +49,12 @@ Iterations:
3. `corepack prepare pnpm@10.13.1` → works. Last major before the node:sqlite cache backend; reads lockfile v9 unchanged; already cached on dev host.
Fix: Dockerfile:7 pinned to `pnpm@10.13.1`.
Status: resolved (commit 990c8e7).
---
## BLK-006 | 2026-10-08 | Docker socket permission denied → no local Supabase stack for Claude
Friction: `supabase start` → "permission denied … /var/run/docker.sock"; daemon up (`docker info` client OK), user not in `docker` group. No psql/postgres on host either.
Root: host group membership; needs `sudo usermod -aG docker $USER` + re-login (user runs, not Claude).
Workaround: PGlite harness (BDR-028) executes migrations + 81 pgTAP checks; CLI config parses (`supabase start` fails only at Docker inspect).
Status: open — real-stack run (`pnpm db:start && pnpm db:test && pnpm db:types:check`, manual curl script SUPABASE.md §8) pending user Docker access or CI runner.
+31
View File
@@ -224,3 +224,34 @@ Status: closed.
gitflow lib purges `docs/superpowers/{specs,plans}` at every `finish` (BDR-065, fixed path list). Step 1 finish deleted 9 design docs (8f217d8). Restored from history under `docs/history/superpowers/` (not purged); refs updated (CLAUDE.md, migration map, plan). Audit docs keep old path (frozen).
Alt rejected: revert in place → purged again next finish; editing the lib list → global change for one repo.
Status: closed.
---
## BDR-026 | 2026-10-08 | platform_role enum = owner/admin/moderator/support only; professional statuses excluded
Business arch §4.1 lumps 7 values in `profile_roles.role` (practitioner/student/professor + 4 platform). User rule: never confuse platform roles with professional statuses. Table name kept `profile_roles` (plan + helper names unchanged), enum `platform_role` 4 values. practitioner/student/professor → verification outcome (identity step); cabinet roles → organization_members. Hierarchy for checks: owner ⊇ admin ⊇ moderator; support separate (§17.3). Deactivated profile (`active=false`) → all helpers false.
Alt rejected: 7-value enum per arch doc → self-declared "practitioner" row readable as verified status.
Status: closed (user instruction), name `profile_roles` open to rename if user prefers `platform_roles`.
---
## BDR-027 | 2026-10-08 | Role writes RPC-only + audited; column-level GRANT protects profiles.active / phone_verified_at
No INSERT/UPDATE/DELETE policy on `profile_roles`; only `grant_platform_role` / `revoke_platform_role` (security definer, actor = auth.uid(), self-target refused, owner any role / admin moderator+support) → `private.assign/withdraw_platform_role` → `private.log_event`. Bootstrap first owner: `assign_platform_role(null, uid, 'owner')` from privileged SQL. Last active owner cannot be revoked. `profiles`: `grant update (display_name, first_name, last_name, phone, locale, timezone)` instead of a protect-columns trigger → `active`, `phone_verified_at` raise 42501 for API role, server functions untouched.
Alt rejected: BEFORE UPDATE trigger checking auth.uid() → blocks future server RPC acting for the caller; column grants declarative, visible in `has_column_privilege`.
Status: closed.
---
## BDR-028 | 2026-10-08 | pgTAP single source of SQL tests; PGlite runner in vitest beside `supabase test db`
Docker socket denied to user on dev host (BLK-006). PGlite 0.3.16 (PG17 WASM) ships pgtap extension → `packages/supabase/tests/db/` applies `supabase-shim.sql` (API roles, auth.users, auth.uid(), Supabase default privileges) + migrations, runs every `supabase/tests/*.sql`, fails on `not ok` / plan mismatch. Same files run by `supabase test db` on real stack (CI supabase job). Shim replicates permissive default privileges so a missing `revoke` fails.
Alt rejected: TS-only RLS tests (duplicate harness, drift); waiting for Docker (no executed proof).
Status: closed.
---
## BDR-029 | 2026-10-08 | database.types.ts hand-written in `supabase gen types` format + schema↔types test
CLI gen needs running stack. File written in generator format (Row/Insert/Update/Relationships/Functions/Enums/Constants). `schema-types.test.ts`: compile-time exhaustiveness (every Row column listed, every Args key listed) + runtime diff vs information_schema / pg_enum / pg_proc in PGlite; also pins RLS-on + no `using(true)` for every future public table. CI `db:types:check` diffs against real generator once Docker available; first real run may reformat (PostgrestVersion string) → regenerate + commit.
Status: closed; column scalar types (uuid→string…) reviewed by hand, not executed.
+7
View File
@@ -42,3 +42,10 @@ Method: 7 files on real assets (SVG, catalog, fixtures), oracle = audit tables (
Result: 271/271 green, 0 src change. Audit figures all confirmed (26 mappings score 0, 792/612/41, 48 attrs…).
Anomalies: 4 assertions wrong on first run, all test-side (census regex, stale closure, ZONES drawn as bullet rows not ' · ' line, attachment names in object streams). None app-side.
Action: LRN-033. Known quirks pinned as "KNOWN:" tests (orphan findings, no_attachment cause lost, sphenoid id, fuzzy FR pairs).
## EVAL-006 | 2026-10-08 | Step 3 Supabase foundation — PGlite suite
Method: 4 pgTAP files (81 checks: schema/privileges 24, profiles RLS 17, platform roles 28, audit 12) + schema↔types (6) + client (2) on PGlite; root typecheck/lint/build; app suite.
Result: all green first run except plan count (27→28) and pgtap-in-public polluting function census; 278 app + 13 package tests. Zero app behaviour change.
Anomalies: `set_config` rows appear in TAP line capture (noise, filtered by regex). `now()` constant in tx broke naive updated_at>created_at assertion.
Action: LRN-035/036. Not executed: real Supabase image (`supabase test db`), `gen types` diff, seed.sql (needs auth.identities + extensions.crypt), REST manual script. Flagged in report + BLK-006.
+4
View File
@@ -172,3 +172,7 @@ fix(editor) 2803cf7 — pathology-editor.html 404 in prod (faunosteo.com/patholo
SaaS migration kickoff. Step 0: 8 docs in docs/development/ (27-step plan, domain map, FE/BE arch, migration, tests, 9 open questions) — user validated + decided: no external users, no v2 compat obligation, equine only, 2 SVG assets kept, import anomalies into draft (no silent fix), self-hosted Supabase on adequate infra, design decisions gated by user (ChatGPT), manual report points confirmed. Step 1: 91 characterisation tests, 2 golden fixtures, CHARACTERIZATION_REPORT.md; 271/271, typecheck/lint/build green; host had no pnpm → corepack (LRN-032). Both committed on feature/step-01-characterisation-tests, validated.
- Step 2 (same day): app → apps/app (git mv, 144 R100), pnpm workspace, Node 24 + pnpm 10.13.1 pins, Dockerfile node:24 filtered build (unverified locally, no daemon), Gitea CI, WORKSPACE.md; 271/271, typecheck, lint, build green from root. Finish purged docs/superpowers (lib BDR-065) → restored under docs/history (BDR-025). Both steps merged into develop (c8d48ab, 4959602). BDR-023/024/025, LRN-034. User confirmed `@faunosteo/app`; working method set: harness owns gitflow/memory/quality, user gives step goals, design changes gated. Next: Step 3 on user goals.
## 2026-10-08 (session 3 — Step 3)
Step 3 Supabase foundation on feature/step-03-supabase-foundation (9 commits, pushed). Docker socket denied (BLK-006) → PGlite+pgtap harness (BDR-028). 3 migrations: foundation (private/audit, set_updated_at, append-only audit_logs, log_event), profiles (auth trigger, own-row RLS, column grants), platform_roles (4-value enum BDR-026, RPC-only writes audited BDR-027, helpers hierarchy). 81 pgTAP checks allowed+denied; packages/supabase (client PKCE, types in gen format BDR-029, schema↔types test); app env.supabase null-safe, lib/supabase.ts, entrypoint/env.example; CI supabase job; SUPABASE.md. 278+13 tests, typecheck/lint/build green. Not run: real stack, gen types, seed. LRN-035/036, EVAL-006. Next: user validation; Step 4 (sheet model) parallelizable; Docker access for real-stack proof.
+14
View File
@@ -267,3 +267,17 @@ Apply: any "tests before migration" step on untested legacy code.
`allowBuilds` key in pnpm-workspace.yaml = pnpm ≥10.14 syntax; 10.13.1 ignores it silently → "Ignored build scripts: @swc/core, esbuild" on every install. Fix: `onlyBuiltDependencies` list. Warning persists until `pnpm rebuild` (state cached in node_modules/.modules.yaml), then disappears.
Also: root scripts calling `pnpm -r` fail under `corepack pnpm` (shim not on child PATH) → pin pnpm as root devDependency.
Apply: any pnpm 10.x workspace; check `pnpm --version` vs key syntax before trusting a silent config.
---
## LRN-035 | 2026-10-08 | PGlite + pgtap = Dockerless Supabase RLS tests
`@electric-sql/pglite` 0.3 bundles `pgtap`, `pgcrypto`, `uuid_ossp` (`import { pgtap } from '@electric-sql/pglite/pgtap'`). Boot ~1s, `create extension pgtap with schema extensions` + `set search_path to public, extensions` (else pgTAP functions pollute `public` and break "list public functions" checks; filter `pg_depend deptype='e'` too). `db.exec(file)` runs multi-statement begin…rollback; collect string cells → TAP lines; fail on `/^not ok/` or `# Looks like`. After error: `rollback` to clear aborted tx. Impersonate: `set local role authenticated; set_config('request.jwt.claims', '{"sub":…}', true)`. `now()` frozen in tx → test updated_at by overwriting then `is(updated_at, now())`.
Apply: any Supabase project needing SQL tests in CI without Docker.
---
## LRN-036 | 2026-10-08 | Supabase default privileges grant ALL to anon/authenticated on new public tables
Hosted/local Supabase: `alter default privileges … grant all on tables/functions to anon, authenticated, service_role`. New table or RPC = anon can SELECT/EXECUTE until revoked (RLS still filters rows, but RPC runs). Pattern per migration: `revoke all on <table> from public, anon, authenticated;` then exact grants (column-level for partial UPDATE); `revoke all on function … from public, anon`. Also Postgres default EXECUTE to PUBLIC on functions in own schemas → `alter default privileges in schema private revoke execute on functions from public`. Shim replicates defaults so pgTAP `has_table_privilege('anon',…)` catches omissions.
Apply: every migration; pin with pgTAP privilege checks.
+3 -2
View File
@@ -49,7 +49,7 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo
- [x] Step 0 — preparation docs in docs/development/ (2026-10-08, validated)
- [x] Step 1 — characterisation tests: 7 files / 91 cases, 2 golden fixtures, docs/development/CHARACTERIZATION_REPORT.md; 271/271, typecheck, lint, build green (2026-10-08, branch feature/step-01-characterisation-tests, awaiting validation)
- [x] Step 2 — monorepo workspace: apps/app via git mv (144 files), root scripts, Node 24 + pnpm 10.13.1 pins, Dockerfile node:24 + filtered build, CI .gitea/workflows/ci.yml, WORKSPACE.md; 271/271, typecheck, lint, build green from root (2026-10-08, branch feature/step-02-monorepo-workspace, uncommitted, awaiting validation)
- [ ] Step 3 — Supabase foundation (2026-10-08, branch feature/step-03-supabase-foundation)
- [x] Step 3 — Supabase foundation (2026-10-08, branch feature/step-03-supabase-foundation, awaiting validation; real-stack run pending Docker access BLK-006)
- [x] 3.0 context: plan Step 3, BACKEND_ARCHITECTURE §2-§9, business §4.1/§17/§29; Docker socket denied to user → PGlite harness as executable proof, pgTAP kept for `supabase test db`
- [x] 3.1 supabase/config.toml (CLI pinned as root devDependency) + `supabase/seed.sql` (local users only)
- [x] 3.2 migration 0001 foundation: schemas private/audit, set_updated_at, audit.audit_logs append-only, private.log_event
@@ -60,7 +60,8 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo
- [x] 3.7 app integration: env.ts supabaseUrl/anonKey, lib/supabase.ts lazy client (null when unconfigured), entrypoint.sh + .env.example + compose; no UI change; tests
- [x] 3.8 CI: supabase job (start, db reset, test db, gen types diff); check job runs PGlite suite via pnpm -r
- [x] 3.9 docs: docs/development/SUPABASE.md (start/reset/test/types/bootstrap owner), CLAUDE.md folder map + scopes, README pointer
- [ ] 3.10 verify: typecheck, test:run (271 + new), lint, build; registries + journal; report
- [x] 3.10 verify: typecheck, test:run 278 app + 13 supabase (81 pgTAP), lint 0, build OK; BDR-026..029, LRN-035/036, BLK-006, EVAL-006
- [ ] Step 4 — sheet model + importer (next, on validation; ∥ Step 3 per plan)
---