Skip to content

feat: namespace filter for graph & memories (multi-select)#93

Merged
ajianaz merged 5 commits into
developfrom
feat/graph-namespace-filter
Jul 3, 2026
Merged

feat: namespace filter for graph & memories (multi-select)#93
ajianaz merged 5 commits into
developfrom
feat/graph-namespace-filter

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

Graph and Memories views were limited to a single namespace. On the VPS server (is_primary=1, 27 namespaces / 19k memories), only the default namespace was visible because uteke's legacy /list and /graph endpoints return only default when called without a namespace scope.

Solution

A reusable namespace filter (multi-select dropdown) wired into both Graph and Memories, backed by a per-namespace fan-out that works on any server version (no waiting on the upcoming uteke release).

Backend (src-tauri/src/)

  • uteke_server_graph / uteke_list — new namespaces: Option<Vec<String>> param. Three modes:
    • null (all) → fan out across every namespace (fetch /namespaces then /list per-ns), merge, dedup, sort newest-first.
    • [] (none) → empty result (explicit).
    • [...] (explicit) → fan out across just those selected.
  • uteke_namespaces_with_counts + client namespaces_with_counts() — uses /namespaces?with_counts=true (uteke #527), falls back to plain /namespaces with count: 0 on older servers that 404.
  • Graceful: namespaces that error (read-only token, missing, etc.) are skipped; the rest still load.

Frontend (src/lib/)

  • NamespaceFilter.svelte (new, reusable) — dropdown with:
    • Checkbox list, per-namespace counts, search box, select-all.
    • 3-state select-all indicator: ☑ all / ☐ none / ⊟ partial.
    • null = all, [] = none, array = explicit (unambiguous).
  • GraphView — filter on the right of the toolbar (spacer layout, matches Memories); debounced reload on change.
  • MemoryList — filter on the right of the toolbar; multi-namespace pager; search scoped to the single selected ns when exactly one is picked.
  • pagination.svelte.ts — supports namespaces alongside single namespace.

Backward compatibility

This works today on the currently deployed servers via per-namespace fan-out. When uteke releases the in-flight fixes, CorIn gets free bonuses with no code change:

Uteke PR Effect on CorIn Action needed?
#524 read-only token on read POST endpoints Eliminates spurious 403s none
#527 /namespaces?with_counts=true Per-namespace counts show real numbers instead of none (fallback auto-disables)
#526 cross-namespace /list Correct results with fewer requests optional optimization later

Verification

  • cargo clippy -- -D warnings ✅ clean
  • svelte-check ✅ clean on changed files (1 pre-existing error in DetailPanel.svelte unrelated to this PR)
  • Tested against both local 127.0.0.1:8767 and the VPS connection: filter shows all namespaces, select-all/deselect behaves correctly, graph loads across multiple namespaces.

Out of scope (follow-up)

  • Optimization: use single cross-namespace /list once uteke #526 is released (currently N requests via fan-out — correct, just not minimal).

ajianaz and others added 5 commits July 3, 2026 16:27
Graph and memories views were limited to a single namespace because
uteke's /list and /graph endpoints only operate per-namespace. On the
VPS server with 27 namespaces, only "default" was visible.

Backend:
- uteke_server_graph: add `namespaces: Vec<String>` param; fan-out /list
  across selected namespaces, merge (dedup), build tag-based graph.
- uteke_list: add `namespaces` param; fan-out, merge, sort newest-first.
- namespaces_with_counts command + client method: uses /namespaces?with_counts
  (uteke >= #527), falls back to plain list with count 0 on older servers.

Frontend:
- NamespaceFilter.svelte: reusable dropdown — checkbox list with per-ns
  counts, search, select-all. Backward-compatible (works on legacy servers).
- GraphView: filter in toolbar, debounced reload on change.
- MemoryList: filter in toolbar, multi-namespace pager + scoped search.
- pagination store: support `namespaces` alongside single `namespace`.

All paths work on current deployed servers AND will use the upcoming
uteke #526/#527/#528 improvements when released.
…n-out

Filter UX & semantics:
- Fix select-all/deselect: state is now 3-valued — null=all, []=none,
  array=explicit. Previously [] was ambiguous (all or none), making the
  toggle flip unexpectedly and unchecking one item from "all" misbehave.
- NamespaceFilter: resolve null→full set before toggling so unchecking a
  single item in "all" mode removes just that item. Indicator shows
  ☑ all / ☐ none / ⊟ partial.
- Graph: move filter to the right of the toolbar (spacer), matching the
  memories layout so the filter always sits on the right.

Backend "all" mode:
- uteke_server_graph & uteke_list: when no namespace scope is given, fan
  out across ALL namespaces instead of hitting legacy no-namespace /list
  which only returns "default". Graph & list now reflect every namespace.
- Treat explicit empty list as "none" (empty result), distinct from null.

MemoryList:
- Fix TypeError (null.length) by deriving the search scope instead of
  reading .length on a nullable state inline.
@ajianaz ajianaz merged commit c30c851 into develop Jul 3, 2026
8 checks passed
@ajianaz ajianaz deleted the feat/graph-namespace-filter branch July 3, 2026 13:52
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