feat(voyager): Related Entities sidebar tab + focused sub-graph#93
Merged
Conversation
Add a read-only "Related Entities" tab to the ER diagram double-click
sidebar. It renders a focused mini ER sub-graph (selected entity + its
direct neighbors + incident edges) using an independent d3-graphviz
instance, reusing the main graph's rendering config (show module cluster /
show methods / edge length) so the sub-graph stays in sync as the user
tweaks the main panel or selects another entity.
Backend:
- ErDiagramDotBuilder.filter_to_neighborhood(schema_name) prunes the
built nodes/links to the one-level neighborhood after analysis().
- VoyagerContext.get_er_diagram_subgraph mirrors get_er_diagram_data's
response shape; returns empty dot for unknown schema.
- New POST /er-diagram-subgraph endpoint + ErDiagramSubgraphPayload.
Frontend:
- New RelatedEntitiesDisplay component (read-only, pan/zoom, four states:
loading / normal / isolated-with-hint / error).
- schema-code-display gains a third tab (gated by showRelatedEntities).
- store gains relatedEntities state + fetch/clear actions; clearRelatedEntities
is wired into resetDetailPanels.
Also fixes sidebar responsiveness (spec FR-011/012/013):
- Single-click on the canvas now re-points the open sidebar (was: only
double-click did). Idempotent.
- Background click closes the sidebar; a drag (pan) does not (5px threshold
via mousedown tracking).
- Tab persistence across entity switches is preserved and guarded with a
protective comment in resetState.
Tests: tests/test_voyager_subgraph.py adds 11 tests (quickstart A1-A5 +
FR-009 edge direction + FR-010 parallel edges). Full suite 1123 passed,
6 skipped. ruff clean.
Spec: specs/005-related-entities-tab/ (spec / plan / research /
data-model / contracts/{api,ui} / quickstart / tasks).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
allmonday
added a commit
that referenced
this pull request
Jun 30, 2026
Version bump for PR #93 (feat: Voyager Related Entities sidebar tab + focused sub-graph) plus the sidebar-follows-selection fixes bundled in the same PR. Updates CHANGELOG, pyproject.toml, uv.lock. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Changes
Backend (
src/nexusx/voyager/)er_diagram_dot.py—ErDiagramDotBuilder.filter_to_neighborhood(schema_name):在analysis()之后把 nodes/links 收窄到一层邻域;保留自引用与平行边。voyager_context.py—get_er_diagram_subgraph(payload):响应结构与get_er_diagram_data完全一致;未知 schema 短路为空。create_voyager.py—ErDiagramSubgraphPayload+POST /er-diagram-subgraph。Frontend (
src/nexusx/voyager/web/)component/related-entities-display.js(新)—RelatedEntitiesDisplayVue 组件:独立 d3-graphviz 实例;四态(加载 / 正常 / 孤立节点+文案 / 错误);只读 + pan/zoom;watch schemaName 与 filter 配置触发响应式 refetch。component/schema-code-display.js— 第三个<q-tab name="related">(由showRelatedEntitiesprop 门控,仅 ER-diagram 模式显示)+ panel 挂载新组件;FR-012 protective comment。store.js—relatedEntities状态 +fetchRelatedEntities/clearRelatedEntitiesactions +buildErDiagramSubgraphPayloadhelper;clearRelatedEntities接入resetDetailPanels。vue-main.js— 注册RelatedEntitiesDisplay;给GraphUI传isSidebarOpengetter。graph-ui.js— FR-011(单击 + 侧边栏开 → 触发onSchemaClick)+ FR-013(mousedown 位移追踪 + drag 阈值)。index.html— 给schema-code-display传:show-related-entities。Spec / Design artifacts
specs/005-related-entities-tab/:spec → plan → research → data-model → contracts/{api,ui} → quickstart → tasks(+ checklists/requirements.md)。Test plan
tests/test_voyager_subgraph.py(11 tests,覆盖 quickstart A1–A5 + FR-009 边方向 + FR-010 平行边)uv run pytest -q→ 1123 passed, 6 skipped(基线 1118 + 新增 11 = 1129;1123+6=1129 ✓)uv run ruff checkcleanPOST /er-diagram-subgraphforOrganization→ 5 nodes(Organization + Workspace/Department/Office/Vendor)+ 8 links,全部触碰 anchor;未知 schema → 空 dot;show_module与edge_minlen变化时 DOT 改变(配置跟随成立)。🤖 Generated with Claude Code