Skip to content

Feat: VSCode lineage "Only Direct Neighbors" filter#5815

Merged
StuffbyYuki merged 2 commits into
SQLMesh:mainfrom
tjirab:vscode-lineage-direct-neighbors
May 29, 2026
Merged

Feat: VSCode lineage "Only Direct Neighbors" filter#5815
StuffbyYuki merged 2 commits into
SQLMesh:mainfrom
tjirab:vscode-lineage-direct-neighbors

Conversation

@tjirab
Copy link
Copy Markdown
Contributor

@tjirab tjirab commented May 28, 2026

Proposes a fix for #5811.

Adds an "Only Direct Neighbors" toggle to the VSCode lineage panel's settings menu (the cog icon in the bottom-left controls). When enabled, the view collapses to the selected model + its direct parents + its direct children — independent of the existing withConnected / withImpacted / withSecondary flags.

Summary

  • New withOnlyDirect: boolean state and directNeighbors: Set<ModelEncodedFQN> memo on LineageFlowContext (vscode/react/src/components/graph/context.tsx). directNeighbors is derived from the lineage map and mainNode.
  • getUpdatedNodes and getUpdatedEdges (vscode/react/src/components/graph/help.ts) take the new flag + set as optional parameters and hide anything outside the direct set when the flag is on. Existing filtering logic is untouched.
  • SettingsControl (vscode/react/src/components/graph/SettingsControl.tsx) gains a second menu item that toggles the flag.

Default is off, so behavior is unchanged unless the user opts in.

Screenshots

Current behavior
Screenshot 2026-05-28 at 09 31 36

New toggle
Screenshot 2026-05-28 at 09 31 46

Only direct neighbors
Screenshot 2026-05-28 at 09 31 52

Test plan

  • Open the SQLMesh VSCode extension on a project with a hub model that has many downstream consumers.
  • Navigate to that model — the lineage panel renders the full transitive graph (current behavior).
  • Click the cog icon in the bottom-left of the lineage panel → toggle "Only Direct Neighbors".
  • Verify only the selected model + its direct parents + its direct children remain visible.
  • Toggle off → verify the full graph returns.
  • Switch to a different model with the filter still on → verify the new model's direct neighbors are shown.

Locally tested in a transformer repo against a model with ~30+ downstream nodes; the filter collapses the view to ~10 nodes as expected.

tjirab and others added 2 commits May 29, 2026 11:03
Selecting a model in the VSCode lineage panel renders the full transitive
lineage, which can be dense for hub models. This adds a new toggle to the
existing settings menu that limits the view to the selected model plus
its direct parents and direct children.

The filter is implemented as a new withOnlyDirect boolean on
LineageFlowContext, paired with a directNeighbors set memoized from the
lineage map and mainNode. When enabled, getUpdatedNodes and
getUpdatedEdges hide anything outside that set, leaving existing
withConnected/withImpacted/withSecondary logic untouched.

Refs SQLMesh#5811

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Bart Schuijt <schuijt.bart@gmail.com>
- Build reverse parent->children adjacency map once per lineage change so
  directNeighbors stays O(parents + children) per mainNode switch instead
  of scanning the full graph each time.
- Hoist SettingsControl itemClass to module scope; rename props to
  withOnlyDirect / onWithOnlyDirectChange for consistency with the rest
  of the codebase.
- Extend lineage_settings.spec.ts with a Playwright test that toggles
  "Only Direct Neighbors" and asserts the visible node count drops and
  is restored on toggle-off.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Bart Schuijt <schuijt.bart@gmail.com>
@tjirab tjirab force-pushed the vscode-lineage-direct-neighbors branch from c7c1a56 to 6192058 Compare May 29, 2026 09:03
@StuffbyYuki StuffbyYuki merged commit 0a5980c into SQLMesh:main May 29, 2026
39 checks passed
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.

2 participants