Skip to content

fix(core): bound result bytes, keep MongoDB number types, hold FFI secrets in secrecy, keep long iOS query values whole and give each iOS connection one session owner - #4201

Merged
datlechin merged 7 commits into
mainfrom
fix/audit-wave-5-ios-core
Nov 11, 2026
Merged

datlechin merged 7 commits into
mainfrom
fix/audit-wave-5-ios-core

Conversation

@datlechin

@datlechin datlechin commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Audit wave 5 (2026-11-10 audit), iOS and the shared core, with the Linux and Windows parts they reach.

iOS long values (IO-06)

  • A query result keeps text over 4 KB whole while it fits a per-request budget (a sixth of the free memory past 64 MB, at most 64 MB); past it the value is cut as before and the result and the row say so.
  • The grid shows a capped preview, the row screen an excerpt and View Full Value; copy, export and View as JSON use the whole value. Copy and Share Results check free memory first.
  • Bundled: Redis key values get the same budget; a DuckDB BLOB streams as binary, not editable base64; Oracle BINARY_DOUBLE, BINARY_FLOAT and BINARY_INTEGER are numbers, not BLOBs; a query result's row screen exports in the engine's quoting, not SQLite's.

iOS session (IO-10)

  • One ConnectionSessionModel per connection owns the session, catalog, pending loss and the one check, follow and catalog reload; its lifecycle is the ConnectionSessionState enum. ConnectionCoordinator is the per-scene facade with the same API.
  • Fixed on the way: Connected with no session after a failed database restore; SQL Server's schema list after a database switch; the lost screen's Reconnect now takes the toolbar's path; a background rollback is reported in the window that reopens the connection.
  • Deliberate: every window of a connection shows Reconnecting or Lost at once, the table list is read once per change, a schema restore no longer shows "Switching to" in the asking window.

Byte limit (CD-06)

  • A run stops keeping rows once they pass 256 MB (RunOptions::byte_limit), through ByteLimitSink around every editor session the core opens. The crossing row stays whole; the statement is never cancelled for bytes. MongoDB stops collecting itself. Batches flush at 256 rows or 4 MiB.
  • Truncation::ByteLimit and ResultEvent::ByteLimitReached reach the FFI, C#, the Linux banner and the Windows status. Table pages are exempt: both pagers read a short page as the last.
  • Bundled: the C# truncation mapping throws on an unknown tag; a held sort copies only a text column's sort head; the FFI store shrinks a finished set.
  • Core ADR 0019; ADR 0003 and Linux ADR 0016 amended.

PostgreSQL row limit (CD-03)

  • Kept: it is how PostgreSQL runs a row-limited portal (Execute with a row count, then Sync commits), and libpq's only other stop is a cancel, which rolls the statement back. Sources in linux/docs/drivers/postgresql.md.
  • Linux and Windows now say the server stopped the statement at the row limit, before its end, also when the byte limit cut the set. The old text claimed it ran no further than the rows shown; it ran one row further.

MongoDB numbers (CD-07)

  • Value::Int32 keeps an int32 apart from a long. An edited number saves in the type it was read as when the new value is one; otherwise, and for null, missing or new cells, the column's type. The save carries each cell's read value; Extended JSON and mongosh literals keep the width; the FFI keeps it privately. Core ADR 0020 amends Linux ADR 0014.

FFI secrets (CE-09)

  • Secrets cross as a UniFFI custom type SecretString over String, so Rust holds each one in secrecy from the lift on. The Credential Manager path uses Zeroizing and wipes the blob CredReadW returns before CredFree. C# ConnectionSecrets, ParsedConnectionUrl and SecretAnswer print [REDACTED].
  • Still plain, as UniFFI and .NET document: the buffers UniFFI frees, a secret lowered to C#, managed strings (no SecureString, per Microsoft). Listed in core/ARCHITECTURE.md, Bindings.

Tests changed on purpose

  • iOS: DuckDBDriverTests.testStreamingMatchesMaterializedAcrossTypes; followCommitsPlacementWithItsTables, followYieldsToAnEditStartedDuringItsFetch, editArrivingDuringTheFetchPinsTheWindow, editPinsALostWindowAgainstAnotherDatabase gate the one shared read; followOvertakenBySecondSwitchFollowsTheNewest renamed overtakenSwitchNeverLands.
  • Linux: limit_title_for_server_stopped_without_total and the editor banner test take the new wording; an_update_sets_only_the_moved_cell_and_keys_on_the_whole_primary_key reads an int32.
  • Core: the MongoDB cells.rs, rows.rs, dialect.rs, json_cells and statements.rs tests and conformance document.rs read int32 as Int32; the_drivers_row_limit_is_swallowed_for_a_set_already_cut keeps ServerStopped.

Needs the maintainer

  • CD-03 kept as documented, per the wave's decision: a PostgreSQL SELECT cut at the row limit commits what it did up to the FETCH.
  • CD-06 partly: table pages have no byte bound; that needs a prefix and length of long values and a full-value read by row identity in both grids.
  • One row larger than 256 MB is still kept whole.

Docs: TableProApp/docs#200 (draft).

Test plan

  • Rust: clippy -D warnings on the workspace without the Linux app crate; cargo test on the same set: 4,153 passed, 8 failed, all macOS-only and untouched by this PR (Linux /proc memory peak, listen backlog, /private/var path, ssh-agent check). The Linux app crate (glycin needs Linux), the Docker driver tests and the .NET build and tests run on CI only.

  • iOS: TableProCore package tests (125) and 381 iOS tests passed for IO-06 and the first IO-10 stage; the app and tests build after the shared model, but this machine lost its simulator runtime, so the iOS tests ran on CI only.

  • C# bindings regenerated with uniffi-bindgen-cs 0.11.1.

  • New: CellTests, ConnectionSessionStateTests, query-editor, row-detail, buffer and coordinator cases (D1 to D4 and each review fix); ByteLimitSink, RowBatch, retained_bytes, session wrap, conformance byte_limit, FFI byte_limit, C# ByteLimitTests, ConnectionUrlTests, RunResultsTests; Int32 identity, order, bind and parse tests, FFI column_cells, the Docker test an_edited_number_keeps_its_own_bson_type.

  • Reviewed in five rounds by a Claude agent that did not write the change, with the security lens on CE-09 and CD-03.

  • After merging main (feat(windows): edit table rows and move the tab lifecycle into models #4194 row edits, fix(linux-mongodb): seed-list login, field-safe writes and exports, UUID columns, drops that ask, stops on Atlas free tier #4202 MongoDB): the new row-edit, document and conformance tests carry the read value and SecretString; a_cell_read_as_null_or_not_a_number_takes_the_columns_type drops its null case, since a null edit is now $unset; the export test reads _id as Int32(1), since an Int exports as NumberLong. Workspace clippy, tablepro-core (1045), tablepro-driver-mongodb (70), tablepro-ffi, tablepro-session, the .NET solution and the iOS build-for-testing pass; resident_peak fails on macOS as on main.

…core

# Conflicts:
#	core/crates/core/src/document/document_write.rs
#	core/crates/drivers/mongodb/src/cursor_rows.rs
#	core/crates/drivers/mongodb/src/editor_run.rs
#	core/crates/drivers/mongodb/src/rows.rs
#	core/crates/drivers/mongodb/tests/integration/statements.rs
#	core/docs/decisions/README.md
#	linux/docs/drivers/mongodb.md
#	windows/src/TablePro.App/Views/TableTabView.xaml.cs
#	windows/src/TablePro.App/Views/WorkspaceView.xaml.cs
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