fix(viz): match backend internal keys case-insensitively (#1458) - #1471
Closed
Shashankss1205 wants to merge 1 commit into
Closed
fix(viz): match backend internal keys case-insensitively (#1458)#1471Shashankss1205 wants to merge 1 commit into
Shashankss1205 wants to merge 1 commit into
Conversation
The offline renderer's four parsing helpers keyed only on the lowercase internal fields Kuzu returns (_label/_src/_dst/_id). LadybugDB returns the same fields uppercase (_LABEL/_SRC/_DST/_ID), so no dict branch matched, every value was discarded, and _render_offline_visualization bailed out with 'No graph data returned - index a repository first' against a database that demonstrably held data. Adds _meta()/_has_meta() helpers that accept either casing, and routes the four helpers through them. Deliberately additive: both helpers try the lowercase spelling first and only then the uppercase one, so the Kuzu, Neo4j and Falkor paths are unchanged. Mixed casing within a single record also works, since each field is resolved independently. One intentional behaviour change: an empty or missing _label now falls back to 'Node'/'RELATED' rather than propagating '' - previously only a *missing* key hit the default. Tests add the Ladybug uppercase shape to the existing backend-shape parametrisation plus three cases: uppercase records render, mixed casing renders, and an uppercase relationship is still not misclassified as a node (_LABEL alone must not decide - _SRC/_DST does). Verified: 944 passed, 7 skipped, 0 failed across tests/unit. Closes #1458 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ |
Contributor
🔍 PR Code Graph Analysisfix(viz): match backend internal keys case-insensitively (#1458) (#1471) 📊 Interactive VisualizationView the blast radius graph: PR Reviewer Dashboard 📦 ArtifactsThe graph JSON has been uploaded as a build artifact: Generated by CodeGraphContext using FalkorDB Lite |
Shashankss1205
added a commit
that referenced
this pull request
Aug 5, 2026
…_DST) (#1506) Closes #1458. KùzuDB and LadybugDB share the same embedded-graph wire format (plain dict records), but LadybugDB spells its internal metadata fields uppercase (_ID/_LABEL/_SRC/_DST) where KùzuDB spells the same fields lowercase (_id/_label/_src/_dst). Confirmed empirically against both real packages: # real ladybug package, MATCH (n)-[r]->(m) RETURN n, r, m >>> list(node_row.keys()) ['_ID', '_LABEL', 'name', 'path'] >>> list(rel_row.keys()) ['_SRC', '_DST', '_LABEL', '_ID'] # real kuzu package, same query >>> list(node_row.keys()) ['_id', '_label', 'name', 'path'] >>> list(rel_row.keys()) ['_src', '_dst', '_label', '_id'] `cli_helpers.py`'s offline-viz helpers (`_is_node`, `_is_relationship`, `_node_payload`, `_edge_payload`) only checked the lowercase spelling, so every LadybugDB row was silently discarded and `_render_offline_visualization` bailed out with "No graph data returned" even on a freshly indexed repo — exit code 1. The same gap exists, unaddressed, in `viz/server.py` — the live web visualization server (the flagship FastAPI-served graph UI, not just the CLI fallback). `_get_eid`, the inline `/api/graph` node/edge parsing, and the standalone `parse_node`/`parse_rel`/`parse_element` helpers all had the identical lowercase-only checks, so a LadybugDB backend renders an empty live graph too. This file was not touched by the earlier attempt at this issue (#1471, closed unmerged). Adds a small `_meta()`/`_has_meta()` helper in each file that reads a backend-internal field regardless of casing, and uses it everywhere the four fields are read. KùzuDB/Neo4j/FalkorDB behavior is untouched (lowercase-first, upper as fallback). Verified end-to-end against the real `ladybug` package, not just unit tests: indexed a sample repo with LADYBUGDB as the active backend and ran `cgc visualize`. Before: No graph data returned — index a repository first After: Rendered 8 nodes and 9 edges to /tmp/cgc_graph_....html Unit tests: added a LadybugDB fixture (uppercase keys) to the existing parametrized offline-viz test, and a new tests/unit/viz/test_server_graph_parsing.py covering `_get_eid`, `_meta`, `parse_node`, `parse_rel`, and `parse_element` against both KùzuDB and LadybugDB shapes. Confirmed all new cases fail on the pre-fix code before reapplying the fix. Co-authored-by: Shashank Shekhar Singh <Shashankshekharsingh1205@gmail.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.
Closes #1458
The offline renderer's four parsing helpers keyed only on the lowercase internal fields Kùzu returns (
_label/_src/_dst/_id). LadybugDB returns the same fields uppercase (_LABEL/_SRC/_DST/_ID), so no dict branch matched, every value was discarded, and the renderer bailed out withNo graph data returned — index a repository firstagainst a database that demonstrably held data.Adds
_meta()/_has_meta()helpers accepting either casing, and routes all four helpers through them.Deliberately additive and low-risk: both helpers try the lowercase spelling first and only then uppercase, so the Kùzu, Neo4j and Falkor code paths are byte-for-byte unchanged. Mixed casing inside a single record also works, since each field resolves independently.
One intentional behaviour change, called out explicitly: an empty-or-missing
_labelnow falls back toNode/RELATED, whereas previously only a missing key hit the default and a present-but-empty one propagated"".Tests add the Ladybug uppercase shape to the existing backend-shape parametrisation, plus three cases: uppercase records render, mixed casing renders, and an uppercase relationship is still not misclassified as a node (
_LABELalone must not decide —_SRC/_DSTdoes).Verified: 944 passed, 7 skipped, 0 failed across
tests/unit.🤖 Generated with Claude Code