fix(records): validate aggregate and filter container shapes - #2748
Open
andersfylling wants to merge 4 commits into
Open
fix(records): validate aggregate and filter container shapes#2748andersfylling wants to merge 4 commits into
andersfylling wants to merge 4 commits into
Conversation
The aggregates argument is a mapping of client-defined ID to aggregate, and a Filters aggregate takes a list. Passing an aggregate, or a list of them, builds a request body the API cannot make sense of, with nothing pointing at the shape as the problem. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An aggregates mapping must be keyed by the client-defined aggregate IDs, and a Filters aggregate takes a sequence of filters. Both now raise TypeError naming the expected shape - at the top-level aggregates argument and in every bucket aggregate that nests further aggregates. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2748 +/- ##
==========================================
- Coverage 93.79% 93.76% -0.03%
==========================================
Files 513 513
Lines 52445 52481 +36
==========================================
+ Hits 49189 49210 +21
- Misses 3256 3271 +15
🚀 New features to boost your workflow:
|
andersfylling
marked this pull request as ready for review
August 11, 2026 15:22
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces validation for the aggregates and filters arguments in the data modeling API and data classes. Specifically, it adds _validate_aggregates and _validate_filters helper functions to ensure that aggregates are passed as mappings and filters as sequences, raising appropriate TypeErrors with helpful hints otherwise. Unit tests have been added to verify these validations. There are no review comments, and I have no feedback to provide.
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.
aggregatesis a mapping of the aggregate IDs you choose to aggregates, and aFiltersaggregate takes a sequence. Passing an aggregate directly, or a list of them, is silently serialized into a body the API cannot make sense of:Both shapes are now validated where they are taken — the top-level
aggregatesargument, the nestedaggregatesof every bucket aggregate, andFilters.filters— with a TypeError that shows the expected shape.First commit is the failing tests, second is the fix.
🤖 Generated with Claude Code