Skip to content

refactor(schema): address PR #62/#63 code-review follow-ups#64

Merged
BorisTyshkevich merged 1 commit into
mainfrom
fix/schema-graph-review-followups
Jun 28, 2026
Merged

refactor(schema): address PR #62/#63 code-review follow-ups#64
BorisTyshkevich merged 1 commit into
mainfrom
fix/schema-graph-review-followups

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

Follow-up to the high-effort /code-review of #62 (zoom coordinate bridge) and #63 (schema-graph: draw all tables / singles below / drop db prefix). Both reviews found no correctness bug; this PR fixes the substantive behavior items and the cleanup/altitude notes.

Correctness / behavior

  • Transitive nodeCap counts only linked nodes (ch-client.js) — fix(schema): draw every table in a whole-DB graph, linked or not #63's main finding. The cap that bounds cross-DB lineage expansion was counting every standalone table now that the whole-DB view keeps them, so a single large DB of mostly-unrelated tables tripped truncated on round 1 and never followed its few cross-DB links. Now only edge-participating nodes count toward the cap; standalone tables (which never drive expansion) don't truncate the walk.
  • Guard the label strip with && n.name (schema-graph.js) — fix(schema): draw every table in a whole-DB graph, linked or not #63. Prevents a focus-db node with an empty name from being rewritten to a blank card title.

Altitude / cleanup

  • Extract schemaLayout() (dot-layout.js) — fix(zoom): bridge html{zoom} in full-view panel + drag/popover coordinates #62/fix(schema): draw every table in a whole-DB graph, linked or not #63 altitude. The schema-specific "lineage first, edge-less tables gridded below" policy moves out of the generic dagre wrapper into its own pure function; dagreLayout reverts to its plain form (no opts/isolatedLast). Also drops the dead usedCols (provably == cols) and the connected set that was built even on the pipeline path.
  • Extract fixedAnchor() (dom.js) — fix(zoom): bridge html{zoom} in full-view panel + drag/popover coordinates #62 reuse + coverage. The "anchor a fixed popover under a button, dividing client coords by the zoom" recipe was hand-transcribed in three spots; the File menu and the Save/user popover now share one pure, 100%-covered helper — which also brings the previously-untested anchoredPopover arithmetic (app.js, lower gate) under test.
  • Simplify dragCtx.scale (app.js) — drop the redundant per-axis ternary (dragValue already ignores scale for the % axes).
  • Clarify zoomScale doc — the measured element is immaterial (zoom is page-global).

The two design-level altitude notes (per-rule calc(/var(--zoom)) CSS pattern; grid-in-layout) are mitigated by the centralized --zoom var + the schemaLayout/fixedAnchor extractions; a deeper "don't use zoom" rework was judged out of scope.

Tests

New tests for schemaLayout (grid extent with exact px, no-lineage, no-singles fallback, empty/missing-keys), fixedAnchor (both corners + min/gap floors), the ·inner label-skip, and the linked-only nodeCap (standalone tables don't truncate the cross-DB walk). 1020 tests pass; dot-layout.js and dom.js back to 100% across the board.

Verification

Built, deployed to antalya, drove bentoclick (15 tables) post-refactor: inline + full view still render all 15 with the lineage chain first (y≤460) and the 12 singles gridded below (y≥711), card titles stripped of the bentoclick. prefix — identical to #63, confirming the schemaLayout extraction is behavior-preserving.

🤖 Generated with Claude Code

https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ

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.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ
@BorisTyshkevich BorisTyshkevich merged commit 3cd33f4 into main Jun 28, 2026
6 checks passed
BorisTyshkevich added a commit that referenced this pull request Jun 28, 2026
Bugfix release rolling up the schema-graph + zoom work since 0.1.3:
- #64: code-review follow-ups (schemaLayout extraction, fixedAnchor helper,
  linked-only transitive nodeCap, label-strip guard).
- #65: drop the detail-pane "Insert SHOW CREATE" button, ring the selected node
  (double border), and clear that ring on every pane-close path (incl. Esc).
No new runtime deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kE9qbgBNBrfNgwg9fRsMJ
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