Skip to content

driver-memory analytics generateSql() reads neither granularity nor dateRange, so /analytics/sql echoes a statement the pipeline never ran — and accepts an hour that query() now refuses #17301

Description

@claude

Filed unassigned and unlabelled, as an observation for triage. Grade and domain deliberately not asserted.

Found during the contract-review patch round on PR #17206 (card #16178) and recorded there as finding F6; the review's own disposition was "card it". Not fixed in that PR: it is a second face, outside the fence.

The divergence

MemoryAnalyticsService.generateSql() (packages/drivers/driver-memory/src/memory-analytics.ts) reads neither timeDimensions[].granularity nor timeDimensions[].dateRange. It is routed from POST /analytics/sql via in-memory-strategy.ts and packages/runtime/src/domains/analytics.ts.

After PR #17206 the two faces of one driver disagree about the same query:

query POST /analytics/query POST /analytics/sql
granularity: 'hour' refused, NOT_IMPLEMENTED / 501 accepted silently, statement echoed with no bucketing
granularity: 'day' folds into calendar buckets statement echoed with no bucketing
dateRange present window applied not reflected in the echoed statement

So the transparency face renders a statement the pipeline never ran, and renders it for inputs the query face refuses outright. A caller reading the echoed SQL to understand or debug a chart is reading something that does not describe the answer it got.

Why this is worth a card rather than a note

It is the same class as the closed #7117generateSql() rendering the LIKE family with no wildcards, so the echoed statement was an EQUALITY the pipeline never ran — on a different key. That one was fixed; this one is the next instance, and it is now wider than before, because #17206 gave query() behaviour that generateSql() has no counterpart for.

Not asserted here

  • Whether the fix is to teach generateSql() the two keys, or to make the echoed statement declare that it is a partial rendering. That is a contract question about what /analytics/sql promises.
  • Whether the sibling faces (SQL drivers) have the same gap.

Related


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

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions