Skip to content

refactor(config)!: make graph config mappings private - #70

Merged
prrao87 merged 1 commit into
mainfrom
fix/private-config-mappings-type-check
Oct 28, 2026
Merged

prrao87 merged 1 commit into
mainfrom
fix/private-config-mappings-type-check

Conversation

@prrao87

@prrao87 prrao87 commented Oct 28, 2026

Copy link
Copy Markdown
Member

Why

GraphConfig keys its node and relationship mappings by lowercase label so lookups are case-insensitive. The mapping fields were public, so code outside GraphConfigBuilder could insert a key like "Person" and lookups would silently miss it. Deserialization had the same gap: a saved config was loaded without normalizing or validating its keys.

Closes #23. The issue's second half, type checking comparisons and arithmetic in semantic analysis, already landed with the 0.3.0 integration in crates/lance-csr/src/semantic/types.rs. A mismatch in WHERE or RETURN raises a ValueError that names the expression and both operand types, it has tests, and the error table in docs/cypher.md already describes it. This PR doesn't change it.

What changed

  • node_mappings and relationship_mappings on GraphConfig are private. Reads go through get_node_mapping, get_relationship_mapping, iter_node_mappings and iter_relationship_mappings, which every caller in the workspace and the Python bindings already used.
  • GraphConfig now deserializes through GraphConfigBuilder::build(), so a loaded config is validated like a built one. The serialized format is unchanged.
  • The crate README describes the private fields instead of promising a future migration.

Breaking change for Rust users: code that writes to the mapping fields directly no longer compiles and should use the builder instead. A deserialized config that build() would reject now fails to load: one with an unnormalized key, or a relationship whose endpoint label has no node mapping. Because of this, the next release should be a minor version bump. The Python API is unaffected.

Validation

  • cargo fmt --all -- --check passes.
  • cargo clippy --workspace --all-targets -- -D warnings passes.
  • cargo test --workspace passes, including a new round-trip test that also checks an unnormalized key is rejected on load.
  • uvx typos@1.26.0 passes on the changed files.
  • The Python suite (make test) was not run locally. The bindings compile under clippy and don't touch the fields. CI is pending.

🤖 Generated with Claude Code

GraphConfig's node and relationship mappings are now private, so keys
are always normalized through GraphConfigBuilder. Deserialization also
goes through the builder, so a loaded config is validated like a built
one. The serialized format is unchanged.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6de91f
Status: ✅  Deploy successful!
Preview URL: https://217fce81.lance-csr.pages.dev
Branch Preview URL: https://fix-private-config-mappings.lance-csr.pages.dev

View logs

@prrao87
prrao87 marked this pull request as ready for review October 28, 2026 14:43
@prrao87
prrao87 merged commit 57a3326 into main Oct 28, 2026
7 checks passed
@prrao87
prrao87 deleted the fix/private-config-mappings-type-check branch October 28, 2026 14:55
prrao87 added a commit that referenced this pull request Oct 28, 2026
0.4.0 rather than 0.3.2: #70 made the graph config mappings private,
a breaking change. Also refresh the version in the three lockfiles,
which bump-my-version does not update.
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.

Make config mappings private and type-check expressions

1 participant