refactor(workspace): split SQL and database driver crates

This commit is contained in:
t8y2 committed 2026-09-25 15:51:58 +08:00
1 parent b99c60aff6
commit e0da2d09d3
180 files changed
+1422 -538

No files matched your search

@@ -1003,7 +1003,7 @@ describe("RedisKeyBrowser continuation ownership (issue #7779)", () => {
// `iterations` (aka `max_iterations`) is the 6th positional arg the frontend
// sends to `redisScanKeysBatch` — the same unit the backend spends as real
// Redis SCAN calls (see `crates/dbx-drivers/src/db/redis_driver.rs`).
// Redis SCAN calls (see `crates/dbx-driver-redis/src/lib.rs`).
function totalIterationsRequested(): number {
return mocks.redisScanKeysBatch.mock.calls.reduce((sum: number, call: unknown[]) => sum + (call[5] as number), 0);
}
@@ -220,7 +220,7 @@ describe("useSidebarTableMutationRuntime SAP HANA schema-scoped actions", () =>
it("classifies a JDBC-agent-routed timeout (SAP HANA/Oracle/DB2/SQL Server) as timed-out, not failed, even though its message has no timeout wording", async () => {
const { feature } = runtime("");
// AgentCallError::Timeout carries no `detail` (crates/dbx-drivers/src/backend_error.rs),
// AgentCallError::Timeout carries no `detail` (crates/dbx-driver-agent/src/backend_error.rs),
// so BackendErrorException.message degrades to a generic fallback with no
// "timed out" text — only the structured backendError distinguishes it.
const agentTimeoutError = {
@@ -2,7 +2,7 @@
* Issue #6189 — SQL Server "focus jumps to the message result".
*
* Background:
* - `crates/dbx-drivers/src/db/sqlserver.rs:523-542` synthesizes a pseudo result with a
* - `crates/dbx-driver-sqlserver/src/sqlserver.rs` synthesizes a pseudo result with a
* single "Message" column and `server_message: true` for any batch segment that
* produced only server messages (PRINT / "DBCC execution completed" / ...).
* - `stores/queryStore.ts:4727` then picks the first result that HAS COLUMNS as the
+4 -4
View File
@@ -48,7 +48,7 @@ const STRUCTURED_BACKEND_ERROR_KEYS = [
"backendErrors.unknown",
] as const;
// Reproduces the exact string crates/dbx-drivers/src/agent_service.rs builds on
// Reproduces the exact string crates/dbx-driver-agent/src/agent_service.rs builds on
// Windows: `\` line continuations strip the newline plus the following indent.
const WINDOWS_JRE_REMOVE_ERROR = [
"Failed to remove the old JRE directory: C:\\dbx\\jre21",
@@ -644,9 +644,9 @@ describe("backend error wording is pinned to the Rust sources", () => {
["crates/dbx-core/src/data/mongodb_import_export.rs", "MongoDB Legacy Agent does not support insertMany; upgrade or reinstall the MongoDB Legacy driver"],
["crates/dbx-core/src/data/mongodb_import_export.rs", "MongoDB Legacy Agent returned an invalid find cursor"],
["crates/dbx-core/src/query/mongo_ops.rs", "MongoDB Legacy Agent rejected "],
["crates/dbx-drivers/src/agent_service.rs", "Failed to remove the old JRE directory: "],
["crates/dbx-drivers/src/agent_service.rs", "is in use by drivers: "],
["crates/dbx-drivers/src/agent_service.rs", "agent-registry.json not found in the ZIP; not a valid offline driver package."],
["crates/dbx-driver-agent/src/agent_service.rs", "Failed to remove the old JRE directory: "],
["crates/dbx-driver-agent/src/agent_service.rs", "is in use by drivers: "],
["crates/dbx-driver-agent/src/agent_service.rs", "agent-registry.json not found in the ZIP; not a valid offline driver package."],
["crates/dbx-core/src/admin/mq/adapters/kafka.rs", "Kafka does not support unloading topics"],
["crates/dbx-plugin-runtime/src/plugins/installer.rs", "Plugin update source change requires confirmation:"],
["crates/dbx-plugin-runtime/src/plugins/installer.rs", "Plugin downgrade to version "],
+1 -1
View File
@@ -149,7 +149,7 @@ const patterns: [RegExp, string][] = [
// Legacy bundled DuckDB error kept for compatibility with older backends.
[/^The previous DuckDB query is still stopping\. Please try again shortly\.$/, "editor.duckdbDraining"],
// Driver / JRE management (crates/dbx-drivers/src/agent_service.rs, routes/agents.rs)
// Driver / JRE management (crates/dbx-driver-agent/src/agent_service.rs, routes/agents.rs)
// The Windows variant is multi-line, so it must be tried before the single-line one.
[/^Failed to remove the old JRE directory: (.+)\nPossible causes:[\s\S]*\(original error: ([\s\S]+)\)$/, "driverStore.jreDirRemoveFailedWindows"],
[/^Failed to remove the old JRE directory: (.+) \(original error: ([\s\S]+)\)$/, "driverStore.jreDirRemoveFailed"],
+1 -1
View File
@@ -7,7 +7,7 @@
- `app`, `tabs`, `sidebar`, `connection`: shell, navigation, and connection UI state helpers.
- `database`, `metadata`, `schema`, `table`: relational database metadata, capabilities, DDL, and table-object helpers.
- `sql`, `sql/semantic`, `editor`, `query`, `history`, `savedSql`: SQL editing, execution, diagnostics, history, and saved SQL behavior.
Keep fixed SQL completion statements and their database-specific variants in `sql/sqlSnippetTemplates.ts`; cross-check row-limiting families against `crates/dbx-sql/src/sql_dialect/capabilities.rs` and authoritative dialect documentation, and never replace a user-customized built-in body with a generated default.
Keep fixed SQL completion statements and their database-specific variants in `sql/sqlSnippetTemplates.ts`; cross-check row-limiting families against `crates/dbx-sql-dialect/src/sql_dialect/capabilities.rs` and authoritative dialect documentation, and never replace a user-customized built-in body with a generated default.
- `dataGrid`: result/grid rendering, editing, previews, pagination, and export helpers tied to the grid.
- `ai`, `mcp`: AI assistant and MCP configuration helpers.
- `redis`, `mongo`, `elasticsearch`, `etcd`, `kv`, `mq`, `nacos`, `zookeeper`, `webdav`: non-relational or service-specific helpers.
@@ -69,7 +69,7 @@ describe("databaseObjectCapabilities", () => {
it("exposes materialized views for StarRocks only", () => {
// StarRocks has a dedicated MV listing/classification path in
// crates/dbx-drivers/src/db/mysql.rs (`list_starrocks_tables` +
// crates/dbx-driver-mysql/src/mysql.rs (`list_starrocks_tables` +
// `classify_starrocks_materialized_views`).
expect(sidebarObjectKindsForDatabase("starrocks")).toContain("MATERIALIZED_VIEW");
@@ -2,7 +2,7 @@
* Read/write classification for Elasticsearch-compatible REST requests.
*
* Mirrors `classify_search_engine_query_risk` in
* `crates/dbx-sql/src/query_execution_sql.rs` so the desktop guards (read-only
* `crates/dbx-sql-core/src/query_execution_sql.rs` so the desktop guards (read-only
* unlock, production safety) agree with the backend read-only gate instead of
* treating every `GET`/`POST` request as an unrecognized — and therefore
* unsafe — statement.
@@ -1,4 +1,4 @@
// Mirrors dbx-core `redis_database_index()` (crates/dbx-drivers/src/db/redis_driver.rs):
// Mirrors dbx-core `redis_database_index()` (crates/dbx-driver-redis/src/lib.rs):
// a Redis database is a numeric index. Anything else (e.g. redis-cli flags like
// "0 --tls --insecure" pasted into the field or imported from a dirty URL) fails
// to parse on the backend and silently falls back to db 0, so every frontend
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* Read/write classification for Apache Solr REST requests.
*
* Mirrors `classify_solr_query_risk` in `crates/dbx-sql/src/query_execution_sql.rs`
* Mirrors `classify_solr_query_risk` in `crates/dbx-sql-core/src/query_execution_sql.rs`
* so the desktop guards (read-only unlock, production safety) agree with the
* backend read-only gate instead of treating every request as unrecognized.
*
+1 -1
View File
@@ -151,7 +151,7 @@ export function resolveNewQueryTable(input: ResolveNewQueryTableInput): NewQuery
*
* Time-series engines get the same rolling-window scoping the sidebar
* quick-open uses (see `default_time_series_predicate` in
* `crates/dbx-sql/src/sql_dialect/table_select.rs`). Without a `time`
* `crates/dbx-sql-dialect/src/sql_dialect/table_select.rs`). Without a `time`
* predicate InfluxDB scans every shard (v1/v2) or every Parquet file
* (v3), which turns "let me draft a query against this table" into a
* full-history scan the moment the user hits Run. VictoriaMetrics