refactor: architecture extensibility (P1–P6) - #10
Merged
Conversation
Introduces a registration pattern for database engine families. Each engine exports a zero-size EngineDescriptor implementor; the EngineRegistry global is populated at startup. Adding a new engine family no longer requires touching central dispatch — only a new register() call in main.rs and a new descriptor struct. Purely additive: no existing behavior changes. Co-authored-by: Cursor <cursoragent@cursor.com>
Each engine module now owns its panel-construction logic in tab_dispatch::build_panel(). The central dispatch_open_tab becomes a short delegating match with one arm per engine. Adding a new tab type for an existing engine only requires editing that engine's tab_dispatch.rs. Adding a new engine requires one match arm plus a new tab_dispatch.rs. Co-authored-by: Cursor <cursoragent@cursor.com>
Replaces flat, mixed-engine fields on TabSpec::QueryEditor with a typed QueryEditorInit enum (Sql | MongoPipeline). Engine-specific init data no longer pollutes the shared TabSpec type. Session migration: load_tabs_with_migration() falls back to per-item parsing so pre-P3 sessions lose only their QueryEditor tabs (not all tabs) when the format doesn't match. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduces AuthMethod enum (Password, SshTunnel, AwsIam, ClientCertificate, External) as a typed first-class auth abstraction. Includes has_tunnel(), inner_auth(), and label() helpers. Six unit tests cover default, SSH tunnel nesting, and serde round-trips. Migration path to wire into ConnectionConfig is documented in auth.rs. Purely additive — no existing code changed. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduces VariableScope, SchemaCache, and EditorContext types in apps/desktop/src/editor/. Each SQL editor panel (Postgres, SQLite) creates an EditorContext entity on construction. EditorContext is the attachment point for future LSP clients, variable autocomplete, schema-aware completion, and inline explain overlays — none of those features require touching panel internals once wired here. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduces TabScope enum (Connection | MultiConnection | Workspace | Global) for classifying tabs by their connection scope. Removes the HOME_CONN_SENTINEL sentinel hack — TabSpec::conn_id() now cleanly returns Option<&ConnectionId>. Workspace-scoped tabs (future: ER diagrams, agent chat, chart builder) and global tabs (Home, ReleaseNotes) are now first-class, not sentinel-based hacks. Co-authored-by: Cursor <cursoragent@cursor.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
based | d452dae | Commit Preview URL Branch Preview URL |
Jun 01 2026, 05:48 PM |
pavi2410
marked this pull request as ready for review
June 1, 2026 04:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six prioritised refactors that make Based structurally ready for the upcoming roadmap (new DB engines, auth methods, LSP support, ER diagrams, agent chat, CLI usage).
P1 — Engine Registration (
e47d50d)EngineDescriptortrait andEngineRegistryGPUI global (connection/descriptor.rs)PostgresEngine,SqliteEngine,MongoEngine)main.rsregisters them at startup — the only file to touch when adding a new engineP2 — Panel Factory Decoupling (
63e5261)tab_dispatch::build_panel(spec, ...) -> Option<Arc<dyn PanelView>>dispatch_open_tabshrinks from a 300-line match-of-matches to ~20 linestab_dispatch.rsP3 — Typed
QueryEditorInit(89c68f4)TabSpec::QueryEditornow carriesinit: QueryEditorInit(Sql { sql, auto_run }|MongoPipeline { pipeline, collection }) instead of flat optional fieldsTabSpectypeP4 —
AuthMethodinbased-core(3fd4b8b)crates/based-core/src/auth.rs:Password,SshTunnel { inner: Box<AuthMethod> },AwsIam,ClientCertificate,Externalhas_tunnel(),inner_auth(),label(), serde round-trips, and a migration path comment for moving per-engine auth fields hereP5 —
EditorContextservice (eebe5d5)apps/desktop/src/editor/module:VariableScope,SchemaCache(withcomplete(prefix)for autocomplete),EditorContextGPUI entityP6 —
TabScope+ cleanconn_id()(4173f92)TabSpec::scope() -> TabScopereturnsConnection,MultiConnection,Workspace, orGlobalconn_id()now returnsOption<&ConnectionId>— removes the__homesentinel hackTest plan
cargo check -p desktoppasses with no errorsmain.rscompiles with just aregistry.register(...)callAuthMethodserde round-trip tests pass (cargo test -p based-core)Made with Cursor