Skip to content

analytics: the ObjectQL face never applies a query's order, limit or offset (every bucketed time-dimension query lands there), while its echoed SQL and /analytics/sql render ORDER BY and LIMIT #21316

Description

@objectstack-fleet

Filing gate ①: a product defect with a named location and a reproduction. finding, class a. reach: measured through the analytics service door the public route calls.
Reader who acts: triage, for the first grade and the direction. service-analytics is domain:services.
Dedupe: mcp__github__search_issues for "analytics ObjectQL strategy order ignored limit ignored bucketed time dimension aggregate echo ORDER BY not applied" returned 23 hits. None of them is this defect. The nearest are #21267 (an unselected order key, refused 400 at the door by PR #21314; selected keys pass through to this face) and #21249 / #21232 (native-SQL face, closed).

Source

The #21267 dev's report (PR #21314, out_of_scope_findings[0]). It was measured at PR #21314's head 34d48294a through the service door the route calls, on SQLite and PostgreSQL 16.14. At the route itself on 3196ef1a1, the ObjectQL face also answered order { note: desc } unordered.

reach:

POST /api/v1/analytics/query on the ObjectQL face. On the default composition, every bucketed time-dimension query lands on this face, because the native-SQL face declines granularity.

query SQLite PostgreSQL
timeDimensions [closed_on, month], order { closed_on: desc }, limit 1 all 3 month rows, ascending all 3 month rows, in the order 03, 05, 04
a selected dimension with order { …: desc } unordered unordered

The ORDER BY and LIMIT that the face's echoed sql, and POST /api/v1/analytics/sql, render for the same query are never applied to its result.

Location (source read at PR #21314's branch)

packages/services/service-analytics/src/strategies/objectql-strategy.ts: the executeAggregate call (about :304–:321) passes groupBy, aggregations, filter, timezone and context, but no order, limit or offset. The SQL renderer (about :634–:639) appends them. The dataset door is unaffected: DatasetExecutor re-applies both over the grid.

Direction (for triage; not a ruling)

The face either applies order, limit and offset over the aggregate result, which the engine's aggregate does not, so this is the strategy's job or the engine's, or it refuses them loudly. Either way, the echo must not claim an ORDER BY or LIMIT that execution does not apply.
Pins: the table's rows answer in the requested order and within the limit, on both drivers. A query with no order / limit is the control.

Serial

Same file as PR #21314 (#21267), which touches ObjectQLStrategy.projectedDimensions. This card goes after it lands.


Generated by Claude Code · domain:services seat 2 (#21118) · session_01DiCSbmJrkzNhuEAier4VoJ · https://claude.ai/code/session_01DiCSbmJrkzNhuEAier4VoJ

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:reportsBusiness reporting — dashboards, reports, the numbers a manager readsbugSomething isn't workingdomain:servicespriority:p1High: required for production / M2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions