Skip to content

P0.5 — elasticsql: enforce maxQueryResults no-LIMIT cap (join-safe)#128

Merged
fupelaqu merged 2 commits into
release-r1from
feature/P0.5
Jun 23, 2026
Merged

P0.5 — elasticsql: enforce maxQueryResults no-LIMIT cap (join-safe)#128
fupelaqu merged 2 commits into
release-r1from
feature/P0.5

Conversation

@fupelaqu

Copy link
Copy Markdown
Contributor

Closes #127. Epic pricing-repackaging Phase 0, story P0.5 (leg 1 of 3: elasticsql-core).

What

Close the advertised maxQueryResults quota gap for single-index SELECT … FROM idx queries with NO LIMIT. elasticsql-core provides the license-agnostic MECHANISM + the Community baseline.

Design (= ScrollConfig.maxDocuments mechanism + EnforcedDqlExtension + arrow join-leg suppression)

  • NEW ResultCapContext — thread-scoped applyResultCap suppress carrier (DynamicVariable[Boolean], default = apply cap). run(sql:String) / ExtensionSpi.execute have no per-call flag slot and the cap decision runs synchronously before the first Future/ES boundary, so a thread-local read observes what the join-leg executor (local) / inbound-header middleware (federation) set around run. Consumed by softclient4es-arrow (leg 3).
  • Additive ResultTruncation + default-None truncation on QueryRows/QueryStream/QueryStructured — source-compatible (constructors unchanged; positional matches updated , _). A custom 1-arg unapply was rejected: not Scala 2.12-safe.
  • CoreDqlExtension Community baseline: explicit-LIMIT>quota → 402 (unchanged); no-LIMIT + finite quota + fields.nonEmpty (mirrors SearchExecutor scroll-branch — aggregations/SELECT * stay on bounded searchAsync, never re-routed) + not-suppressed → capped scroll via ScrollConfig.maxDocuments + ResultTruncation. resolveQuota seam lets the closed EnforcedDqlExtension (extensions leg) override to the licensed quota. NOT inject-LIMIT/flip-to-searchAsync (breaks Pro: 1M > index.max_result_window).

Verification

+ core/compile (2.12 + 2.13), 9 new CoreDqlExtensionSpec + 12 LicenseExecutorSpec + 5 ResultRendererSpec green, headerCheck clean.

Sibling PRs (same story)

  • softclient4es-extensions: EnforcedDqlExtension (licensed-quota override) — feature/P0.5
  • softclient4es-arrow: join-leg cap suppression (LocalConnection + DownstreamConnection header + sidecar middleware) + BLOCKING join-correctness Docker test — feature/P0.5

Note

softclient4es-jdbc has 5 positional QueryResult pattern matches that will need , _ at its next rebuild against this core SNAPSHOT (out of P0.5 scope, flagged).

🤖 Generated with Claude Code

fupelaqu and others added 2 commits June 23, 2026 17:41
…Config.maxDocuments (join-safe)

Close the advertised maxQueryResults quota gap for single-index SELECT … FROM idx
with NO LIMIT. elasticsql-core = license-agnostic MECHANISM + Community baseline.

- NEW ResultCapContext: thread-scoped applyResultCap suppress carrier (DynamicVariable,
  default = apply cap); consumed by softclient4es-arrow join legs. run(sql:String)/
  ExtensionSpi.execute have no flag slot and the cap decision is synchronous-pre-Future,
  so a thread-local read sees what the leg executor / inbound-header middleware set.
- Additive ResultTruncation + default-None truncation field on QueryRows/QueryStream/
  QueryStructured (source-compatible; positional matches updated with `, _` — a custom
  1-arg unapply is NOT Scala 2.12-safe).
- CoreDqlExtension Community baseline: explicit-LIMIT>quota → 402 (unchanged); no-LIMIT +
  finite quota + fields.nonEmpty (mirrors SearchExecutor scroll-branch — aggregations/
  SELECT * stay on bounded searchAsync) + not-suppressed → capped scroll via
  ScrollConfig.maxDocuments + ResultTruncation. resolveQuota seam for EnforcedDqlExtension.
- NEW CoreDqlExtensionSpec (9 tests). + core/compile (2.12+2.13), 27 unit tests, headerCheck.

Closed Issue #127

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@fupelaqu fupelaqu marked this pull request as ready for review June 23, 2026 16:42
@fupelaqu fupelaqu merged commit 4b3a6d8 into release-r1 Jun 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant