Skip to content

Editable relationship modal + dual-mode relationship transport (#1918) - #2002

Merged
mstomar125 merged 1 commit into
mainfrom
issue-1918-editable-modal
Aug 7, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-1918-editable-modal

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Part of #1918 (relationship viewer) — slices a (editing) + c (target selection), building on the read-only viewer (#1992) and the backend command surface (#1993). Does not close #1918 (slice d, view-settings, remains).

What

Makes the relationship modal editable and routes the whole relationship feature through the dual-mode backend-adapter, so it works in browser dev mode — not only the packaged Tauri app.

Editing (a): Edit/Done toggle. Per row: remove (confirm on the last edge of a required group) + editable edge-field inputs with a per-row Save (reusing property-form-style controls). Per group: an Add control with a target picker — type-ahead search by title filtered to the declared target_type, or paste a UUID — and an edge-field prompt before create. Edge orientation is centralized in a pure resolveEdgeEndpoints so mutations hit the correct (source,target) from either direction.

First-edge support: rel_ops::get_node_relationships now emits declared outbound relationship groups even when empty (inbound only when non-empty); the modal shows empty groups only in edit mode (read mode stays clean), so a relationship's first edge can be added.

Transport (dual-mode): backend-adapter (+ adapter-core) gains getNodeRelationships / createRelationship / deleteRelationship / updateRelationshipProperties / searchNodesByTitle across the Tauri / Http / Mock adapters; dev-proxy gains GET /api/nodes/:id/relationships + method-differentiated POST/DELETE/PATCH /api/relationships.

Validation — live, end-to-end against a running daemon

Every operation exercised in the running app (via an isolated daemon + dev-proxy + Chromium): read (loads edges), update (role edited → PATCH → persisted), create (picker → POST 204), delete (✕ → DELETE 204), and the first edge of an empty relationship (empty group shows Add in edit mode → POST 204). Rust relationship tests pass (38+); a new relationship-orientation test + updated grouping tests; svelte-check / eslint / vitest clean; pre-push gate green.

Adversarial review → addressed

Independent review confirmed the core is correct + safe (orientation both directions; no dangling/wrong-typed edge possible — FK-backed; errors surface, not swallowed; reload covers both directions; full adapter parity) and flagged the first-edge gap (fixed, above) + minor items: datetime edge fields now use datetime-local; a successful mutation no longer discards other rows' unsaved drafts. Deferred follow-ups: dev-mode picker-label title, title-null picker search, undeclared-key value coercion.

Make the relationship viewer modal editable (slices a + c) and route the whole
relationship feature through the dual-mode backend-adapter so it works in
browser dev mode, not only the packaged Tauri app.

Transport (dual-mode):
- backend-adapter (+ adapter-core): add getNodeRelationships / createRelationship
  / deleteRelationship / updateRelationshipProperties / searchNodesByTitle across
  the Tauri (invoke), Http (fetch), and Mock adapters; HTTP_ROUTES entries;
  `titleContains` on NodeQuery. RawNodeRelationships imported type-only.
- dev-proxy: GET /api/nodes/:id/relationships and method-differentiated
  POST/DELETE/PATCH /api/relationships forwarding to the gRPC NodeService.
- relationship-viewer-service: fetch via backendAdapter (was raw invoke); add
  addEdge / removeEdge / updateEdgeProperties / searchTargets, with edge
  orientation centralized in the pure `resolveEdgeEndpoints` (out: source=node,
  target=other; in: flipped) so mutations hit the correct endpoints from either
  direction.

Modal editing:
- Edit/Done toggle. Per row: remove (with a confirm on the last edge of a
  `required` group) and editable edge-field inputs with a per-row Save. Per
  group: an Add control with a type-ahead target picker (search by title,
  filtered to the declared target_type, or paste a UUID) and an edge-field
  prompt before create.
- View model carries relationshipName / required / edgeFields.

First-edge support: `rel_ops::get_node_relationships` now emits declared
outbound relationship groups even when empty (inbound still only when
non-empty); the modal shows empty groups only in edit mode (read mode stays
clean) so the first edge of a relationship can be added. datetime edge fields
use datetime-local; a successful mutation no longer discards other rows' unsaved
drafts.

Validated end-to-end against a running daemon (read/update/create/delete round
trips, including adding the first edge of an empty relationship). New
relationship-orientation test; grouping tests updated for retained empty groups.

Co-Authored-By: Claude <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Adversarial review → addressed → APPROVE. Independent review confirmed the implementation is correct + safe (orientation correct in both directions; no dangling/wrong-typed edge can be persisted — FK-backed; error handling surfaces, not swallowed; reload covers both directions; full Tauri/Http/Mock adapter parity). The one MAJOR finding — the first-edge gap (Add couldn't create the first edge of an empty relationship) — is fixed (declared outbound groups now surface in edit mode). Minors fixed: datetime→datetime-local, unsaved-draft preservation. Live-validated end-to-end (read/update/create/delete + first-edge) against a running daemon; gate green. APPROVE.

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.

Relationship viewer: view and manage typed relationships between nodes

1 participant