Skip to content

Filter already-linked targets in the two-pane relationship picker - #2461

Merged
mstomar125 merged 1 commit into
mainfrom
issue-2434-picker-already-linked-v2
Sep 8, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-2434-picker-already-linked-v2

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Closes #2434.

The relationship picker used to have a paste-a-UUID entry path (relationship-viewer-modal.svelte) that bypassed the "already linked" filter search results went through, so pasting the id of an already-linked node offered a live "Use ID" Add whose write silently no-opped (the daemon's create_relationship is correctly idempotent for an existing edge).

Note on scope drift: my first pass at this fix (PR #2456, since closed) targeted the old stacked-table picker. #2432's two-pane redesign merged into main while that PR was in review and rewrote relationship-viewer-modal.svelte end to end, including removing the paste-a-UUID path entirely — the picker is search-only now. So the specific paste-UUID repro in #2434 can no longer happen. This PR instead:

  1. Adds linkedTargetIds / isTargetLinked / filterUnlinkedTargets to relationship-grouping.ts as the single source of truth for "already linked into this group" — comparing case-insensitively (a caller may hold an id in a different case than the backend's canonical lowercase form; caught this in review of the closed PR).
  2. runSearch in the two-pane picker now filters through filterUnlinkedTargets instead of an inline, unshared Set.
  3. Fixes a real imprecision already present in the merged two-pane picker: the "no matches" message was keyed off group.rows.length > 0 (does this relationship have ANY linked row at all), so a genuinely-empty search on a relationship that already had other linked rows misreported "every result is already linked" instead of "No matches." It's now keyed off whether this search's own raw results were non-empty before filtering (addAllLinked).

The daemon's idempotent create_relationship is untouched — pure frontend diff.

Test plan

  • 7 unit tests for linkedTargetIds / isTargetLinked / filterUnlinkedTargets (including 2 case-insensitivity regression tests), each individually mutation-tested (broke the real implementation, confirmed the test failed, restored, confirmed it passed again)
  • bun run test — 232 files / 4895 tests pass
  • svelte-check / tsc --noEmit / eslint — clean
  • cargo build --bin nodespaced (the actual pre-push gate step) — clean
  • Full pre-push gate (test:all + cargo build --bin nodespaced + test:e2e) — green, confirmed via the push itself

Note: bun run quality:fix's cargo clippy step currently fails on main due to unrelated code in packages/daemon/src/services/embeddings_service.rs (introduced by the most recent commit on main, unrelated to relationships). Confirmed this PR's diff touches zero Rust files and cargo build --bin nodespaced (what the actual push gate runs) is clean.

🤖 Generated with Claude Code

Rebased against #2432's already-merged two-pane relationship panel, which
rewrote relationship-viewer-modal.svelte end to end (including removing
the paste-a-UUID picker path this issue originally described — search is
now the only entry path into the target picker).

Add linkedTargetIds/isTargetLinked/filterUnlinkedTargets to
relationship-grouping.ts as the single source of truth for "already
linked into this group", comparing case-insensitively since a caller may
hold an id in a different case than the backend's canonical lowercase
form. runSearch now filters through filterUnlinkedTargets instead of an
inline, unshared Set.

Also fixes an imprecision already present in the merged two-pane picker:
the "no matches" message was keyed off whether the relationship already
had ANY linked row (group.rows.length > 0), so a genuinely-empty search
on a relationship that already had other linked rows misreported "every
result is already linked" instead of "No matches." It's now keyed off
whether THIS search's own raw results were non-empty before filtering.

Co-Authored-By: Claude <noreply@anthropic.com>
@mstomar125
mstomar125 merged commit ecb897a into main Sep 8, 2026
@mstomar125
mstomar125 deleted the issue-2434-picker-already-linked-v2 branch September 8, 2026 09:07
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.

Pasting an already-linked node's ID offers an Add that silently does nothing

1 participant