Repository navigation
Conversation
Local mode stopped validating a SliceCondition used inside a FormulaQuery once the slice checks moved into validate_filter, so total=0 raised ZeroDivisionError and an out of range index was accepted. The formula expression is now walked once before scoring and each condition in it goes through validate_filter, the same check used for request filters.
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
closes #1595
In local mode a
SliceConditionused inside aFormulaQuerywas no longer validated after the slice range checks moved fromcheck_conditionintovalidate_filter, because formula conditions are evaluated throughcheck_conditionand never pass throughvalidate_filter. As a resultSlice(total=0)raisedZeroDivisionErrorand an index outside0..totalwas accepted and scored as false, while the server rejects both.This change adds
validate_expressioninqdrant_client/hybrid/formula.py, which walks the formula once and sends every condition it finds throughvalidate_filter, the same check request filters already use.LocalCollection._rescore_with_formulacalls it before scoring any point, so a formula given in a nested prefetch is covered too. The async local client sharesLocalCollection, so it gets the same fix.The new test
test_formula_rejects_invalid_sliceinqdrant_client/local/tests/test_formula.pyruns the example from the issue against an in-memory client:Slice(total=0, index=0)andSlice(total=2, index=5), each placed directly in the formula and inside aFilterunder aNegExpression, must raiseValueErrornaming the bad parameter. All four cases fail ondevand pass with the change.All Submissions:
devbranch. Did you create your branch fromdev?Changes to Core Features: