fix(rest-native): Phase 1 — add 22 missing tables/views to READ whitelist#546
Conversation
…list +4 tables: collections, collection_products, variant_supplier_sources, supplier_branches +1 table: price_history +17 views: categories_tree_visual, materials_complete, mv_*, v_kit_*, v_n8n_*, v_product_*_cdn, v_products_* +1 SEARCH_COLUMNS: collections Audit: 121 scenarios simulated, 0 regressions. Restores ~25 screens.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA PR expande a whitelist de tabelas/views seguras do módulo REST-native, adicionando suporte de leitura para MudançasExpansão da whitelist REST-native
Esforço estimado de revisão🎯 2 (Simples) | ⏱️ ~10 minutos A mudança é direta: expansão de configuração sem alteração nas assinaturas de função exportadas, sem lógica complexa ou riscos de segurança/performance aparentes. A principal atenção deve ser verificar se as tabelas/views listadas são de fato seguras para leitura pública e se a coluna Possíveis PRs relacionadas
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds 22 missing tables/views to the REST native read whitelist (REST_NATIVE_SAFE_TABLES) so existing callers stop silently returning empty arrays now that the edge_external_db_bridge kill-switch is OFF. Also maps collections → name in SEARCH_COLUMNS.
Changes:
- Promote 4 tables (
collections,collection_products,variant_supplier_sources,supplier_branches) and addprice_historyto READ whitelist. - Add 17 views/MVs to READ whitelist.
- Add
collections → nametoSEARCH_COLUMNSand a Phase 1 comment block / section header.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
collections,collection_products,variant_supplier_sources,supplier_branches(were write-only, had active read callers)price_history(212 rows, callers usesupabase.from()directly)categories_tree_visual,materials_complete,mv_material_group_stats,mv_product_compositions,mv_product_intelligence,products_with_materials,v_kit_with_components,v_media_stats,v_n8n_sync_errors,v_n8n_sync_success_recent,v_n8n_sync_summary,v_product_images_cdn,v_product_videos_cdn,v_products_min_price,v_products_missing_primary_image,v_products_with_tags,v_products_without_imagescollections → name// ── Core product tables ──section header addedContext
Kill-switch
edge_external_db_bridgehas been OFF (enabled=false, rollout=100%) since 2026-05-30. An exhaustive audit (121 scenarios, 0 regressions) found these 22 tables/views exist indoufsxqlfjyuvxuezplnwith active callers but were missing fromREST_NATIVE_SAFE_TABLES. With the bridge OFF they silently returned empty arrays, breaking ~25 screens.Known risks (pre-existing, not caused by this PR)
useKitStockForecastuses non-existent columns onvariant_supplier_sources— catch returns[](same as before)collectionsRLS: onlyis_public=truerows visible withoutshare_tokenmv_product_intelligenceis a materialized view with 0 rows (needs REFRESH)Rollback
Remove the 34 added lines. No other file changes required.
Test plan
REST_NATIVE_SAFE_TABLESSet has 68 entriesSEARCH_COLUMNShas 18 entriescollections,variant_supplier_sources, and the view callersGenerated by Claude Code
Summary by cubic
Adds 22 missing tables and views to
REST_NATIVE_SAFE_TABLESso existing callers return data again withedge_external_db_bridgeoff. Also addscollections → nametoSEARCH_COLUMNS. Restores ~25 screens and removes silent empty results.collections,collection_products,variant_supplier_sources,supplier_branches,price_historycategories_tree_visual,materials_complete,mv_material_group_stats,mv_product_compositions,mv_product_intelligence,products_with_materials,v_kit_with_components,v_media_stats,v_n8n_sync_errors,v_n8n_sync_success_recent,v_n8n_sync_summary,v_product_images_cdn,v_product_videos_cdn,v_products_min_price,v_products_missing_primary_image,v_products_with_tags,v_products_without_imagescollections → nameWritten for commit 6513cb3. Summary will update on new commits.
Summary by CodeRabbit