Skip to content

Add Trino Unit testcoverage and fix minor bugs - #374

Open
Bohreromir wants to merge 10 commits into
mainfrom
worktree-test-345-trino-api-coverage
Open

Bohreromir wants to merge 10 commits into
mainfrom
worktree-test-345-trino-api-coverage

Conversation

@Bohreromir

Copy link
Copy Markdown
Member

No description provided.

Unit tests for the query, catalog and completion metadata endpoints:
request validation, connection checks, generated SQL including identifier
and literal escaping, result mapping and error status codes.
Covers sequential script execution and stop conditions, cancellation,
snapshots, tab removal and the TTL-based eviction sweep.
- Count a submit without query ID as failed, so trino_query_total stays
  balanced.
- Don't expose a terminal state straight from the submit response. The
  query previously skipped draining any remaining pages and never got a
  completion time or outcome metric.
…345)

While a script waited for Trino to accept its next statement, the tab had
no active query: cancelling did nothing, and a re-run's results were mixed
with those of the old script, which kept executing.

Track the running script per tab with an AbortController. cancelQuery,
resetTabQueries and a new script abort it; a statement accepted after the
abort is cancelled in Trino instead of stored. Cancellation now updates
state synchronously before calling Trino, so concurrent callers cannot
cancel or count a query twice and a reset cannot wipe a newer script.
Mapping terminal submit states to RUNNING turned a FAILED response
without an error object into a completed query, and the script went on
to the next statement.
collectResults only failed a query when the page carried an error object.
A FAILED state without one was ignored and the query ended as FINISHED.
@Bohreromir Bohreromir changed the title Add Trino Unit testcoverage Add Trino Unit testcoverage and fix minor bugs Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 57.16% 2824 / 4940
🔵 Statements 62% 4067 / 6559
🔵 Functions 68.38% 1077 / 1575
🔵 Branches 48.87% 1493 / 3055
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/lib/server/trino/queries.ts 100% 94.54% 100% 100%
Generated in workflow #1066 for commit 76ef1c2 by the Vitest Coverage Report Action

@Bohreromir Bohreromir linked an issue Oct 9, 2026 that may be closed by this pull request
@Bohreromir
Bohreromir marked this pull request as ready for review October 9, 2026 10:11
@Bohreromir Bohreromir self-assigned this Oct 9, 2026
lfrancke
lfrancke previously approved these changes Oct 9, 2026

@lfrancke lfrancke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only lazily scrolled through this and let Claude do a review. As this is only test code I think it's okay. I didn't spot anything obvious.

Comment thread src/lib/server/trino/queries.ts Outdated
@Bohreromir
Bohreromir requested a review from lfrancke October 12, 2026 10:06
lfrancke
lfrancke previously approved these changes Oct 12, 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: In Review

Development

Successfully merging this pull request may close these issues.

Improve Trino (api) testcoverage

2 participants