Repository navigation
feat(office-settings): read and write the platform settings in core.system_config - #31
Merged
Merged
Conversation
…ystem_config `core.system_config` is service-role only: RLS is off and it grants nothing to `authenticated`, so a client reading it through PostgREST gets 42501. The admin geographic-settings screen did exactly that and failed on every load. Widening the grant is the wrong fix — the table holds platform limits only the office role may see — so the read moves behind a role-checked endpoint like every other office screen. `officeSettings.getGeographic()` / `.updateGeographic()` against `/v1/office/settings/geographic`. Refs Scaffald/SaaS#856 Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 22, 2026
Scaffald/sdk#31 merged as f29eb76. Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 22, 2026
…t PostgREST (#863) * fix(office): the geographic settings screen reads through the API, not PostgREST `core.system_config` has RLS off and grants nothing to `authenticated`, so the screen's direct `supabase.schema('core')` read answered 42501 on every load. The grant is deliberately not widened: the table holds platform limits — storage caps, photo limits, the site-overlap threshold — that only the office role may read or change, and SELECT for every logged-in user is a far wider door than one admin form needs. Service role behind a role-checked endpoint is how every other office screen reads privileged data. GET /v1/office/settings/geographic PUT /v1/office/settings/geographic A missing row is not an error: the setting has simply never been changed from its default, and answering 404 would put the screen into its error state on a healthy install. `value` is jsonb and has been written both as a number and as a quoted string, so the handler reads either. On the client, `useGeographicSettings` / `useUpdateGeographicSettings` replace the direct query. The failed read now renders once, with a retry, instead of raising a toast from inside the effect that fetched — which is what made the failure re-trigger itself (#852 fixed the unbounded half; this removes the failure). Needs the pointer re-pointed at the squashed commit once Scaffald/sdk#31 merges. Closes #856 Co-Authored-By: Claude Opus 5 <[email protected]> * chore(sdk): repoint the submodule at the squashed commit on sdk main Scaffald/sdk#31 merged as f29eb76. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
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.
Part of Scaffald/SaaS#856.
core.system_confighas RLS off and grants nothing toauthenticated, so any client reading it through PostgREST gets42501 insufficient privilege. The admin geographic-settings screen read it directly and failed on every load — and its error path re-triggered the read, so it made roughly 35,000 requests per visit and never settled.Widening the grant is the wrong fix: the table holds platform limits (storage caps, photo limits, the site-overlap threshold) that only the office role may read or change. The read moves behind a role-checked endpoint instead, like every other office screen.
Adds
OfficeSettingswithgetGeographic()andupdateGeographic()against/v1/office/settings/geographic, registered on the client asofficeSettingsand exportingGeographicSettings.tsc --noEmitandpnpm buildclean. The endpoint ships in the SaaS PR.🤖 Generated with Claude Code