-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[HOTFIX] applying PR #5751 to rc/2025-10-24 #5753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
## Description of changes _Summarize the changes made by this PR._ - Improvements & Bug fixes - Errors if source_key is set but ef is not supplied. Both client and server side - New functionality - ... ## Test plan _How are these changes tested?_ Added unit-test - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Migration plan None ## Observability plan None ## Documentation Changes None
|
Add strict validation when This hot-fix cherry-picks PR #5751 onto the release branch and introduces a guard that disallows creating a sparse-vector index with Key Changes• Created Affected Areas• This summary was automatically generated by @propel-code-bot |
| if svit.config.source_key.is_some() && svit.config.embedding_function.is_none() { | ||
| return Err(ValidationError::new("schema").with_message( | ||
| "If source_key is provided then embedding_function must also be provided since there is no default embedding function.".into(), | ||
| )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CriticalError]
The Rust validation logic is inconsistent with the Python implementation. The Rust code at line 284 only checks for embedding_function, but the Python validation on line 2055 also allows bm25=True as an alternative:
if (config.source_key is not None
and config.embedding_function is None
and config.bm25 is not True):The Rust validation should be updated to match:
Suggested Change
| if svit.config.source_key.is_some() && svit.config.embedding_function.is_none() { | |
| return Err(ValidationError::new("schema").with_message( | |
| "If source_key is provided then embedding_function must also be provided since there is no default embedding function.".into(), | |
| )); | |
| if svit.config.source_key.is_some() && svit.config.embedding_function.is_none() && !svit.config.bm25.unwrap_or(false) { | |
| return Err(ValidationError::new("schema").with_message( | |
| "If source_key is provided then either embedding_function or bm25 must be provided since there is no default embedding function.".into(), | |
| )); | |
| } |
⚡ Committable suggestion
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Context for Agents
[**CriticalError**]
The Rust validation logic is inconsistent with the Python implementation. The Rust code at line 284 only checks for `embedding_function`, but the Python validation on line 2055 also allows `bm25=True` as an alternative:
```python
if (config.source_key is not None
and config.embedding_function is None
and config.bm25 is not True):
```
The Rust validation should be updated to match:
<details>
<summary>Suggested Change</summary>
```suggestion
if svit.config.source_key.is_some() && svit.config.embedding_function.is_none() && !svit.config.bm25.unwrap_or(false) {
return Err(ValidationError::new("schema").with_message(
"If source_key is provided then either embedding_function or bm25 must be provided since there is no default embedding function.".into(),
));
}
```
⚡ **Committable suggestion**
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
</details>
File: rust/types/src/validators.rs
Line: 287
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
This PR cherry-picks the commit 0d3bd2a onto rc/2025-10-24. If there are unresolved conflicts, please resolve them manually.