Skip to content

The three time-series protocols disagree on what an edge-case request member means: bucketInterval, empty requests, unresolvable fields, expired tx #7675

Closed

Description

@robfrank

Summary

Found by the completeness sweep of #7340, which made every required member of a time-series aggregation request
present and correctly typed, and deliberately stopped short of what the VALUE may be.

bucketInterval is now guaranteed to arrive and to be a number on both HTTP endpoints. Nothing checks that it is
positive, and the three surfaces answer a non-positive one three different ways:

Surface bucketInterval ≤ 0 Where
POST /ts/{database}/query ACCEPTED - the engine's bucketIntervalMs > 0 test selects map mode, so the whole range collapses into ONE bucket and the caller gets 200 PostTimeSeriesQueryHandler.executeAggregation, TimeSeriesEngine.aggregateMulti
POST /ts/{database}/grafana/query SUBSTITUTED - auto-derived from maxDataPoints, else the literal 60000 fallback PostGrafanaQueryHandler.executeAggregation
gRPC TimeSeriesQuery REFUSED - INVALID_ARGUMENT, "TimeSeriesAggregation.bucket_interval_ms must be positive" ArcadeDbGrpcService.streamTimeSeriesBuckets

The same is true of an EMPTY requests array: gRPC refuses it ("TimeSeriesAggregation needs at least one
request"), both HTTP endpoints accept it and answer buckets whose values arrays are empty.

A JSON bucketInterval of 0.5 reaches the same place, because JSONObject.getLong narrows with
Number.longValue(), so it truncates to 0 and lands in the single-bucket branch without a word to the caller.

Why it matters

The /ts/query case is the damaging one: a caller that sent 0 by accident - an uninitialised variable, a
division that rounded down, a template that never filled in - is answered 200 with a single aggregate over the
whole range, which looks like a legitimate answer to a legitimate question. The gRPC refusal exists precisely
because that reading is never what anyone asked for.

Suggested fix

Hoist the gRPC guard into the shared path so all three refuse the same input the same way: bucketInterval must
be a positive integer, and requests must be non-empty. On HTTP that is one more
IllegalArgumentException through TimeSeriesHandlerUtils, which #7340 already wired to the 400 error body and
the per-target Grafana error frame.

Grafana's maxDataPoints-derived interval stays: there the member is genuinely OPTIONAL and its absence means
"derive one". The change is that a bucketInterval the caller DID state, and stated as ≤ 0, is refused instead of
silently replaced by 60000.

This changes what is accepted, so it needs a release note.

Context

Filed from the completeness sweep of #7340 (see that PR's ## Completeness section).


Consolidated scope (merged 2026-09-16)

#7674 and #7685 were closed as duplicates of this issue. Each reported one row of the same table:
the three time-series surfaces - POST /ts/{database}/query, POST /ts/{database}/grafana/query
and gRPC TimeSeriesQuery - answer the same edge input three different ways. The fix is one agreed
contract implemented in TimeSeriesGateway and enforced identically by the two HTTP handlers and
ArcadeDbGrpcService, not three separate patches.

The divergences to reconcile

Input POST /ts/{db}/query Grafana /ts/{db}/grafana/query gRPC TimeSeriesQuery
bucketInterval <= 0 ACCEPTED - bucketIntervalMs > 0 selects map mode, so the whole range collapses into one bucket and the caller gets 200 SUBSTITUTED - auto-derived from maxDataPoints, else the literal 60000 REFUSED - INVALID_ARGUMENT
empty requests array accepted accepted REFUSED - "TimeSeriesAggregation needs at least one request"
a fields name matching no non-timestamp column (#7674) silently DROPPED by TimeSeriesGateway.resolveColumnIndices, as its own javadoc admits silently DROPPED -
a fields projection where no name resolves (#7674) projection silently becomes "all columns" same -
an expired transaction id (#7685) silently DEGRADED to a non-transactional read silently DEGRADED REFUSED

Silently widening a projection and silently ignoring a stale transaction are the two that can return
wrong data rather than a wrong status, so they set the direction: refuse, on every surface, with
the member named in the message - the same standard #7340 applied to absent and wrongly-typed members.

Activity

  1. added
    grpc
    server
    timeseries
    on Sep 16, 2026
  2. added this to the 26.10.1 milestone on Sep 16, 2026
  3. self-assigned this
    on Sep 16, 2026
  4. changed the title [-]The three protocols disagree on what a non-positive time-series 'bucketInterval' means[/-] [+]The three time-series protocols disagree on what an edge-case request member means: bucketInterval, empty requests, unresolvable fields, expired tx[/+] on Sep 16, 2026
  5. added
    in progress
    on Sep 16, 2026
  6. added a commit that references this issue on Sep 16, 2026
  7. robfrank commented on Sep 16, 2026

    @robfrank
    CollaboratorAuthor

    Fixed in #7719.

    The three time-series read protocols each answered the same edge-case request member differently. The rule now lives once in TimeSeriesGateway and all three enforce it identically, each naming the member in its own spelling: a stated bucketInterval of zero or less is refused instead of being accepted as one big bucket (HTTP) or silently replaced with a derived value (Grafana); an empty aggregation.requests is refused instead of answering buckets with empty values; and a fields name matching no column is refused instead of being dropped. That last one is the reason the direction went this way - a typo used to narrow a projection silently, and a fields list where nothing resolved used to widen it to every column, so a Grafana panel could be drawn from a plausible but wrong set of columns with nothing to signal it.

    Grafana's maxDataPoints derivation for an absent bucketInterval is deliberately unchanged; only a stated non-positive one is refused. This changes what is accepted, so it needs a release note.

    Still open


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. removed
    in progress
    on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggrpcservertimeseries

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions