Skip to content

feat(kb): graph navigability — focus + context map (implements #73) - #90

Open
jordanrburger wants to merge 4 commits into
mainfrom
claude/agitated-sanderson-f1c42a
Open

feat(kb): graph navigability — focus + context map (implements #73)#90
jordanrburger wants to merge 4 commits into
mainfrom
claude/agitated-sanderson-f1c42a

Conversation

@jordanrburger

Copy link
Copy Markdown
Collaborator

Implements the KB graph navigability feature per the spec + plan merged in #73, with the merge-time review notes applied where they override the plan.

What changed

Task 1 — engine (KBGraph.swift, KnowledgeBaseService.swift)

  • KBGraph.topHubs(maxNodes:) — top nodes by degree (id-ascending tiebreak), only edges internal to the kept set; no-op under the cap.
  • KBGraph.filtered(types:hideOrphans:minDegree:) — pure post-filter; always retains the center so a re-rooted view is never emptied.
  • KnowledgeBaseService.hubGraph(maxNodes: 40) — the overview's default seed (fullGraph().topHubs).
  • New KBGraphTransformTests suite (6 tests, TDD; fixtures use the neutral alex/priya/sam stand-ins).

Task 2 — KBMapView (new) embedded in KBOverviewView in place of the unbounded fullGraph() map

  • Opens on the top-40 hubs; single-tap re-roots on the tapped node (localGraph(around:depth:2,maxNodes:40)); tapping the centred node again — or the breadcrumb "Open" button — opens it in the editor.
  • Name search (≥2 chars, 8 matches) → focus; breadcrumb with ⌂ Hubs / ‹ Back / current center.

Task 3 — filters + honest captions

  • Entity-type toggle chips (legend colours), "Hide orphans", min-links stepper.
  • "showing N of M notes" caption whenever the map renders.

Review notes from #73 applied

  1. Stale-focus fallback (spec, not the plan's no-reset): an effectiveFocus guard checks the focused path still exists in service.tree; if the note was deleted/renamed the map falls back to the hub seed, and ‹ Back skips history entries whose note is gone.
  2. Vault-empty vs filtered-to-empty: an empty vault shows the map empty state with the spec's "showing 0 of 0 notes" caption; filters removing everything shows "No notes match these filters" with a Reset affordance.
  3. Full ScoutTests target run before each commit — 429 tests in 79 suites, 0 failures (no -only-testing false greens).

Inline nits: no try on the non-throwing reparseAndWait(); canvas .id keyed on the sorted rawValue join of active types (not the set count); spec updated with the tap-divergence sentence, the global-degree "Hide orphans" note, and a neutral search example.

Verification

  • xcodebuild build -scheme Scout -destination 'platform=macOS' — BUILD SUCCEEDED.
  • Whole ScoutTests target after every task: 429 tests in 79 suites passed.
  • ⚠️ The plan's manual /run GUI walkthrough (tap-to-re-root, filter toggles) could not be driven autonomously: this machine has no accessibility grant for UI scripting and the env-gated boot-tab harness was never merged, so the KB tab can't be reached programmatically. Please give the map a quick manual spin before merging.

🤖 Generated with Claude Code

jordanrburger and others added 4 commits August 23, 2026 08:50
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…breadcrumb

Implements the spec's stale-focus fallback (review note on #73): when the
focused note is deleted/renamed, the map falls back to the hub seed via a
cheap existence guard against service.tree; back-history skips stale entries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t cap caption

Vault-empty (no notes at all) shows the map empty state with the spec's
"showing 0 of 0" caption; filtered-to-empty shows "No notes match these
filters" with a reset affordance — distinguished per the #73 review notes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ree orphan note, neutral search example

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant