Skip to content

Conversation

@jairad26
Copy link
Contributor

@jairad26 jairad26 commented Nov 6, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Adds prop tests to distributed & local chroma for e2e create_collection and get_collection flow to ensure all reconciliation logic for vector index config, and schema index configs for inverted indexes on metadata keys & sparse vector indexes are created with the correct parameters
  • 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?

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

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)

Copy link
Contributor Author

jairad26 commented Nov 6, 2025

@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from 394633e to 801ec5a Compare November 6, 2025 18:00
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from 061ee06 to fe04c8f Compare November 6, 2025 18:00
@jairad26 jairad26 marked this pull request as ready for review November 6, 2025 18:01
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Nov 6, 2025

Add extensive Hypothesis-based schema reconciliation tests for collection creation

This PR introduces a large property-based test suite that exhaustively verifies schema, metadata, and configuration reconciliation for both local and distributed Chroma back-ends. Two test-only files are added: a new test module (test_schema.py, ~760 LoC) that drives end-to-end create_collection/get_collection flows, and an expanded strategy helper (strategies.py) that generates valid combinations of metadata, collection configurations, and schema objects—including HNSW and SPANN index permutations, sparse-vector indexes, and embedding-function variants.

Key Changes

• Added new property test file chromadb/test/property/test_schema.py covering vector index config, inverted indexes, sparse vector indexes, and embedding-function persistence
• Extended chromadb/test/property/strategies.py with strategies for VectorIndexConfig, SparseVectorIndexConfig, metadata-with-HNSW, create-collection configurations, and schema generation
• Registered SimpleIpEmbeddingFunction (defaults to ip space) for tests and integrated it into strategies
• Minor fixes in existing strategy helpers (extra comma, stricter filtering, etc.)

Affected Areas

• tests/property/test_schema.py
• tests/property/strategies.py
• Hypothesis strategy helpers
• CI execution time (more test cases)

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

@jairad26 jairad26 changed the title [TST] add schema proptest [TST] add schema proptest to python Nov 6, 2025
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch 2 times, most recently from 46bddae to 148fe32 Compare November 7, 2025 19:26
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from fe04c8f to db3b74e Compare November 7, 2025 19:26
@blacksmith-sh

This comment has been minimized.

@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from 148fe32 to ab35cf0 Compare November 10, 2025 17:10
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from db3b74e to f8cfb53 Compare November 10, 2025 17:10
Comment on lines +127 to +128
for key, value in hnsw_non_none.items():
if value is not None and value != HNSW_DEFAULTS[key]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[BestPractice]

Potential KeyError risk: The code accesses HNSW_DEFAULTS[key] on lines 128 and 197 without checking if the key exists in the dictionary. If a key from hnsw_non_none is not present in HNSW_DEFAULTS, this will raise a KeyError. Add a safety check:

if key in HNSW_DEFAULTS and value is not None and value != HNSW_DEFAULTS[key]:
    should_try_metadata = False

This prevents crashes when unexpected configuration keys are encountered.

Context for Agents
[**BestPractice**]

Potential KeyError risk: The code accesses `HNSW_DEFAULTS[key]` on lines 128 and 197 without checking if the key exists in the dictionary. If a key from `hnsw_non_none` is not present in `HNSW_DEFAULTS`, this will raise a `KeyError`. Add a safety check:

```python
if key in HNSW_DEFAULTS and value is not None and value != HNSW_DEFAULTS[key]:
    should_try_metadata = False
```

This prevents crashes when unexpected configuration keys are encountered.

File: chromadb/test/property/test_schema.py
Line: 128

@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from ab35cf0 to ed59ae9 Compare November 10, 2025 17:37
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from f8cfb53 to 2b76659 Compare November 10, 2025 17:37
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from ed59ae9 to fa7744a Compare November 10, 2025 18:04
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch 2 times, most recently from e0d238f to 5fafa38 Compare November 10, 2025 23:43
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from fa7744a to 19836ec Compare November 10, 2025 23:43
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from 5fafa38 to 7c682b1 Compare November 10, 2025 23:47
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from 19836ec to f1b64d9 Compare November 10, 2025 23:47
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from f1b64d9 to 95c36fd Compare November 12, 2025 23:56
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from 7c682b1 to 8671ea1 Compare November 12, 2025 23:56
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from 95c36fd to 6cd92fc Compare November 13, 2025 00:15
@jairad26 jairad26 force-pushed the jai/fix-default-path-reconcile branch from 8671ea1 to c129192 Compare November 13, 2025 00:15
@jairad26 jairad26 changed the base branch from jai/fix-default-path-reconcile to graphite-base/5823 November 13, 2025 19:03
@jairad26 jairad26 force-pushed the jai/schema-prop-tests branch from 6cd92fc to a021c46 Compare November 13, 2025 19:03
@jairad26 jairad26 changed the base branch from graphite-base/5823 to main November 13, 2025 19:03
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