Skip to content

feat(connections): opaque plugin-specific extra fields for ConnectionParams - #596

Merged
debba merged 2 commits into
TabularisDB:mainfrom
fuleinist:feat/connection-extra-fields
Aug 4, 2026
Merged

feat(connections): opaque plugin-specific extra fields for ConnectionParams#596
debba merged 2 commits into
TabularisDB:mainfrom
fuleinist:feat/connection-extra-fields

Conversation

@fuleinist

Copy link
Copy Markdown
Contributor

Follow-up to the remaining core-side work from #593 (comment) — generic support for plugin-owned connection fields, not just DynamoDB.

What

  • extra: HashMap<String, String> on core ConnectionParams (Rust) + extra?: Record<string, string> (TS). Opaque to the host: persisted verbatim through save_connection/update_connection, forwarded to driver plugins as part of params, omitted from persisted JSON when empty (serde(default, skip_serializing_if) — legacy JSON deserializes to an empty map).
  • New plugin slot connection-modal.extra_fields, rendered below the host/port section of the connection form. Context exposes driver, the current extra map, and setExtraField(key, value) so a plugin UI can edit its own fields (empty value clears the key).
  • updateExtraField pure helper in src/utils/connections.ts with 8 unit tests (set / merge / immutability / clear-on-empty / blank-key / trim).
  • Host API version 0.1.0 → 0.2.0 (HOST_API_VERSION, plugin-api API_VERSION + package.json) — the slot map is observable to plugin bundles.
  • PLUGIN_GUIDE.md slot table updated.

Verification

  • vitest: PASS (3490) FAIL (0) (incl. new helper tests)
  • tsc --noEmit: clean
  • eslint on all touched files: 0 errors
  • cargo clippy --all-targets: clean, no new warnings in touched files
  • plugin-api check:sync: OK
  • rustfmt on touched files: no new diffs vs upstream style

Note on local Rust test execution: on this Windows box the compiled test binary fails at load with STATUS_ENTRYPOINT_NOT_FOUND from an old system comctl32.dll missing TaskDialogIndirect — reproduced identically on pristine upstream code, so it's a local-environment issue unrelated to this change; CI (Linux) runs the full Rust suite.

Companion PR

DynamoDB plugin side (consumes extra["region"]): TabularisDB/tabularis-dynamodb-plugin#59

…Params

Adds a generic mechanism for plugins to carry custom connection
settings (e.g. an AWS region for DynamoDB) without core schema changes.

- ConnectionParams gains `extra: HashMap<String, String>` (Rust) and
  `extra?: Record<string, string>` (TS). Opaque to the host: persisted
  verbatim, forwarded to driver plugins, absent from JSON when empty.
- New plugin slot `connection-modal.extra_fields` rendered below the
  host/port section; context exposes `driver`, `extra`, and
  `setExtraField(key, value)` so plugin UI can edit the map.
- Pure `updateExtraField` helper in src/utils/connections.ts with
  unit tests (8 cases: set, merge, immutability, clear-on-empty,
  blank-key handling).
- Host API version 0.1.0 -> 0.2.0 (HOST_API_VERSION, plugin-api
  API_VERSION + package.json) since the slot map is observable to
  plugin bundles.
- PLUGIN_GUIDE slot table documents the new slot.

Follow-up to TabularisDB/tabularis-dynamodb-plugin#59.
Comment thread packages/plugin-api/package.json Outdated
Comment thread packages/plugin-api/src/version.ts Outdated
Comment thread src/contexts/PluginSlotProvider.tsx Outdated
Co-authored-by: Chris Chen <1163738+fuleinist@users.noreply.github.com>

@debba debba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed and tested this locally on Linux.

Full run on the branch: vitest 3490 passed across 194 files, cargo test --lib 1089 passed / 0 failed / 4 ignored, tsc --noEmit clean, eslint clean on the touched files, and clippy quiet in models.rs and plugins/driver.rs. So the Rust suite you couldn't run on that Windows box is green here, nothing to worry about on that front.

I checked the plumbing instead of just reading the diff. params_for_persistence clones the map so it survives save and update, duplicate_connection keeps it, every plugin RPC ships the whole params struct so drivers get extra on each call, and the edit path spreads the stored params back into the form, so opening and re-saving a connection doesn't quietly drop plugin fields. Legacy connections.json files still load fine and stay byte identical while the map is empty.

To exercise the new slot for real I wrote a small stub UI extension against connection-modal.extra_fields and drove it on a live MySQL connection: prefill from extra, per key edits, clear on empty, and the key disappearing from the persisted JSON once the last entry is gone all behave exactly as documented.

Clean, self contained design. Keeping driver specifics out of the core schema is the right call. Thanks!

@debba
debba merged commit 27226c5 into TabularisDB:main Aug 4, 2026
2 checks passed
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.

2 participants