8000 V0-08: Reconnect graph view and Relationship focus by kiran-brahma · Pull Request #28 · kiran-brahma/nodepad-app · GitHub
[go: up one dir, main page]

Skip to content

V0-08: Reconnect graph view and Relationship focus - #28

Merged
kiran-brahma merged 1 commit into
mainfrom
claude/github-issue-9-f0d4f7
Jul 23, 2026
Merged

kiran-brahma merged 1 commit into
mainfrom
claude/github-issue-9-f0d4f7

Conversation

@kiran-brahma
Copy link
Copy Markdown
Owner

Closes #9.

What changed

A third way of reading the committed Notes — the Thinking Graph, drawn — plus Relationship focus that behaves the same in all three views.

One projection, so nothing can disagree

thinkingGraph(notes, relationships) is now the only place a Relationship becomes a link. Degree, related Notes, relate candidates, dimming, and the drawn graph all read it. Previously degree counted endpoints in Relationship[] while relatedNotes filtered Note[], and the graph would have counted a third time; the acceptance criterion that degree and related highlighting agree is now something you cannot express the negation of.

A link is admitted only when both endpoints name a Note in the list the projection was given, and App gives it the active Workspace's Notes. A Relationship left behind by a moved Note, or one naming another Workspace, has no node to attach to and is never built — no view has to check for it. Canonical pairs are deduplicated on the way in, and a self-pair is refused.

The arrangement is derived, never stored

graph-layout.ts runs a d3 force simulation to rest inside a pure function and returns the placements. There is no simulation to own, no animation frame scheduled, no coordinate to persist, and no reconciliation after a mutation. A restart rebuilds the same picture from SQLite alone, which a test asserts by comparing the drawn markup across a remount. Node radius grows with degree against the most related Note in the graph, floored so an unrelated Note is a smaller node rather than an invisible one.

Focus

Hovering a node previews what it is related to; clicking locks that focus; clicking again, Escape, or the Note leaving the screen (deletion, search, Workspace switch) lets it go. One lit set drives dimming in graph, tiling, and kanban. Selecting a node opens the same NoteCard the other views place, over the same intents, so the graph offers no action the other views lack. Nothing about focus or dimming is committed.

One deviation from the issue, deliberate

The issue lists a view change among the things that clear a locked focus. Two accepted outcomes contradict it: tiling and kanban must dim against the same related set, which is only observable if focus survives the switch between them, and #8 shipped a test asserting the navigated-to Note stays selected across a view switch. Focus therefore survives a view change. This is recorded in the audit rather than resolved silently — say the word if you want it the other way and I will change both.

The graph reads the Workspace's Notes rather than the search-narrowed result, so that every active-Workspace Note appears once and a search cannot make a Note look less connected than it is. Search still narrows tiling and kanban.

Testing

  • src/thinking-graph.test.ts — node and link uniqueness, degree as drawn links, dangling and cross-Workspace endpoints, self-pairs, and what a focus lights, including that degree and the lit set agree for every Note.
  • src/graph-layout.test.ts — every Note placed once and whole inside the canvas; radius monotonic in degree; the same committed state laying out identically; empty, single-Note, disconnected, and dense graphs.
  • src/App.test.tsx — hover preview, lock and unlock, Escape, cross-view dimming, deletion while focused, Relationship removal redrawing from committed state, a moved Note's link disappearing, and a restart.
  • No test asserts a coordinate, a radius value, a tick count, or an animation.

npm run check passes: typecheck, lint, 91 frontend tests, 19 Rust tests, and the Tauri smoke build. The UI only runs against the Tauri backend, so it was verified through the DOM rather than in a browser.

Delivery workflow

prd-simplicity-audit is recorded in docs/v0/audits/09-graph-view.md. src-tauri/ is untouched — no new command, no migration.

🤖 Generated with Claude Code

Adds a graph view of the active Thinking Workspace and makes Relationship
focus consistent across all three views.

Degree, related Notes, relate candidates, dimming, and the drawn graph
previously would have counted the same Relationships in three places. They
now all read one projection, `thinkingGraph(notes, relationships)`, which
admits a link only when both endpoints are Notes of the Workspace it was
given and admits each canonical pair once. A dangling or cross-Workspace
link therefore cannot be built, and a node's degree is by construction the
number of lines drawn to it.

The arrangement is derived, never stored: `graphLayout` runs a force
simulation to rest inside a pure call and returns placements, so there is no
simulation to own, no coordinate to persist, and a restart rebuilds the same
picture from SQLite alone.

Focus stays transient. Hovering a node previews what it is related to,
clicking locks that focus, and clicking again, Escape, or the Note leaving
the screen lets it go. Focus survives a view change, because the accepted
outcome that tiling and kanban dim against the same related set is only
observable if it does, and because #8 shipped a test asserting it; the
audit records this deviation from the issue's clearing list.

Selecting a node opens the same Note card the other views place, over the
same intents, so the graph offers no action the other views lack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kiran-brahma
kiran-brahma merged commit dd916a2 into main Jul 23, 2026
@kiran-brahma
kiran-brahma deleted the claude/github-issue-9-f0d4f7 branch July 23, 2026 05:59
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.

V0-08: Reconnect graph view and Relationship focus

1 participant

0