feat(supabase): postgrest data-api resolver#141
Open
jaylann wants to merge 1 commit into
Open
Conversation
Add SupabasePostgrestResolver — the tabular complement to the auth and storage resolvers (#70). It reaches a subject's PII held in PostgREST-exposed application tables, driven by an explicit, auditable list of PostgrestTable/PostgrestColumn declarations (no schema discovery). Per table, export issues GET /rest/v1/{table}?{subject_column}=eq.{id} &select=... and emits one ExportRecord per populated declared column; erasure issues DELETE ... with Prefer: return=representation. An empty representation across every declared table is already_absent=True (absence is PostgREST's empty array, not a 404). The subject id rides httpx params as eq.<id> and is matched literally, so a hostile id never widens the filter or hits a sibling. Empty tables raise ConfigurationError. errors.raise_for_taxonomy gains a system= label so the shared taxonomy names the rejecting Supabase surface (auth keeps its existing message). The resolver attests an AttestingResolver covered surface built from the declared columns and passes the shared ResolverConformanceSuite; property tests pin no-bleed and idempotent convergence. Service-role key bypasses RLS — server-side only; fresh httpx client per call (ADR 0006). Signed-off-by: Justin Lanfermann <Justin@Lanfermann.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SupabasePostgrestResolver(name="supabase_postgrest") — the tabular complement to the auth (feat: supabase auth resolver (auth.users) #56) and storage (feat: supabase storage resolver #57) resolvers: reaches a subject's PII in PostgREST-exposed application tables (/rest/v1/...), driven by an explicit, auditable list ofPostgrestTable/PostgrestColumndeclarations (no schema discovery).errors.raise_for_taxonomywith asystem=label so the shared taxonomy names the rejecting Supabase surface; auth keeps its exact message.AttestingResolvercovered surface built from the declared columns; passes the sharedResolverConformanceSuite; property tests pin no-bleed and idempotent convergence.Erasure/export semantics
No change to what any existing resolver deletes or exports — this is purely additive (a new resolver, new ref kind
supabase_postgrest). MINORfeat:.New surface introduced by this resolver:
GET /rest/v1/{table}?{subject_column}=eq.{id}&select=...→ oneExportRecordper populated declared column, sourced under the table name. Null/missing cells are skipped.DELETE /rest/v1/{table}?{subject_column}=eq.{id}withPrefer: return=representation. An empty representation across every declared table ⇒already_absent=True(PostgREST signals no-match with an empty array, not a 404). The subject id rides httpxparamsaseq.<id>and is matched literally — a hostile id (/,..,,, spaces) never widens the filter or targets a sibling stem (pinned by a unit test + property tests).Adding/recategorising a declared column changes that deployment's export surface; the config list is the auditable record of what the resolver reaches.
Risk
Low. Self-contained new module; no core changes. Empty
tablesraisesConfigurationError(no degraded mode). Service-role key bypasses RLS — documented server-side-only. Freshhttpxclient per call (ADR 0006), no cached loop-bound state. Rollback = revert the commit; nothing else depends on it.Checklist
stage(nevermain)just checkandjust testgreen locally (modulo the unrelated test: composite-FK schema falsifies test_resurrecting_a_row_deleted_row_flips_verified #140 failure)type:*+area:*labels set