Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(truenas): retest saved connections canonically
rcourtman4524edc51eb2
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 1c793dc5d2..0a52d35a53 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -463,6 +463,10 @@ and `useTrueNASSettingsPanelState.ts` must surface the shared runtime health,poll cadence, discovered contribution summary, and canonical infrastructure /workloads / storage / recovery handoffs coming from `/api/truenas/connections`instead of falling back to panel-local inference or agent-first setup guidance.+Saved connection retests from that workspace must use the server-owned+`POST /api/truenas/connections/{id}/test` path so operators can verify stored+credentials without leaking masked-secret placeholders back into the draft+connection form contract.When that same platform workspace reports TrueNAS as unavailable, the disabledstate must mean the server has explicitly opted out of the default-on TrueNASintegration, not that operators still need to enable a hidden feature gate fordiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex eb7d37b06b..378383f9aa 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -627,6 +627,11 @@ must stay the canonical API-backed platform boundary for listing, creating,updating, deleting, and testing TrueNAS integrations, and `PUT` updates mustpreserve masked secrets (`********`) instead of clearing stored API keys orpasswords when operators edit non-secret fields from the settings surface.+Draft validation must stay on `POST /api/truenas/connections/test`, while+re-testing one saved connection must route through+`POST /api/truenas/connections/{id}/test` so the server reuses stored secret+material instead of forcing the frontend to round-trip redaction placeholders+back through the draft-test API.That same `/api/truenas/connections` list boundary now also owns theoperator-facing runtime summary for those configured connections. The listresponse must carry the canonical redacted config together with poll healthdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 8bec0fe2f7..95ac3c7bea 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -84,7 +84,7 @@ querying, and the operator-facing storage health presentation layer.18. Preserve the dedicated backend-owned `relay:mobile:access` capability and its governed backward-compatible route inventory plus the shared helper call sites around it, so storage- and recovery-adjacent transport surfaces do not treat the mobile relay credential as a general AI scope bundle.19. Preserve shipped local security-doc guidance in shared `internal/api/` config/setup helpers so storage- and recovery-adjacent transport surfaces do not reintroduce GitHub `main` security links when the running build already serves its own local security documentation route.20. Keep shared `internal/api/` Patrol transport and alert-trigger edits feature-isolated: Patrol-specific recency fields, callback fan-out, or alert-bridge wiring changes must not leak into recovery queries, storage links, or recovery-adjacent install/setup flows unless this contract changes in the same slice.-21. Keep provider-backed recovery onboarding on the adjacent platform-connections contract. When `internal/api/` grows or changes TrueNAS connection CRUD, masked-secret preservation, or similar provider setup flows, storage and recovery may consume the resulting recovery points but must not absorb that connection-management ownership into storage/recovery-local handlers or page flows.+21. Keep provider-backed recovery onboarding on the adjacent platform-connections contract. When `internal/api/` grows or changes TrueNAS connection CRUD, masked-secret preservation, saved-connection retest routes, or similar provider setup flows, storage and recovery may consume the resulting recovery points but must not absorb that connection-management ownership into storage/recovery-local handlers or page flows.22. Keep backend-native platform actions on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app control for Assistant, storage and recovery may consume the refreshed recovery points afterward, but they must not grow a parallel recovery-local action transport or action-specific payload shape.23. Keep backend-native platform diagnostics on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app log reads for Assistant, storage and recovery may use those diagnostics during investigation, but they must not grow a parallel recovery-local log transport or diagnostic payload shape.24. Keep backend-native platform configuration reads on the adjacent AI/runtime and platform contracts. When `internal/api/` wires native TrueNAS app config for Assistant, storage and recovery may use that runtime shape during investigation, but they must not grow a parallel recovery-local config transport or provider-shaped configuration payload.@@ -1565,8 +1565,12 @@ payload.That same adjacent `internal/api/` boundary also owns provider-backed recoveryonboarding. Storage and recovery may consume resulting TrueNAS snapshots andreplication points, but connection CRUD, masked-secret preservation on update,-and platform polling setup must stay on the adjacent platform-connections-contract instead of being rebuilt as storage/recovery-local connection flows.+saved-connection retest paths, and platform polling setup must stay on the+adjacent platform-connections contract instead of being rebuilt as+storage/recovery-local connection flows. In particular, re-testing one saved+TrueNAS recovery source must stay on the server-owned stored-config path rather+than forcing storage or recovery surfaces to round-trip redacted secrets back+through the draft connection payload contract.That same provider-backed boundary also owns connection poll cadence, last-synchealth, failure summaries, and discovered platform-contribution counts exposedin the TrueNAS settings workspace. Storage and recovery may consume thediff --git a/frontend-modern/src/api/__tests__/truenas.test.ts b/frontend-modern/src/api/__tests__/truenas.test.tsindex 5ad8984241..1a135eecf8 100644--- a/frontend-modern/src/api/__tests__/truenas.test.ts+++ b/frontend-modern/src/api/__tests__/truenas.test.ts@@ -96,6 +96,7 @@ describe('TrueNASAPI', () => {enabled: false,}).mockResolvedValueOnce({ success: true, id: 'conn-1' })+ .mockResolvedValueOnce({ success: true }).mockResolvedValueOnce({ success: true });await TrueNASAPI.createConnection({@@ -120,6 +121,7 @@ describe('TrueNASAPI', () => {apiKey: 'secret',}),).resolves.toEqual({ success: true });+ await expect(TrueNASAPI.testSavedConnection('conn/1')).resolves.toEqual({ success: true });expect(apiFetchJSON).toHaveBeenNthCalledWith(1,@@ -163,6 +165,13 @@ describe('TrueNASAPI', () => {body: JSON.stringify({ host: 'truenas.local', apiKey: 'secret' }),}),);+ expect(apiFetchJSON).toHaveBeenNthCalledWith(+ 5,+ '/api/truenas/connections/conn%2F1/test',+ expect.objectContaining({+ method: 'POST',+ }),+ );});it('recognizes the masked-secret placeholder used for update preservation', () => {diff --git a/frontend-modern/src/api/truenas.ts b/frontend-modern/src/api/truenas.tsindex 315ef0f092..34ec915b3a 100644--- a/frontend-modern/src/api/truenas.ts+++ b/frontend-modern/src/api/truenas.ts@@ -204,4 +204,16 @@ export class TrueNASAPI {success: strictBoolean(response.success),};}++ static async testSavedConnection(id: string): Promise<TrueNASConnectionTestResult> {+ const response = await apiFetchJSON<Partial<TrueNASConnectionTestResult>>(+ `${TRUE_NAS_CONNECTIONS_PATH}/${encodeURIComponent(id)}/test`,+ {+ method: 'POST',+ },+ );+ return {+ success: strictBoolean(response.success),+ };+ }}diff --git a/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsxindex aadd102804..8044ba8a45 100644--- a/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/TrueNASSettingsPanel.test.tsx@@ -1,4 +1,4 @@-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { TrueNASSettingsPanel } from '../TrueNASSettingsPanel';import type { TrueNASSettingsPanelState } from '../useTrueNASSettingsPanelState';@@ -157,6 +157,11 @@ describe('TrueNASSettingsPanel', () => {expect(screen.getByRole('button', { name: 'Add TrueNAS connection' })).toBeInTheDocument();fireEvent.click(screen.getByRole('button', { name: 'Add TrueNAS connection' }));expect(mockState.openCreateDialog).toHaveBeenCalledTimes(1);++ fireEvent.click(within(screen.getByTestId('truenas-connection-conn-1')).getByRole('button', { name: 'Test' }));+ expect(mockState.testSavedConnection).toHaveBeenCalledWith(+ expect.objectContaining({ id: 'conn-1' }),+ );});it('shows the feature gate warning when the backend path is disabled', () => {diff --git a/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx b/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsxindex c598cef3f7..383de33814 100644--- a/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/useTrueNASSettingsPanelState.test.tsx@@ -11,6 +11,7 @@ vi.mock('@/api/truenas', () => ({updateConnection: vi.fn(),deleteConnection: vi.fn(),testConnection: vi.fn(),+ testSavedConnection: vi.fn(),},isRedactedTrueNASSecret: (value: string | null | undefined) => (value || '').trim() === '********',}));@@ -106,4 +107,32 @@ describe('useTrueNASSettingsPanelState', () => {expect(result.dialogOpen()).toBe(false);expect(notificationStore.success).toHaveBeenCalledWith('TrueNAS connection updated');});++ it('tests saved connections through the canonical saved-connection API path', async () => {+ vi.mocked(TrueNASAPI.listConnections).mockResolvedValueOnce([+ {+ id: 'conn-1',+ name: 'tower',+ host: 'truenas.local',+ apiKey: '********',+ pollIntervalSeconds: 60,+ useHttps: true,+ insecureSkipVerify: false,+ enabled: true,+ },+ ] as never);+ vi.mocked(TrueNASAPI.testSavedConnection).mockResolvedValueOnce({ success: true } as never);++ const { result } = renderHook(() => useTrueNASSettingsPanelState());++ await waitFor(() => expect(result.connections()).toHaveLength(1));++ await result.testSavedConnection(result.connections()[0]);++ expect(TrueNASAPI.testSavedConnection).toHaveBeenCalledWith('conn-1');+ expect(TrueNASAPI.testConnection).not.toHaveBeenCalled();+ expect(notificationStore.success).toHaveBeenCalledWith(+ 'TrueNAS connection successful for tower',+ );+ });});diff --git a/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts b/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.tsindex c5200834a5..18b29f6627 100644--- a/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts+++ b/frontend-modern/src/components/Settings/useTrueNASSettingsPanelState.ts@@ -250,7 +250,7 @@ export function useTrueNASSettingsPanelState() {const testSavedConnection = async (connection: TrueNASConnection) => {setTesting(true);try {- await TrueNASAPI.testConnection(buildConnectionInput(buildFormStateFromConnection(connection)));+ await TrueNASAPI.testSavedConnection(connection.id);notificationStore.success(`TrueNAS connection successful for ${connection.name || connection.host}`);} catch (error) {const message = getErrorMessage(error, 'TrueNAS connection failed');diff --git a/internal/api/router_routes_registration.go b/internal/api/router_routes_registration.goindex f817b76d13..9d9410a246 100644--- a/internal/api/router_routes_registration.go+++ b/internal/api/router_routes_registration.go@@ -212,7 +212,9 @@ func (r *Router) registerConfigSystemRoutes(updateHandlers *UpdateHandlers) {return}- if req.Method == http.MethodDelete {+ if req.Method == http.MethodPost && strings.HasSuffix(strings.Trim(req.URL.Path, "/"), "/test") {+ RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.trueNASHandlers.HandleTestSavedConnection))(w, req)+ } else if req.Method == http.MethodDelete {RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.trueNASHandlers.HandleDelete))(w, req)} else if req.Method == http.MethodPut {RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, r.trueNASHandlers.HandleUpdate))(w, req)diff --git a/internal/api/security_regression_test.go b/internal/api/security_regression_test.goindex 1868fc656a..8ba4940c8b 100644--- a/internal/api/security_regression_test.go+++ b/internal/api/security_regression_test.go@@ -1724,6 +1724,38 @@ func TestConfigNodeMutationsRequireSettingsWriteScope(t *testing.T) {}}+func TestTrueNASConnectionMutationsRequireSettingsWriteScope(t *testing.T) {+ rawToken := "truenas-mutate-token-123.12345678"+ record := newTokenRecord(t, rawToken, []string{config.ScopeSettingsRead}, nil)+ cfg := newTestConfigWithTokens(t, record)+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")++ paths := []struct {+ method string+ path string+ body string+ }{+ {method: http.MethodPost, path: "/api/truenas/connections", body: `{}`},+ {method: http.MethodPost, path: "/api/truenas/connections/test", body: `{}`},+ {method: http.MethodPut, path: "/api/truenas/connections/conn-1", body: `{}`},+ {method: http.MethodDelete, path: "/api/truenas/connections/conn-1", body: ""},+ {method: http.MethodPost, path: "/api/truenas/connections/conn-1/test", body: ""},+ }++ for _, tc := range paths {+ req := httptest.NewRequest(tc.method, tc.path, strings.NewReader(tc.body))+ req.Header.Set("X-API-Token", rawToken)+ rec := httptest.NewRecorder()+ router.Handler().ServeHTTP(rec, req)+ if rec.Code != http.StatusForbidden {+ t.Fatalf("expected 403 for missing settings:write scope on %s %s, got %d", tc.method, tc.path, rec.Code)+ }+ if !strings.Contains(rec.Body.String(), config.ScopeSettingsWrite) {+ t.Fatalf("expected missing scope response to mention %q, got %q", config.ScopeSettingsWrite, rec.Body.String())+ }+ }+}+func TestConfigExportRequiresSettingsReadScope(t *testing.T) {rawToken := "config-export-token-123.12345678"record := newTokenRecord(t, rawToken, []string{config.ScopeMonitoringRead}, nil)diff --git a/internal/api/truenas_handlers.go b/internal/api/truenas_handlers.goindex 82300cc97b..50033dfeec 100644--- a/internal/api/truenas_handlers.go+++ b/internal/api/truenas_handlers.go@@ -278,11 +278,60 @@ func (h *TrueNASHandlers) HandleTestConnection(w http.ResponseWriter, r *http.Reinstance.Host = strings.TrimSpace(instance.Host)instance.APIKey = strings.TrimSpace(instance.APIKey)instance.Username = strings.TrimSpace(instance.Username)+ instance.Password = strings.TrimSpace(instance.Password)+ instance.Fingerprint = strings.TrimSpace(instance.Fingerprint)+ instance.ApplyDefaults()if err := instance.Validate(); err != nil {writeErrorResponse(w, http.StatusBadRequest, "validation_error", err.Error(), nil)return}+ h.testConnectionInstance(w, r, instance)+}++// HandleTestSavedConnection validates connectivity for one saved TrueNAS+// connection using the server-owned stored secret material instead of relying+// on frontend redaction placeholders.+func (h *TrueNASHandlers) HandleTestSavedConnection(w http.ResponseWriter, r *http.Request) {+ if !h.featureEnabled(w) {+ return+ }++ connectionID, ok := trueNASConnectionIDFromTestPath(r.URL.Path)+ if !ok {+ writeErrorResponse(w, http.StatusBadRequest, "missing_connection_id", "Connection ID is required", nil)+ return+ }++ persistence := h.persistenceForRequest(w, r.Context())+ if persistence == nil {+ return+ }++ instances, err := persistence.LoadTrueNASConfig()+ if err != nil {+ writeErrorResponse(w, http.StatusInternalServerError, "truenas_load_failed", "Failed to load TrueNAS configuration", map[string]string{"error": err.Error()})+ return+ }++ for i := range instances {+ instance := instances[i]+ if strings.TrimSpace(instance.ID) != connectionID {+ continue+ }+ instance.ApplyDefaults()+ h.testConnectionInstance(w, r, instance)+ return+ }++ writeErrorResponse(w, http.StatusNotFound, "truenas_not_found", "Connection not found", nil)+}++func (h *TrueNASHandlers) testConnectionInstance(+ w http.ResponseWriter,+ r *http.Request,+ instance config.TrueNASInstance,+) {newClient := h.newClientif newClient == nil {newClient = func(cfg truenas.ClientConfig) (trueNASClient, error) { return truenas.NewClient(cfg) }@@ -396,3 +445,26 @@ func trueNASConnectionIDFromPath(path string) (string, bool) {return connectionID, true}++func trueNASConnectionIDFromTestPath(path string) (string, bool) {+ if !strings.HasPrefix(path, trueNASConnectionsPathPrefix) {+ return "", false+ }+ trimmed := strings.Trim(strings.TrimPrefix(path, trueNASConnectionsPathPrefix), "/")+ if !strings.HasSuffix(trimmed, "/test") {+ return "", false+ }+ raw := strings.TrimSuffix(trimmed, "/test")+ if raw == "" || strings.Contains(raw, "/") {+ return "", false+ }+ connectionID, err := url.PathUnescape(raw)+ if err != nil {+ return "", false+ }+ connectionID = strings.TrimSpace(connectionID)+ if connectionID == "" || strings.Contains(connectionID, "/") {+ return "", false+ }+ return connectionID, true+}diff --git a/internal/api/truenas_handlers_test.go b/internal/api/truenas_handlers_test.goindex 359a050725..8bcc8957d2 100644--- a/internal/api/truenas_handlers_test.go+++ b/internal/api/truenas_handlers_test.go@@ -489,6 +489,51 @@ func TestTrueNASHandlers_HandleTestConnection_SuccessAndFailure(t *testing.T) {}}+func TestTrueNASHandlers_HandleTestSavedConnection_UsesStoredSecrets(t *testing.T) {+ setTrueNASFeatureForTest(t, true)++ handler, persistence, _ := newTrueNASHandlersForTest(t, nil)+ if err := persistence.SaveTrueNASConfig([]config.TrueNASInstance{+ {+ ID: "conn-1",+ Name: "tower",+ Host: "truenas.local",+ Port: 443,+ APIKey: "super-secret",+ UseHTTPS: true,+ InsecureSkipVerify: false,+ Enabled: true,+ },+ }); err != nil {+ t.Fatalf("seed truenas config: %v", err)+ }++ var gotConfig truenas.ClientConfig+ handler.newClient = func(cfg truenas.ClientConfig) (trueNASClient, error) {+ gotConfig = cfg+ return &fakeTrueNASClient{}, nil+ }++ req := httptest.NewRequest(http.MethodPost, "/api/truenas/connections/conn-1/test", nil)+ rec := httptest.NewRecorder()+ handler.HandleTestSavedConnection(rec, req)++ if rec.Code != http.StatusOK {+ t.Fatalf("expected 200, got %d: %s", rec.Code, rec.Body.String())+ }+ if gotConfig.Host != "truenas.local" || gotConfig.APIKey != "super-secret" || !gotConfig.UseHTTPS {+ t.Fatalf("unexpected saved client config: %+v", gotConfig)+ }++ missingReq := httptest.NewRequest(http.MethodPost, "/api/truenas/connections/missing/test", nil)+ missingRec := httptest.NewRecorder()+ handler.HandleTestSavedConnection(missingRec, missingReq)++ if missingRec.Code != http.StatusNotFound {+ t.Fatalf("expected 404 for missing saved connection, got %d: %s", missingRec.Code, missingRec.Body.String())+ }+}+func newTrueNASHandlersForTest(t *testing.T, cfg *config.Config) (*TrueNASHandlers, *config.ConfigPersistence, *monitoring.Monitor) {t.Helper()diff --git a/tests/integration/tests/21-truenas-settings-platform-connections.spec.ts b/tests/integration/tests/21-truenas-settings-platform-connections.spec.tsindex bfd567f6e9..84875897cb 100644--- a/tests/integration/tests/21-truenas-settings-platform-connections.spec.ts+++ b/tests/integration/tests/21-truenas-settings-platform-connections.spec.ts@@ -24,6 +24,13 @@ const OPERATIONS_SCREENSHOT_PATH = path.resolve('tmp','truenas-settings-operations-summary.png',);+const WORKFLOW_SCREENSHOT_PATH = path.resolve(+ __dirname,+ '..',+ '..',+ 'tmp',+ 'truenas-settings-platform-workflow.png',+);const test = base.extend<{}, WorkerFixtures>({storageState: async ({ authStorageStatePath }, use) => {@@ -188,6 +195,168 @@ test.describe('TrueNAS platform connections settings', () => {await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });});+ test('adds, retests, and deletes TrueNAS connections through the canonical settings workflow', async ({+ page,+ }) => {+ const syncedAt = new Date(Date.now() - 60_000).toISOString();+ let connections: Record<string, unknown>[] = [];+ let draftTestPayload: Record<string, unknown> | null = null;+ let createPayload: Record<string, unknown> | null = null;+ let draftTestCalls = 0;+ const savedTestPaths: string[] = [];+ const deletePaths: string[] = [];++ await page.route('**/api/truenas/connections**', async (route) => {+ const request = route.request();+ const method = request.method();+ const pathname = new URL(request.url()).pathname;++ if (pathname === '/api/truenas/connections' && method === 'GET') {+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(connections),+ });+ return;+ }++ if (pathname === '/api/truenas/connections/test' && method === 'POST') {+ draftTestCalls += 1;+ draftTestPayload = JSON.parse(request.postData() || '{}');+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify({ success: true }),+ });+ return;+ }++ if (pathname === '/api/truenas/connections' && method === 'POST') {+ createPayload = JSON.parse(request.postData() || '{}');+ connections = [+ {+ id: 'conn-1',+ name: createPayload.name,+ host: createPayload.host,+ port: createPayload.port,+ apiKey: '********',+ useHttps: createPayload.useHttps,+ insecureSkipVerify: createPayload.insecureSkipVerify,+ fingerprint: createPayload.fingerprint,+ enabled: createPayload.enabled,+ pollIntervalSeconds: createPayload.pollIntervalSeconds,+ poll: {+ intervalSeconds: createPayload.pollIntervalSeconds,+ lastSuccessAt: syncedAt,+ },+ observed: {+ host: 'tower',+ resourceId: 'tower',+ collectedAt: syncedAt,+ systems: 1,+ storagePools: 2,+ datasets: 12,+ apps: 4,+ disks: 8,+ recoveryArtifacts: 18,+ },+ },+ ];+ await route.fulfill({+ status: 201,+ contentType: 'application/json',+ body: JSON.stringify(connections[0]),+ });+ return;+ }++ if (pathname === '/api/truenas/connections/conn-1/test' && method === 'POST') {+ savedTestPaths.push(pathname);+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify({ success: true }),+ });+ return;+ }++ if (pathname === '/api/truenas/connections/conn-1' && method === 'DELETE') {+ deletePaths.push(pathname);+ connections = [];+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify({ success: true, id: 'conn-1' }),+ });+ return;+ }++ await route.continue();+ });++ await page.goto('/settings/infrastructure/platforms/truenas', {+ waitUntil: 'domcontentloaded',+ });+ await page.waitForURL(/\/settings\/infrastructure\/platforms\/truenas/, {+ timeout: 15_000,+ });++ await expect(page.getByText('No TrueNAS connections yet')).toBeVisible();++ await page.getByRole('button', { name: 'Add TrueNAS connection' }).click();+ const dialog = page.getByRole('dialog', { name: 'Add TrueNAS connection' });+ await expect(dialog).toBeVisible();++ await dialog.getByPlaceholder('tower').fill('Tower NAS');+ await dialog.getByPlaceholder('truenas.local').fill('tower.local');+ await dialog.getByPlaceholder('443').fill('443');+ await dialog.getByPlaceholder('60').fill('90');+ await dialog.locator('input[type="password"]').first().fill('secret-api-key');++ await dialog.getByRole('button', { name: 'Test connection' }).click();+ await expect+ .poll(() => draftTestPayload)+ .toMatchObject({+ name: 'Tower NAS',+ host: 'tower.local',+ port: 443,+ apiKey: 'secret-api-key',+ useHttps: true,+ enabled: true,+ pollIntervalSeconds: 90,+ });++ await dialog.getByRole('button', { name: 'Add connection' }).click();++ const connectionCard = page.getByTestId('truenas-connection-conn-1');+ await expect(connectionCard).toBeVisible();+ await expect(connectionCard).toContainText('Tower NAS');+ await expect(connectionCard).toContainText('Healthy');+ await expect+ .poll(() => createPayload)+ .toMatchObject({+ name: 'Tower NAS',+ host: 'tower.local',+ port: 443,+ apiKey: 'secret-api-key',+ useHttps: true,+ enabled: true,+ pollIntervalSeconds: 90,+ });++ await connectionCard.getByRole('button', { name: 'Test' }).click();+ await expect.poll(() => savedTestPaths).toEqual(['/api/truenas/connections/conn-1/test']);+ await expect.poll(() => draftTestCalls).toBe(1);++ await connectionCard.getByRole('button', { name: 'Delete' }).click();+ await page.getByRole('button', { name: 'Delete connection' }).click();+ await expect.poll(() => deletePaths).toEqual(['/api/truenas/connections/conn-1']);+ await expect(page.getByText('No TrueNAS connections yet')).toBeVisible();++ fs.mkdirSync(path.dirname(WORKFLOW_SCREENSHOT_PATH), { recursive: true });+ await page.screenshot({ path: WORKFLOW_SCREENSHOT_PATH, fullPage: true });+ });+test('counts TrueNAS alongside the other platform connections on the operations summary', async ({page,}) => {