feat(data-fabric): add havingFilter to entity record queries [DS-9078] - #647
feat(data-fabric): add havingFilter to entity record queries [DS-9078]#647aayushuipath wants to merge 5 commits into
Conversation
Review findingsInline comment posted
|
|
Addressed both findings in 814bad9: EntityHavingOperator is now an enum (QueryFilterOperator pattern, '<>' dropped), and both queryRecordsById/queryRecords JSDoc @param lists mention havingFilter with a HAVING example added to each (including EntityHavingOperator in the example imports). |
Review findingsInline comment posted
|
814bad9 to
dc1993c
Compare
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
|
Review finding — |
Post-aggregation filter (SQL HAVING) on grouped aggregate results: conditions reference declared aggregate aliases (aggregates-only server contract, DS-9077/DS-9078). Requires aggregates + groupBy - enforced client-side with an actionable ValidationError. havingFilter is registered in excludeFromPrefix so the key reaches the wire un-prefixed; without this the pagination helper would send it as $havingFilter and the server would never see it. Server-side: native (LDO) entities only, gated by the enable-having-on-query feature flag (400 otherwise). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ingFilter Review follow-ups: enum matching the QueryFilterOperator convention (drop the redundant <> - the server normalizes !=), tests on enum members, and havingFilter added to both query methods @param lists with HAVING examples. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Data-independent HAVING assertions on the fixture entity: a satisfiable threshold (cnt >= 1) must return every group and an unsatisfiable one must return none - a backend that ignores havingFilter returns every group there, which is the failing signal. Requires the enable-having-on-query tenant flag; without it the server 400s naming the flag, failing loud as requested. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
af80296 to
65ecdfc
Compare
Review findingsNew inline comments posted this run
|
Group by Id (always present) instead of the join fixture field, drop the unexplained LDO acronym from the JSDoc, and use unknown over any in the integration assertion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
Sonar S5906: toHaveLength reports the actual array contents on failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| * | ||
| * Requires `aggregates` and `groupBy` on the query. Supported for native entities | ||
| * only; gated by the tenant's `enable-having-on-query` feature | ||
| * flag — the server responds 400 when either doesn't hold. Maximum 5 conditions. |
There was a problem hiding this comment.
who enforces "max 5 conditions"?
There was a problem hiding this comment.
The server does - the backend's HavingFilterValidator caps it (MAX_HAVING_FILTERS = 5) and returns 400 'Maximum 5 havingFilter conditions allowed per query'.
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
|



What
Adds
havingFiltertoEntityQueryRecordsOptions: a post-aggregation filter (SQL HAVING) over grouped aggregate results. Conditions reference declared aggregate aliases ({ aggregateAlias, operator, value }), combined with AND/OR.How
EntityHavingFilter,EntityHavingCondition,EntityHavingOperator(wire-shape 1:1 with the Data Service contract from CommonEntityPlatform#5832)queryRecordsById: client-side ValidationError whenhavingFilteris supplied withoutaggregates+groupBy(mirrors the join validations)havingFilteradded toexcludeFromPrefix- without this the pagination helper OData-prefixes the key to$havingFilterand it silently never reaches the serverServer contract notes
filterGroupenable-having-on-queryfeature flag (rolling out ring-by-ring, alpha first)Tests
3 new unit tests (verbatim forwarding + excludeFromPrefix, missing-aggregates rejection, missing-groupBy rejection). Full suite: 2153 passed, lint and build clean.
Consumer-rollout ticket: DS-9078. The uip CLI's
df records querypass-through depends on this change + a version bump (its body keys are gated by this SDK's excludeFromPrefix allowlist).🤖 Generated with Claude Code