Fix silent shared-project misses in Supabase queries

Two of three call sites passing user email to Supabase's `.contains("shared_with", ...)` were sending a raw JS array instead of a JSON-encoded string, so the `@>` predicate matched nothing. Users with shared projects saw empty lists.

multi-tenantworkflow

Supabase's PostgREST .contains() on a jsonb column requires a JSON-encoded value - '["a@b.c"]' - not a JS array. Pass the array directly and PostgREST serializes it into a different shape, and the containment check silently returns zero rows.

CaliLuke extracted a three-line helper in backend/src/lib/sharedWith.ts:

export function sharedWithContains(email: string): string {
  return JSON.stringify([email]);
}

Three call sites are updated: backend/src/lib/access.ts:139 in listAccessibleProjectIds, backend/src/routes/projects.ts:41 in the GET /projects shared-projects branch, and backend/src/routes/tabular.ts:108. The tabular.ts site already had JSON.stringify(...) inline; the other two didn't. So this was a live bug, not a hygiene fix.

The same commit also downgrades the sharedError failure path in projects.ts from a 500 response to a console.warn. Own projects continue to return even if the shared-projects subquery fails.

So what Worth importing if your fork uses `shared_with` arrays. The helper change is four lines and directly restores correctness. The 500-to-warn downgrade is a separate judgment call - skip it if your alerting pipeline depends on 5xx rates.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from CaliLuke/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
bbd8de44 Centralize shared project lookup encoding CaliLuke 2026-05-05 ↗ GitHub

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-67.md from inside the repo you want the changes in.

⬇ Download capture-thread-67.md