fix(jsonb): shared_with containment uses JSON-stringified arrays

↗ view on GitHub · Allen Morgan · 2026-05-08 · 1c9e295b

supabase-js's .contains([...]) on a JSONB column was emitting Postgres
array-literal syntax (cs.{x,y}), which Postgres rejects with "invalid
input syntax for type json". Passing a JSON-formatted string instead
produces cs.<jsonarray>, which PostgREST interprets as JSON containment
(@>). Affects:

  * lib/access.ts        - listAccessibleProjectIds
  * routes/projects.ts   - list + getById + share lookups
  * routes/tabular.ts    - direct-share review lookup

The fix is paired with structured logging on every shared_with query
(the previous shape silently 500'd with a raw Postgres message in the
response body and no backend trace) and downgrades the shared-projects
failure mode from "fail the whole request" to "log + return owned
projects only" so a transient shared-with failure can't lock a user
out of their own data.

Worth upstreaming as an independent bug-fix PR once the provider-
boundary refactors land.
Repository Altien/mikeOssAzure
Author Allen Morgan <amorgan@altien.com>
Authored
Parents 16a0799f
Stats 3 files changed , +220 , -125
Part of Fix: shared_with JSONB containment uses JSON-stringified arrays

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-1c9e295b.md from inside the repo you want the change in.

⬇ Download capture-commit-1c9e295b.md