Skip to content

fix: remove label_field concept, use array key as node label#9

Merged
sonesuke merged 1 commit intomainfrom
fix/remove-label-field-use-array-key-as-label
Mar 30, 2026
Merged

fix: remove label_field concept, use array key as node label#9
sonesuke merged 1 commit intomainfrom
fix/remove-label-field-use-array-key-as-label

Conversation

@sonesuke
Copy link
Copy Markdown
Owner

Summary

  • Remove the label_field concept that incorrectly used field values (e.g., role: "admin") as Cypher node labels — labels should represent node types, not property values
  • Node labels are now derived from the JSON array key (last segment of node_path), so {"Patent": [...]} creates :Patent nodes
  • Add GraphConfig::label() method for deriving the label from node_path

Breaking changes

  • GraphConfig::label_field field removed
  • GraphConfig::new() signature changed (no label_field parameter)
  • ArraySchema::recommended_label_field removed
  • NodeFieldInfo::is_label_candidate removed

Test plan

  • All 67 unit tests pass
  • All 13 doctests pass
  • cargo clippy clean
  • cargo fmt applied

🤖 Generated with Claude Code

The `label_field` config used field values (e.g., role: "admin") as Cypher
node labels, which is semantically incorrect — labels should represent node
types, not property values. Now the last segment of `node_path` is used as
the node label (e.g., `"Patent"` from `{"Patent": [...]}`).

Breaking changes:
- `GraphConfig::label_field` field removed
- `GraphConfig::new()` no longer accepts `label_field` parameter
- `ArraySchema::recommended_label_field` removed
- `NodeFieldInfo::is_label_candidate` removed

New API:
- `GraphConfig::label()` — returns the derived label from `node_path`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonesuke sonesuke merged commit 1908b41 into main Mar 30, 2026
4 checks passed
@sonesuke sonesuke deleted the fix/remove-label-field-use-array-key-as-label branch March 30, 2026 07:35
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