Skip to content

fix(macos): keep T-SQL blocks and rewinds whole, stop CSV sanitizing by default, and fix Stop, defaults and gate cancels across drivers - #4185

Merged
datlechin merged 4 commits into
mainfrom
fix/audit-wave-4-macos
Nov 11, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/audit-wave-4-macos

Conversation

@datlechin

@datlechin datlechin commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Low-severity fixes from the 2026-11-10 code audit (wave 4, Phase 9) for the macOS app, five defects found in wave 3, and the CSV sanitize default in the shared core and the Linux app.

Editor

  • ES-07: an LSP write to a server that exited no longer kills TablePro (SIGPIPE and the ObjC exception): writes go through a queue with F_SETNOSIGPIPE and the throwing write(contentsOf:).
  • ES-09 (partly): on SQL Server, IF, WHILE, bare BEGIN ... END and BEGIN TRY ... END CATCH stay one statement for Run Current, the gutter and the band. BEGIN opens a block only where one can stand, so CREATE TABLE begin(...); DROP TABLE users still splits. IF c stmt; ELSE stmt; still splits at the ;.
    • Gate: QueryClassifier.isMultiStatement refuses a block holding more than one statement (any ; outside parentheses not followed by the block's END, ELSE or ;). A block holding one statement, such as IF x BEGIN SELECT 1; END, now counts as one statement for callers without multi-statement leave (explain_query, export_data, the execution gate), where main counted it as two; inner statements are still tiered. Paired docs: docs: CSV formula sanitizing is off by default, and a one-statement T-SQL block counts as one statement docs#195, which also flips the CSV default.
  • ES-10: a ; inside a PostgreSQL CREATE RULE ... DO ( action list no longer ends the statement; elsewhere a ; ends it as before, so a stray ( cannot swallow the rest of a script.
  • ES-14: the two dead incremental line-count methods are removed.
  • UI-11: the trigger editor opens at the DDL pane's stored font size.
  • W3-04: MongoDB and Redis caret statements read the document once per text and find the caret by binary search.
  • W3-05 (iOS): column and table suggestions are built once per cache, table list and namespaces.
  • Bracket emphasis no longer raises an uncatchable NSRangeException when the caret is outside the visible range: findClosingPair clamps to the text and the search window follows the caret.

Edits and tabs

  • GE-07: the rewind record lists operations in edit order, and undoing a rewind runs its inverse in the order the rewind ran.
  • GE-08: rewind finds a row under the primary key the save gave it, and compares every non-generated column so it never rewrites a row that later took that key.
  • GE-09 (partly): a pending default is the DEFAULT keyword with the expression flag, never text. Engines whose plugin writes its own rows still receive the legacy __DEFAULT__ text, so the literal text is refused there on save and on restore, naming the column; the JSON view and Copy as JSON show a pending default as null.
  • QT-06: a table load turned away while another query's Safe Mode prompt is open clears its loading state and runs once the prompt closes.
  • QT-08: Save on a window close saves every tab of every connection in the window; a close cancelled while it waits stops at once.

Import and export

  • IE-06: Sanitize formula-like values is off by default in all three apps (core CsvOptions::default(), Linux GSettings csv-sanitize-formulas, the macOS option), as RFC 4180 writes a field as stored; the quote stays in the data for any importer. When on, the export says how many values got a quote. Users who saved any CSV option keep their stored value. The MCP export_data CSV and the query history CSV export keep sanitizing.
  • IE-10: the CSV decimal comma applies to numeric columns by type category (PluginColumnNumbers, now shared with the XLSX writer), so 1.10 in a text column is left alone and Nullable(Float64), money, BINARY_DOUBLE, BIGNUMERIC get it.
  • IE-11: every export and the CSV, XLSX and SQL imports copy their settings once at the start of a run.
  • IE-12: Data sync and Copy as SQL write PostgreSQL binary as decode('…','hex'), Redshift as from_hex('…'), KingbaseES as before; Copy as SQL writes DuckDB and Oracle binary in their own forms, and an empty Oracle BLOB is no longer NULL.
  • UI-09: a Shortcuts payload starting with [ or { is JSON only when it parses as JSON; bracketed and case-only header matches find their columns.
  • W3-02: Object Copy and Data Compare report a source read cut at the driver's row cap with the export's wording, and Compare stops at the cut.

Drivers

  • ND-10: Cassandra grid edits send UPDATE ... IF EXISTS; [applied] = false fails the save.
  • ND-11: Redis SET with NX or XX shows OK or (nil).
  • SD-11: the MySQL handle is set and cleared under stateLock, which disconnect() takes; Stop uses the thread id saved at connect.
  • DL-05: failed startup commands and a database or schema a reconnect could not reopen show on the connection's warning banner, with the statement cut before secrets and only the server's code; the full text goes to the log privately.
  • DL-08 (partly): PluginKit's default binder sends text with leading zeros (00123) as a string.
  • W3-01: MongoDB, Dameng, Beancount, Redis, DynamoDB, Bigtable and etcd streams declare their 5,000,000-row cap in the header.
  • W3-03: Teradata Stop sends the Abort parcel, or the Cancel parcel during a fetch, and keeps the session; a Stop before the request is sent sends nothing; an unanswered Stop gives the session up after 5 s.

Structure

  • UI-05: the ClickHouse Parts pane keeps load and action errors apart and never blanks a shown list.
  • UI-06: Drop and Detach use PARTITION ID '<id>' from system.parts.partition_id, validated as the server validates it.
  • UI-07: a Cancel at the execution gate keeps every object sheet and its edits with no error (comment, sequences, Create Type, triggers, Create Database, the schema editor, Create Table, Users & Roles), through GatedOperationFailure.
  • UI-10: a principal staged for drop emits no ALTER, SET PASSWORD or grant changes.

PluginKit

  • Additive: PluginColumnNumbers, PluginRowWriters.isFormulaLike(_:), a changed default binder body. Kit 44, since v0.87.0-beta.1 shipped 43; minimum 19. The ABI check passes.

Known limits

  • SD-06 (Oracle region time zones) and DL-08's typed parameters are not fixed; both need a design the reports give.
  • A Teradata Stop rolls back the open transaction and the app does not say so yet.
  • Engines whose plugin writes its own rows refuse the literal text __DEFAULT__, including drivers that never read it, until PluginKit carries the default mark.
  • Not run against live servers: Teradata Abort and Cancel, ClickHouse PARTITION ID, Cassandra LWT, KingbaseES and Redshift binary literals.

Tests changed on purpose

  • The old PostgreSQL binary form in CompareSQLLiteralTests, SQLRowToStatementConverterTests and DataSyncScriptBuilderColumnTests; the sanitize default in FormatLimits.csv.
  • About 15 files that pinned the __DEFAULT__ text marker (listed in b-edits report); five Vim line-count tests replaced by one recount test.
  • Linux: encoding_sink.rs, three export_ledger/tests.rs tests and csv_options_round_trip pinned the old sanitize default.

Test plan

  • verify.sh: build, AllPlugins, the PluginKit ABI check, lint, the Unit plan (29920 of 29922 before the last two fixes, then the five affected suites), TableProCore (5023), an iOS build with DataBrowserViewModelTests and QueryCompletionCatalogTests (75), core tablepro-core, the catalog check.
  • New suites include TSQLControlFlowBlockTests, QueryClassifierTSQLBlockTests, SQLParenthesizedSemicolonTests, LSPTransportBrokenPipeTests, StatementCaretTableTests, TriggerEditorFontSizeTests, TableLoadAfterSafeModePromptTests, WindowCloseSaveEveryConnectionTests, PayloadRowPlannerHeaderMatchTests, RowPayloadFormatTests, FormatSettingsChangedMidRunTests, StartupCommandWarningTests, TeradataStopTests, SchemaWriteGateDenialTests, PrincipalApplyGateDenialTests, TriggerGateDenialTests, plus cases in TextViewControllerTests, RewindPlannerTests, ClickHousePartStatementsTests and the CSV and compare tests.
  • Reviewed in three rounds by Claude agents that did not write the change, with the security lens on the statement scanner, the gate and SQL construction.

@datlechin
datlechin merged commit c778863 into main Nov 11, 2026
34 of 35 checks passed
@datlechin
datlechin deleted the fix/audit-wave-4-macos branch November 11, 2026 16:01
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