Skip to content

fix(edits): keep pending edits, transactions and saved connections from being lost without asking - #4283

Merged
datlechin merged 3 commits into
mainfrom
fix/edit-loss-4268
Nov 14, 2026
Merged

datlechin merged 3 commits into
mainfrom
fix/edit-loss-4268

Conversation

@datlechin

@datlechin datlechin commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

From #4268:

  • QT-09: each tab owns its staged row edits (DataChangeManager) and their undo history. The window-wide manager swapped by snapshot is gone, with QueryTab.pendingChanges, the parked-edit bookkeeping and the selected-tab guards. A save, a result, an undo or a metadata answer acts on the tab it belongs to, whichever tab is selected.
  • GE-06: switching tabs and back keeps Cmd+Z and Cmd+Shift+Z for the grid's edits. A field being typed in, or the sidebar's folder edits, still undo first on the window's history.
  • DL-02: after an unattended reconnect drops a transaction, temp tables or SET values, the report is no longer spent on whatever runs first. The next statement someone wrote (query tab, Run All, Explain, transaction bar, AI and MCP, AppleScript, Shortcuts) and the app's own next work on that session (grid save, import, structure, rename), which would have joined the lost transaction, are each refused once; neither uses up the other's. Reads are never refused. Work on a temporary table the session took is refused until it is created again.
  • WD-2 (Windows): the session file now carries each table tab's pending edits, keyed by primary key, and whether a tab held a transaction, in every save but the last one of Exit or a window close. After a forced end (Restart Manager, a crash) the relaunch reopens those tabs even with Reopen at startup off, puts the edits back as pending and says how many it could not, and reports the transaction the server rolled back. The app registers with RegisterApplicationRestart, as Restart Manager's guidelines ask.

From #4273:

  • CS-08: connections.json and credentialProfiles.json decode record by record. A record this build cannot read is written back as it was, or kept in <file>.unreadable-records when the file changed outside TablePro, so a save never signs it. Each save keeps the previous file and its tag as <file>.backup, and a file that no longer parses is restored from it with the backup's own trust (an untagged backup stays untrusted on every later load).

Tests changed on purpose:

  • Deleted with the snapshot model: ParkedEditSnapshotTests, PendingChangesSnapshotTests, the saveState/restoreState cases in DataChangeManagerExtendedTests, the TabChangeSnapshot cases in DataChangeModelsTests, UnloadedValueWriteTests.backgroundTabSnapshotTakesLoadedValue, MainContentCoordinatorTabSwitchTests.dataChangeManagerRestoresFromSnapshot. ResultReplacementEditsTests and TabEditHistoryTests cover the behavior now.
  • Meaning changed: SaveAttributionTests (a save approved after a switch now writes the saving tab's edits), DataTabGridEditCommitTests (a commit from a tab the selection left lands in its own edits), four MainContentCoordinatorTabSwitchTests cases, TabCloseProtectionTests, DataChangeManagerExtendedTests (redo kept by describeTable), SessionRecoveryLoopTests, SessionLanesTests (app work told once, then runs).
  • Every other MainContentCoordinator(...) call drops the changeManager: argument.

Docs: TableProApp/docs#239 (draft, merges after this).

Test plan

  • TabEditHistoryTests: undo after switching away and back, undo stays in its tab, a background result drops only its tab's edits (fail on main: the switch wiped the history).
  • SessionRecoveryLoopTests, SessionLanesTests: app work after a loss runs and leaves the report for the next statement; temporary-table work refused while the loss stands.
  • ConnectionStoreTagRemovalTests: unreadable record kept, backup kept, damaged file restored with its trust, untrusted unreadable records set aside.
  • Windows: SessionRecoveryTests, TabRecoveryTests (model, run here), APendingEditComesBackAfterTheAppIsKilledEvenWithReopenOff (UI, CI).

Closes #4268
Refs #4273

@datlechin
datlechin merged commit bc23977 into main Nov 14, 2026
13 checks passed
@datlechin
datlechin deleted the fix/edit-loss-4268 branch November 14, 2026 21:29
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.

Edits and transactions: remaining audit items

1 participant