Repository navigation
fix(bundle): map primary keys for 7 unimportable node labels (#1322) - #1473
Merged
Merged
Conversation
`CGCBundle._PK_MAP` had drifted behind the node tables declared in `database_embedded_kuzu.py`. A label missing from the map falls through to the `CREATE (n:Label) SET n = $props` branch of `_import_node_batch`, which Kùzu rejects with "Create node n expects primary key name as input" — so an omission is not a slow path, it is a hard failure for any bundle containing that label. #1322 reports DbTable and ExternalClass. Diffing the map against the schema found seven affected labels, not two: EnumMember, Mixin, Extension, Object PK(uid) DbTable, Datasource, ExternalClass PK(name) The four uid-keyed labels also needed `_UID_PARTS` entries. Without them the synthesised uid is the empty string, which would silently MERGE every node of that label onto a single row — a data-loss bug rather than an error. Still unfixed, deliberately: DbColumn PK(name, table_fqn) and RedisKeyPattern PK(pattern, datasource_name). Composite keys need a multi-key MERGE and a wider `_node_lookup_key` return shape than the current (label, field, value) tuple, so they are out of scope here. `KNOWN_COMPOSITE_PK_LABELS` in the new test records the gap explicitly instead of leaving it implicit. Tests: `tests/unit/core/test_bundle_pk_map_coverage.py` derives expectations from the schema file itself, so adding a node table without teaching the importer about it now fails in CI instead of in a user's import. 8 of its cases fail against the pre-fix code; all 26 pass after. Closes #1322 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
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(bundle): map primary keys for 7 unimportable node labels (#1322) (#1473) 📊 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 |
This branch was successfully deployed
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.
CGCBundle._PK_MAPhad drifted behind the node tables declared indatabase_embedded_kuzu.py. A label missing from the map falls through to theCREATE (n:Label) SET n = $propsbranch of_import_node_batch, which Kùzurejects with "Create node n expects primary key name as input" — so an omission
is not a slow path, it is a hard failure for any bundle containing that label.
#1322 reports DbTable and ExternalClass. Diffing the map against the schema
found seven affected labels, not two:
EnumMember, Mixin, Extension, Object PK(uid)
DbTable, Datasource, ExternalClass PK(name)
The four uid-keyed labels also needed
_UID_PARTSentries. Without them thesynthesised uid is the empty string, which would silently MERGE every node of
that label onto a single row — a data-loss bug rather than an error.
Still unfixed, deliberately: DbColumn PK(name, table_fqn) and RedisKeyPattern
PK(pattern, datasource_name). Composite keys need a multi-key MERGE and a wider
_node_lookup_keyreturn shape than the current (label, field, value) tuple, sothey are out of scope here.
KNOWN_COMPOSITE_PK_LABELSin the new test recordsthe gap explicitly instead of leaving it implicit.
Tests:
tests/unit/core/test_bundle_pk_map_coverage.pyderives expectationsfrom the schema file itself, so adding a node table without teaching the
importer about it now fails in CI instead of in a user's import. 8 of its cases
fail against the pre-fix code; all 26 pass after.
Closes #1322
🤖 Generated with Claude Code