Skip to content

fix(bundle): map primary keys for 7 unimportable node labels (#1322) - #1473

Merged
Shashankss1205 merged 1 commit into
mainfrom
fix/bundle-pk-map-coverage-1322
Jul 31, 2026
Merged

Shashankss1205 merged 1 commit into
mainfrom
fix/bundle-pk-map-coverage-1322

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

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

🤖 Generated with Claude Code

`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]>
@vercel

vercel Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-graph-context-pack Ready Ready Preview Jul 29, 2026 11:28pm

@github-actions

Copy link
Copy Markdown
Contributor

Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Code Graph Analysis

fix(bundle): map primary keys for 7 unimportable node labels (#1322) (#1473)

📊 Interactive Visualization

View the blast radius graph: PR Reviewer Dashboard

📦 Artifacts

The graph JSON has been uploaded as a build artifact: pr-code-graph-1473


Generated by CodeGraphContext using FalkorDB Lite

@Shashankss1205
Shashankss1205 merged commit 4a58f90 into main Jul 31, 2026
16 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Jul 31, 2026

This branch was successfully deployed

1 active deployment
Preview — 66a41895 Deployed Jul 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: bundle import fails with "Create node n expects primary key name as input" - _PK_MAP missing DbTable/ExternalClass

1 participant