fix(datasource-cosmos): increase maxConditions default to 1000#212
Merged
Conversation
Charts with daily time buckets over long date ranges generate one condition per bucket, easily exceeding the previous 100-condition limit. A year of daily data with 2-3 filters produces ~1100 conditions. Also exposes maxConditions as a configurable option in createCosmosDataSource for users who need even higher limits. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Error QueryValidationError now extends ValidationError from datasource-toolkit so the agent error handler maps it to 400 (Bad Request) instead of 500 (Internal Server Error). A query with too many conditions is a client validation issue, not a server error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
forest-bot
added a commit
that referenced
this pull request
Apr 9, 2026
# [1.9.0](https://github.com/ForestAdmin/forestadmin-experimental/compare/datasource-cosmos@1.8.3...datasource-cosmos@1.9.0) (2026-04-09) ### Bug Fixes * **datasource-cosmos:** increase maxConditions default to 1000 ([#212](#212)) ([96df1f5](96df1f5)) ### Features * **api chart:** allow customizing api chart with query or body parameters ([#211](#211)) ([6d3eb65](6d3eb65))
forest-bot
added a commit
that referenced
this pull request
Apr 24, 2026
# [1.12.0](https://github.com/ForestAdmin/forestadmin-experimental/compare/datasource-rpc@1.11.0...datasource-rpc@1.12.0) (2026-04-24) ### Bug Fixes * allow aggregation by date ([#208](#208)) ([4622350](4622350)) * **datasource-cosmos:** increase maxConditions default to 1000 ([#212](#212)) ([96df1f5](96df1f5)) * fix aggregation when using a reserved keyword ([#207](#207)) ([7200f0b](7200f0b)) * **rpc agent:** release ([8f532a0](8f532a0)) * **rpc datasource:** fix introspection parsing ([b3978a1](b3978a1)) * use Cosmos DB compatible functions for date aggregation ([#209](#209)) ([f4be4e2](f4be4e2)) ### Features * **api chart:** allow customizing api chart with query or body parameters ([#211](#211)) ([6d3eb65](6d3eb65)) ### Performance Improvements * rollup Week/Quarter from Day-level queries ([#210](#210)) ([9528843](9528843))
forest-bot
added a commit
that referenced
this pull request
May 5, 2026
## [2.9.1](https://github.com/ForestAdmin/forestadmin-experimental/compare/rpc-agent@2.9.0...rpc-agent@2.9.1) (2026-05-05) ### Bug Fixes * **datasource-cosmos:** increase maxConditions default to 1000 ([#212](#212)) ([96df1f5](96df1f5)) * **rpc agent:** use schema path option ([#215](#215)) ([4c700ec](4c700ec)) * **rpc datasource:** fix introspection parsing ([b3978a1](b3978a1))
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.
Summary
maxConditionsfrom 100 to 1000 inQueryValidator, fixing chart queries that fail withQueryValidationError: Condition tree exceeds maximum of 100 conditionswhen using daily time buckets over long date rangesmaxConditionsas a configurable option increateCosmosDataSourcefor users who need higher limitsCosmosDataSource→CosmosCollection→QueryConverter→QueryValidatorQueryValidationErrornow extendsValidationErrorfrom datasource-toolkit, so the agent returns 400 Bad Request instead of 500 Internal Server Error when the condition limit is hitContext
Forest Admin charts with daily granularity generate one condition per time bucket. A year of daily data = 365 conditions, and adding 2-3 filters pushes it over 1000. The previous default of 100 broke charts for any date range beyond ~3 months.
Additionally,
QueryValidationErrorextended plainError, causing the agent's error handler to fall through to the default 500 status code. A query validation issue is a client error (400), not a server error (500).Test plan
max-conditions.test.tscovering:QueryValidatorlevel (boundary tests at 1000/1001)maxConditionspassthrough viaQueryConverter,CosmosCollection, andCosmosDataSourceQueryValidationErrorisinstanceof ValidationErrorand passesBusinessError.isOfTypecheck🤖 Generated with Claude Code
Note
Increase
maxConditionsdefault from 100 to 1000 in Cosmos datasource query validatormaxConditionslimit inQueryValidatorfrom 100 to 1000, fixing failures for queries with large condition trees (e.g. chart filters).maxConditionsoption tocreateCosmosDataSource,CosmosDataSource, andCosmosCollectionso callers can override the limit.QueryValidationErrorto extendValidationErrorfrom@forestadmin/datasource-toolkit, so validation failures return HTTP 400 instead of 500.Macroscope summarized 4cf51be.