WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@Sicheng-Pan
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan commented Dec 9, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • N/A
  • New functionality
    • CMEK support in Python and JS client

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?

@Sicheng-Pan Sicheng-Pan mentioned this pull request Dec 9, 2025
1 task
@github-actions
Copy link

github-actions bot commented Dec 9, 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

Sicheng-Pan commented Dec 9, 2025

@Sicheng-Pan Sicheng-Pan marked this pull request as ready for review December 9, 2025 00:06
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Dec 9, 2025

Add CMEK abstractions and schema plumbing to Python and JS clients

Introduces a cross-language Cmek abstraction with provider and resource handling, enabling schema-level CMEK configuration in both the Python and JavaScript clients. Extends schema serialization/deserialization, CLI exports, and unit tests to ensure CMEK data round-trips correctly while preserving existing index configuration behavior.

Key Changes

• Added Cmek dataclass and supporting enums/validation to chromadb/api/types.py, including schema serialization/deserialization hooks and warning-based error handling.
• Updated Schema class to carry an optional CMEK, expose set_cmek, and emit CMEK state during JSON conversions while maintaining index configuration semantics.
• Mirrored CMEK provider/serialization logic in the TypeScript client (schema.ts) with new warning logging and unit coverage.
• Expanded Python and JavaScript schema tests to cover CMEK creation, serialization round-trips, and interaction with existing index configuration tests.
• Re-exported Cmek from chromadb/__init__.py for public API availability.

Affected Areas

• chromadb/api/types.py
• chromadb/test/api/test_schema.py
• clients/new-js/packages/chromadb/src/schema.ts
• clients/new-js/packages/chromadb/test/schema.test.ts
• chromadb/init.py

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

@Sicheng-Pan Sicheng-Pan force-pushed the 12-08-_enh_cmek_support_in_python_and_js_client branch from cf4a53a to ffaf33f Compare December 9, 2025 00:28
@Sicheng-Pan Sicheng-Pan force-pushed the 12-05-_enh_add_cmek_to_collection_schema branch from 19bf9fa to 454424e Compare December 9, 2025 00:28
@Sicheng-Pan Sicheng-Pan force-pushed the 12-08-_enh_cmek_support_in_python_and_js_client branch 4 times, most recently from 8c321db to 42039db Compare December 9, 2025 00:47
Comment on lines +2566 to +2570
except (ValueError, KeyError) as e:
warnings.warn(
f"Could not deserialize CMEK configuration: {e}. Setting to None."
)
instance.cmek = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Advisory

[Maintainability] This line is redundant. instance.cmek is already initialized to None before the if block and will retain that value if an exception is caught. You can safely remove this line to make the except block more concise.

Suggested change
except (ValueError, KeyError) as e:
warnings.warn(
f"Could not deserialize CMEK configuration: {e}. Setting to None."
)
instance.cmek = None
except (ValueError, KeyError) as e:
warnings.warn(
f"Could not deserialize CMEK configuration: {e}. Setting to None."
)
Context for Agents
This line is redundant. `instance.cmek` is already initialized to `None` before the `if` block and will retain that value if an exception is caught. You can safely remove this line to make the `except` block more concise.

```suggestion
            except (ValueError, KeyError) as e:
                warnings.warn(
                    f"Could not deserialize CMEK configuration: {e}. Setting to None."
                )
```

File: chromadb/api/types.py
Line: 2570

@Sicheng-Pan Sicheng-Pan changed the base branch from 12-05-_enh_add_cmek_to_collection_schema to graphite-base/5991 December 9, 2025 02:39
@Sicheng-Pan Sicheng-Pan force-pushed the 12-08-_enh_cmek_support_in_python_and_js_client branch from 42039db to 73cfc36 Compare December 9, 2025 03:08
@graphite-app graphite-app bot changed the base branch from graphite-base/5991 to main December 9, 2025 03:08
@Sicheng-Pan Sicheng-Pan force-pushed the 12-08-_enh_cmek_support_in_python_and_js_client branch from 73cfc36 to c1ebea4 Compare December 9, 2025 03:08
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