Review v2: Drizzle setup + drizzle-kit pull schema.ts from basketball db

review-1089-2026-04-25-v2 Review

review needs-refinement

Verdict: NEEDS_REFINEMENT

Re-review of board item #1089 (forgejo_admin/westside-admin#1) after refinement per review-1089-2026-04-25. Type=Feature. All v1 [BODY] recommendations resolved. One [SCOPE] item remains: arch label backing note still missing.

v1 Recommendations Resolution

  • [x] [BODY] "Blocked by #6 + pal-e-platform#302" — RESOLVED. Lineage now reads: "Hard depends on forgejo_admin/westside-admin#6 ... Hard depends on forgejo_admin/pal-e-platform#302". Explicit issue numbers present.
  • [x] [BODY] CI drift AC narrowed — RESOLVED. AC now reads "scripts/check-schema-drift.sh runs locally with DATABASE_URL set and exits 0 if schema matches, non-zero on diff". Woodpecker wiring explicitly excluded under "Do NOT create" with cross-ref to #8. Script is a new file target.
  • [~] [SCOPE] Resolve arch label mismatch — PARTIALLY RESOLVED. Label was renamed arch:scopeddb-helperarch:scoped-db on board item #1089 (and #1091). However, no arch-scoped-db note exists in pal-e-docs (404 on direct slug, 0 hits on search). The project-westside-admin Architecture section still lists only 3 arch notes: arch-domain-westside-admin, arch-dataflow-westside-admin, arch-deployment-westside-admin. The new label still has no backing note.

Template Completeness

  • [x] Type, Lineage, Repo, User Story, Context, File Targets, Acceptance Criteria, Test Expectations, Constraints, Checklist, Related — all present and well-formed.
  • [x] File Targets section now includes scripts/check-schema-drift.sh.

Traceability

  • [x] story:admin-row-crud label — verified in project-westside-admin user-stories table (single v1 story).
  • [x] arch:scoped-db label — present (renamed since v1).
  • [ ] arch note MISSING — no arch-scoped-db note exists; project page Architecture section does not list it. [SCOPE] Either (a) create arch-scoped-db note documenting the tenant-scoped query helper component and add it to the project page Architecture list, OR (b) re-label this ticket and #1091 to arch:domain-westside-admin (closest existing fit since the artifact this ticket produces — schema.ts — is the schema dimension already documented there).
  • [x] Forgejo issue — https://forgejo.tail5b443a.ts.net/forgejo_admin/westside-admin/issues/1, open.

File Targets

Greenfield repo (only README.md on main). All targets are net-new creates; existence checks are N/A.
  • [x] drizzle.config.ts — config spec clear (dialect=postgresql, schema path, env-driven creds)
  • [x] src/lib/server/db.ts — pattern stated (lazy init, SIGTERM handling, @internal)
  • [x] src/lib/server/schema.ts — generated, committed
  • [x] package.json — deps + db:pull script
  • [x] scripts/check-schema-drift.sh — new in v2; locally runnable, exit-coded

Repo Placement

OK. Forgejo issue is on forgejo_admin/westside-admin. No cross-repo file targets.

Dependencies

  • Hard blocker: westside-admin#6 (scaffolding) — explicit in Lineage. Must merge first.
  • Hard blocker for AC verification: pal-e-platform#302 (admin_app Postgres user) — explicit in Lineage. Needed for db:pull and integration AC.
  • Decoupled: westside-admin#8 (Woodpecker CI) — drift check runs locally; CI wiring is out of scope per "Do NOT create" section. Good separation.
  • Downstream consumers: #2 (hooks-server), #4/#5 (page-server), #3 (scoped-db query helper) all import from src/lib/server.

Acceptance Criteria

6 ACs, all verifiable. Strong: explicit table count (22), enum count (18), local drift script with exit code, lazy init + SIGTERM. The CI-coupling concern from v1 is gone.

Blast Radius

Greenfield repo, no existing patterns to break. Driver choice (pg) matches westside-app convention. jsonb narrowing flagged with defer-or-document option.

Decomposition Assessment

5 file targets (was 4), 6 ACs, single repo, ~5–10 min agent work. Borderline acceptable as one ticket. No decomposition needed.

Recommendation

One remaining item:
  • [SCOPE] Resolve arch:scoped-db backing note. Two viable paths:
All [BODY] fixes from v1 are clean. Ticket body is dispatch-ready. The arch-note gap is the sole reason for NEEDS_REFINEMENT; depending on Ava's call this is a 5-minute docs fix or a label change. Once resolved, advance backlog → todo.