Skip to content

feat: extend DriverPlugin with UI/capability metadata#274

Merged
datlechin merged 2 commits intomainfrom
feat/plugin-ui-capability-metadata
Mar 11, 2026
Merged

feat: extend DriverPlugin with UI/capability metadata#274
datlechin merged 2 commits intomainfrom
feat/plugin-ui-capability-metadata

Conversation

@datlechin
Copy link
Owner

@datlechin datlechin commented Mar 11, 2026

Summary

  • Add 20 static property requirements to the DriverPlugin protocol (brand color, connection mode, URL schemes, file extensions, supported features, column types, grouping strategy, etc.) with sensible defaults in a protocol extension
  • Create 3 new enums in TableProPluginKit: ConnectionMode, EditorLanguage (with manual Codable for .custom(String)), GroupingStrategy
  • Update all 9 driver plugins (MySQL, PostgreSQL, SQLite, ClickHouse, MSSQL, MongoDB, Redis, Oracle, DuckDB) with their specific non-default values
  • Add 28 unit tests covering enum behavior, protocol defaults, custom override mechanics, and edge cases (empty arrays in columnTypesByCategory)

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

  • Build succeeds: xcodebuild -scheme TablePro build -skipPackagePluginValidation
  • Lint passes with no new violations
  • 28/28 unit tests pass (ConnectionMode, EditorLanguage, GroupingStrategy, protocol defaults, custom overrides)
  • All existing plugins compile without changes (defaults satisfy the protocol)

Summary by CodeRabbit

  • New Features

    • Driver plugins now expose standardized UI/capability metadata (brand colors, connection modes, URL schemes, feature flags, query/editor language, grouping strategy, categorized column types).
    • Core plugin API extended with defaults so drivers inherit consistent metadata.
  • Tests

    • New test suite verifying metadata defaults, overrides, and Codable/enum behavior for the plugin metadata types.

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.
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 768b5b43-691e-47c1-be77-afef4b1322e0

📥 Commits

Reviewing files that changed from the base of the PR and between e5d5ead and c713761.

📒 Files selected for processing (1)
  • Plugins/MongoDBDriverPlugin/MongoDBPlugin.swift

📝 Walkthrough

Walkthrough

Extends 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

Cohort / File(s) Summary
Plugin Kit Framework
Plugins/TableProPluginKit/DriverPlugin.swift, Plugins/TableProPluginKit/ConnectionMode.swift, Plugins/TableProPluginKit/EditorLanguage.swift, Plugins/TableProPluginKit/GroupingStrategy.swift
Adds new enums ConnectionMode, EditorLanguage, GroupingStrategy; extends DriverPlugin with ~20 new static metadata properties and provides default implementations (branding, capabilities, column type categories, etc.).
Driver Plugin Implementations
Plugins/.../ClickHousePlugin.swift, Plugins/.../DuckDBPlugin.swift, Plugins/.../MSSQLPlugin.swift, Plugins/.../MongoDBPlugin.swift, Plugins/.../MySQLPlugin.swift, Plugins/.../OraclePlugin.swift, Plugins/.../PostgreSQLPlugin.swift, Plugins/.../RedisPlugin.swift, Plugins/.../SQLitePlugin.swift
Adds database-specific static metadata fields to each plugin (brandColorHex, urlSchemes, connectionMode, fileExtensions, system databases, grouping strategy, columnTypesByCategory, capability flags). Changes are additive, no runtime control-flow modifications.
Tests
TableProTests/Core/Plugins/DriverPluginMetadataTests.swift
Introduces comprehensive tests (mock plugins + suites) validating defaults, overrides, and Codable round-trips for new enums and metadata properties.
Changelog
CHANGELOG.md
Documents addition of DriverPlugin metadata API extension.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 Hopping through code with metadata cheer,

Brand colors, schemes, and types appear,
Plugins now tell what they can do,
Defaults in place, and tests held true,
A rabbit's grin — the plugins are clear!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: extending DriverPlugin protocol with UI and capability metadata properties. It is clear, concise, and directly reflects the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/plugin-ui-capability-metadata

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 .sqlitedb files. 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 to https vs http). 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 → encode doesn't preserve the original JSON for unknown types
  • decode → encode → decode still yields the same .custom("graphql") value

If 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5372d66 and e5d5ead.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • Plugins/ClickHouseDriverPlugin/ClickHousePlugin.swift
  • Plugins/DuckDBDriverPlugin/DuckDBPlugin.swift
  • Plugins/MSSQLDriverPlugin/MSSQLPlugin.swift
  • Plugins/MongoDBDriverPlugin/MongoDBPlugin.swift
  • Plugins/MySQLDriverPlugin/MySQLPlugin.swift
  • Plugins/OracleDriverPlugin/OraclePlugin.swift
  • Plugins/PostgreSQLDriverPlugin/PostgreSQLPlugin.swift
  • Plugins/RedisDriverPlugin/RedisPlugin.swift
  • Plugins/SQLiteDriverPlugin/SQLitePlugin.swift
  • Plugins/TableProPluginKit/ConnectionMode.swift
  • Plugins/TableProPluginKit/DriverPlugin.swift
  • Plugins/TableProPluginKit/EditorLanguage.swift
  • Plugins/TableProPluginKit/GroupingStrategy.swift
  • TableProTests/Core/Plugins/DriverPluginMetadataTests.swift

@datlechin datlechin merged commit 7366712 into main Mar 11, 2026
2 of 3 checks passed
@datlechin datlechin deleted the feat/plugin-ui-capability-metadata branch March 11, 2026 10:19
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