Skip to content

Reject dashboard-variable option queries returning more than 1000 rows #496

Description

@BorisTyshkevich

Follow-up to #493.

Problem

#493 added end-to-end validation for running Dashboard variable option SQL, but the Run path does not currently reject a query that produces more than the supported 1000 option rows.

Requiring authors to include an explicit top-level LIMIT 1000 would add SQL-parsing complexity and enforce syntax rather than the actual option-count contract. The existing probe already wraps the query with LIMIT 1001, so the extra row can be used to detect overflow directly.

Intended behaviour

After a successful dashboard-variable Run response passes column-shape validation, reject it when the raw returned row count is greater than VARIABLE_OPTION_CAP.

  • Keep compileOptionProbe bounded at VARIABLE_OPTION_CAP + 1.
  • Count raw returned rows before any future filtering or deduplication.
  • Accept zero through 1000 rows.
  • Reject 1001 returned rows with a specific diagnostic explaining that option SQL may return at most 1000 rows.
  • Do not require the authored SQL to contain an explicit LIMIT clause.
  • Preserve transport errors and cancellation; row-count validation must run only after a successful complete response.
  • A row-count failure must not be recorded as a successful run for History or detached-result source capture.
  • Keep the Dashboard option-batch bounds and truncation handling unchanged.

Acceptance criteria

  • A query returning zero rows passes.
  • A query returning exactly 1000 rows passes.
  • A query returning 1001 or more rows is rejected after the probe returns its 1001-row sentinel result.
  • The diagnostic states that Dashboard variable option SQL may return at most 1000 rows.
  • Queries without an authored LIMIT pass when their actual result contains at most 1000 rows.
  • Queries with any authored LIMIT are judged by their actual returned row count, not by parsing the SQL text.
  • Server and cancellation errors are preserved and are not overwritten by row-count validation.
  • A row-count validation failure is not recorded as a successful run.
  • Unit tests cover 0, 1000, and 1001 returned rows in the dashboard-variable Run path.

Related: #465, #493.

Metadata

Metadata

Assignees

No one assigned

    Labels

    inboxFiled mid-task; not yet triaged into the roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions