Skip to content

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Jan 19, 2026

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

Summary by CodeRabbit

  • New Features
    • A new Relations management feature is now available in global settings. Users can define and configure custom relations with properties including labels, source/destination specifications, complement settings, conditional logic rules, and node positioning data. This enables sophisticated relation management and supports complex discourse configurations for advanced platform control.

✏️ Tip: You can customize this high-level summary in your review settings.

@linear
Copy link

linear bot commented Jan 19, 2026

@supabase
Copy link

supabase bot commented Jan 19, 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 ↗︎.

1 similar comment
@supabase
Copy link

supabase bot commented Jan 19, 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 sid597 changed the title zod schema for discourse relations ENG-1330: zod schema for discourse relations Jan 19, 2026
@sid597 sid597 marked this pull request as ready for review January 19, 2026 15:33
@sid597
Copy link
Collaborator Author

sid597 commented Jan 19, 2026

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

This pull request adds a new Relations feature to the GlobalSettings schema by introducing three Zod schemas (Triple, RelationCondition, DiscourseRelation) and extending GlobalSettingsSchema with a Relations field. The example file demonstrates the structure with two sample relation definitions containing metadata and conditional triples.

Changes

Cohort / File(s) Summary
Schema and Example Data for Relations Feature
apps/roam/src/components/settings/utils/zodSchema.ts, apps/roam/src/components/settings/utils/zodSchema.example.ts
Introduces three new Zod schemas: TripleSchema (tuple of three strings), RelationConditionSchema (with triples and nodePositions), and DiscourseRelationSchema (with id, label, source, destination, complement, triples, and ifConditions). Extends GlobalSettingsSchema with a Relations array field. Example file populates Relations with two sample relations (relation-uid-1 "Informs" and relation-uid-2 "Supports") including their metadata and conditional configuration. Exports new TypeScript types: Triple, RelationCondition, and DiscourseRelationSettings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 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 PR title clearly and specifically identifies the main change: adding a zod schema for discourse relations, which is directly reflected in the file modifications.
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.


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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/roam/src/components/settings/utils/zodSchema.ts`:
- Around line 139-154: The conversion currently drops relation metadata arrays:
STANDARD_ROLES (conceptConversion.ts) filters out triples and ifConditions and
discourseRelationSchemaToLocalConcept maps relation.triples to only the first
element via relation.triples.map((t) => t[0]), causing silent data loss when
producing LocalConceptDataInput for local_reference_content; update the
conversion to preserve the full arrays (include triples and ifConditions) by
adding them to the allowed output shape or extending LocalConceptDataInput to
accept a relations metadata field, remove or extend STANDARD_ROLES so it no
longer strips triples/ifConditions, and ensure
discourseRelationSchemaToLocalConcept copies relation.triples and
relation.ifConditions intact (instead of extracting only t[0]) so serialized
storage retains the full structures.

@sid597 sid597 force-pushed the eng-1330-add-zod-schema-for-the-discourse-relations branch from 0370894 to 22c8d6b Compare January 19, 2026 15:47
@sid597 sid597 requested a review from mdroidian January 19, 2026 15:51
Copy link
Contributor

@mdroidian mdroidian left a comment

Choose a reason for hiding this comment

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

Since these triples are just conditions I wonder if we could we reuse Conditions and/or ConditionSchema?

@sid597 sid597 deleted the eng-1330-add-zod-schema-for-the-discourse-relations branch January 20, 2026 16:09
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.

3 participants