Skip to content

analytics: the ObjectQL /analytics/sql echo prints IN / = SQL for a multi-value-field filter the engine refuses with 400 #36265

Open

Description

@objectstack-fleet

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

Filing gate ① · Source: fleet · found by the #35270 review sweep (run record r08 S6) on PR #36184, re-read on main c30ce97

What happens

The analytics "show me the SQL" endpoint prints a normal-looking SQL statement for a filter that the platform will actually refuse to run. When a report filters a multi-value field (tags, multi-select) with equality or "in", the real query answers 400, but on the ObjectQL path the SQL preview answers 200 with a plain IN (...) statement. An author who copies that SQL, or trusts the preview, is misled about what the report does.

  • packages/services/service-analytics/src/strategies/objectql-strategy.ts:2207 buildFilterClauseSql: in / notIn print col IN (...) / NOT IN (...) (:2249-2254) and the plain comparisons below, with no declared-shape check; reached from generateSql (:916) via renderFilterNodeSql (:1184).
  • The same file states the echo's contract: the echo and the executed statement are one description, and "an echo that printed a parseable statement while the engine refused the real one is that failure in its loudest form" (:2286-2290).
  • The native strategy refuses the same leaf (native-sql-strategy.ts:2510), so the same /analytics/sql request answers 400 on one strategy and a 200 echo on the other. Pre-existing on the ObjectQL side.

Done when

  • The ObjectQL echo refuses a leaf of JSON_COLUMN_INCOMPATIBLE_OPERATORS on a declared multi-value / JSON-stored column with the same 400 INVALID_FILTER and sentence (reuse json-column-comparison-refusal.ts).
  • Pins: /analytics/sql (ObjectQL strategy) with { tags: { $in: ['a'] } } on a multiple: true field → 400; $nin, implicit equality → 400; control: $contains and a scalar $in → 200 with SQL.
  • Ablation: remove the refusal call from the echo and the $in pin goes red.

reach: public HTTP door POST /api/v1/analytics/sql on the ObjectQL strategy; display only, runs nothing. Read from the code, not measured.
Business reason: report authors see SQL that claims to work for a filter the platform rejects, so they debug the wrong thing.
Reader: area:reports / domain:server (service-analytics).
Dedupe: analytics sql echo, objectql strategy echo, 36184 → #33878, #36189, #36190 (none carries this).
Grade: p3 — preview text only; the real query is refused correctly.

Activity

  1. added
    bug
    pm:queue
    area:reports
    domain:server
    on Nov 22, 2026
  2. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (/analytics/sql echo) · pm:queue; rationale: area:data (was the legacy area:reports) · Bug · the SQL echo prints IN / = for a multi-value-field filter the engine refuses. It is preview text only; the real query is refused correctly → p3 as filed · size XS. Linked under topic #36230.

  3. added and removed
    area:reports
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:databugdomain:serverpm:queuepriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions