Repository navigation
Filter already-linked targets on every relationship-picker entry path - #2456
mstomar125 wants to merge 2 commits into
Conversation
The paste-a-UUID branch in the relationship viewer's target picker bypassed the existing-target filter that search results already went through, so pasting an already-linked node's id offered a live "Use ID" button whose Add silently no-opped against the daemon's idempotent create_relationship. Add linkedTargetIds/isTargetLinked/filterUnlinkedTargets to relationship-grouping.ts as the one source of truth for "already linked", used by both the search-results filter and the pasted-id check. A pasted id that's already linked now renders explanatory text instead of an Add button, and a search whose matches are all already-linked now says so in language distinct from a genuine "No matches." Co-Authored-By: Claude <[email protected]>
Address review: UUID_RE (the paste-a-uuid check) accepts a pasted id in any case, but linkedTargetIds/isTargetLinked/filterUnlinkedTargets did an exact string comparison against the group's (canonical, lowercase) row ids. A differently-cased paste of an already-linked node's id therefore still offered a live "Use ID" Add — the exact silent no-op #2434 reports, just triggered by case variance instead of an exact re-paste. Co-Authored-By: Claude <[email protected]>
|
Closing without merging: #2432 (the two-pane relationship panel redesign) merged into `main` after this branch was cut, and it rewrote `relationship-viewer-modal.svelte` end to end — including removing the paste-a-UUID picker path entirely (the target picker is now search-only). That's the exact code path this PR's fix targeted, so this branch no longer applies (`gh pr view` reports `CONFLICTING`). The good news: #2432's rewrite already carries forward the spirit of #2434 — its own `runSearch` filters already-linked targets from search results, and it already distinguishes "No matches — every result is already linked." from a plain "No matches." So the paste-UUID-specific bug this issue described can no longer happen (there's no paste-UUID affordance left to trigger it). I did find one real remaining gap in the merged code: the "all linked vs genuinely no matches" message is keyed off |
Summary
Fixes #2434. The relationship viewer's target picker filtered out already-linked nodes from search results, but the paste-a-UUID branch bypassed that filter entirely — pasting the id of an already-linked node offered a live "Use ID" button whose Add silently no-opped (the daemon's
create_relationshipis correctly idempotent for an existing edge, so nothing observable happened).Changes
relationship-grouping.ts: addedlinkedTargetIds/isTargetLinked/filterUnlinkedTargetsas the single source of truth for "already linked into this group" — used by both entry paths into the picker.relationship-viewer-modal.svelte:isTargetLinkedbefore offering "Use ID" — an already-linked id shows explanatory text instead of a live Add button.addAllLinked), and shows "All matching<type>are already linked." in that case, distinct from "No matches." for a search that genuinely found nothing.create_relationshipbehavior is unchanged — this is a UI-only fix, per the issue.Test plan
linkedTargetIds/isTargetLinked/filterUnlinkedTargets, each individually mutation-tested (broke the real implementation, confirmed the test failed, restored, confirmed it passed again)bun run test:all— no new failures (233 test files / 4905 tests pass; Rust suite green)bun run quality:fix— clean (eslint/svelte-check/tsc/cargo fmt/clippy all pass)🤖 Generated with Claude Code