Skip to content

feat: report completed results and transaction state - #916

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

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

Conversation

@EVWorth

@EVWorth EVWorth commented Oct 29, 2026

Copy link
Copy Markdown
Owner

The backend side of #845 and #843, done by the implementer-rust lane. The frontend from #908 already reads both new fields.

Closes #911, #913, #914.

#911

  • Completed results on failure.
    • QueryError gains an optional completedResults: the results of the statements that ran before statement N failed (N > 0).
    • The field is left out entirely when there are none, so existing TS consumers don't have to handle a new required key.
  • Transaction state.
    • QueryResult gains an optional transaction: "open" | "none".
    • It is set only on the last result of a run on an editor session.
    • How it is read:
      • It reuses the probe that grid saves already use: SET @@transaction_isolation = @@session.transaction_isolation. The server refuses that statement inside a transaction (ER 1568), so a refusal means one is open.
      • sqlx keeps the server's in-transaction flag private, and @@in_transaction exists only on MariaDB, which is why it isn't read directly.
      • If the probe fails, a warning is logged and the field is left out; the run itself never fails because of it.
    • Side effect: the probe is a SET, so a later SELECT ROW_COUNT() on that session returns 0. LAST_INSERT_ID() and SHOW WARNINGS are unaffected. This is documented on transaction_state.
  • Generated code: bindings regenerated with cargo test -p sqlpilot --test export_bindings. The mock's execute_query emits both fields.

#913 and #914

  • scripts/clean-debug.sh now cleans ${CARGO_TARGET_DIR:-src-tauri/target}/debug.
  • just db-down now runs docker rm -fv, so the containers' data volumes are removed with them.
  • The CLAUDE.md note on Docker in cloud sessions is corrected: Docker's data survives a restart, so only dockerd needs starting.

Tests

  • New tests:
    • 5 unit tests in mas-core/src/error.rs.
    • 2 integration tests in integration_tests.rs: a failed script returns what ran before it.
    • 5 integration tests in editor_sessions.rs: BEGIN/COMMIT, autocommit = 0, implicit commit after DDL, no state off a session, and earlier results kept on a failed run.
  • cargo fmt and clippy -D warnings are clean.
  • cargo test passes for mas-core --lib, mas-mcp and sqlpilot.
  • The mas-core integration suite passes on MySQL (port 13306) and on MariaDB (port 13308).
  • Frontend: npm run type-check is clean, vitest on src/dev, src/lib and src/stores passes (1656 tests), and npx dprint check is clean.

Generated by Claude Code

A query run that fails at statement N > 0 now carries the results of
statements 0..N-1 in QueryError.completedResults, so a script's earlier
results survive its error. A run on an editor tab's session reports the
server's transaction state ("open" | "none") on its last result, asked
with the same isolation-level probe grid saves already use, since sqlx
keeps SERVER_STATUS_IN_TRANS crate-private.

This completes the backend parts of #845 and #843; the frontend already
reads both fields. The mock query handler emits them too.

Closes #911

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
Worktrees that share a target directory through CARGO_TARGET_DIR had nothing cleaned: the script always looked under src-tauri/target.

Closes #913

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
docker rm -f left each test container's anonymous data volume behind, so every db-reset leaked one. The CLAUDE.md cloud-session note also claimed Docker does not survive a container restart; /var/lib/docker does, and only dockerd needs starting.

Closes #914

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
@EVWorth
EVWorth merged commit d6640e1 into main Oct 29, 2026
12 checks passed
@EVWorth
EVWorth deleted the claude/hopeful-bardeen-1k4d1h branch October 29, 2026 12:43
EVWorth added a commit that referenced this pull request Oct 29, 2026
* build: ignore scripts/ in the dev server watcher

A helper written into scripts/ while `just dev-web` runs reloaded the page
and wiped whatever state a review had reached.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(designer): read tables through a store

TableDesigner called the table reads itself and kept their loading and
error state. They now go through tableDetailsStore, keyed by the
mounted view, so the store owns that state and the reads are tested
there.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(schema): read table structure via store

TableStructure read the table's columns, indexes, keys, partitions and
DDL itself. It now asks tableDetailsStore, which owns the loading state
and the per-part errors.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* fix(mock): drop unlistened events; honest restore

The event mock in @tauri-apps/api looks for `args.id` on unlisten while the
event API sends `eventId`, so no listener was ever removed and every emit
after a dialog closed logged "Couldn't find callback id". The mock backend
now passes the id under both names.

A restore with every statement refused (read-only production, Stop on error
off) reported partiallyApplied with nothing run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): inject command failures from the URL

`?mock=connected&fail=get_foreign_keys,save_connection_profile` makes the
named commands reject, with a QueryError for the three commands typed that
way and the CoreError string for the rest, so every error state can be
reviewed without wrapping invoke by hand. A trailing `*` matches by prefix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): lost and multi-server scenarios

`?mock=lost` connects Local dev and then loses its server: every health
check fails and is reported, so the red tab and "Lost — retrying (n)" can
be reviewed, and reads fail with 2013. `?mock=servers` adds a read-write
production profile, a MariaDB that connects, a wrong password (1045) and a
server that times out, each worded as the backend words it.

The admin and restore handlers read profiles from the mock state rather than
the static list, so the added profiles behave as listed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* fix(mock): reject ports that are not a u16

save_connection_profile and test_connection accepted any port. The Rust
profile's port is a u16, so Tauri rejects 70000, -1 or 3306.5 before the
command runs; the mock now rejects them with the same message. Port 0 gets
through as it does in the app, and connecting to it is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(backup): run backup, restore, import in a store

The backup, restore and import dialogs called the API themselves and
each kept its own run state. backupStore now owns the job id, progress,
cancel and outcome of each run, and fileStore wraps the native file
dialogs and file reads that these and other components use.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): update, keyring and startup switches

`update=available|downloading|download-error|error` drives the updater
plugin, including the download's progress channel; `keyring=missing` and
`startup=problems` report the missing credential store and the stores that
could not be opened, worded as the backend words them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(history): move file and history reads to stores

QueryHistory, HistoryQuickOpen and QueryFavorites called the API for
history reads and file dialogs. historyStore now owns the export to a
file (with its exporting flag) and the quick-open search, and
favoritesStore exports to and imports from a file. The component tests
mock the stores; the file flows are tested in the store tests.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): history pages, shop events and users

History grows to 130 entries, so paging can be tried; shop gets events in
each state; the admin panel's Users and Roles tabs read accounts from
mysql.user, the role tables and SHOW GRANTS, which the user statements
change. The SQLite fixture already had a view (#825).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(admin): read processes, variables, grants via store

ProcessListTab, ServerVariablesTab, UserDetail and PrivilegesEditor
called the API themselves. adminStore now owns the process list (with
kill), the server variables and an account's grants, with their loading
and error state, keyed by the mounted tab.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): agent approvals, proposals and drafts

An agent turn now picks its request from the message: approvals on
production and staging, a schema change, propose_edit, open_draft, and two
approvals at once. Requests are no longer queued in the mock, since the
window queues them. `agent=uninstalled` reports no harness installed and
`agent=no-tools` starts sessions without the database tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(layout): read app version and startup report via store

StatusBar and the help dialog called the API for the app version, the
keyring check and the startup report. appInfoStore now holds them.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(routine): read routine DDL through ddlStore

RoutineViewer called the API for the routine's DDL and kept its own
loading and error state. It now uses ddlStore, the same entry the DDL
tab for that routine reads. A failure is shown as the server said it,
without the "Error: " prefix String(e) added (#804).

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* refactor(connection): test a connection through the store

useConnectionForm called the API to test a profile. connectionStore
now has testConnection, which turns a failure into an unsuccessful
result as the hook did.

Refs #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* build(lint): forbid tauri-api imports in components

Components call store actions, never api.* (src/CLAUDE.md). With the
last direct calls moved into stores, a no-restricted-imports rule keeps
new ones out. Type-only imports and tests are allowed.

Closes #862

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): apply schema writes; reject bad DDL

CREATE, ALTER, RENAME and DROP TABLE, CREATE and DROP INDEX and CREATE and
DROP DATABASE now change the fixture, so the schema reads after a
designer Apply show the change. Each statement is all-or-nothing, and
invalid DDL such as `CREATE TABLE orders ()` fails with the server's 1064,
with 1050, 1060, 1061, 1091 and 1146 for the other usual mistakes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* feat(mock): delay the first backup/restore event

The first progress event arrived at once, so the dialog's state before any
progress could not be reviewed. It now comes 450 ms in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* fix(favorites): open a favorite as a clean tab

Opening a favorite wrote its SQL into the tab without setting the saved
baseline, so the tab showed as unsaved and closing it asked to save
what had just been opened. Double-click into a new tab had the same
problem. Both now mark the SQL as the tab's saved content.

Closes #909

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* fix(transaction): clear TX flags on disconnect

Disconnecting ends the connection's tab sessions, and the server rolls
back any transaction they had open, but the tabs kept their TX badge.
The disconnect path now forgets the transaction state of every tab
bound to that connection.

Closes #910

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* fix(results): drop "Error: " from a failed run outcome

executeQuery's failed outcome carried String(e), so TableDesigner and
RoutineViewer showed "Error: ..." where the results pane shows the
message alone. The outcome now uses the same text as the pane.

Closes #912

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* test(mock): cover completedResults and transaction

After the merge of #916: the QueryError command check follows the
regenerated bindings (QueryError_Serialize), and execute_query's
completedResults and per-session transaction state have tests (#917).

Closes #785

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

* docs: list the new mock scenarios in ui-preview

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g

---------

Co-authored-by: Claude <[email protected]>
@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.

feat: report per-run results and transaction state

2 participants