Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(agent): accept legacy H2 offline packages

zipg2bb85dcdc929
diff --git a/crates/dbx-core/src/agent_catalog.rs b/crates/dbx-core/src/agent_catalog.rs
index afff3ee7e7..86b2acf108 100644
--- a/crates/dbx-core/src/agent_catalog.rs
+++ b/crates/dbx-core/src/agent_catalog.rs
@@ -46,6 +46,7 @@ const H2_PROFILES: &[AgentDriverProfile] = &[
const EXTRA_AGENT_LABELS: &[(&str, &str)] = &[
("duckdb", "DuckDB"),
+ ("h2-legacy", "H2 2.1 Legacy"),
("kafka", "Apache Kafka"),
("rocketmq", "Apache RocketMQ"),
("rabbitmq", "RabbitMQ"),
@@ -432,6 +433,7 @@ mod tests {
assert_eq!(agent_key(&DatabaseType::H2, Some("h2-v2")), Some("h2"));
assert_eq!(agent_key(&DatabaseType::H2, Some("h2-v3")), Some("h2"));
assert_eq!(agent_key(&DatabaseType::H2, Some("h2-custom")), Some("h2"));
+ assert_eq!(label_for_key("h2-legacy"), Some("H2 2.1 Legacy"));
assert!(!driver_store_entries().any(|(key, _)| key == "h2-legacy"));
}
diff --git a/crates/dbx-core/tests/agent_service.rs b/crates/dbx-core/tests/agent_service.rs
index c20673e34d..470e2cc832 100644
--- a/crates/dbx-core/tests/agent_service.rs
+++ b/crates/dbx-core/tests/agent_service.rs
@@ -814,6 +814,20 @@ fn offline_zip_import_rejects_unknown_driver_type() {
assert!(err.contains("unknown driver type"));
}
+#[tokio::test]
+async fn offline_zip_import_accepts_hidden_legacy_h2_driver() {
+ let manager = test_manager("offline-h2-legacy-driver");
+ let zip_path = test_path("offline-h2-legacy-driver").join("agents.zip");
+ std::fs::create_dir_all(zip_path.parent().unwrap()).unwrap();
+ write_offline_driver_zip_with_jar(&zip_path, "h2-legacy", "0.1.18", test_agent_jar_bytes());
+
+ let result = import_agents_from_zip(&manager, &zip_path, |_| {}).await.unwrap();
+
+ assert_eq!(result.drivers_installed, vec!["h2-legacy"]);
+ assert!(manager.is_driver_installed("h2-legacy"));
+ assert_eq!(manager.load_state().installed_drivers["h2-legacy"].version, "0.1.18");
+}
+
#[test]
fn offline_zip_import_rejects_unsafe_entry_path() {
let zip_path = test_path("offline-unsafe-entry").join("agents.zip");