fix(connection-form): show the right default socket path per database type (#1902)#1904
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc44a6a0b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| PluginMetadataRegistry.shared.snapshot(forTypeId: databaseType.pluginTypeId)? | ||
| .connection.defaultUnixSocketPath |
There was a problem hiding this comment.
Use the concrete type for socket path metadata
When the connection form is opened for a PostgreSQL-backed alias such as Redshift or CockroachDB, databaseType.pluginTypeId resolves to PostgreSQL via the registry aliases, so this lookup returns /var/run/postgresql/.s.PGSQL.5432 even though those concrete snapshots do not define a Unix-socket convention. That leaves the new per-type placeholder wrong for those database types; this UI metadata should be read from the concrete type snapshot instead of the driver lookup ID.
Useful? React with 👍 / 👎.
Fixes #1902.
Problem
In the New/Edit Connection form, when SSH tunneling is enabled the Socket Path field showed the same PostgreSQL hint (
/var/run/postgresql/.s.PGSQL.5432) for every database type, so MySQL and MariaDB connections got the wrong default.Root cause
GeneralPaneView.swifthardcoded the field's placeholder to the PostgreSQL socket regardless of type. It is hint text only, never a saved value, so no stored connections were affected.Fix
Route the placeholder through the existing per-type metadata system instead of hardcoding it, so it is correct for every driver. Same plumbing as
defaultPortandhidesBuiltInPassword, entirely app-side:PluginMetadataSnapshot.ConnectionConfigis an internal app struct, not a PluginKit transfer type, so there is no PluginKit ABI bump and no plugin re-release.defaultUnixSocketPathtoConnectionConfig./var/run/mysqld/mysqld.sock, PostgreSQL →/var/run/postgresql/.s.PGSQL.5432, Redis →/var/run/redis/redis.sock.buildMetadataSnapshotso a loading plugin binary can't drop it (same pattern ashidesBuiltInPassword).PluginManager.defaultUnixSocketPath(for:)and aNetworkPaneViewModel.socketPathPromptcomputed property that falls back to a generic/path/to/database.sockfor types with no socket convention.socketPathPrompt.The values match TablePro's own docs table in
docs/databases/ssh-tunneling.mdx, so no docs change was needed.Tests
SocketPathPlaceholderTests—defaultUnixSocketPath(for:)returns the right path for MySQL, MariaDB, PostgreSQL, and Redis, andnilfor SQLite, ClickHouse, and unknown types.NetworkPaneSocketForwardTests—socketPathPromptfollows the database type and falls back to the generic hint for a socketless type.Notes
filePathPrompt,containerEntityPlaceholder) are covered at the metadata/view-model layer, not with UI automation, and this follows the same pattern.