feat: include property definitions per label in get_graph_schema (#179)#181
Open
dLo999 wants to merge 3 commits intoDeusData:mainfrom
Open
feat: include property definitions per label in get_graph_schema (#179)#181dLo999 wants to merge 3 commits intoDeusData:mainfrom
dLo999 wants to merge 3 commits intoDeusData:mainfrom
Conversation
…sData#179) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add SQLITE_OK guard before bind/step calls, matching existing patterns in store.c. Add LIMIT 50 rationale in comments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dLo999
commented
Mar 29, 2026
Author
dLo999
left a comment
There was a problem hiding this comment.
Review Summary
Adds property definitions per node label and edge type to get_graph_schema. Base columns listed first, then JSON property keys discovered via json_each() with LIMIT 50 cap. Backward compatible — existing label/count fields unchanged.
Findings
- [warning] src/store/store.c:2521,2587 —
sqlite3_prepare_v2()return was unchecked before bind/step calls, deviating from existing patterns. Fixed in follow-up commit: addedSQLITE_OKguard matching the pattern at line 2449. If prepare fails, base columns are still returned (graceful degradation). - [nit] src/store/store.c — LIMIT 50 rationale now documented in inline comments (added in fix commit).
- [observation] No new test for property discovery — existing
store_schema_infotest passes but doesn't validate the newpropertiesarrays. Not blocking since the feature is backward compatible and manually verified.
CI Status
No CI on fork branch. Local: 2741 tests pass, 0 regressions. Behavioral verification against 23K-node project confirms correct output across 14 labels including empty-properties edge cases.
Verdict
APPROVE — Review warning addressed in follow-up commit. Implementation is correct, performant (59ms for 23K nodes), and backward compatible.
Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Closes #179
Summary
Adds property definitions per node label and edge type to
get_graph_schemaoutput. Users can now discover which properties are available for Cypher queries without trial and error.Changes
src/store/store.h: Extendedcbm_label_count_tandcbm_type_count_twithproperties/property_countfieldssrc/store/store.c: Added per-label/type property key queries usingjson_each()incbm_store_get_schema(), with proper cleanup incbm_store_schema_free()src/mcp/mcp.c: Emits"properties"array in JSON output for both node labels and edge typesOutput format (before → after)
Before:
{"label": "Function", "count": 13531}After:
{"label": "Function", "count": 13531, "properties": ["name", "qualified_name", "file_path", "start_line", "end_line", "complexity", "docstring", "is_entry_point", "is_exported", "is_test", "lines", "param_names", "param_types", "return_type", "signature"]}How it works
name,qualified_name,file_path,start_line,end_line) are always listed first — these exist on every nodeSELECT DISTINCT je.key FROM nodes, json_each(nodes.properties) AS je WHERE label = ?(limited to 50 keys)source_id,target_id) plus JSON property keyslabel,count,type) are unchanged — fully backward compatibleTest results
Build: Compiles cleanly on macOS (Apple Clang, arm64)
Test suite: 2741 passed, 0 failed (confirmed flake in
test_pipeline.c:2672did not reproduce on rerun; passes on main intermittently too)Behavioral verification (ran
cli get_graph_schemaagainst real indexed project — codebase-memory-mcp itself, 23,736 nodes, 14 labels):{}){})Edge case: empty properties — Labels where every node has
properties = '{}'(Folder, Project) correctly return only the 5 base columns with 0 JSON properties. Same for edge types with no JSON properties (DEFINES, CALLS).Performance: 59ms total for 23K nodes across 14 labels — negligible overhead from the
json_each()queries.Generated with agent-team via /issue