Skip to content

feat: wire enable_realtime into DATABASE_SETTINGS_SQL COALESCE cascade#1129

Merged
pyramation merged 2 commits intomainfrom
devin/1778488542-wire-enable-realtime-cascade
May 11, 2026
Merged

feat: wire enable_realtime into DATABASE_SETTINGS_SQL COALESCE cascade#1129
pyramation merged 2 commits intomainfrom
devin/1778488542-wire-enable-realtime-cascade

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented May 11, 2026

Summary

Removes the hardcoded enableRealtime: false placeholder and wires enable_realtime into the DATABASE_SETTINGS_SQL COALESCE cascade, following the same pattern as all other feature flags (enable_llm, enable_ltree, etc.).

This is a follow-up to constructive-db#1105 (which added the enable_realtime column to database_settings and api_settings) and #1119 (which integrated RealtimeManager into the preset but hardcoded the flag to false because the column didn't exist yet).

Three changes in api.ts:

  1. SQL: added COALESCE(aps.enable_realtime, ds.enable_realtime) AS resolved_enable_realtime to the query
  2. Type: added resolved_enable_realtime: boolean to DatabaseSettingsRow
  3. Mapping: replaced enableRealtime: false with enableRealtime: row.resolved_enable_realtime in toDatabaseSettings

Updates since last revision

Added enable_realtime column to the integration test seed DDL (simple-seed-services/setup.sql). Without this, the DATABASE_SETTINGS_SQL query fails against the test database (column doesn't exist), queryDatabaseSettings catches the error and returns undefined, and all feature flags fall back to defaults — causing the Bob restricted API: uploadAppFile NOT exposed test to fail because the api_settings override for enable_presigned_uploads was silently ignored.

Review & Testing Checklist for Human

  • Deployment ordering: This PR assumes enable_realtime already exists in both services_public.database_settings and services_public.api_settings. If constructive-db#1105 has not been deployed to an environment, the DATABASE_SETTINGS_SQL query will fail. The failure is caught by queryDatabaseSettings's try/catch (returns undefined + logs a warning), but this means all database settings become undefined for that tenant — not just realtime. Verify feat: add DataBillingMeter and DataAggregateLimitCounter node types #1105 is deployed before rolling this out.
  • Verify the COALESCE cascade resolves correctly: api_settings.enable_realtime is nullable (NULL inherits from database_settings), while database_settings.enable_realtime is NOT NULL DEFAULT false. Confirm COALESCE produces the right result: api-level override wins when non-null, otherwise falls back to database-level default.
  • Test seed DDL stays in sync: The test seed in simple-seed-services/setup.sql manually mirrors the production database_settings / api_settings schema. Any future column additions to these tables will need a corresponding update to the seed DDL, or the same silent-failure pattern will recur.

Notes

  • With this merged, setting enable_realtime = true in database_settings (or per-API in api_settings) will cause RealtimeManager to start and the RealtimeSubscriptionsPreset to be included for that tenant.
  • The next step toward integration testing is deploying realtime_module to a test database and applying DataRealtime to a table (which automatically adds the @realtime smart tag).

Link to Devin session: https://app.devin.ai/sessions/19485cf5cc58416a9f86068563d512f5
Requested by: @pyramation

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.
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@blacksmith-sh

This comment has been minimized.

…i_settings

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.
@pyramation pyramation merged commit cb4ec37 into main May 11, 2026
54 checks passed
@pyramation pyramation deleted the devin/1778488542-wire-enable-realtime-cascade branch May 11, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant