Skip to content

ENG-1469: Refactor getDiscourseRelations and getDiscourseNodes to read from block props#853

Merged
sid597 merged 3 commits intomigration-block-init-staging-branchfrom
eng-1469-refactor-getdiscourserelations-and-getdiscoursenodes-to-read
Mar 9, 2026
Merged

ENG-1469: Refactor getDiscourseRelations and getDiscourseNodes to read from block props#853
sid597 merged 3 commits intomigration-block-init-staging-branchfrom
eng-1469-refactor-getdiscourserelations-and-getdiscoursenodes-to-read

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Mar 3, 2026

https://www.loom.com/share/c2ec64fca234492d9a0cd15f7a44a067


Open with Devin

Summary by CodeRabbit

  • New Features

    • Extended conditional logic system with new "not or" operator for more complex condition combinations.
  • Refactoring

    • Restructured internal data handling for discourse nodes and relations to align with updated system architecture.

@linear
Copy link

linear bot commented Mar 3, 2026

@supabase
Copy link

supabase bot commented Mar 3, 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 ↗︎.

@sid597
Copy link
Collaborator Author

sid597 commented Mar 3, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

This PR implements a feature-flagged migration of discourse nodes and relations retrieval from legacy configuration to a new settings-store-backed approach. The accessors are refactored to transform settings data into standardized DiscourseNode and DiscourseRelation types, the Condition type is exported publicly with a new "not or" variant, and consumer functions conditionally route to the new store or preserve existing behavior.

Changes

Cohort / File(s) Summary
Type definitions and transformations
apps/roam/src/components/settings/utils/zodSchema.ts, apps/roam/src/components/settings/utils/accessors.ts
Extended Condition type to include "not or" variant; refactored getAllDiscourseNodes() and getAllRelations() with new transformers (toDiscourseNode, addConditionUids) to normalize settings data into DiscourseNode[] and DiscourseRelation[] structures; updated return types and type imports.
Feature-flagged consumers
apps/roam/src/utils/getDiscourseNodes.ts, apps/roam/src/utils/getDiscourseRelations.ts
Introduced conditional logic using isNewSettingsStoreEnabled() to route node/relation retrieval to new settings-store accessors or preserve legacy behavior; maintains existing fallback and configuration patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main refactoring work: changing getDiscourseRelations and getDiscourseNodes to read from block props via the new settings store.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
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.

coderabbitai[bot]

This comment was marked as resolved.

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 6 additional findings.

Open in Devin Review

initSingleDiscourseNode was writing backedBy: "default" which caused
nodes to be filtered out of the settings panel when the flag is ON.
Also fixes up existing graphs that already stored the wrong value.
devin-ai-integration[bot]

This comment was marked as resolved.

@sid597 sid597 requested a review from mdroidian March 4, 2026 19:11
@sid597 sid597 merged commit 6606ffa into migration-block-init-staging-branch Mar 9, 2026
9 checks passed
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.

2 participants