Skip to content

Conversation

@sanketkedia
Copy link
Contributor

@sanketkedia sanketkedia commented Oct 28, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Setting only source_key without an ef in the sparse vector index config now returns an error
  • New functionality
    • ...

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@sanketkedia sanketkedia marked this pull request as ready for review October 28, 2025 22:37
@propel-code-bot
Copy link
Contributor

Add validation: require embedding_function when source_key is set on SparseVectorIndexConfig

This PR introduces defensive validation in both Python (chromadb/api/types.py) and Rust (rust/types/src/validators.rs) layers to prevent mis-configuration of sparse vector indexes. A ValueError (Python) / ValidationError (Rust) is now raised if source_key is provided without an accompanying embedding_function, since the system has no default sparse embedding function. Corresponding unit tests are updated and a new test is added to assert the error behaviour.

Key Changes

• Added _validate_sparse_vector_config helper and integrated it into _set_index_for_key and _enable_all_indexes_for_key in chromadb/api/types.py
• Parallel check added in Rust validator (validators.rs) for schema validation
• Updated multiple test cases to include MockSparseEmbeddingFunction; added test_sparse_vector_config_requires_ef_with_source_key

Affected Areas

Schema.create_index path for sparse vectors (Python)
Schema validation logic (Rust)
• Test suite for schema validation

This summary was automatically generated by @propel-code-bot

@sanketkedia sanketkedia requested a review from jairad26 October 28, 2025 22:38
@sanketkedia sanketkedia merged commit 8e8fb95 into main Oct 28, 2025
122 of 124 checks passed
chroma-droid pushed a commit that referenced this pull request Oct 29, 2025
## Description of changes

_Summarize the changes made by this PR._

- Improvements & Bug fixes
- Setting only source_key without an ef in the sparse vector index
config now returns an error
- New functionality
  - ...

## Test plan

_How are these changes tested?_

- [ ] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Migration plan

_Are there any migrations, or any forwards/backwards compatibility
changes needed in order to make sure this change deploys reliably?_

## Observability plan

_What is the plan to instrument and monitor this change?_

## Documentation Changes

_Are all docstrings for user-facing APIs updated if required? Do we need
to make documentation changes in the [docs
section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_
sanketkedia added a commit that referenced this pull request Oct 29, 2025
This PR cherry-picks the commit 8e8fb95
onto release/2025-10-24. If there are unresolved conflicts, please
resolve them manually.

Co-authored-by: Sanket Kedia <[email protected]>
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.

2 participants