Skip to content

fix(macos): stop the data loss, wrong writes and gate bypasses the code audit found - #4174

Merged
datlechin merged 4 commits into
mainfrom
fix/audit-wave-1
Nov 10, 2026
Merged

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

Conversation

@datlechin

@datlechin datlechin commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes for 55 defects from a code audit of the macOS app and its plugins. Not reviewed by Codex yet (out of quota until Nov 14): do not merge before that review.

Editing and execution

  • A run or a save approved in Safe Mode stays on the tab that asked. A tab bound to a database that changed during the prompt drops the run with a message.
  • Running a query over an edited result asks before discarding the edits. Parked edits of a background tab are dropped when a new result lands on it.
  • Deleting an edited row keys on the row as read. Redo of a cell edit on an already edited row is saved. Updates are sequenced with inserts and deletes.
  • Row paste keeps a leading empty field and is one undo step. Bulk edits no longer publish per row.
  • MySQL-family BIT cells are written as numbers, in the grid and in SQL dumps.
  • Reopening a closed connection from a deeplink or history no longer overwrites its saved tabs.

Sessions and structure

  • User SQL on a database the session is not browsing runs on a tracked session connection, not a pooled one. A connection opened this way keeps an open transaction and is closed after 10 idle minutes otherwise; on PostgreSQL its temp tables, SET values and advisory locks go with it, as with the pool before.
  • After a reconnect or a database switch that lost a transaction, the next user statement is refused once. Metadata reads do not consume that report.
  • Trigger editing reads and restores the full CREATE TRIGGER, and refuses a drop-first edit that cannot be restored.
  • A SQLite table rebuild is refused while the session holds a transaction.
  • A partly applied structure save rebases the staged edits on the table as it now is.

Drivers

  • DuckDB: streaming results with no 5,000,000 row stop, one materialization, bounded buffering through export and masked export.
  • PostgreSQL: table DDL keeps PARTITION BY, PARTITION OF and UNLOGGED; a zero-row stream sends its header.
  • Redis: SET ... KEEPTTL, RENAMENX and SET NX for rename and new string keys. MUSTAPPLY is accepted only around those two and graded by the wrapped command.
  • Elasticsearch, etcd, MongoDB, SurrealDB, Snowflake: writes no longer replace an existing document or key, retype a string, or resubmit a statement. etcd mv is graded destructive.

Import and export

  • Parquet: binary values written as given, a column whose values do not fit its type is written as text with a warning.
  • XLSX: cells typed from the column type. CSV import: a row with a non-empty surplus field is a row error.

AI, MCP, storage

  • Claude Agent's MCP token is limited to the chat's connection. MCP completion goes through the approval gate.
  • A protected write queued at the deadline or at cancel never runs; one already in the driver reports that it may have been applied.
  • A deleted connections.json tag reads as modified. Secrets of a Local only connection are written device-only.
  • A failed or partial Keychain read no longer deletes secrets or MCP tokens.

Tests that pinned behavior this PR changes on purpose

  • ScopedDriverRoutingTests, SessionLanesTests: a foreign-database statement routes to a session connection.
  • CrossEngineValueCoercerTests.aPostgresArrayBecomesJson: a text[] becomes JSON strings.
  • RedisStatementGeneratorTests, RedisBinaryValueTests, RedisCommandParserTests: SET updates carry KEEPTTL.
  • SyncCategoryRefetchTests.turningACategoryOnRefetches: pull count.
  • KeywordUppercaseHelperTests: signature only.

Needs the maintainer

  • Local only: the older synced copy of a secret stays in iCloud Keychain. Removing it needs a user confirmation, since another device may still read it.
  • Not run against live servers: Elasticsearch, etcd, Snowflake, SurrealDB, Kafka, MySQL BIT casts, Redis cluster.
  • A docs PR for the MCP completion and Claude Agent scope changes.

Test plan

  • verify.sh build, plugins, abi, lint, l10n: PASS.
  • verify.sh test (Unit plan): 29342 executed, 29342 passed.
  • verify.sh package TableProCore: 76 passed for the new DuckDB, document path and operator suites.
  • verify.sh ios MongoDBStringFieldWriteTests: INCONCLUSIVE, no simulator on this Mac.
  • apple/scripts/probes/check-parquet-export-values.sh and check-duckdb-streaming-results.sh pass against the bundled libduckdb.

@datlechin
datlechin enabled auto-merge (squash) November 10, 2026 10:56
@datlechin
datlechin disabled auto-merge November 10, 2026 10:56
# Conflicts:
#	apple/TablePro/Core/MCP/MCPTokenStore.swift
#	apple/TableProTests/Core/MCP/MCPTokenStoreTests.swift
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