Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion windows/docs/decisions/0004-app-shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ On 2026-11-05 the maintainer had the app show what the server prints, PostgreSQL
- Table tabs page as macOS pages a table: a page is the default page size long (Settings, Pagination: 100, 500, 1,000, 5,000 or 10,000 rows, 1,000 unless changed, as macOS); First, Previous, Next and Last sit in the tab's `CommandBar`, and its one status words the page as the macOS status bar does, with the run's time: "1,001-2,000 of 3,503 rows · 15 ms", or "Rows 1,001-2,000 · 15 ms" until the count lands. A table that fits one page keeps "Rows: 347 · 12 ms". The core writes each page (`table_query` takes an offset, over `build_page`'s `PagePosition::Offset`) and counts the table (`table_row_count`, `build_count` as the Linux pager counts), in the background after the first full page; until the count lands, Next stays while pages come back full. Before it counts, it reads the engine's estimate (`table_row_estimate`, over `Connection::table_estimate`, as the Linux pager does), and decides as macOS does: an exact count the engine keeps is the total; under the threshold (Settings, Pagination, Count rows if estimate less than: 1,000, 10,000, 100,000, 1,000,000 or Always count, 100,000 unless changed, as macOS), or with no estimate, the server counts; from the threshold on nothing is counted, the status says "1-1,000 of about 2,000,000 rows" (no total under a filter), and Count rows in the command bar counts on request. Last page, Go to page and All rows wait for an exact count. A sort or a refresh goes back to the first page, and a refresh counts again. An engine that pages on the server (Cassandra) cannot seek by offset, so it has only its first page, as on macOS, and the core refuses another (`ffi.page_unsupported`).
- Rows per page: a "1,000 rows" button before First page opens the macOS sizes, 5, 10, 20, 100, 500 and 1,000, as `RadioMenuFlyoutItem`s, then All rows..., which asks first and needs the count, and Custom..., up to 1,000,000. A new size keeps the page that holds the first row shown, as macOS does. The size belongs to the tab: `session.json` keeps it with the tab's page, and Reopen closed tab brings both back.
- Go to page: between Previous and Next, "Page 3 of 36" opens a flyout with a `NumberBox` from 1 to the page count, as macOS asks in a popover. It is offered once the table is counted, as on macOS, and the box keeps a typed number inside that range (`InvalidInputOverwritten`).
- An open transaction: each run's `Finished` event carries the transaction the editor's connection is left in (the core's `RunSummary.transaction_state`). The tab that holds one shows a Warning `InfoBar` above its results, "Transaction open", with Roll back, which asks first, and Commit, hidden on a read-only connection; a failed one is an Error bar with Roll back only. Both send COMMIT or ROLLBACK as typed SQL, EXEC or DISCARD for a key-value engine, as the Linux app does. Over the tabs, a bar names another tab that holds one, with Show; macOS shows its bar above every tab of the connection, and here the owning tab carries the actions, since the transaction lives on that tab's own connection. Closing a tab that holds one asks first, since closing rolls it back. Window close and Exit confirm every affected held transaction before closing any tabs; cancelling keeps them open. Then one dialog lists every query tab still running, as macOS asks before it quits, and says closing rolls back a transaction a run has open; a table tab loading a page is not asked about. Exit then hides the windows and closes every connection, each tab stopping its run, for up to 5 seconds before the process ends. While any tab holds a transaction or unsaved changes, the primary window registers a reason with `ShutdownBlockReasonCreate` ("Table changes are not saved.", "A transaction is open.") and answers `WM_QUERYENDSESSION` with FALSE once it has written the session file: a sign-out or a restart then lists TablePro with its reason and the user can cancel and save, and a Restart Manager request, as from an installer, is cancelled ([Application Shutdown Changes in Windows Vista](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms700677(v=vs.85)); Restart Manager, [Guidelines for Applications](https://learn.microsoft.com/en-us/windows/win32/rstmgr/guidelines-for-applications)). A running query does not hold it, since stopping it is the default. A forced end cannot be held: "Sign out anyway" (`ENDSESSION_CRITICAL`) goes on to `WM_ENDSESSION`, which writes the session file again, and a forced Restart Manager close, as an update that closes the app by force, ends the process with no `WM_ENDSESSION`. Either way the server rolls the transaction back, and the session file already holds the work, as Restart Manager's guidelines ask: each table tab's pending changes, with the open cell editor's text as if it were kept (each change of that text starts the 2-second write too), a data row named by its primary key's values, each with the kind the core read it as so a BLOB and a text that read alike stay apart, and a cell by its column's name (a table with no primary key keeps none, since nothing finds its rows again), and each tab that held a transaction (`SavedEdits`, `SessionTab`). The app registers with `RegisterApplicationRestart` at startup (`RESTART_NO_CRASH | RESTART_NO_HANG`, no arguments), so Restart Manager starts it again after an update or a restart, and the new process claims the data folder as any launch does. A launch whose session holds such work reopens those connections and tabs even with Reopen at startup off (`SessionState.Recovered`). A table tab puts its changes back as pending once a page is read, each on the row its key finds there; a key two rows of the page share finds neither. What the page cannot take (a row not on it, a column gone, a value refused, every change while the table is locked) waits on the tab, and each later page read tries it again, so going to the row's page brings it back; a new row goes back whole or waits whole, since each try adds it again. An InfoBar over the rows says how many wait, with Discard, which drops only those and asks nothing more, and closes once none are left. Before a save sends its first statement, the session file is written at once with that tab's changes marked uncertain (`SavedRowEdit.Uncertain`), a write the file refuses being logged and the save going on; the change-triggered write that follows the save's answer clears the mark. Changes from a save whose outcome was unknown keep it too. The server may hold changes so marked already, so once any goes back, the tab is in the state an unknown outcome leaves it in, Save refused with "The last save may have been written" until a reload or Discard changes, and the bar says so. A query tab that held a transaction shows an InfoBar that it was open when TablePro last closed and the server rolled it back; the words name no cause, since a crash or a kill keeps the same work from the write before it. Only the session's own writes carry the work: the last write of a close or Exit leaves out what its questions covered, and a reconnect, a tab window's close and Reopen closed tab never carry it, so an answered change does not come back. Changes still waiting on a tab, and a connection not opened since, keep theirs in every write, Exit's last one too, since nothing has asked about them. Disconnect, Reconnect and connecting an edited connection ask about held transactions the same way first, in the primary and in a tab window, but not about a running query, which they stop, and Reconnect and an edited connection bring the tabs back with their text on the new session. Cancelling that connect keeps the connection with Retry, so the tabs still come back. A window with a dialog already open waits for it to be dismissed before accepting a close request. WinUI opens one `ContentDialog` per thread, even across windows, so a question asked while another window shows one is declined, as Cancel would decline it (`WindowDialogs`).
- An open transaction: each run's `Finished` event carries the transaction the editor's connection is left in (the core's `RunSummary.transaction_state`). The tab that holds one shows a Warning `InfoBar` above its results, "Transaction open", with Roll back, which asks first, and Commit, hidden on a read-only connection; a failed one is an Error bar with Roll back only. Both send COMMIT or ROLLBACK as typed SQL, EXEC or DISCARD for a key-value engine, as the Linux app does. Over the tabs, a bar names another tab that holds one, with Show; macOS shows its bar above every tab of the connection, and here the owning tab carries the actions, since the transaction lives on that tab's own connection. Closing a tab that holds one asks first, since closing rolls it back. Window close and Exit confirm every affected held transaction before closing any tabs; cancelling keeps them open. Then one dialog lists every query tab still running, as macOS asks before it quits, and says closing rolls back a transaction a run has open; a table tab loading a page is not asked about. Exit then hides the windows and closes every connection, each tab stopping its run, for up to 5 seconds before the process ends. While any tab holds a transaction or unsaved changes, the primary window registers a reason with `ShutdownBlockReasonCreate` ("Table changes are not saved.", "A transaction is open.") and answers `WM_QUERYENDSESSION` with FALSE once it has written the session file: a sign-out or a restart then lists TablePro with its reason and the user can cancel and save, and a Restart Manager request, as from an installer, is cancelled ([Application Shutdown Changes in Windows Vista](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms700677(v=vs.85)); Restart Manager, [Guidelines for Applications](https://learn.microsoft.com/en-us/windows/win32/rstmgr/guidelines-for-applications)). A running query does not hold it, since stopping it is the default. A forced end cannot be held: "Sign out anyway" (`ENDSESSION_CRITICAL`) goes on to `WM_ENDSESSION`, which writes the session file again, and a forced Restart Manager close, as an update that closes the app by force, ends the process with no `WM_ENDSESSION`. Either way the server rolls the transaction back, and the session file already holds the work, as Restart Manager's guidelines ask: each table tab's pending changes, with the open cell editor's text as if it were kept (each change of that text starts the 2-second write too), a data row named by its primary key's values, each with the kind the core read it as so a BLOB and a text that read alike stay apart, and a cell by its column's name (a table with no primary key keeps none, since nothing finds its rows again), and each tab that held a transaction (`SavedEdits`, `SessionTab`). The app registers with `RegisterApplicationRestart` at startup (`RESTART_NO_CRASH | RESTART_NO_HANG`, no arguments), so Restart Manager starts it again after an update or a restart, and the new process claims the data folder as any launch does. A launch whose session holds such work reopens those connections and tabs even with Reopen at startup off (`SessionState.Recovered`). A table tab puts its changes back as pending once a page is read, each on the row its key finds there; a key two rows of the page share finds neither. What the page cannot take (a row not on it, a column gone, a value refused, every change while the table is locked) waits on the tab, and each later page read tries it again, so going to the row's page brings it back; a new row goes back whole or waits whole, since each try adds it again. An InfoBar over the rows says how many wait, with Discard, which drops only those and asks nothing more, and closes once none are left. Before a save sends its first statement, the session file is written at once with that tab's changes marked uncertain (`SavedRowEdit.Uncertain`), a write the file refuses being logged and the save going on; the change-triggered write that follows the save's answer clears the mark. Changes from a save whose outcome was unknown keep it too. The server may hold changes so marked already, so once any goes back, the tab is in the state an unknown outcome leaves it in, Save refused with "The last save may have been written" until a reload or Discard changes, and the bar says so. A query tab that held a transaction shows an InfoBar that it was open when TablePro last closed and the server rolled it back; the words name no cause, since a crash or a kill keeps the same work from the write before it. Only the session's own writes carry the work: the last write of a close or Exit leaves out what its questions covered, and a reconnect, a tab window's close and Reopen closed tab never carry it, so an answered change does not come back. Changes still waiting on a tab, and a connection not opened since, keep theirs in every write, Exit's last one too, since nothing has asked about them. Disconnect, Reconnect and connecting an edited connection ask about held transactions the same way first, in the primary and in a tab window, but not about a running query, which they stop, and Reconnect and an edited connection bring the tabs back with their text on the new session. Cancelling that connect keeps the connection with Retry, so the tabs still come back. A window with a dialog already open waits for it to be dismissed before accepting a close request. WinUI opens one `ContentDialog` per thread, even across windows, so a question asked while another window shows one is declined, as Cancel would decline it (`WindowDialogs`). A dialog stops counting as open once it is answered, though WinUI plays its closing transition before `ShowAsync` returns, and a question asked during that transition, as Roll back clicked right after Cancel, waits for it to end.
- Safe Mode: before a typed run the core judges each statement at the connection's level (`DatabaseSession.gate_run`, over `SafeModeLevel::gate`, as the Linux editor judges its batches). Confirm writes asks before any write, and Off before a DROP, a TRUNCATE, or a DELETE or UPDATE with no WHERE. The question is a `ContentDialog` that lists each statement in full, with Cancel as the default. Read only keeps the whole run back, since the editor sends the text it runs whole: the selection, the whole text, or with Run statement the one statement. The driver splits that text with the session's own settings, so when the whole text reads stricter than every statement, the question shows the whole text. A MySQL script with DELIMITER lines is judged statement by statement, since the driver sends its statements apart. A level saved while the connection is open applies at once to its sessions in every window (`set_safe_mode`), as on Linux, and a connect still under way starts over when the save changed a field it reads or a secret, since the core read the saved connection as it began; a change to or from Read only takes a new connection, so those sessions reconnect once their held transactions are confirmed. A session that keeps its connection shows "Changes apply the next time you connect", as Linux says it, and one that cannot take Read only asks before every write until then. Statements are judged by the connection's own engine, also while its link is down and a tab's own connection still runs (`Session::grammar`). Commit, Roll back and a sort's rerun are not asked about. Closing a tab stops its run and waits for it to end before its connection closes.
- Lifecycle: running, closing, paging, sorting, a lost editor, the session share and connecting are plain types in `src/TablePro.App.Model` (`QueryTab`, `TableTab`, `WorkspaceTabs`, `ConnectionLife`, `SessionShare`) over `ITabSession`, `ITabEditor` and `ITabRun`, with the core's adapters beside them. The views draw and ask through small view interfaces (`IQueryTabView`, `ITableTabView`, `IResultsView`, `IWorkspaceTabsView`, `IConnectionView`), so the model tests run them with fakes.
- A table tab edits its page's rows, keeps the changes pending until Save, and asks before a reload or a close would lose them ([0006](0006-editing-table-rows.md)).
Expand Down Expand Up @@ -174,6 +174,7 @@ Facts the CI runs on `windows-2025` and `windows-11-arm` established, which the
- The Toolkit's `GridSplitter` in an `Auto` column of its own resized nothing; on the left edge of the star column after the pane, as its page lays it out, it resizes the pane.
- FlaUI moves the pointer with `SetCursorPos`, which WinUI does not take as a pointer moving with the button down, so neither a tree drag nor the splitter moved. The UI tests drag through `SendInput`.
- A closed `InfoBar` stays in the UI Automation tree with its content folded away, so the tests read whether a bar shows from its buttons.
- On `windows-11-arm`, an answered `ContentDialog` returned from `ShowAsync` 210 to 350 ms after its `Closing` event (run 43643257678). `WindowDialogs` counted it as open until then, so a Roll back invoked within that time was declined as Cancel would decline it, and `CancellingCloseSelectsTheConnectionWhoseTransactionWasShown` failed in runs 43447041133 and 43537927072. Roll back invoked right after Cancel was declined in 20 of 20 tries (run 43645046133). A dialog now stops counting at `Closing`, and the next question waits for the transition: the same tries and the original test's steps passed 40 of 40 on `main` and on the branch of #4285 (runs 43645911845 and 43645919130).
- A grid given a new set as the set started had no rows until the first ones arrived, and a client that had asked for a cell before then read its name after: WinUI reports an empty name as none, so FlaUI threw `PropertyNotSupportedException` (x64, once in run 41566360608). The pane now hands the grid a set once it has rows, and a cell peer outside the grid's current data reads as empty, off screen and with no bounds, and takes no selection.
- On `windows-11-arm`, a rebuilt library tree folded rows the page had opened, in a pass of the tree's own after the page's, and the folds read as the user's. The page opens the rows again at low priority and records no fold until then.
- On `windows-2025` the app died three times in run 41581443963 (0xC0000005 in `UpdateLayout`), each in one of those low-priority passes. The page now skips a pass once its window has closed. A passing run cannot show whether it still happens: the test platform prints the app's error output only when a test fails.
Expand Down
2 changes: 1 addition & 1 deletion windows/src/TablePro.App/Services/CredentialDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ internal async Task<bool> RecoverHostKeyAsync(
DefaultButton = trust ? ContentDialogButton.Close : ContentDialogButton.Primary,
};
AutomationProperties.SetAutomationId(dialog, "CredentialDialog");
var shown = WindowDialogs.ShowAsync(dialog, owner);
var shown = WindowDialogs.ShowAsync(dialog, owner, cancellationToken);
using var registration = cancellationToken.Register(() => owner.DispatcherQueue.TryEnqueue(dialog.Hide));
var result = await shown;
cancellationToken.ThrowIfCancellationRequested();
Expand Down
Loading
Loading