feat(entities): support havingFilter post-aggregation filter [DS-9078] - #1863
feat(entities): support havingFilter post-aggregation filter [DS-9078]#1863aayushuipath wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds SQL HAVING-style post-aggregation filtering support to the Data Fabric Entities structured query (EntitiesService.retrieve_records / retrieve_records_async) in uipath-platform, including new request models, request-body serialization, and local preflight validation.
Changes:
- Introduces
EntityHavingFilter/EntityHavingCondition/EntityHavingOperatormodels and exports them fromuipath.platform.entities. - Extends structured-query request building to serialize
having_filterashavingFilterand validates thathaving_filteris only used withaggregates+group_by. - Adds tests for wire-format serialization and local validation; bumps
uipath-platformversion to0.2.19and updates lockfiles.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/uipath/uv.lock | Updates locked editable dependency version for uipath-platform to 0.2.19. |
| packages/uipath-platform/uv.lock | Updates locked package version for uipath-platform to 0.2.19. |
| packages/uipath-platform/tests/services/test_entities_service.py | Adds tests for havingFilter wire serialization and local validation error behavior. |
| packages/uipath-platform/src/uipath/platform/entities/entities.py | Adds HAVING-related models (EntityHaving*) alongside existing structured-query models. |
| packages/uipath-platform/src/uipath/platform/entities/_entity_data_service.py | Adds having_filter plumbing + local validation + JSON serialization to the query request spec builder. |
| packages/uipath-platform/src/uipath/platform/entities/_entities_service.py | Exposes having_filter on the public facade methods and documents usage with an example. |
| packages/uipath-platform/src/uipath/platform/entities/init.py | Exports new HAVING models from the public entities module. |
| packages/uipath-platform/pyproject.toml | Bumps uipath-platform version to 0.2.19. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| [project] | ||
| name = "uipath-platform" | ||
| version = "0.2.18" | ||
| version = "0.2.19" |
There was a problem hiding this comment.
Good call. Dropped the version bump (and lockfile updates) from this PR, so merging no longer publishes anything; the 0.2.19 bump will go in a small follow-up PR once the backend rollout completes. Updated the PR description to match.
There was a problem hiding this comment.
Update: the split does not work in this repo. The check-version-availability gate fails any PR whose package files change without an unpublished version in pyproject.toml, so the bump has to ride along. Restored it and kept the do-not-merge hold in the description instead.
| body = json.loads(sent.content) | ||
| assert body["havingFilter"] == { | ||
| "logicalOperator": 0, | ||
| "aggregateFilters": [ | ||
| {"aggregateAlias": "total", "operator": ">", "value": "5"} | ||
| ], | ||
| } |
There was a problem hiding this comment.
The hard-coded 0 is deliberate here: this test pins the exact wire contract the server sees. If it asserted LogicalOperator.And.value, the test would keep passing even if the enum's value were accidentally changed, which is precisely the regression it should catch.
🚨 Heads up:
|
|



What
Adds
having_filter(SQLHAVING) support toentities_service.retrieve_records/retrieve_records_async, mirroring the TS SDK change (UiPath/uipath-typescript#647) for the Data Fabric query endpoint.EntityHavingFilter,EntityHavingCondition,EntityHavingOperator(=,!=,>,>=,<,<=), exported fromuipath.platform.entitieshaving_filteris serialized ashavingFilterin the query bodyhaving_filterwithoutaggregates+group_byraisesValueErrorbefore any HTTP call (same rule the server enforces, clearer error)check-version-availability)Scope notes (matches the backend contract)
filter_group/query/executepath return 400 server-sideenable-having-on-queryfeature flag on the backend; max 5 conditions (server-enforced)Do not merge yet
Merging publishes 0.2.19 to PyPI via CD (the
check-version-availabilitygate requires the bump in-PR, so the release cannot be split out). The backend reaches production rings Aug 24-28; releasing before then would let clients sendhavingFilterto servers that silently ignore unknown properties and return unfiltered results. This note will be removed once the backend is confirmed on prod.Companion PRs
Testing
pytest packages/uipath-platform/tests/: 1645 passed, 0 failed (7 pre-existing credential-gated skips)havingFilterbody) and local validation errorruff check,ruff format --check,mypy: clean🤖 Generated with Claude Code