feat: extend DriverPlugin with UI/capability metadata#274
Conversation
Each driver plugin now self-declares brand color, connection mode, supported features, column types, URL schemes, and grouping strategy. All 20 properties have sensible defaults so existing plugins compile without changes. This is Phase 1.1 of the plugin extensibility plan.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughExtends the DriverPlugin protocol with many static UI/capability metadata properties, adds supporting enums (ConnectionMode, EditorLanguage, GroupingStrategy) with Codable/Sendable conformances, provides default implementations, updates all plugin implementations with database-specific metadata, and adds tests validating defaults and overrides. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
Plugins/SQLiteDriverPlugin/SQLitePlugin.swift (1)
27-27: Consider adding additional file extensions for consistency.The CHANGELOG (line 51) mentions support for
.sqlite,.sqlite3,.db3,.s3db,.sl3, and.sqlitedbfiles. The current list only includes["db", "sqlite", "sqlite3"]. Consider adding the missing extensions for consistency with the documented file association support.Proposed fix
- static let fileExtensions: [String] = ["db", "sqlite", "sqlite3"] + static let fileExtensions: [String] = ["db", "sqlite", "sqlite3", "db3", "s3db", "sl3", "sqlitedb"]🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Plugins/SQLiteDriverPlugin/SQLitePlugin.swift` at line 27, Update the static fileExtensions array in SQLitePlugin (static let fileExtensions) to include the additional documented extensions so it matches the CHANGELOG: add "db3", "s3db", "sl3", and "sqlitedb" (in addition to the existing "db", "sqlite", "sqlite3") so the plugin recognizes all supported SQLite file types.Plugins/RedisDriverPlugin/RedisPlugin.swift (1)
30-30: Consider adding"rediss"URL scheme for TLS connections.Redis uses
rediss://for TLS-encrypted connections (similar tohttpsvshttp). Including this scheme would enable URL-based connection string parsing for secure Redis connections.💡 Suggested addition
- static let urlSchemes: [String] = ["redis"] + static let urlSchemes: [String] = ["redis", "rediss"]🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Plugins/RedisDriverPlugin/RedisPlugin.swift` at line 30, Update the RedisPlugin.swift URL scheme list to include the TLS scheme so secure Redis URLs are recognized: modify the static constant urlSchemes (currently defined as static let urlSchemes: [String] = ["redis"]) to also contain "rediss", ensuring any URL parsing or connection creation logic that checks RedisPlugin.urlSchemes will accept rediss:// connection strings for TLS connections.Plugins/TableProPluginKit/EditorLanguage.swift (1)
26-31: Asymmetric encoding for unknown type strings.When decoding an unknown type like
{"type": "graphql"}, it maps to.custom("graphql"). However, re-encoding produces{"type": "custom", "value": "graphql"}, not the original structure. This means:
decode → encodedoesn't preserve the original JSON for unknown typesdecode → encode → decodestill yields the same.custom("graphql")valueIf this asymmetry is intentional (treating unknown types as equivalent to explicit custom), consider adding a brief comment explaining this design choice. Otherwise, to preserve the original JSON structure, store the original type string separately.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Plugins/TableProPluginKit/EditorLanguage.swift` around lines 26 - 31, The Decoder/Encoder for EditorLanguage is asymmetric: decoding an unknown "type" like "graphql" becomes .custom("graphql") but encoding emits {"type":"custom","value":"graphql"} instead of preserving {"type":"graphql"}; to fix, either (A) document this intentional equivalence with a brief comment on the EditorLanguage enum and its init(from:) / encode(to:) implementation, or (B) preserve the original type string by adding storage for the raw type (e.g., add a backing property or extend the .custom case to hold the originalRawType), update init(from:) to save the incoming type string when it’s unknown, and update encode(to:) to emit the original type string (writing "type": original) when present; refer to the EditorLanguage enum, its init(from:) decoder branch that handles case "custom" and the encode(to:) method to implement the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Plugins/RedisDriverPlugin/RedisPlugin.swift`:
- Line 30: Update the RedisPlugin.swift URL scheme list to include the TLS
scheme so secure Redis URLs are recognized: modify the static constant
urlSchemes (currently defined as static let urlSchemes: [String] = ["redis"]) to
also contain "rediss", ensuring any URL parsing or connection creation logic
that checks RedisPlugin.urlSchemes will accept rediss:// connection strings for
TLS connections.
In `@Plugins/SQLiteDriverPlugin/SQLitePlugin.swift`:
- Line 27: Update the static fileExtensions array in SQLitePlugin (static let
fileExtensions) to include the additional documented extensions so it matches
the CHANGELOG: add "db3", "s3db", "sl3", and "sqlitedb" (in addition to the
existing "db", "sqlite", "sqlite3") so the plugin recognizes all supported
SQLite file types.
In `@Plugins/TableProPluginKit/EditorLanguage.swift`:
- Around line 26-31: The Decoder/Encoder for EditorLanguage is asymmetric:
decoding an unknown "type" like "graphql" becomes .custom("graphql") but
encoding emits {"type":"custom","value":"graphql"} instead of preserving
{"type":"graphql"}; to fix, either (A) document this intentional equivalence
with a brief comment on the EditorLanguage enum and its init(from:) /
encode(to:) implementation, or (B) preserve the original type string by adding
storage for the raw type (e.g., add a backing property or extend the .custom
case to hold the originalRawType), update init(from:) to save the incoming type
string when it’s unknown, and update encode(to:) to emit the original type
string (writing "type": original) when present; refer to the EditorLanguage
enum, its init(from:) decoder branch that handles case "custom" and the
encode(to:) method to implement the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 166bbd96-1f69-4ef5-827b-2ab3bc0c030d
📒 Files selected for processing (15)
CHANGELOG.mdPlugins/ClickHouseDriverPlugin/ClickHousePlugin.swiftPlugins/DuckDBDriverPlugin/DuckDBPlugin.swiftPlugins/MSSQLDriverPlugin/MSSQLPlugin.swiftPlugins/MongoDBDriverPlugin/MongoDBPlugin.swiftPlugins/MySQLDriverPlugin/MySQLPlugin.swiftPlugins/OracleDriverPlugin/OraclePlugin.swiftPlugins/PostgreSQLDriverPlugin/PostgreSQLPlugin.swiftPlugins/RedisDriverPlugin/RedisPlugin.swiftPlugins/SQLiteDriverPlugin/SQLitePlugin.swiftPlugins/TableProPluginKit/ConnectionMode.swiftPlugins/TableProPluginKit/DriverPlugin.swiftPlugins/TableProPluginKit/EditorLanguage.swiftPlugins/TableProPluginKit/GroupingStrategy.swiftTableProTests/Core/Plugins/DriverPluginMetadataTests.swift
Summary
DriverPluginprotocol (brand color, connection mode, URL schemes, file extensions, supported features, column types, grouping strategy, etc.) with sensible defaults in a protocol extensionTableProPluginKit:ConnectionMode,EditorLanguage(with manualCodablefor.custom(String)),GroupingStrategycolumnTypesByCategory)This is Phase 1.1 of the plugin extensibility plan. No app-side consumers are wired up — only declarations and defaults. Consuming code switches over in Phase 5.
Test plan
xcodebuild -scheme TablePro build -skipPackagePluginValidationSummary by CodeRabbit
New Features
Tests