Repository navigation
Description
Problem
The relationships panel shipped in #2426 stopped it scaling with the schema — declared-but-empty relationships no longer each get a section. But it still scales with the node's data: every populated relationship renders its own full-width table, stacked vertically. A node with six populated relationships is six stacked tables and a scrollbar.
It also splits one action across two affordances: populated relationships have an inline + Add, empty ones live behind a separate + Add relationship chooser. And edge properties have nowhere to live — a table cell can't hold a variable-length form, so editing one edge opens a nested dialog on top of the panel (edge-properties-modal.svelte).
Direction: two panes
Left — the relationships this node actually has, one row each with its edge count, + Add beneath them.
Right — every edge of the selected relationship. A row expands to that edge's properties only if the relationship declares edge_fields; most don't, so most rows are just the target node with open and delete.
Interactive wireframe (7 plates; 03 is clickable):
https://claude.ai/code/artifact/1a8b4a2a-fff0-4359-be04-97cc469df5ec
┌─ Relationships ──────────────────────────────────────── ✕ ┐
│ ON THIS NODE │ supersedes → adr │
│ ▸ supersedes 2 │ │
│ authored_by 1 │ ▾ ADR-2 · Replace libsql with sqlite │
│ shared_with 2 │ REASON [sqlite embeds with…] │
│ │ DECIDED ON [2026-03-04 ] │
│ [ + Add ] │ Changes save as you make them. ↗✕ │
│ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ │ │
│ INCOMING · │ ▸ ADR-7 · Single-process daemon ↗ ✕ │
│ READ-ONLY │ │
│ superseded_by 1 │ │
└──────────────────┴────────────────────────────────────────┘
Two panes rather than three because expansion does the third pane's job in place: the rail stays short whatever the node's connectivity, properties stay one click away, and a single-target relationship needs no special case — it simply shows its one edge.
Only established relationships appear
The rail lists what exists. A relationship the schema declares but the node has no edge for does not appear — not even as a 0 row. Placeholder rows in a rail are the same disease #2385 cured, rotated ninety degrees. The schema's declarations surface only when the user asks, via + Add.
+ Add marks the ownership boundary
Rail order: relationships this node owns, then + Add, then a divider, then incoming · read-only. The control's position tells the user what they can create, so nothing has to carry that rule as a badge.
Incoming relationships: the same edge, from the other end
An incoming relationship is not a second relationship. It is the same physical row in the relationship table, whose source is the other node — which is where it is declared, and therefore where it is owned. It shows here with its properties and the same values (not a copy), read-only. Editing means opening the owning node.
This is the authority model, not a UI convenience: a person viewing has_access_to → Design Docs sees access: Owner and cannot change it, because access is granted from the collection's panel. A person should not be able to grant themselves Owner from their own node.
No read-only badge in the detail header. The rail heading above the selection already says it, and the pane offers no controls to edit with. A third signal is noise, and the absent controls are what actually hold the rule.
Nothing is "saved"
Edits persist on change, as node edits already do everywhere else in the app. #2426 already works this way (confirmAdd, removeRow, updateEdgeProperties all write immediately) — there is no Save button, and adding one would reintroduce a pattern the codebase has moved past.
+ Add is the single creation path
No "add edge" control in the right pane. + Add opens a list of the relationships still available, filtered by:
- direction — outbound only; an incoming edge is declared on the other schema and cannot be created from this side
- cardinality — a
cardinality: onerelationship already holding an edge is omitted. This is a UX affordance over an invariant the daemon already enforces (relationship.rs:584-600rejects the second edge), so the filter is allowed to be imperfect; the write still fails safely - availability — see Pasting an already-linked node's ID offers an Add that silently does nothing #2434
Terminology: single, not one-to-one
cardinality constrains only this end — one person per ADR, while that person may own many ADRs. The reverse constraint lives in reverse_cardinality, which governs the inbound view (rel_ops.rs:610). Each group therefore arrives with one cardinality already resolved for its own side; the panel never reasons about pairings. Label it single / multiple, not with relational-model terms the view model doesn't carry.
Phase 1 — focusOrOpenNode in the navigation service
The target link and the open-owning-node action should open the node in the other pane, reusing an existing tab rather than stacking duplicates. Seeing both ends of an edge side by side is the point.
Neither existing method does this:
navigateToNodenavigates the current tab in place (updateTabContent)navigateToNodeInOtherPanehandles the pane logic correctly but always callsaddTab
The open-or-focus pattern is hand-rolled across the codebase:
const existingTab = state.tabs.find((tab) => tab.content?.nodeId === id);
if (existingTab) setActiveTab(existingTab.id, existingTab.paneId);
else addTab({ /* … */ });Extract it into one navigation-service method and migrate:
| File | Notes |
|---|---|
navigation-sidebar.svelte |
3 plain call sites (node, schema, chat) |
navigation-sidebar.svelte:228 |
Variant — also matches nodeType === 'date' |
search-pane.svelte |
plain |
collection-node-viewer.svelte |
plain |
query-node-viewer.svelte:527 |
plain |
query-node-viewer.svelte:310 |
Variant — also constrains by paneId |
pane-content.svelte:95 |
Not a migration target — a check inside a different flow |
The two variants need an optional nodeType filter and pane constraint, or they keep their own logic deliberately. Decide when implementing; don't force all of them into one signature.
Phase 2 — the panel
Survives from #2426 (do not rewrite):
edge-field-input.ts— field-type → input mapping, includingenumsupport from EdgeField cannot declare enum values, so RBAC roles on a relationship would be free text #2387findGroupByKey/findRowByKey— resolve-by-key so state outliving a reload isn't a stale snapshot. Still needed: rail selection and expansion state are exactly thatgroupSupportsEdgeEditing— whether a relationship declaresedge_fields- Inbound read-only semantics; immediate persistence; per-edge draft isolation; error surfacing
Replaced:
partitionGroups'addablelist and the+ Add relationshipchooser popover — the rail supersedes both. Thepopulatedfilter remains the right rule- The stacked
<section>per group edge-properties-modal.svelte— the expanded row makes it unnecessary. Delete it, don't leave it unused
Selection styling follows the --active modifier convention from tab-system.svelte (the sidebar has hover but no persistent selected state, so it is not the precedent).
Expansion: independent toggles, not an accordion. Most rows never expand, expanded content is short, and the RBAC case means several edges are relevant at once — comparing access across people is exactly what an accordion prevents. Collapsed by default; state not persisted across reopening.
Container: widen to roughly sm:max-w-4xl; collapse to one pane at a time below a breakpoint.
Acceptance criteria
Phase 1 — navigation
- One navigation-service method opens a node in the other pane, focusing an existing tab for that node instead of adding a duplicate
- Creates a second pane when only one exists (preserving current
navigateToNodeInOtherPanebehavior) - Plain call sites in the table use it; the two variants either use it via options or keep their own logic with a comment saying why
- Repeat activation of the same target does not stack duplicate tabs
- No regression in sidebar, search, collection-viewer or query-viewer navigation
Phase 2 — panel
- The rail lists only relationships with at least one edge; a declared-but-empty relationship does not appear, including as a
0row - Rail order is: owned-by-this-node →
+ Add→ divider → incoming/read-only - Selecting a relationship shows its edges in the right pane
- A relationship with no
edge_fieldsrenders plain target rows — no disclosure arrow, no empty property form - A relationship with
edge_fieldsrenders expandable rows; several may be expanded at once - Edge properties are edited in the expanded row — no nested dialog;
edge-properties-modal.svelteis deleted - Edits persist on change; there is no Save button
-
enumedge fields render as a picker showing declared labels and persist the value key (from EdgeField cannot declare enum values, so RBAC roles on a relationship would be free text #2387 — must not regress) -
+ Addis the only creation path; the right pane has no add control -
+ Addomits incoming relationships, and omits acardinality: onerelationship that already has an edge - Incoming relationships show their edge properties read-only, with the same values the owning node shows
- Incoming rows offer no add/edit/delete; the one action opens the owning node
- No
read-onlybadge in the detail header — the rail heading and absent controls carry it - Target links and open-owner actions use the Phase 1 method (other pane, reuse existing tab)
- A node with no relationships shows an empty rail with
+ Add - The panel fits without scrolling for a node with several populated relationships — the case the stacked layout fails
- Panes collapse to one at a time below a narrow breakpoint
- Existing behavior preserved: immediate persistence, per-edge draft isolation, error surfacing
Open question
Untyped relationships (target_type: None) apply to any node type (rel_ops.rs:516) and are documented as the exception (:211). The + Add picker searches by group.targetType; with null it searches everything, and the rail's · <type> annotation has nothing to show. Decide the treatment rather than letting it fall out of the code — worth confirming how these are actually used first.
Dependencies
- Depends on Require reverseName and reverseCardinality so a relationship edge is named from both ends #2433 — the rail shows an inbound relationship's name and cardinality, both of which come from the reverse half of the declaration that Require reverseName and reverseCardinality so a relationship edge is named from both ends #2433 makes required. Building first means rendering the synthesized
"{SourceType} ({Relationship Name})"fallback and omitting inbound cardinality entirely - Related: Pasting an already-linked node's ID offers an Add that silently does nothing #2434 — already-linked targets must not be offered by the picker, on every entry path. Whichever ships second inherits the criteria
Context
Follows #2426 (closed #2385), which fixed schema-driven scaling but kept the stacked-section layout. This is the UI improvement on top of it, driven by wanting to browse relationships rather than scroll through all of them at once.
Activity
malibio commentedon Sep 7, 2026
Depends on #2433 — do that one first.
This panel shows an inbound relationship's name and cardinality in the rail. Both come from the reverse half of the schema declaration (
reverseName/reverseCardinality), which is optional today and frequently unset. Building this first means:"Invoice (Customer)"instead of"Invoices"(relationship-grouping.ts:152)reverse_cardinalitygoverns that side (rel_ops.rs:610)groupDisplayLabel's fallback gets carried into the new rail rendering, then deleted again once Require reverseName and reverseCardinality so a relationship edge is named from both ends #2433 landsThe dependency is one-directional — #2433 needs nothing from here.
Not an absolute blocker: this panel would function against today's half-populated declarations, just with worse labels. If the UI is wanted sooner, the two can run in parallel — expect
"Invoice (Customer)"in review screenshots until #2433 merges.[-]Browse relationships in three panes instead of stacked tables[/-][+]Browse relationships in two panes instead of stacked tables[/+]malibio commentedon Sep 7, 2026
Baseline (phase 1 worktree): Frontend 233 files / 4900 tests passed.
Add focusOrOpenNode to the navigation service (#2432)
Name both ends of the test-fixture 'held_at' relationship
Add focusOrOpenNode to the navigation service (#2432)
Add focusOrOpenNode to the navigation service (#2432 phase 1) (#2441)
Browse relationships in two panes instead of stacked tables (closes #…
Browse relationships in two panes instead of stacked tables (closes #…
Filter already-linked targets in the two-pane relationship picker (#2461