Repository navigation
feat(history): record every statement, tagged with where it came from - #603
Merged
Merged
Conversation
Only editor queries were recorded. Grid cell edits, admin actions, imports and restores all called api.executeQuery directly and left no trace, so a user who changed three cells and later asked "what did I run against prod" got an incomplete answer with no sign anything was missing. Which statements appeared was an accident of which call sites had been refactored, not a decision (#586). Everything goes through lib/run-statement.ts now, tagged editor, grid, designer, routine, admin, import, restore or internal. That is the same shape DBeaver's Query Manager uses, and it is the only way to make coverage a policy rather than an accident. The panel shows the user's own work by default and offers the rest behind a checkbox. A thousand-statement dump would otherwise bury a day's editing under statements nobody typed. Reads the app makes on the user's behalf — SHOW GLOBAL STATUS, the backup generator's SHOW CREATE TABLE, the restore's USE — are tagged internal and stay hidden unless asked for, which is better than not recording them at all when something looks odd. The migration defaults existing rows to editor, because that is the only thing that recorded history before the column existed. runStatement deliberately does not gate. A caller running a hundred statements from a dump confirms once for the operation rather than once per statement, so that decision stays with the caller and confirmDestructive stays a separate call. A throw while recording no longer fails the statement. It surfaced as "Save failed" on a grid edit that had already been written — telling the caller to roll back something that had succeeded. Found by an existing test whose result fixture had no `rows` array, which also showed the row count had to be read defensively. Two browser tests mocked lib/tauri-api without CommandError, which runStatement imports. They failed to import at all. Only the chromium suite catches that — `npx vitest run` excludes *.browser.test.tsx. Closes #586 Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #586. Unblocked by #595 merging.
Only editor queries were recorded. Grid cell edits, admin actions, imports and restores all called
api.executeQuerydirectly and left no trace — a user who changed three cells and later asked "what did I run against prod" got an incomplete answer with no sign anything was missing. Which statements appeared was an accident of which call sites had been refactored, not a decision.Everything goes through
lib/run-statement.tsnow, taggededitor/grid/designer/routine/admin/import/restore/internal. Same shape as DBeaver's Query Manager, and the only way to make coverage a policy rather than an accident.Defaults
The panel shows the user's own work and offers the rest behind a checkbox — a thousand-statement dump would otherwise bury a day's editing under statements nobody typed.
Reads the app makes on the user's behalf (
SHOW GLOBAL STATUS, the backup generator'sSHOW CREATE TABLE, the restore'sUSE) are taggedinternaland hidden unless asked for. Recorded rather than dropped, because when something looks odd you want them.The migration defaults existing rows to
editor— the only thing that recorded history before the column existed.runStatementdeliberately does not gateA caller running a hundred statements from a dump confirms once for the operation, not once per statement. That decision stays with the caller;
confirmDestructiveremains a separate call.Two real bugs this surfaced
rowsarray, which also showed the row count needed reading defensively.lib/tauri-apiwithoutCommandErrorand failed to import at all. Only the chromium suite catches that;npx vitest runexcludes*.browser.test.tsx. I'd missed this class of failure once already this session, which is why I now run both suites before pushing.Verification
5 new Rust tests (54 in the module), 9 helper tests, 5 store tests, 3 panel tests. Unit 1964, browser 300, all Rust crates, clippy clean, 0 lint errors.