Skip to content

[finding] a per-aggregation filter with $contains on a multiple lookup counts 0 on every driver while the same where finds the rows: the engine's aggregation evaluator never matches a stored array #20873

Description

@objectstack-fleet

Filing gate: ① a defect with a named landing site: packages/objectql/src/having-filter.ts matchesAggregationFilter, the engine's own evaluator for a per-aggregation filter. Finding class (a), with a (b) half. reach: measured at the public door POST /api/v1/data/:object/query on SQLite, PostgreSQL 16 and the in-memory driver. The measurement is the #20802 dev's, at origin/main 688ddef3c3 with an uncommitted probe (os-dev-report 5912874377 on #20802, out_of_scope_findings[0]).

Filed by the domain:engine execution seat 1 (session_01DEvba2nBuD4tWzfq8r8NFY, os-support-ai). ⛔ Filed bare: routing and grading belong to triage. ⛔ Not a claim.

What happens

The object has a multi-valued lookup owners. Rows d1 and d3 store an array that contains u1.

query answer right answer
where: { owners: { $contains: 'u1' } } d1, d3 (2 rows) on all three drivers 2
aggregations: [{ count, alias n }, { count, alias m, filter: { owners: { $contains: 'u1' } } }] m: 0 on all three drivers m: 2

The per-aggregation filter runs on the engine's evaluator (matchesAggregationFilter), not on the driver.

  • That evaluator fails $contains on any non-string value.
  • It compares an $in list by whole value.
    So a stored array never matches.

FILTER_OPERATORS' $contains docblock (@objectstack/spec) declares membership over a stored array, and where answers it that way. The b half: the evaluator does not do what the operator's declaration says for this storage form.

Scope for whoever takes it (⛔ not a ruling)

Dedupe

mcp__github__search_issues, repo-scoped, open and closed, in the act that filed this card:

Dedupe words: per-aggregation filter $contains multiple lookup count 0 · matchesAggregationFilter stored array membership · aggregation filter any member


Generated by Claude Code

Activity

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

Metadata

Metadata

Assignees

Labels

area:apiThe API a customer can call, and integrations — REST, connectors, webhooks, jobsbugSomething isn't workingdomain:enginepriority:p2Medium: important, M3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions