From f13e76cf9cca08166d2420456d7899b261a8c159 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Mon, 11 May 2026 08:37:45 +0000 Subject: [PATCH 1/2] feat: wire enable_realtime into DATABASE_SETTINGS_SQL COALESCE cascade Now that constructive-db#1105 is merged, the enable_realtime column exists in both database_settings and api_settings. Wire it into the COALESCE cascade so the resolved value flows through to the preset. --- graphql/server/src/middleware/api.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphql/server/src/middleware/api.ts b/graphql/server/src/middleware/api.ts index 147a39be9..b21134165 100644 --- a/graphql/server/src/middleware/api.ts +++ b/graphql/server/src/middleware/api.ts @@ -226,7 +226,8 @@ const DATABASE_SETTINGS_SQL = ` COALESCE(aps.enable_many_to_many, ds.enable_many_to_many) AS resolved_enable_many_to_many, COALESCE(aps.enable_connection_filter, ds.enable_connection_filter) AS resolved_enable_connection_filter, COALESCE(aps.enable_ltree, ds.enable_ltree) AS resolved_enable_ltree, - COALESCE(aps.enable_llm, ds.enable_llm) AS resolved_enable_llm + COALESCE(aps.enable_llm, ds.enable_llm) AS resolved_enable_llm, + COALESCE(aps.enable_realtime, ds.enable_realtime) AS resolved_enable_realtime FROM services_public.database_settings ds LEFT JOIN services_public.api_settings aps ON ds.database_id = aps.database_id AND aps.api_id = $2 WHERE ds.database_id = $1 @@ -325,6 +326,7 @@ interface DatabaseSettingsRow { resolved_enable_connection_filter: boolean; resolved_enable_ltree: boolean; resolved_enable_llm: boolean; + resolved_enable_realtime: boolean; } interface ApiListRow { @@ -672,9 +674,7 @@ const toDatabaseSettings = (row: DatabaseSettingsRow | null): DatabaseSettings | enableConnectionFilter: row.resolved_enable_connection_filter, enableLtree: row.resolved_enable_ltree, enableLlm: row.resolved_enable_llm, - // Reads from the COALESCE cascade once constructive-db#1105 is merged and - // the enable_realtime column exists in database_settings / api_settings. - enableRealtime: false, + enableRealtime: row.resolved_enable_realtime, }; }; From def6aa906ee9022d4cbc74ce60d3f6ec0a3b2b67 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Mon, 11 May 2026 08:51:33 +0000 Subject: [PATCH 2/2] fix: add enable_realtime column to test seed database_settings and api_settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DATABASE_SETTINGS_SQL query now references enable_realtime via the COALESCE cascade. The integration test seed DDL was missing this column, causing the query to fail and all feature flags to fall back to defaults — which made Bob's restricted API expose uploadAppFile when it should have been hidden by the api_settings override. --- .../__fixtures__/seed/simple-seed-services/setup.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphql/server-test/__fixtures__/seed/simple-seed-services/setup.sql b/graphql/server-test/__fixtures__/seed/simple-seed-services/setup.sql index 9f50cb495..b6b73cd35 100644 --- a/graphql/server-test/__fixtures__/seed/simple-seed-services/setup.sql +++ b/graphql/server-test/__fixtures__/seed/simple-seed-services/setup.sql @@ -302,6 +302,7 @@ CREATE TABLE IF NOT EXISTS services_public.database_settings ( enable_connection_filter boolean NOT NULL DEFAULT true, enable_ltree boolean NOT NULL DEFAULT true, enable_llm boolean NOT NULL DEFAULT false, + enable_realtime boolean NOT NULL DEFAULT false, options jsonb NOT NULL DEFAULT '{}'::jsonb, CONSTRAINT ds_db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE ); @@ -320,6 +321,7 @@ CREATE TABLE IF NOT EXISTS services_public.api_settings ( enable_connection_filter boolean, enable_ltree boolean, enable_llm boolean, + enable_realtime boolean, options jsonb NOT NULL DEFAULT '{}'::jsonb, CONSTRAINT as_db_fkey FOREIGN KEY (database_id) REFERENCES metaschema_public.database (id) ON DELETE CASCADE, CONSTRAINT as_api_fkey FOREIGN KEY (api_id) REFERENCES services_public.apis (id) ON DELETE CASCADE