From e6c7baa2d955326f94640e336b394f17e6a52afa Mon Sep 17 00:00:00 2001 From: Elias <45232878+mapan0424@users.noreply.github.com> Date: Thu, 1 Oct 2026 15:22:04 +0800 Subject: [PATCH] fix(xugu): align capability flags with implemented features --- .../database/databaseDriverManifest.spec.ts | 27 ++++++++++++++++++- .../database/databaseUserAdmin.spec.ts | 9 +++++++ .../assets/database-drivers.manifest.json | 6 ++--- plugins/connection-types/xugu.yaml | 6 ++--- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts index 9b7ab7a11e..006d584ebf 100644 --- a/apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/databaseDriverManifest.spec.ts @@ -1,7 +1,32 @@ import { describe, expect, it } from "vitest"; -import { databaseConnectionFormKind, databaseDefaultPort, databaseManifestEntry, databaseRuntimeMode, usesAgentCursorForQuery, usesAgentCursorForTableData } from "@/lib/database/databaseDriverManifest"; +import { databaseConnectionFormKind, databaseDefaultPort, databaseManifestEntry, databaseProductCapabilities, databaseRuntimeMode, supportsDatabaseFeature, usesAgentCursorForQuery, usesAgentCursorForTableData } from "@/lib/database/databaseDriverManifest"; describe("databaseDriverManifest", () => { + it("advertises implemented Xugu capabilities without enabling unsupported features", () => { + expect(databaseProductCapabilities("xugu")).toEqual({ + queryExecution: true, + metadataBrowse: true, + objectBrowser: true, + objectSource: true, + schemaSearch: true, + diagram: true, + tableDataEdit: true, + tableStructureEdit: true, + tableImport: true, + dataTransfer: false, + sqlFileExecution: true, + databaseCreate: false, + fieldLineage: false, + sqlExplain: false, + userAdmin: true, + driverManagement: true, + }); + for (const capability of ["objectSource", "tableDataEdit", "userAdmin"] as const) { + expect(supportsDatabaseFeature("xugu", capability), capability).toBe(true); + } + expect(supportsDatabaseFeature("xugu", "sqlExplain")).toBe(false); + }); + it("uses agent cursor only for agent or external runtimes", () => { expect(databaseRuntimeMode("gaussdb")).toBe("native"); expect(databaseRuntimeMode("meilisearch")).toBe("native"); diff --git a/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts index d3ca54121e..f6aacfe0ad 100644 --- a/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts +++ b/apps/desktop/src/lib/__tests__/database/databaseUserAdmin.spec.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from "vitest"; +import { supportsDatabaseFeature } from "@/lib/database/databaseDriverManifest"; import { dorisGrantPrivilegesSql, dorisGrantsResult, @@ -15,6 +16,7 @@ import { postgresUserAdminProvider, resolveDatabaseUserAdminProviderForConnection, starrocksTableGrantsResult, + supportsDatabaseUserAdmin, } from "@/lib/database/databaseUserAdmin"; import type { ConnectionConfig, QueryResult } from "@/types/database"; @@ -84,6 +86,13 @@ describe("MySQL grant privilege selection", () => { }); describe("database user admin providers", () => { + it("keeps Xugu on its dedicated permission surface despite the product capability", () => { + expect(supportsDatabaseFeature("xugu", "userAdmin")).toBe(true); + expect(supportsDatabaseUserAdmin("xugu")).toBe(false); + expect(getDatabaseUserAdminProvider("xugu")).toBeNull(); + expect(resolveDatabaseUserAdminProviderForConnection(connection("xugu"))).toBeNull(); + }); + it("opts only native MySQL connections into account Host changes", () => { const legacyNative = resolveDatabaseUserAdminProviderForConnection(connection("mysql")); const blankLegacyNative = resolveDatabaseUserAdminProviderForConnection(connection("mysql", " ")); diff --git a/crates/dbx-core/assets/database-drivers.manifest.json b/crates/dbx-core/assets/database-drivers.manifest.json index a4556e7c20..0e6dbb7151 100644 --- a/crates/dbx-core/assets/database-drivers.manifest.json +++ b/crates/dbx-core/assets/database-drivers.manifest.json @@ -2496,10 +2496,10 @@ "queryExecution": true, "metadataBrowse": true, "objectBrowser": true, - "objectSource": false, + "objectSource": true, "schemaSearch": true, "diagram": true, - "tableDataEdit": false, + "tableDataEdit": true, "tableStructureEdit": true, "tableImport": true, "dataTransfer": false, @@ -2507,7 +2507,7 @@ "databaseCreate": false, "fieldLineage": false, "sqlExplain": false, - "userAdmin": false, + "userAdmin": true, "driverManagement": true } }, diff --git a/plugins/connection-types/xugu.yaml b/plugins/connection-types/xugu.yaml index 2be6259bc6..18dedabebc 100644 --- a/plugins/connection-types/xugu.yaml +++ b/plugins/connection-types/xugu.yaml @@ -21,10 +21,10 @@ capabilities: queryExecution: true metadataBrowse: true objectBrowser: true - objectSource: false + objectSource: true schemaSearch: true diagram: true - tableDataEdit: false + tableDataEdit: true tableStructureEdit: true tableImport: true dataTransfer: false @@ -32,5 +32,5 @@ capabilities: databaseCreate: false fieldLineage: false sqlExplain: false - userAdmin: false + userAdmin: true driverManagement: true