Skip to content

refactor(db): every query through typed effect-orm builders - #598

Merged
Makisuo merged 4 commits into
mainfrom
t3/check-effect-orm-usage
Nov 20, 2026
Merged

Makisuo merged 4 commits into
mainfrom
t3/check-effect-orm-usage

chore(deps): lock @maple-dev/effect-orm 0.11.0

f2385b8
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 20, 2026 in 6m 14s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. The conversions preserve their WHERE clauses and filters; the message-search upsert's excludedAll() (does it rewrite id, the FTS content rowid?) is the one path no test pins.
no findings · tests covered · risk high

Replaces Hazel's hand-written SQL with typed effect-orm 0.11.0 builders across the sync runtime, objects, customers, auth and the bot gateway, and removes the Database service's raw query/execute/sql. The conversions I read keep the same filters and column values; no defect found.

  • Visibility filters become inSubquery/exists, keeping each principal's membership condition
  • Database loses query/execute/sql; tests seed through SqlClient
  • _object_meta, _changes, _outbox etc. become external query-only tables
  • sync-do outbox/inbox and _changes run through SQLite.runSync and fail with StoreError
What was checked
  • memberOf/channelAccess/conversationAccess keep their deletedAt IS NULL and user filters (org-source.ts:28-64)
  • searchAvailable still counts three sqlite_master tables; catchTag("DatabaseError") matches Hazel's tag (database.ts:40)
  • inList/valuesOf still bind one json_each parameter, isActive equals the old ACTIVE fragment (customers/sql.ts:8-25)

f2385b8 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.