fix(core): parse rejections say SQL statement, not schema DDL (Story 20.4) - #264
Merged
Conversation
…20.4) Both rejection routes of GatewayApi.run(sql) — the Left(ParserError) branch and the thrown-parser route (#250) — now emit 'Error parsing SQL statement [<statement excerpt>]: <parser reason>' with operation = Some("sql") through one shared builder (GatewayApi.parseRejectionMessage). Each half is rendered on a single line and capped at 200 characters (head + '...' + tail, so the discriminating end of a long generated statement survives); control characters and line separators are collapsed so the text cannot forge a log record or emit an ANSI escape; cuts are surrogate-safe. The thrown route never relays attempt's 'Operation failed: null' (falls back to the cause's class name) and now logs the rejection. statusCode is unchanged on both routes (400 / None). Testkit template gains a DQL rejection case and a batch position-2 case; documentation/client/gateway.md shows the new shape. Verified live on ES 8.18: JavaClientGatewayApiSpec 45/45, JavaClient8ReplGatewayIntegrationSpec 56/56 with the two existing 'Error parsing' assertions untouched. Closes #262 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fupelaqu
marked this pull request as ready for review
September 2, 2026 13:12
This was referenced Sep 2, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #262
Root fix in core for SOFTNETWORK-APP/softclient4es-jdbc#35 (that issue is closed later by the
jdbc core-bump PR — lead hand-off). Story 20.4, Epic 20 (BI venue enablement), train
0.22.0.What changed
GatewayApi.run(sql: String)labelled every parse rejection — a mistypedSELECTincluded —as
Error parsing schema DDL statement: <reason>withoperation = Some("schema"). The JDBCdriver puts
error.messageverbatim intoSQLException, so BI analysts were sent to DDL docs forDQL typos.
Both rejection routes (the
Left(ParserError)branch and the thrown-parser route, #250) now gothrough one shared builder,
GatewayApi.parseRejectionMessage:with
operation = Some("sql")(the value the empty-query branch already used). Properties, eachpinned by a test:
...+ tail,so the discriminating end of a long Tableau-generated statement (or a statement behind a
/* app=... */banner) survives; avalidate()reason embedding a whole AST/SCRIPT body cannotbury the diagnosis.
\smissesESC/NUL/BEL —
\p{Cntrl}+ U+0085/U+2028/U+2029 added), cuts are surrogate-safe. A craftedstatement cannot forge a log record or emit an ANSI escape.
attempt'sOperation failed: null(falls back to the cause's class name).statusCodeuntouched on both routes: 400 on the normal path; stillNoneon the thrownroute (an internal fault must not be asserted to be a client-side 400 — the honest 400 arrives
with Parser.apply can throw ValidationError instead of returning Left on parenthesized WHERE clauses #250).
Files:
GatewayApi.scala(2 branch bodies + helpers in the companion object), newParseRejectionMessageSpec(20 Docker-free tests viaNopeClientApi), testkit templateGatewayApiIntegrationSpec(2 assertions updated + DQL case + batch position-2 case),documentation/client/gateway.md. The 35 otherSome("schema")sites in the file are executoroperations and are deliberately untouched, as are
run(statement: Statement)andPipelineApi(accurate labels).Verification
sbt "+ core/compile",sbt "++ 2.12.20 core/Test/compile",sbt "core/test"(841/841),sbt "+ softclient4es-core-testkit/compile",scalafmtAllclean,headerCheckgreen.JavaClientGatewayApiSpec45/45 (incl. the new DQL and batchposition-2 cases),
JavaClient8ReplGatewayIntegrationSpec56/56 — the two pre-existinginclude("Error parsing")assertions pass unchanged (the stem was kept on purpose).web.
Release notes (0.22.0)
🤖 Generated with Claude Code