Skip to content

Sanitise trino errors - #430

Open
Bohreromir wants to merge 2 commits into
mainfrom
worktree-fix-304-sanitise-trino-errors
Open

Bohreromir wants to merge 2 commits into
mainfrom
worktree-fix-304-sanitise-trino-errors

Conversation

@Bohreromir

@Bohreromir Bohreromir commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Description

This classifies Trino errors and passes some to the user and keeping potentially sensitive ones to the server while informing the user generic

closes #304

Docs

Release note

Checklist

Author

  • AI review done, findings addressed
  • Tests added or updated
  • Changelog updated (if the repo keeps one)

Reviewer

  • Useful comments and logging
  • Docs added or updated per the style guide

Acceptance

  • Check for release notes and docs

Trino error messages and raw upstream response bodies were passed to the
browser verbatim. Errors are now classified on the server:

- USER_ERROR and INSUFFICIENT_RESOURCES keep Trino's message, as they
  describe the user's own query.
- INTERNAL_ERROR, EXTERNAL and unknown types only expose the error name;
  the message is logged.
- HTTP and network failures are reported as unavailable; the response
  body is only logged.

Query snapshots carry the classification as a structured error that the
client translates. The catalog and completion metadata endpoints return
a generic message with the request ID for anything but query errors.
Add mock Trino markers for an internal error and an HTTP 502 while
polling, and check that the UI shows the generic text without the
internal details.
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 67.39% 9135 / 13555
🔵 Statements 66.35% 12300 / 18537
🔵 Functions 68.16% 2946 / 4322
🔵 Branches 57.34% 5159 / 8996
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/components/trino/StatementResult.svelte 0% 0% 0% 0% 24-273
src/lib/server/trino/client.ts 69.13% 60.86% 53.33% 75% 74, 75, 87-88, 108, 126-136, 150, 160, 182-184, 189-195, 227-228, 234, 270-277
src/lib/server/trino/errors.ts 100% 85.71% 100% 100%
src/lib/server/trino/queries.ts 100% 94.33% 100% 100%
src/lib/server/trino/result-collector.ts 89.58% 75% 100% 95.55% 25, 31, 40, 45, 87
src/lib/types/query.ts 100% 100% 100% 100%
src/routes/(app)/api/trino/catalog/+server.ts 100% 100% 100% 100%
src/routes/(app)/api/trino/completion/metadata/+server.ts 100% 100% 100% 100%
Generated in workflow #1210 for commit e36b689 by the Vitest Coverage Report Action

@Bohreromir
Bohreromir marked this pull request as ready for review October 29, 2026 15:34
@Bohreromir Bohreromir self-assigned this Oct 29, 2026
@Bohreromir Bohreromir moved this to Development: Waiting for Review in Stackable Engineering Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: Waiting for Review

Development

Successfully merging this pull request may close these issues.

Raw upstream error messages returned to the client

1 participant