Skip to content

fix: keep results on timeout; restore and startup bugs - #926

Merged
EVWorth merged 5 commits into
mainfrom
claude/hopeful-bardeen-1k4d1h
Oct 30, 2026
Merged

EVWorth merged 5 commits into
mainfrom
claude/hopeful-bardeen-1k4d1h

Conversation

@EVWorth

@EVWorth EVWorth commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Backend follow-ups, done by the implementer-rust lane.

Closes #917, #919, #920, #925.

Changes

  • fix: stray spaces in startup problem messages #920: removed the runs of spaces in the two data-directory startup messages. Both messages are now built in one place.
  • fix: restore reports partially applied with 0 run #919: a restore no longer reports "partially applied" when no statement ran. The rule lives in a partially_applied(...) function and requires statements_run > 0.
  • fix: timeout and failure lose run results/state #917:
    • Timeouts keep earlier results. A statement that hits the query timeout is now tagged with its statement index and the results completed before it, like any other failure. A timeout before the first user statement stays untagged.
    • A failed run reports its transaction state. QueryError gains an optional transaction. After a failure on an editor session, the same probe added in feat: report completed results and transaction state #916 runs, bounded to 2 s. If the probe fails, the field is left out and the original error comes back unchanged.
    • Mock and bindings. The mock reports the field too, and the bindings are regenerated.
    • New helper. CoreError::root() looks through the statement tag, so code that matches on Timeout still works now that timeouts are tagged.
    • Docs. They now say that just db-down removes the containers and their data volumes.
    • Item 3 (mock tests) was already done in feat: mock backend gaps; components go via stores #918.
  • fix: query timeout on a tab session takes ~11s #925: the query timeout on an editor session or an agent route used to take about 11 s instead of 1 s. The KILL was sent through the route's own pool, whose only connection the timed-out query was holding. It now goes through the shared interactive pool, as cancel() already does.

Tests

  • Unit: startup messages contain no double spaces; partially_applied; the error's transaction state and root().
  • Live:
    • a failed run on a session reports the open transaction, and none after ROLLBACK;
    • a run outside a session reports no transaction state;
    • a script that times out keeps the earlier result;
    • a timeout on a session reports the open transaction. This last test fails without the fix: query timeout on a tab session takes ~11s #925 fix.
  • Mock: a failure on a tab session reports the transaction state.
  • Rust checks: cargo fmt, clippy -D warnings, and cargo test for mas-core, sqlpilot and mas-mcp all pass. The mas-core integration suites pass on MySQL 13306 and on MariaDB 13308.
  • After merging main: npm run type-check is clean, and vitest passes for src/dev, src/stores and src/lib (1798 tests).

Generated by Claude Code

The two data-directory summaries were string literals broken across lines
without a backslash continuation, so the next line's indentation ended up
inside the message. Move them into helpers and test for double spaces.

Closes #920

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
A restore whose every statement was refused, with Stop on error off,
reported partially_applied even though statements_run was 0. Move the
rule into a function, require statements_run > 0, and unit test it.

Closes #919

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
A script that hit the query timeout came back without a statement index,
so the results of the statements that had already finished were lost.
The timeout is now tagged with the statement it stopped, carrying the
completed results the same way a normal failure does.

A failed run on an editor session now also asks the server whether a
transaction is still open, using the same probe as a successful run,
and reports it as QueryError.transaction. The probe is bounded to two
seconds and never fails, so it cannot replace or hold back the error.
The mock mirrors it on execute_query's error path.

CoreError::root() looks through the statement tag for callers that
match on the kind of error, now that timeouts are tagged too.

The docs said `just db-down` stops the test containers; it removes them
and their data volumes.

Item 3 of #917 (mock tests for completedResults and transaction) was
done in #918.

Closes #917

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
When a statement on an editor tab's session (or an agent's pool) ran
past the query timeout, the KILL QUERY was sent through that same pool,
whose only connection the timed-out statement was holding. The KILL
waited for a connection until the acquire timeout and failed, so the tab
sat out the whole statement: a 1s timeout on SELECT SLEEP(5) took 11s.
Send it through the shared pool instead, as cancel already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
@EVWorth
EVWorth merged commit 3f6a64a into main Oct 30, 2026
12 checks passed
@EVWorth
EVWorth deleted the claude/hopeful-bardeen-1k4d1h branch October 30, 2026 11:32
@github-actions github-actions Bot mentioned this pull request Nov 8, 2026
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.

fix: timeout and failure lose run results/state

2 participants