fix(python): validate query field names#612
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Tightens Python-side Query validation to ensure field_name is a non-empty string, preventing later executor/schema failures from invalid field names.
Changes:
- Update
Query._validate()to reject non-strand emptyfield_namevalues with a clearer error message. - Add a parametrized regression test covering
None, empty string, and non-string field names.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/zvec/model/param/query.py | Strengthens field_name validation and improves error message clarity. |
| python/tests/test_params.py | Adds parametrized tests to ensure invalid field_name values are rejected. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not isinstance(self.field_name, str) or not self.field_name: | ||
| raise ValueError("Field name must be a non-empty string") |
f8ec25c to
c088569
Compare
|
Addressed Copilot review feedback: whitespace-only |
Summary
Tighten Python Query validation so field_name must be a non-empty string.
Previously, Query._validate() only rejected None, so an empty string or non-string value could pass Python-side validation and fail later with a less direct executor/schema error.
This adds a focused regression test for None, empty string, and non-string field names.
Tests