Repository navigation
ENG-2244 Create a discourse relation from canvas and associate it with the selected node type pair - #1557
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53DJCT7B1B1EH2SGWK7CT67
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53DJK4HHT5M8P4SJP1NHP0P
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53DKASE7WMVC6MZAD22WW9Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53DPPTTDD3PC2K1W4BQ65MP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53DYEBFE1XPJTCP4XXXNF5J
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M53E2VACPA43HK1R6PMZKRAE
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5535XZX4ZHXB6XF47RW7YX6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M553RFVK9VDD0CW414TY1TYN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M553XB2HTKC42JHFWGG761TS
… for provisional matches Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M55435EMQ14XZK0E385NCMMF
…nst fresh settings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M5549SPV81F6E131W85JA08Z
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
Devin Review found 4 potential issues.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| !(isAcceptedOnSave && r.label === label && r.complement === complement) && | ||
| sameText(r.label, label) && | ||
| sameText(r.complement, complement), |
There was a problem hiding this comment.
🟡 Imported pair hides an accepted duplicate
When an exact provisional pair exists, isAcceptedOnSave suppresses every exact-name duplicate, including accepted types on other pairs. Saving accepts the provisional type instead of directing the user to Add existing.
Learn more
The validator permits one exact provisional schema on the selected pair because createTripletForPair accepts that schema on save. But isAcceptedOnSave is a boolean, and the duplicate predicate skips every schema with that text, including accepted schemas on unrelated pairs. The save then accepts a redundant imported schema even though the existing picker offers the accepted type.
Example: An imported provisional supports / is supported by exists on Evidence → Claim, and an accepted identical type exists on Question → Hypothesis. Creating the type on Evidence → Claim passes validation and accepts the imported schema, leaving two accepted versions of the same type.
Recommended fix: Exempt only the exact provisional schema on the selected pair from duplicate detection. Keep accepted matches, and other provisional matches, eligible for the duplicate error.
Was this helpful? React with 👍 or 👎 to provide feedback.
…-type identical names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M55529KWSCRCQ37CTFJ4Y72M
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M55G3X6FG6K5VCCQ45E3QYGB
…ed colors ignoring case Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M55H91JVM3A3RY4AZNYA0JB3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M55HFQ1FK0F47N6WZY2F6NMH
Reviewer brief
Stacked on #1553 (ENG-2243), which must merge first.
Create newin the canvas relation menu opens an "Add relation type" dialog. Submitting a valid label and complement saves the triplet for the dragged node-type pair through ENG-2243'screateTripletForPair, shows both toasts, and lists the new type without a refresh.validateNewRelationTypeinapps/roam/src/components/canvas/existingRelationTypes.ts. The canvas groups relation types by label, and queries match a name against both label and complement. So the dialog blocks any new label or complement that reuses another type's text, ignoring case. It also rejects built-in query condition names (such asis a), names inherited fromObject(such asconstructor), and identical label and complement on a same-type pair. Each error says what clashes, and points to Add existing only when that picker can list the type.getRelationColorinapps/roam/src/components/canvas/DiscourseRelationShape/DiscourseRelationUtil.tsx. Arrows paint the color name as a raw CSS color, and the old fallback was white, so every custom relation drew invisibly on light canvases. Named colors (Supports, Opposes, Informs and their complements) now match ignoring case. Every other relation drawn without a palette index is grey, which reads on light and dark canvases. The positional palette is unchanged, and positions past its end now wrap instead of returningundefined. This is shared: the toolbar relation tool, style panel, legacy arrow migration and tool panel all call it. Existing arrows keep their stored color.apps/roam/src/components/canvas/overlays/RelationTypeDropdown.tsx. The dialog renders in a Blueprint portal outside the menu, so the menu's click-outside and Escape handlers stand down while it's open.?, because those aren't usable anywhere until they're completed in Settings.roamjs-canvas-dialog: another extension's CSS in the test graph recolors that class's first footer button.The diagram shows the submit path from the menu to the saved triplet.
flowchart LR A["RelationTypeDropdown: Create new"] --> B["CreateRelationTypeDialog: Label, Complement, Source → Target"] B -- Continue --> C{"validateNewRelationType: required, shown on pair, duplicate, label/complement reuse"} C -- error --> B C -- ok --> D["DragHandleOverlay.saveRelationTypeForPair(isNew)"] D --> E["createTripletForPair (ENG-2243)"] E --> F["Toasts: Relation type created, Discourse relation added"] F --> G["Menu lists the new type"]Verification
Live run in Roam (slot 1 test graph) with
pnpm --filter roam playwright:load-extensionand a test module. Stored relations were off in the graph, so the module turned them on with "Reactivate without Migration" and turned them off again in cleanup. Cleanup removed all test pages, triplets and stored relations, and a fresh load confirmed nothing remained.select, no new shapes+→ Create new on Conclusion → ConsequenceA second run at aa536a7 in Chrome on
discourse-dev-graphcovered the checks added after review. Stored relations were turned on and off again the same way, and all test data was removed.IS A/is an instance of"is a" is a reserved query condition.Objectconstructor"constructor" is a reserved name.TESTS/Is Tested Byis tested by(unaccepted),Is Opposed By(accepted)?eng2244t mirrors/Eng2244t Mirrorson Conclusion → Conclusioneng2244t informs live/eng2244t informed liveon Question → HypothesisA third Chrome run at 8998af2 checked relation colors.
eng2244t colors, then draw itgrey; label readable on bothsupports / is supported by, then draw itgreensupportsandopposesshow named colorsTests added in
apps/roam/src/utils/__tests__/existingRelationTypes.test.ts(validation rules, case-insensitive matching, provisional handling) andapps/roam/src/utils/__tests__/relationTypeDropdown.test.ts(dialog submit, validation error, failed save, click-outside and Escape while open). Rerun:Not verified:
isCloseButtonShownprop.Loom video
pending
Scope check
$scope-checkagainst ENG-2244 and the final diff.Done When: validation of the new label and complement (required, placeholder, shown on the pair, duplicates, label or complement reuse, built-in query condition andObjectnames, and identical names on a same-type pair, all case-insensitive, with imported-triplet handling). The fallback color in the sharedgetRelationColorchanges from white to grey, so custom relations drawn by the toolbar tool, style panel and legacy migration are also grey. Named colors match ignoring case. To tell built-in names from relation names,apps/roam/src/utils/conditionToDatalog.tsnow records built-in condition keys, andapps/roam/src/utils/registerDiscourseDatalogTranslators.tsflags its fixed conditions withbuiltIn: true.Done Whenalso requires an automatic color, and new and added types were drawn white, which is invisible on a light canvas.Standards check
$dg-pr-adherence-checkagainst the final diff and PR metadata.Local delegated full review
$dg-delegated-full-reviewwhen no other full-review workflow is available.🤖 Generated with Claude Code