fix(sqlserver): attribute login and catalog errors, keep sidebar search read-only

This commit is contained in:
zipg authored and GitHub committed 2026-09-23 15:42:02 +08:00
1 parent 33eb12d9f8
commit 491565fdda
16 files changed
+542 -35

No files matched your search

@@ -12,7 +12,7 @@ describe("ConnectionTree global search loading", () => {
// a searchable group instead of an empty child list.
expect(source).toMatch(/isSidebarSearchContainer\(node\) && needsSidebarObjectGroupDiscovery\(node, searchableObjectGroupTypes\)/);
expect(source).not.toMatch(/isSidebarSearchContainer\(node\) && !node\.children\?\.length/);
expect(source).toContain("store.loadTreeNodeChildren(node, { force: true, expectedSidebarSearchQuery: store.sidebarSearchQuery })");
expect(source).toContain("store.loadTreeNodeChildren(node, { force: true, expectedSidebarSearchQuery: store.sidebarSearchQuery, sidebarSearch: true })");
expect(source).toContain("searchExpansionState.markFiltered(node.id, wasCollapsed)");
expect(source).toMatch(/if \(refreshedNodeIds && node\.children\) \{[\s\S]*?searchableObjectGroupTypes\.has\(child\.type\)/);
});
@@ -29,7 +29,20 @@ describe("ConnectionTree global search loading", () => {
// Clearing a remote search must put back the pages the user had loaded
// through "load more"; only an uncaptured group falls back to a reload.
expect(source).toContain("} else if (!store.restoreFilteredObjectGroupChildren(node)) {");
expect(source).toMatch(/restoreFilteredObjectGroupChildren\(node\)\) \{[\s\S]*?tasks\.push\(\(\) => store\.loadObjectGroupChildren\(node, \{ force: true \}\)\);/);
expect(source).toMatch(/restoreFilteredObjectGroupChildren\(node\)\) \{[\s\S]*?tasks\.push\(\(\) => store\.loadObjectGroupChildren\(node, \{ force: true, sidebarSearch: true \}\)\);/);
});
it("never lets the global search connect a connection on the user's behalf", () => {
// Searching the sidebar is a background projection. Reconnecting here is what
// surfaced a raw SQL Server TLS/login error for a connection whose saved
// database no longer exists, so only already-connected connections may be
// refreshed and every search-driven load is tagged for the store.
expect(source).toContain("const connectionIsConnected = store.connectedIds.has(node.connectionId);");
expect(source).toMatch(/if \(!connectionIsConnected \|\| node\.connectionId !== store\.activeConnectionId\) return;/);
// Search-driven loads are tagged so the store degrades a failed reconnect to a
// one-line skip hint instead of the raw driver error (see the store spec).
expect(source.match(/sidebarSearch: true/g)?.length ?? 0).toBeGreaterThanOrEqual(7);
expect(source).not.toMatch(/tasks\.push\(\(\) => store\.connect\(/);
});
it("limits concurrent metadata loads without dropping a task", async () => {