Skip to content

fix(schema): draw every table in a whole-DB graph, linked or not#63

Merged
BorisTyshkevich merged 2 commits into
mainfrom
fix/schema-graph-show-all-tables
Jun 28, 2026
Merged

fix(schema): draw every table in a whole-DB graph, linked or not#63
BorisTyshkevich merged 2 commits into
mainfrom
fix/schema-graph-show-all-tables

Conversation

@BorisTyshkevich

@BorisTyshkevich BorisTyshkevich commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

When you open a database's data-flow graph, tables that aren't part of any relationship (view/MV/dictionary/Distributed lineage) were dropped whenever the database had some lineage — a confusing "where are my tables?" UX. Two follow-up refinements were folded in (see commits).

Changes

  1. Draw every table in a whole-DB graph — buildSchemaGraph no longer prunes isolated nodes; lineage edges are drawn between the linked ones, standalone cards for the rest. Table-focus (1-hop) is unchanged; cross-DB scoping in the full view is still handled by expandLineage (seeds the focus DB, BFS the rest), so neighbouring databases don't dump their unrelated tables in.

  2. Singles packed at the end — new opt-in isolatedLast on dagreLayout: the connected lineage lays out first (top), and the edge-less "single" tables are gridded into a roughly-square block beneath it, instead of dagre ranking the orphans across the top. Used by both the inline preview and the full view.

  3. Drop the redundant db. prefix on node labels when the node is in the focused database (e.g. dashboards, not bentoclick.dashboards); nodes from another database keep their qualified id so the cross-DB origin stays visible. Applied once in buildSchemaGraph, so both the inline short view and the full-view cards pick it up. ids/edges (and click-to-SHOW-CREATE) are untouched — only the display label changes.

Tests

Updated/added unit tests for all three: keep-isolated, label strip vs cross-db keep, and isolatedLast grid packing (mixed + no-lineage). Full suite 1013 passing; dot-layout.js 100% all metrics, schema-graph.js coverage green.

Verification

Built, deployed to antalya (play-sql.html), drove the live cluster on bentoclick (15 tables, one 3-node lineage chain + 12 standalone):

  • All 15 tables render (inline preview + full view). ✅
  • Singles below the lineage: lineage at y 12–460 (dashboards_raw → dashboards_mv → dashboards), the 12 singles gridded in a 4-col block at y 711–925. ✅
  • Labels stripped: cards/boxes show dashboards, _asset_dash_* — no bentoclick. prefix — in both the full view and the inline short view. ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ

BorisTyshkevich and others added 2 commits June 28, 2026 18:16
The data-flow graph dropped tables that didn't participate in any
view/MV/dictionary/Distributed relationship whenever the database had *some*
lineage — so a database of mostly-standalone tables showed only the few linked
boxes and hid the rest. Reverses that pruning: a whole-DB view now keeps every
object as a node, drawing lineage edges between the linked ones and standalone
cards for the rest (matching the no-relationships case, which already did this).

Table-focus (1-hop neighbourhood) is unchanged — it's a deliberately scoped view.
Cross-DB scoping in the full view is still handled by expandLineage, which seeds
the focus DB and BFS-walks only the connected nodes of other databases, so this
doesn't pull unrelated tables in from neighbouring databases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ
…db prefix

Two UX refinements on the whole-DB graph:

- Lay the connected lineage out first and grid the edge-less "single" tables
  beneath it (new `isolatedLast` option on dagreLayout, used by both the inline
  preview and the full view), instead of dagre ranking the orphans across the top.
- Drop the redundant "<db>." prefix from a node's label when it's in the focused
  database; nodes from another database keep their qualified id so the cross-DB
  origin stays visible. Applied once in buildSchemaGraph, so both the inline short
  view and the full-view cards pick it up. ids/edges (and click-to-SHOW-CREATE)
  are unaffected — only the display label changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ
@BorisTyshkevich BorisTyshkevich merged commit b01cf27 into main Jun 28, 2026
6 checks passed
BorisTyshkevich added a commit that referenced this pull request Jun 28, 2026
Schema data-flow graph improvements (#63): the whole-DB graph now draws every
table (linked or not), packs the unlinked "single" tables into a grid below the
lineage, and drops the redundant "<db>." prefix from node labels for objects in
the focused database (cross-DB nodes stay qualified). No new runtime deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ
BorisTyshkevich added a commit that referenced this pull request Jun 28, 2026
Code-review follow-ups for the zoom-bridge (#62) and schema-graph (#63) PRs.

Correctness / behavior:
- ch-client: the transitive-lineage nodeCap now counts only *linked* nodes, not
  every standalone table — so a single large DB of mostly-unrelated tables no
  longer truncates on round 1 and skips its cross-DB lineage walk (#63 review).
- schema-graph: guard the db-prefix label strip with `&& n.name` so a node with
  an empty name can't be rewritten to a blank title (#63 review).

Altitude / cleanup:
- dot-layout: split the schema-specific "lineage first, singles gridded below"
  policy out of the generic dagre wrapper into a dedicated `schemaLayout()`;
  `dagreLayout` reverts to its plain generic form (no opts). Drops the dead
  `usedCols` (== cols) term and the always-built `connected` set on the pipeline
  path (#62/#63 review).
- dom: extract the fixed-popover anchor recipe (divide client coords by the zoom)
  into a pure, 100%-covered `fixedAnchor()` helper; the File menu and the
  Save/user popover now share it instead of hand-transcribing the math — which
  also moves the previously-untested anchoredPopover arithmetic under test (#62).
- app: simplify `dragCtx.scale` to report the page zoom without the redundant
  per-axis ternary (dragValue already ignores scale for the % axes) (#62).
- dom: note in zoomScale that the measured element is immaterial (page-global) (#62).

Tests added for schemaLayout (grid extent + no-lineage + no-singles + empty),
fixedAnchor (both corners + floors), the ·inner label-skip, and the
linked-only nodeCap. All 1020 tests pass; dot-layout/dom back to 100% coverage.


Claude-Session: https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ

Co-authored-by: Claude Opus 4.8 (1M context) <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