Skip to content

ENG-2257 Add an existing discourse relation from relation menu - #1492

Merged
trangdoan982 merged 4 commits into
mainfrom
eng-2257-add-an-existing-discourse-relation-from-relation-menu
Oct 2, 2026
Merged

trangdoan982 merged 4 commits into
mainfrom
eng-2257-add-an-existing-discourse-relation-from-relation-menu

Conversation

@trangdoan982

@trangdoan982 trangdoan982 commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

https://entire.io/gh/DiscourseGraphs/discourse-graph/trails/32

Reviewer brief

  • Result: "Add existing…" in the canvas relation type menu opens a picker in the same menu. Picking a type links it to the arrow's node-type pair (source → target), saves settings, shows the type in the menu and shows a "Discourse relation added" toast. The user then picks it to create the relation, as in the DES-349 Case 1 mockup.
  • Review focus: associateRelationTypeWithNodePair in relationTypeUtils.ts is the shared helper ENG-2258 will call after adding a new type. It replaces the discourseRelations array, and the dropdown's memos depend on that array's identity to refresh the menu.
  • Stacked on ENG-2256 Implement new relation menu empty state #1491 (ENG-2256); review only the commits after it.

Verification

  • pnpm ci:validate --filter=@discourse-graphs/obsidian passes; new unit tests in src/components/canvas/utils/__tests__/relationTypeUtils.test.ts.
  • Live Obsidian run with dg-obsidian-cdp-verify on the ENG-2256 fixture canvas:
Scenario Result
Empty pair: Add existing… → pick first row Picker listed all 4 accepted types; menu then showed "supports"; toast "supports relation added for Question and Claim"; data.json gained one rel3_ Question → Claim triple with no status
Then click the new type Arrow got that relation type and the text "supports"
Populated pair (Evidence → Claim) Picker listed only informs and derived from; flyout closed
Escape, then back chevron Both returned to the list with the menu and pending arrow kept
Every type already valid for the pair Picker shows "All relation types are already available for these nodes"

The failed-save error toast is covered by a unit test for the rollback only, not a live run.

Loom video

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

Scope check

  • Ran $scope-check against the ENG ticket and final diff.
  • Scope beyond Done When: The picker offers only accepted types not yet valid for the pair in either direction (the mockup lists all types). A back chevron and Escape return from the picker to the list. A failed save restores the in-memory settings and shows an error toast. RelationTypeDropdown takes a canvasPath prop for the toast target. These keep the picker from offering no-op picks, avoid a dead end that would delete the pending arrow, and keep the menu from showing an unsaved association. Decided with the requester during planning; recorded on ENG-2257 and DES-349.

Standards check

  • Ran $dg-pr-adherence-check against the final diff and PR metadata.

Outstanding: the new markup uses the file's existing Tailwind gray utilities rather than Obsidian CSS variables, kept for consistency within the file.

Local delegated full review

  • Ran a comprehensive review of the entire final diff in a subagent with a fresh context. Use $dg-delegated-full-review when no other full-review workflow is available.

No findings.

🤖 Generated with Claude Code

@supabase

supabase Bot commented Sep 27, 2026

Copy link
Copy Markdown

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 ↗︎.

@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
discourse-graph Ready Ready Preview Oct 2, 2026 8:58pm UTC

Request Review

@linear-code

linear-code Bot commented Sep 27, 2026

Copy link
Copy Markdown

ENG-2257

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment thread apps/obsidian/src/components/canvas/utils/relationTypeUtils.ts
@trangdoan982
trangdoan982 force-pushed the eng-2257-add-an-existing-discourse-relation-from-relation-menu branch from fb35322 to d13c06d Compare October 2, 2026 19:39
Base automatically changed from eng-2256-implement-new-relation-menu-empty-state to main October 2, 2026 20:56
trangdoan982 and others added 4 commits October 2, 2026 16:56
Wire "Add existing…" to a picker in the relation type menu that links an
accepted relation type to the arrow's node-type pair, then shows it in the
menu with a toast. Adds the shared pair-link helper ENG-2258 reuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M3J9REFKC30VYBVF3H13BG5P
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M3J9XJKH4F716WY3TM769TG4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M3JADA205HB1WJG30ER2HJVE
Roll back a failed save by removing only the added relation, so a
concurrent association that saved meanwhile survives. Disable picker rows
while a save is pending so a double click can't add the same triple twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M3M6DWP2S1FKJJRY03MA09AG
@trangdoan982
trangdoan982 force-pushed the eng-2257-add-an-existing-discourse-relation-from-relation-menu branch from d13c06d to fe1a992 Compare October 2, 2026 20:56
@trangdoan982
trangdoan982 merged commit e3555c5 into main Oct 2, 2026
9 checks passed
@trangdoan982
trangdoan982 deleted the eng-2257-add-an-existing-discourse-relation-from-relation-menu branch October 2, 2026 20:59

This branch was successfully deployed

1 active deployment
Preview — fe1a9928 Deployed Oct 2, 2026 by vercel[bot]
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