fix(dashboard): wire layer + node-type filters into knowledge-graph view#189
Open
patrickloscabos-art wants to merge 1 commit into
Open
fix(dashboard): wire layer + node-type filters into knowledge-graph view#189patrickloscabos-art wants to merge 1 commit into
patrickloscabos-art wants to merge 1 commit into
Conversation
The Filter panel exposes per-layer and per-node-type checkboxes that write to `filters.layerIds` and `filters.nodeTypes`, but `KnowledgeGraphView` only consumed the all-or-nothing `nodeTypeFilters.knowledge` flag — so the layer checkboxes and the article/entity/topic/claim/source checkboxes had no visible effect on knowledge graphs. This change: - Reads `filters.layerIds`. When any layer is selected, restricts the visible set to nodes in that layer plus one-hop neighbors. The neighbor expansion matters because analyzer-generated entity/claim nodes aren't placed in any layer's `nodeIds`, so a strict layer-membership filter would orphan the picked layer's articles. - Reads `filters.nodeTypes` so the per-node-type checkboxes (article / entity / topic / claim / source) actually filter the knowledge view, matching their behavior in code/domain views. - Preserves the existing `nodeTypeFilters.knowledge` blanket toggle. Tested by selecting a single layer in a 191-node / 279-edge knowledge graph: filtered set drops from 191 → ~30 nodes (the layer's articles plus their referenced entities/claims), and the resulting subgraph remains fully connected for the picked layer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Filter panel's per-layer checkboxes and per-node-type checkboxes (
article,entity,topic,claim,source) have no visible effect when viewing a knowledge graph.KnowledgeGraphView.tsxonly reads the all-or-nothingnodeTypeFilters.knowledgeflag — it never consumesfilters.layerIdsorfilters.nodeTypes, even thoughFilterPanelwrites to both and the layer checkboxes are gated onlayers.length > 0(which only fires on graphs that have layers — i.e. knowledge graphs and architecture-layered code graphs).Repro
/understand-knowledgeon any Karpathy-pattern wiki with multiple categories inindex.mdso the resulting graph has 2+ layers.Fix
In
understand-anything-plugin/packages/dashboard/src/components/KnowledgeGraphView.tsx:filtersfrom the store.filters.layerIds.size > 0, build an allow-set of nodes in the selected layers plus their one-hop neighbors (via the edge list). The one-hop expansion is important because analyzer-generatedentityandclaimnodes typically aren't placed in any layer'snodeIds— a strict layer-membership filter would orphan the picked layer's articles by hiding the entities/claims they reference.filters.nodeTypesso the per-node-type checkboxes filter the knowledge view, matching their behavior in code/domain views.nodeTypeFilters.knowledgeblanket toggle.Manual test
On a 191-node / 279-edge knowledge graph with 8 layers:
entity): entity nodes vanish, edges pruned, articles/claims remain.Test plan
🤖 Generated with Claude Code