Repository navigation
fix(query): refuse keyed values in a having alias comparison - #1097
Conversation
An aggregate alias comparison skipped the list-shape check the filter rules apply, so greaterThan(total, ['x' => 10]) passed at any depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code review
The having validator now rejects keyed value arrays when comparing aggregate aliases, matching the list-shape rule used by ordinary filter queries. The query-shape tests cover both direct alias comparisons and comparisons nested in a logical group. Walkthrough (2)
Reviewed Tip Comment |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|

What does this PR do?
A having condition on a SUM/COUNT/AVG alias checked its value count and that each value is finite, but not that
valuesis a list, sogreaterThan(total, ['x' => 10])passed — at the top level and insideand()/or(). It is now refused withGreaterThan query values must be a list, as the filter rules refuse it for attributes. (MIN/MAX aliases already went throughFilter.)Found in review of the Rust port (appwrite/appwrite#16355), which gets the same fix.
Test Plan
QueryShapeHavingTestcases (top level and in a logical group); both fail without the fix🤖 Generated with Claude Code
Summary by CodeRabbit