Repository navigation
Closed
Description
Goal
Drop two Supabase functions that nothing calls: get_bookmark_count and admin_get_user_notification_subs. Maintainer ruling on #327, 2026-10-24.
Facts
Checked at 25992f89e.
git grepfinds no caller of either function inapps/,extensions/orpackages/, outside the generatedapps/webapp/src/types/supabase.ts.- Close the remaining 47 linter warnings on functions #318 made both
service_roleonly (packages/supabase/migrations/20261014121100_close_self_gated_and_trigger_function_grants.sql:17). Close the remaining 47 linter warnings on functions #318 left the drop to its own issue. get_bookmark_count(character varying, boolean)is defined inpackages/supabase/scripts/07-bookmark-functions.sql:238-279. Its search path is at:343, and its grants at:358-359.admin_get_user_notification_subs()is defined inpackages/supabase/scripts/07-4-push-notifications-pgmq.sql:489-513. Its search path is at:754.- Its body gates on
is_admin(auth.uid()), so underservice_roleit returns zero rows. A code comment says not to call it (apps/hocuspocus.server/src/api/controllers/admin-stats.controller.ts:428).
What to do
- Remove both functions from the two scripts: the definition, the comment, the search-path line and the grant lines.
- Add a paired migration in
packages/supabase/migrations/, with a timestamp later than the newest file there (20261023120000at25992f89e). It runsdrop function if existsfor each signature above. - Run
bun run --filter @docs.plus/supabase_back seed, which regeneratespackages/supabase/seed.sqlfrom the scripts. Then runbun run --filter @docs.plus/supabase_back types. Commit both regenerated files,seed.sqlandapps/webapp/src/types/supabase.ts, in the same change. Never hand-edit either one. Without the seed step, thegit grepbelow still finds both functions inseed.sql. - Update the comment at
admin-stats.controller.ts:428, so it no longer names a dropped function. - Apply the migration to the local database without a reset, as
packages/supabase/CLAUDE.mdsays. A reset wipes the local volume that other worktrees share. Then runpackages/supabase/scripts/check-grants.sql. It returns 0 rows.
Acceptance criteria
-
git grep -nE 'get_bookmark_count|admin_get_user_notification_subs' -- . ':!packages/supabase/migrations'finds nothing. - The migration applies locally, and
check-grants.sqlreturns 0 rows. - The regenerated
supabase.tsis in the same commit. - After the production push, the maintainer runs
check-grants.sqlon production, and it returns 0 rows.
Effort and order
Effort S. No blocker. It lands with the other Supabase work in this milestone.
Parent: #327. Ruled there on 2026-10-24.
Activity
HMarzban commentedon Oct 25, 2026
Built and committed on local main. Awaits the maintainer's final push.
Remaining gates: the Supabase production push, then
check-grants.sqlon production (0 rows).fix(supabase): drop the unused get_bookmark_count and admin_get_user_…
refactor: cross-review wave-1
HMarzban commentedon Nov 3, 2026
Status, 2026-11-03. The drop is pushed in
eb4e7fb53. Its CHANGELOG entries are in5cfcc023d. These steps are left:20261025120000to prod.check-grants.sqlon prod.The guard will also show
default_acl_openrows forpgmqandstorage. Those belong to #570 and stay until its held migration20261026120000lands.HMarzban commentedon Nov 3, 2026
Live in production. Migration
20261025120000(eb4e7fb53) is applied, soget_bookmark_countandadmin_get_user_notification_subsare dropped. On 2026-11-03 the maintainer pushed every pending Supabase migration to production withsupabase db push, andpackages/supabase/scripts/check-grants.sqlthen returned 0 rows.