Skip to content

fix(data-grid): keep edits through saves, undo and paste, hold keyed writes and restores to their rows - #4226

Merged
datlechin merged 4 commits into
mainfrom
fix/audit-w6-edits
Nov 12, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/audit-w6-edits

Conversation

@datlechin

@datlechin datlechin commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes from the 2026-11-12 audit, lane edits (macOS grid edits, saves, structure save).

  • ED-1: while a save runs, its tab's grid, row inspector, row commands, Undo, Redo and Discard are refused, so an edit typed during the write is no longer wiped when the save lands.
  • ED-2: a keyed UPDATE the app writes that matched no row now fails the save on PostgreSQL, CockroachDB, Redshift, KingbaseES, PGlite, SQLite, libSQL, Turso and DuckDB, whose count is the matched rows. MySQL, MariaDB, TiDB and OceanBase count changed rows and keep the lenient rule, and so does a write through a view or an update after a delete in the same save (cascade).
  • ED-3: an edit's undo keeps the row as read, so undoing a cell typed back to its value no longer stages the edited value as the pre-image.
  • ED-4: the row menu's Undo Delete is its own undo step (Restore Row, Restore Rows); Cmd+Z after it no longer replays the old delete step the wrong way round.
  • ED-5: Restore Previous Values re-reads each edited or inserted row inside the write, with the query the sheet read it with, and refuses when it changed since the sheet listed it.
  • ED-6: Cloudflare D1 statements bind at most 100 parameters; libSQL and Turso use SQLite's 32,766.
  • ED-7: paste keeps a pasted primary key unless the server fills it (identity, a default that calls a function, SQLite's INTEGER PRIMARY KEY, or a key the driver takes no value for, as MongoDB's _id). A UUID key the server does not fill still gets a fresh UUID per row. A blank key that refuses NULL stays NULL, not an empty string.
  • ED-8: a JSON edit in the row inspector or the grid's JSON editor keeps a value stored across lines in the editor's lines; a one-line value stays compact.
  • ED-9: Duplicate on the row menu copies every selected row, as one undo step.
  • ED-10: CSV paste keeps spaces inside a field.
  • RV-4: a structure save that stopped part way keeps a staged "drop column, add one with the same name".
  • Tests changed because they pinned the old behavior: DataWriteExecutorTests.fewerRowsIsNotAFailure (now MySQL), RowOperationsManagerPasteTests (key is AUTO_INCREMENT), RowPasteForeignTextTests, RowOperationsFieldAbsenceTests.sqlPasteHasNoAbsence, RowOperationsManagerUUIDKeyTests.pasteWithoutUUIDKeysKeepsTheKey, RowOperationsExpressionClipboardTests (key is an identity), JSONViewerWindowCommitTests (callers now get the editor text).
  • Docs: docs(features): paste keys, duplicate rows, save lock, restore check docs#217

Needs the maintainer

  • MySQL family: a keyed UPDATE that matches no row still reports success. Holding it needs CLIENT_FOUND_ROWS, which would also change the affected-row count every MySQL query reports.
  • SQL Server, Oracle, Snowflake and Dameng write their own keyed statements, which carry no expected row count, so ED-2 does not reach them. Holding them needs each plugin to report one (and SQL Server to send SET NOCOUNT OFF on keyed writes).

Test plan

  • New: RowEditUndoStepTests, SaveInFlightEditGateTests, RowOperationsManagerPasteKeyTests, RowOperationsManagerDuplicateRowsTests; cases added to DataWriteExecutorTests, DataWriteExecutorLookupTests, RewindPlannerTests, StructureChangeRebaseTests, MultiRowEditStateJsonTests, JSONViewerWindowCommitTests, SQLStatementGeneratorBatchDeleteScaleTests, SQLStatementGeneratorImportTests.
  • Measured: DuckDB 1.5.4 and SQLite report 2 for UPDATE t SET a = 1 over two rows already holding 1.

@datlechin
datlechin enabled auto-merge (squash) November 12, 2026 05:28
@datlechin
datlechin merged commit d880209 into main Nov 12, 2026
11 checks passed
@datlechin
datlechin deleted the fix/audit-w6-edits branch November 12, 2026 15:14
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.

1 participant