Skip to content

feat: mock backend gaps; components go via stores - #918

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

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

Conversation

@EVWorth

@EVWorth EVWorth commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Two implementer-frontend lanes, combined to save a CI cycle. Each one's commits are self-contained.

Closes #785, #862, #909, #910, #912.

#785: mock backend gaps (src/dev/mock/ and vite.config.ts only)

  • Error injection: ?mock=connected&fail=get_foreign_keys,save_connection_profile. Also takes prefixes (fail=get_*) and plugin commands. Each command fails with the error shape the backend would return for it.
  • Connection scenarios:
    • ?mock=lost: the health check starts failing after 4 s.
    • ?mock=servers adds four profiles: read-write production, a MariaDB that connects, a wrong password (1045) and a connect timeout.
  • Port validation: ports that aren't a u16 are rejected, as Tauri rejects them. Port 0 is accepted because the backend accepts it.
  • App state switches: update=available|downloading|download-error|error, keyring=missing, startup=problems.
  • Data:
    • 130 more history entries.
    • Three events in shop.
    • 11 user accounts and a role, with working CREATE/ALTER/DROP USER and GRANT/REVOKE.
  • Agent:
    • The words in the prompt pick the request: production or staging approvals, schema changes, propose_edit, open_draft, or two approvals at once.
    • agent=uninstalled and agent=no-tools.
  • Schema writes: the designer's ALTERs show up in later schema reads. Invalid DDL such as CREATE TABLE orders () fails with 1064.
  • Timing: the first backup or restore progress event now arrives 450 ms in.
  • Mock bugs:
    • Unlisten never removed a listener: @tauri-apps/api 2.12's mock reads args.id, but the event API sends eventId. That caused the "Couldn't find callback id" spam.
    • A restore where nothing ran no longer reports partiallyApplied.
  • Dev server: **/scripts/** is now ignored by the watcher.
  • Docs and tests: the switches are documented in src/dev/mock/README.md and in the ui-preview skill. This also adds tests for the mock's completedResults and transaction fields (part of fix: timeout and failure lose run results/state #917).

#862: components never call api.*

  • 16 files called the API directly (the issue's grep found 12; it missed calls split over two lines and .ts files). None do now.
  • New stores:
    • tableDetailsStore: table reads, including the designer's reference tables.
    • backupStore: backup, restore and import runs, with progress and cancel.
    • fileStore: file pick, read and write.
    • adminStore: process list, server variables and grants.
    • appInfoStore: app version, keyring check and startup problems.
  • New actions on existing stores:
    • history: export, quick-open search;
    • favorites: export, import;
    • connection: testConnection;
    • ddl: the routine viewer now reads its DDL here.
  • ESLint rule: @typescript-eslint/no-restricted-imports forbids importing lib/tauri-api from src/components/**. Type-only imports and tests are allowed.

Small fixes

Tests

  • Every fix test fails with its fix reverse-applied.
  • After combining the branches: npm run test:unit passes (196 files, 3695 tests). npm run type-check and npx dprint check are clean. npm run lint has 0 errors and no new warnings.
  • The #862 lane ran the browser tests one file at a time, and all passed: ImportDialog, ProcessListTab, ServerVariablesTab, ConnectionDialog, AppLayout, MainPanel, Sidebar, TitleBar.

Generated by Claude Code

claude added 27 commits October 29, 2026 12:19
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
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
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
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
`?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
`?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
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
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
`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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
@EVWorth
EVWorth merged commit 0ee1278 into main Oct 29, 2026
12 checks passed
@EVWorth
EVWorth deleted the claude/hopeful-bardeen-1k4d1h branch October 29, 2026 12:56
@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.

Fill the mock backend's gaps found in the UX review

2 participants