-
Notifications
You must be signed in to change notification settings - Fork 5
ENG-1330: zod schema for discourse relations #719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENG-1330: zod schema for discourse relations #719
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
1 similar comment
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ 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. Comment |
There was a problem hiding this 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.
0370894 to
22c8d6b
Compare
mdroidian
left a comment
There was a problem hiding this 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?
22c8d6b to
bc39440
Compare

https://www.loom.com/share/ea503e1ac69d4a8a8be222770058e3bf
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.