fix(utils): compare numeric attribute-filter literals as strings#115
Open
joshuarobinson wants to merge 1 commit into
Open
fix(utils): compare numeric attribute-filter literals as strings#115joshuarobinson wants to merge 1 commit into
joshuarobinson wants to merge 1 commit into
Conversation
In the attribute filter grammar, the number transformer returned a
float, but compare() evaluates '=' / '!=' as
str(metadata[key]) <op> value. Comparing a string against a float made
equality on an unquoted numeric literal always fail (and inequality
always succeed) for string-typed metadata, e.g. 'priority = 10' never
matched {'priority': '10'}. Return the literal as a string so equality
works; ordering operators are unaffected since they coerce both operands
with float().
Found in merged MR !500.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe attribute-filter expression evaluator now preserves numeric literals as strings for equality and inequality comparisons, while ordering comparisons continue using numeric coercion. ChangesAttribute filter comparison
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the attribute filter grammar, the number transformer returned a float, but compare() evaluates '=' / '!=' as
str(metadata[key]) value. Comparing a string against a float made equality on an unquoted numeric literal always fail (and inequality always succeed) for string-typed metadata, e.g. 'priority = 10' never matched {'priority': '10'}. Return the literal as a string so equality works; ordering operators are unaffected since they coerce both operands with float().
Found in merged MR !500.
Checklist
.release_notes/.unreleased.mdmulti-storage-client/pyproject.toml.release_notes/.unreleased.md.release_notes/{bumped package version}.mdfile.Summary by CodeRabbit