Skip to content

Comments

ENG-1465: Enable dual read feature flag#811

Open
sid597 wants to merge 2 commits intoeng-1217-section-components-in-left-sidebarv2from
eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor
Open

ENG-1465: Enable dual read feature flag#811
sid597 wants to merge 2 commits intoeng-1217-section-components-in-left-sidebarv2from
eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Feb 22, 2026

ENG-1454: Enable dual read feature flag

add caller


Open with Devin

Summary by CodeRabbit

  • New Features

    • Added "Enable dual read" toggle in Admin Panel settings to control alternative data read behavior.
  • Chores

    • Improved settings lifecycle management for monitoring configuration changes.

@linear
Copy link

linear bot commented Feb 22, 2026

@supabase
Copy link

supabase bot commented Feb 22, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Collaborator Author

sid597 commented Feb 22, 2026

@sid597
Copy link
Collaborator Author

sid597 commented Feb 22, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

✅ Actions performed

Full review triggered.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

This PR introduces the "Enable dual read" feature flag with supporting infrastructure across multiple modules. The changes add UI rendering in AdminPanel, define the schema field, create an accessor utility, wire a feature flag handler with logging, and update the initialization flow to set up and tear down pull-watchers on application load/unload.

Changes

Cohort / File(s) Summary
Feature Flag UI
apps/roam/src/components/settings/AdminPanel.tsx
Added FeatureFlagPanel component import and rendering in FeatureFlagsTab with title, description, and featureKey for "Enable dual read".
Settings Schema & Utilities
apps/roam/src/components/settings/utils/zodSchema.ts, apps/roam/src/components/settings/utils/accessors.ts
Added "Enable dual read" boolean field to FeatureFlagsSchema and created isDualReadEnabled() accessor utility for querying the feature flag.
Pull-Watchers Handler
apps/roam/src/components/settings/utils/pullWatchers.ts
Added featureFlagHandlers entry for "Enable dual read" that logs transitions on flag changes; removed placeholder handlers.
Initialization Lifecycle
apps/roam/src/index.ts
Updated initSchema to expose blockUids in return value and integrated setupPullWatchOnSettingsPage(blockUids) with corresponding cleanup on unload for settings page watcher lifecycle management.

Sequence Diagram

sequenceDiagram
    participant App as Application<br/>(index.ts)
    participant Schema as Settings Schema<br/>(initSchema)
    participant Watchers as Pull-Watchers<br/>(setupPullWatchOnSettingsPage)
    participant Handlers as Flag Handlers<br/>(featureFlagHandlers)
    participant UI as AdminPanel<br/>(FeatureFlagPanel)

    App->>Schema: initSchema()
    Schema-->>App: return { blockUids, ... }
    
    App->>Watchers: setupPullWatchOnSettingsPage(blockUids)
    Watchers->>Watchers: register handlers for feature flags
    Watchers-->>App: return cleanup function
    
    Note over UI: User toggles "Enable dual read"
    
    UI->>Handlers: Feature flag value changes
    Handlers->>Handlers: Execute "Enable dual read" handler
    Handlers->>Handlers: Console log transition (newValue, oldValue)
    
    Note over App: Application unload
    App->>App: cleanupPullWatchers()
    App->>Watchers: Execute cleanup function
    Watchers->>Watchers: Unregister watchers
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding an 'Enable dual read' feature flag to the system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment on lines +471 to +475
<FeatureFlagPanel
title="Enable dual read"
description="When enabled, accessor getters read from block props instead of the old system. Surfaces dual-write gaps during development."
featureKey="Enable dual read"
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 FeatureFlagPanel missing initialValue causes checkbox to always render unchecked

The new FeatureFlagPanel for "Enable dual read" in AdminPanel does not pass initialValue, so the checkbox always starts as unchecked regardless of the persisted feature flag state.

Root Cause

The BaseFlagPanel component initializes its internal state with initialValue ?? false (BlockPropSettingPanels.tsx:177-178). Since initialValue is not provided by the caller at AdminPanel.tsx:471-475, the checkbox always renders as unchecked.

The existing FeatureFlagPanel usage in GeneralSettings.tsx:43-47 correctly passes initialValue={settings.leftSidebarEnabled.value} to reflect the persisted state. The new usage should similarly read the stored value, e.g. via getFeatureFlag("Enable dual read") from accessors.ts:283-286.

Impact: If a user enables "Enable dual read", navigates away from the Admin Panel, and returns, the toggle will incorrectly show as unchecked even though the feature is still enabled. Toggling it again would be a no-op or cause confusion about the actual state.

Prompt for agents
In apps/roam/src/components/settings/AdminPanel.tsx, at lines 471-475, the FeatureFlagPanel for "Enable dual read" needs an initialValue prop to reflect the persisted state. Import getFeatureFlag from ~/components/settings/utils/accessors (it's already available in the file's scope since setFeatureFlag is imported from the same module). Then pass initialValue={getFeatureFlag("Enable dual read")} to the FeatureFlagPanel. Note that this should be computed inside the component, ideally via useMemo or during the initial render, similar to how GeneralSettings.tsx:46 passes initialValue={settings.leftSidebarEnabled.value}. You may need to add getFeatureFlag to the existing import statement on line 41.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@sid597 sid597 force-pushed the eng-1328-port-small-blueprint-based-misc-settings-into-props-based branch from 1d2ba62 to 4634da5 Compare February 23, 2026 10:40
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch 2 times, most recently from 23d75a0 to 9dddded Compare February 23, 2026 13:51
@sid597 sid597 force-pushed the eng-1328-port-small-blueprint-based-misc-settings-into-props-based branch 2 times, most recently from 1b440fb to 586c385 Compare February 23, 2026 14:13
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 9dddded to 41691df Compare February 23, 2026 14:13
@sid597 sid597 changed the base branch from eng-1328-port-small-blueprint-based-misc-settings-into-props-based to graphite-base/811 February 23, 2026 14:31
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 41691df to 176d0d1 Compare February 23, 2026 14:31
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 176d0d1 to 86bbad9 Compare February 23, 2026 14:35
@sid597 sid597 changed the base branch from graphite-base/811 to eng-1217-section-components-in-left-sidebarv2 February 23, 2026 14:36
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from a8420de to 307dd54 Compare February 23, 2026 15:28
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch 2 times, most recently from 9ab2003 to 64767b4 Compare February 23, 2026 15:31
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from 307dd54 to 5bcf109 Compare February 23, 2026 15:31
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from 64767b4 to fbc154f Compare February 23, 2026 16:40
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from 5bcf109 to a679322 Compare February 23, 2026 16:40
@sid597 sid597 changed the title ENG-1454: Enable dual read feature flag ENG-1465: Enable dual read feature flag Feb 23, 2026
@sid597 sid597 force-pushed the eng-1465-add-enable-dual-read-feature-flag-with-reactive-accessor branch from fbc154f to ace46c2 Compare February 23, 2026 17:53
@sid597 sid597 force-pushed the eng-1217-section-components-in-left-sidebarv2 branch from a679322 to 79d4150 Compare February 23, 2026 17:53
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