Skip to content

feat(ios): open Cloudflare D1 connections - #3998

Merged
datlechin merged 2 commits into
mainfrom
feat/ios-cloudflare-d1
Nov 2, 2026
Merged

datlechin merged 2 commits into
mainfrom
feat/ios-cloudflare-d1

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • iPhone and iPad open Cloudflare D1 connections: browse, edit rows, query, structure, truncate and drop, switch between the account's databases, Shortcuts, sync and import. The macOS plugin is compiled into the app and runs behind PluginBackedDriver, as ClickHouse and MongoDB do.
  • The form asks for an Account ID and an API Token, then lists the account's databases in a searchable picker that still takes a typed name or UUID. No host, port, SSL or SSH for an API engine.
  • PluginBackedDriver no longer owns row writes. PluginRowWritingDriver carries them for ClickHouse and MongoDB, and D1 writes through SQLBuilder like iOS SQLite.
  • iOS sorts engines by DatabaseType.connectionMode (server, file, API), which replaces the file-or-server boolean wherever it meant "has a network transport". DatabaseType.isSQLiteFamily replaces .sqlite-only checks that meant SQLite's grammar.
  • D1 plugin, both apps:
    • One request resolves a database by name or UUID.
    • The list is paged.
    • A BLOB reads as bytes instead of NULL.
    • A binary parameter is refused instead of being stored as base64 text.
    • A connect failure keeps its cause.
    • An unlimited SELECT is bounded at the row cap, before D1's 50 MB result limit fails it.
  • SQLDialectDescriptor.likePatternByteLimit: an additive PluginKit field. Kit 41 already includes it, since v0.84.0-beta.2 shipped 40. Past D1's 50-byte LIKE pattern, both apps' filters and the iOS search match with instr/substr.
  • The Mac's limit walk moved into TableProSQLGrammar as SQLStatementRowLimit, so the plugin can use it.
  • iOS fixes found on the way:
    • Truncate on SQLite sent TRUNCATE TABLE; it now sends DELETE FROM.
    • A server connection switched to a file type kept its SSH tunnel, which still dialed. DriverFactory.dialsSSHTunnel now refuses a tunnel for a type with no network transport.
    • An imported D1 got localhost as its host.
  • Tests changed on purpose:
    • The row-write cases in PluginBackedDriverTests and ClickHouseOnIOSTests now use the new class.
    • IOSDriverFactoryCatalogTests lists ClickHouse and D1.
    • SQLLimitDetectorTests keeps one wrapper case; its walk tests moved to SQLStatementRowLimitTests.

Test plan

  • New: CloudflareD1OnIOSTests, ConnectionFormViewModelCloudflareD1Tests, CloudflareD1DatabaseListTests, SQLBuilderSQLiteFamilyTests, SQLStatementRowLimitTests, SQLSubstringMatchTests, FilterSQLGeneratorLikeLimitTests, DatabaseTypeSQLiteFamilyTests, plus D1 cases in the refusal, catalog, parity, routing, form-edit, formatter, info and import tests. ConnectionManagerTests covers a tunnel the factory declines.
  • Local: swift test on TableProCore (all targets green), the macOS Unit suites for the changed types, the macOS build, AllPlugins, and the iOS app and test bundle compiled for the simulator. This Mac has no simulator runtime, so the iOS suites run on CI.
  • Not measured against a live D1: the /raw BLOB shape. apple/scripts/probes/check-cloudflare-d1-wire-shapes.sh prints it.

iPhone and iPad open Cloudflare D1 with the macOS plugin compiled into the
app. The form takes an Account ID and an API Token and lists the account's
databases. PluginBackedDriver no longer owns row writes, so D1 writes through
SQLBuilder. iOS sorts engines by connection mode: server, file or API.

The D1 plugin, on both apps:
- resolves a database by name or UUID with one request
- pages the database list
- reads BLOBs as bytes
- refuses binary parameters
- keeps the real connect error
- bounds unlimited reads before D1's 50 MB result limit

Filters and search switch from LIKE to instr past D1's 50-byte LIKE pattern
limit, through a new dialect field.

Also fixes on iOS: Truncate on SQLite sent TRUNCATE; a connection switched to
a file type kept dialing its SSH tunnel.
@datlechin
datlechin merged commit cbfe85f into main Nov 2, 2026
7 of 8 checks passed
@datlechin
datlechin deleted the feat/ios-cloudflare-d1 branch November 2, 2026 21:02
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