From c7e02b00f71c4a10d1c182acd0fdb703df515b57 Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Fri, 20 Nov 2026 12:47:16 +0800 Subject: [PATCH 1/4] Add storage type to the platform health page --- docs/frontend/platform-health-page.md | 11 ++- src/Frontend/src/resources/PlatformModel.ts | 1 + src/Frontend/src/resources/RemoteInstance.ts | 2 + .../src/stores/PlatformHealthStore.spec.ts | 4 ++ .../src/stores/PlatformHealthStore.ts | 4 ++ .../src/stores/PlatformModelStore.spec.ts | 70 +++++++++++++++++++ src/Frontend/src/stores/PlatformModelStore.ts | 2 + .../src/views/PlatformHealthView.spec.ts | 3 + .../test/mocks/platform-health-state.ts | 3 + src/Frontend/test/mocks/platform-topology.ts | 1 + 10 files changed, 98 insertions(+), 3 deletions(-) diff --git a/docs/frontend/platform-health-page.md b/docs/frontend/platform-health-page.md index 3a3cfba6c..6f75d242b 100644 --- a/docs/frontend/platform-health-page.md +++ b/docs/frontend/platform-health-page.md @@ -47,10 +47,12 @@ Rows expand from the health badge to show details. Those details come from: -- informational row context: API URL, transport type, error/audit queue names, forward error messages setting, and error/audit retention periods (when available from instance configuration) +- informational row context: API URL, transport type, error/audit queue names, forward error messages setting, error/audit retention periods, and persistence type (when available from instance configuration) - matching internal platform custom checks when available - fallback page-specific messages when no custom-check detail is available +The information table shows the persistence type as reported by the API under the `Storage Type` label. Primary and remote error instances use `storage.storage_type`; audit instances use the raw setting in `persistence.persistence_type`. Remote rows prefer `storage.storage_type` when both fields are present. Responses without a persistence type produce no persistence line. The platform model excludes `persistence_settings`, which can contain connection strings and certificate secrets. The support export includes only the mapped persistence type. + Built-in custom-check `healthDetails` can include both the failure summary and a `Reported at: ` line. ## Severity Model @@ -181,6 +183,7 @@ The support export includes both the current Platform health payload and the cur | File | Type | Description | |------|------|-------------| | `src/Frontend/src/stores/PlatformHealthStore.spec.ts` | Component/unit | Platform health severity, row derivation, and internal check inference | +| `src/Frontend/src/stores/PlatformModelStore.spec.ts` | Unit | Mapping of ServiceControl configuration responses into platform instances | | `src/Frontend/src/views/PlatformHealthView.spec.ts` | Component | Page rendering, upgrade cues, row expansion, and support modal behavior | | `src/Frontend/test/mocks/platform-health-state.spec.ts` | Unit | Runtime mock helper behavior and custom-check preset switching | @@ -190,6 +193,7 @@ Use the shared commands in `docs/frontend/testing-basics.md`, then run these Pla ```bash npx vitest run src/stores/PlatformHealthStore.spec.ts +npx vitest run src/stores/PlatformModelStore.spec.ts npx vitest run src/views/PlatformHealthView.spec.ts npx vitest run test/mocks/platform-health-state.spec.ts ``` @@ -198,8 +202,9 @@ npx vitest run test/mocks/platform-health-state.spec.ts | Area | Covered behavior | |------|------------------| -| Platform health store | warning/danger severity, unavailable audit remotes, remote error instance danger, monitoring presence, version fallback, internal custom-check health inference, transport and retention details in infoDetails | -| Platform health view | support download gating, known-version-only upgrade cue rendering, plain-text names, API-in-details rendering, monitoring row rendering, always-expandable health badges | +| Platform health store | warning/danger severity, unavailable audit remotes, remote error instance danger, monitoring presence, version fallback, internal custom-check health inference, transport, retention, and persistence details in infoDetails | +| Platform health view | support download gating, known-version-only upgrade cue rendering, plain-text names, API-in-details rendering, monitoring row rendering, always-expandable health badges, persistence type in expanded details | +| Platform model store | persistence type mapping from the primary `storage`, remote error `storage`, and remote audit `persistence` shapes, `storage` precedence, absence on older responses, clearing on refresh, support JSON that includes the type and omits `persistence_settings` | | Mock helpers | independent topology and custom-check switching | ## Key Source Files diff --git a/src/Frontend/src/resources/PlatformModel.ts b/src/Frontend/src/resources/PlatformModel.ts index 6f7371e5f..13547ab18 100644 --- a/src/Frontend/src/resources/PlatformModel.ts +++ b/src/Frontend/src/resources/PlatformModel.ts @@ -23,6 +23,7 @@ export interface PlatformInstance { errorRetentionPeriod?: string; auditRetentionPeriod?: string; storageType?: string; + persistenceType?: string; } export interface PlatformModel { diff --git a/src/Frontend/src/resources/RemoteInstance.ts b/src/Frontend/src/resources/RemoteInstance.ts index 3fff19175..b6fcee65c 100644 --- a/src/Frontend/src/resources/RemoteInstance.ts +++ b/src/Frontend/src/resources/RemoteInstance.ts @@ -10,6 +10,8 @@ export interface RemoteInstanceHostConfiguration { export interface RemoteInstanceConfiguration { host?: RemoteInstanceHostConfiguration; data_retention?: RemoteInstanceDataRetention; + storage?: { storage_type?: string }; + persistence?: { persistence_type?: string }; } export enum RemoteInstanceType { diff --git a/src/Frontend/src/stores/PlatformHealthStore.spec.ts b/src/Frontend/src/stores/PlatformHealthStore.spec.ts index 807f3860c..0630287b7 100644 --- a/src/Frontend/src/stores/PlatformHealthStore.spec.ts +++ b/src/Frontend/src/stores/PlatformHealthStore.spec.ts @@ -50,10 +50,12 @@ describe("PlatformHealthStore", () => { expect(primaryRow.infoDetails).toContain("Error log queue: error.log"); expect(primaryRow.infoDetails).toContain("Forward error messages: Yes"); expect(primaryRow.infoDetails).toContain("Error retention: 14 days"); + expect(primaryRow.infoDetails).toContain("Storage Type: SQLServer"); const auditRow = store.rows[1]; expect(auditRow.infoDetails).toContain("API: http://Particular.ServiceControl.Audit/api/"); expect(auditRow.infoDetails).toContain("Audit retention: 7 days"); + expect(auditRow.infoDetails).toContain("Storage Type: PostgreSQL"); expect(auditRow.infoDetails).not.toContain(expect.stringContaining("Transport")); }); @@ -510,6 +512,7 @@ const primaryWithTransportModel: PlatformModel = { errorLogQueue: "error.log", forwardErrorMessages: true, errorRetentionPeriod: "14.00:00:00", + persistenceType: "SQLServer", }, remotes: [ { @@ -521,6 +524,7 @@ const primaryWithTransportModel: PlatformModel = { health: "healthy", apiUrl: "http://Particular.ServiceControl.Audit/api/", auditRetentionPeriod: "7.00:00:00", + persistenceType: "PostgreSQL", }, ], monitoring: null, diff --git a/src/Frontend/src/stores/PlatformHealthStore.ts b/src/Frontend/src/stores/PlatformHealthStore.ts index 99d0384b0..3db9751fe 100644 --- a/src/Frontend/src/stores/PlatformHealthStore.ts +++ b/src/Frontend/src/stores/PlatformHealthStore.ts @@ -208,6 +208,10 @@ function toRow(instance: PlatformInstance, latestVersion: string, upgradeLink: s infoDetails.push(`Audit retention: ${formatTimeSpan(instance.auditRetentionPeriod)}`); } + if (instance.persistenceType) { + infoDetails.push(`Storage Type: ${instance.persistenceType}`); + } + return { id: instance.id, type: formatRowType(instance), diff --git a/src/Frontend/src/stores/PlatformModelStore.spec.ts b/src/Frontend/src/stores/PlatformModelStore.spec.ts index 98b1bc7be..51d8f488c 100644 --- a/src/Frontend/src/stores/PlatformModelStore.spec.ts +++ b/src/Frontend/src/stores/PlatformModelStore.spec.ts @@ -1,6 +1,8 @@ import { beforeEach, describe, expect, test, vi } from "vitest"; import { createPinia, setActivePinia } from "pinia"; import { usePlatformModelStore } from "@/stores/PlatformModelStore"; +import { usePlatformHealthStore } from "@/stores/PlatformHealthStore"; +import { useCustomChecksStore } from "@/stores/CustomChecksStore"; import { RemoteInstanceType } from "@/resources/RemoteInstance"; const getRoot = vi.fn(); @@ -204,6 +206,74 @@ describe("PlatformModelStore", () => { expect(store.primary?.storageType).toBeUndefined(); }); + test("maps the persistence type from the primary and from error and audit remotes", async () => { + getRoot.mockResolvedValue(rootResponse({ name: "Particular.ServiceControl", health: "healthy", version: "6.19.3" })); + getConfiguration.mockResolvedValue({ json: () => Promise.resolve({ storage: { storage_type: "SQLServer" } }) } as never); + getRemoteInstances.mockResolvedValue([ + { api_uri: "http://localhost:33334/api/", version: "6.19.3", status: "online", configuration: { data_retention: { error_retention_period: "14.00:00:00" }, storage: { storage_type: "RavenDB" } } }, + { api_uri: "http://localhost:33335/api/", version: "6.19.3", status: "online", configuration: { data_retention: { audit_retention_period: "7.00:00:00" }, persistence: { persistence_type: "PostgreSQL" } } }, + ]); + getMonitoringRoot.mockResolvedValue(null); + + const store = usePlatformModelStore(); + await store.refresh(); + + expect(store.primary?.persistenceType).toBe("SQLServer"); + expect(store.remotes[0].persistenceType).toBe("RavenDB"); + expect(store.remotes[1].persistenceType).toBe("PostgreSQL"); + }); + + test("prefers storage.storage_type over persistence.persistence_type on a remote", async () => { + getRoot.mockResolvedValue(rootResponse({ name: "Particular.ServiceControl", health: "healthy", version: "6.19.3" })); + getRemoteInstances.mockResolvedValue([{ api_uri: "http://localhost:33334/api/", version: "6.19.3", status: "online", configuration: { storage: { storage_type: "RavenDB" }, persistence: { persistence_type: "raw" } } }]); + getMonitoringRoot.mockResolvedValue(null); + + const store = usePlatformModelStore(); + await store.refresh(); + + expect(store.remotes[0].persistenceType).toBe("RavenDB"); + }); + + test("leaves the persistence type undefined when responses omit it and clears it on refresh", async () => { + getRoot.mockResolvedValue(rootResponse({ name: "Particular.ServiceControl", health: "healthy", version: "6.19.3" })); + getConfiguration.mockResolvedValueOnce({ json: () => Promise.resolve({ storage: { storage_type: "RavenDB" } }) } as never); + getRemoteInstances.mockResolvedValueOnce([{ api_uri: "http://localhost:33334/api/", version: "6.19.3", status: "online", configuration: { persistence: { persistence_type: "PostgreSQL" } } }]); + getMonitoringRoot.mockResolvedValue(null); + + const store = usePlatformModelStore(); + await store.refresh(); + expect(store.primary?.persistenceType).toBe("RavenDB"); + expect(store.remotes[0].persistenceType).toBe("PostgreSQL"); + + getConfiguration.mockResolvedValueOnce({ json: () => Promise.resolve({ host: {} }) } as never); + getRemoteInstances.mockResolvedValueOnce([{ api_uri: "http://localhost:33334/api/", version: "6.19.3", status: "online", configuration: {} }]); + await store.refresh(); + + expect(store.primary?.persistenceType).toBeUndefined(); + expect(store.remotes[0].persistenceType).toBeUndefined(); + }); + + test("includes the persistence type but not persistence_settings in the support JSON", async () => { + getRoot.mockResolvedValue(rootResponse({ name: "Particular.ServiceControl", health: "healthy", version: "6.19.3" })); + getConfiguration.mockResolvedValue({ + json: () => + Promise.resolve({ + storage: { storage_type: "SQLServer" }, + persistence_settings: { connection_string: "SENTINEL_CONNECTION_STRING", client_certificate_password: "SENTINEL_CERT_PASSWORD", client_certificate_base64: "SENTINEL_CERT_BASE64" }, + }), + } as never); + getRemoteInstances.mockResolvedValue([]); + getMonitoringRoot.mockResolvedValue(null); + useCustomChecksStore().refresh = vi.fn(() => Promise.resolve()); + + const healthStore = usePlatformHealthStore(); + await healthStore.refresh(); + + expect(healthStore.supportDownloadJson).toContain("SQLServer"); + expect(healthStore.supportDownloadJson).not.toContain("SENTINEL"); + expect(healthStore.supportDownloadJson).not.toContain("persistence_settings"); + }); + test("skips remote discovery when the primary root is unavailable", async () => { getRoot.mockRejectedValue(new Error("primary unavailable")); getRemoteInstances.mockResolvedValue([ diff --git a/src/Frontend/src/stores/PlatformModelStore.ts b/src/Frontend/src/stores/PlatformModelStore.ts index 257ba68b9..3d872cfa9 100644 --- a/src/Frontend/src/stores/PlatformModelStore.ts +++ b/src/Frontend/src/stores/PlatformModelStore.ts @@ -115,6 +115,7 @@ function mapPrimary(primaryRoot: PrimaryRootResult | null, configuration: Config forwardErrorMessages: configuration?.transport?.forward_error_messages, errorRetentionPeriod: configuration?.data_retention?.error_retention_period, storageType: configuration?.storage?.storage_type, + persistenceType: configuration?.storage?.storage_type, }; } @@ -133,6 +134,7 @@ function mapRemotes(remotes: RemoteInstance[]): PlatformInstance[] { apiUrl: remote.api_uri, errorRetentionPeriod: remote.configuration?.data_retention?.error_retention_period, auditRetentionPeriod: remote.configuration?.data_retention?.audit_retention_period, + persistenceType: remote.configuration?.storage?.storage_type ?? remote.configuration?.persistence?.persistence_type, }; }); } diff --git a/src/Frontend/src/views/PlatformHealthView.spec.ts b/src/Frontend/src/views/PlatformHealthView.spec.ts index 5f8c68f07..cac63246b 100644 --- a/src/Frontend/src/views/PlatformHealthView.spec.ts +++ b/src/Frontend/src/views/PlatformHealthView.spec.ts @@ -221,6 +221,7 @@ describe("PlatformHealthView", () => { version: "6.19.3", health: "healthy", apiUrl: "http://localhost:33333/api/", + persistenceType: "SQLServer", }, remotes: [ { @@ -251,6 +252,8 @@ describe("PlatformHealthView", () => { await user.click(screen.getAllByRole("button", { name: /Healthy/i })[0]); expect(screen.getByText("API")).toBeInTheDocument(); expect(screen.getByText("http://localhost:33333/api/")).toBeInTheDocument(); + expect(screen.getByText("Storage Type")).toBeInTheDocument(); + expect(screen.getByText("SQLServer")).toBeInTheDocument(); }); test("renders monitoring when present alongside remote error instances", () => { diff --git a/src/Frontend/test/mocks/platform-health-state.ts b/src/Frontend/test/mocks/platform-health-state.ts index 4bc30f525..f43af79f3 100644 --- a/src/Frontend/test/mocks/platform-health-state.ts +++ b/src/Frontend/test/mocks/platform-health-state.ts @@ -109,6 +109,9 @@ export function getPlatformHealthConfiguration() { data_retention: { error_retention_period: "15.00:00:00", }, + storage: { + storage_type: "SQLServer", + }, }; } diff --git a/src/Frontend/test/mocks/platform-topology.ts b/src/Frontend/test/mocks/platform-topology.ts index 50e7aa130..e2e7378da 100644 --- a/src/Frontend/test/mocks/platform-topology.ts +++ b/src/Frontend/test/mocks/platform-topology.ts @@ -115,6 +115,7 @@ export function toRemoteInstances(topology: Pick): instance_name: remote.name, }, data_retention: remote.instanceType === "error" ? { error_retention_period: "14.00:00:00" } : { audit_retention_period: "7.00:00:00" }, + ...(remote.instanceType === "error" ? { storage: { storage_type: "RavenDB" } } : { persistence: { persistence_type: "PostgreSQL" } }), }, platform_health_status: remote.status, platform_health_id: remote.id, From 946ba44c5e2069f3cf887a660f377697ff8bdab8 Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Tue, 24 Nov 2026 15:47:36 +0800 Subject: [PATCH 2/4] Update src/Frontend/src/stores/PlatformHealthStore.ts Co-authored-by: Warwick Schroeder --- src/Frontend/src/stores/PlatformHealthStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Frontend/src/stores/PlatformHealthStore.ts b/src/Frontend/src/stores/PlatformHealthStore.ts index 3db9751fe..351040e45 100644 --- a/src/Frontend/src/stores/PlatformHealthStore.ts +++ b/src/Frontend/src/stores/PlatformHealthStore.ts @@ -209,7 +209,7 @@ function toRow(instance: PlatformInstance, latestVersion: string, upgradeLink: s } if (instance.persistenceType) { - infoDetails.push(`Storage Type: ${instance.persistenceType}`); + infoDetails.push(`Storage type: ${instance.persistenceType}`); } return { From 759b8da4ccce8eb63fdebef9aeb184a53625584e Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Tue, 24 Nov 2026 15:59:54 +0800 Subject: [PATCH 3/4] Remove deleted test from docs --- docs/frontend/platform-health-page.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/frontend/platform-health-page.md b/docs/frontend/platform-health-page.md index 6f75d242b..bd698a1b8 100644 --- a/docs/frontend/platform-health-page.md +++ b/docs/frontend/platform-health-page.md @@ -185,7 +185,6 @@ The support export includes both the current Platform health payload and the cur | `src/Frontend/src/stores/PlatformHealthStore.spec.ts` | Component/unit | Platform health severity, row derivation, and internal check inference | | `src/Frontend/src/stores/PlatformModelStore.spec.ts` | Unit | Mapping of ServiceControl configuration responses into platform instances | | `src/Frontend/src/views/PlatformHealthView.spec.ts` | Component | Page rendering, upgrade cues, row expansion, and support modal behavior | -| `src/Frontend/test/mocks/platform-health-state.spec.ts` | Unit | Runtime mock helper behavior and custom-check preset switching | ### Running Automated Tests @@ -195,7 +194,6 @@ Use the shared commands in `docs/frontend/testing-basics.md`, then run these Pla npx vitest run src/stores/PlatformHealthStore.spec.ts npx vitest run src/stores/PlatformModelStore.spec.ts npx vitest run src/views/PlatformHealthView.spec.ts -npx vitest run test/mocks/platform-health-state.spec.ts ``` ### Test Coverage @@ -205,7 +203,6 @@ npx vitest run test/mocks/platform-health-state.spec.ts | Platform health store | warning/danger severity, unavailable audit remotes, remote error instance danger, monitoring presence, version fallback, internal custom-check health inference, transport, retention, and persistence details in infoDetails | | Platform health view | support download gating, known-version-only upgrade cue rendering, plain-text names, API-in-details rendering, monitoring row rendering, always-expandable health badges, persistence type in expanded details | | Platform model store | persistence type mapping from the primary `storage`, remote error `storage`, and remote audit `persistence` shapes, `storage` precedence, absence on older responses, clearing on refresh, support JSON that includes the type and omits `persistence_settings` | -| Mock helpers | independent topology and custom-check switching | ## Key Source Files From 1f02cc008e15ad6393cb5d6643c1d52d8c43117b Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Tue, 24 Nov 2026 16:10:55 +0800 Subject: [PATCH 4/4] Fix changed string in tests & doc --- docs/frontend/platform-health-page.md | 2 +- src/Frontend/src/stores/PlatformHealthStore.spec.ts | 4 ++-- src/Frontend/src/views/PlatformHealthView.spec.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/frontend/platform-health-page.md b/docs/frontend/platform-health-page.md index bd698a1b8..f9ab1181e 100644 --- a/docs/frontend/platform-health-page.md +++ b/docs/frontend/platform-health-page.md @@ -51,7 +51,7 @@ Those details come from: - matching internal platform custom checks when available - fallback page-specific messages when no custom-check detail is available -The information table shows the persistence type as reported by the API under the `Storage Type` label. Primary and remote error instances use `storage.storage_type`; audit instances use the raw setting in `persistence.persistence_type`. Remote rows prefer `storage.storage_type` when both fields are present. Responses without a persistence type produce no persistence line. The platform model excludes `persistence_settings`, which can contain connection strings and certificate secrets. The support export includes only the mapped persistence type. +The information table shows the persistence type as reported by the API under the `Storage type` label. Primary and remote error instances use `storage.storage_type`; audit instances use the raw setting in `persistence.persistence_type`. Remote rows prefer `storage.storage_type` when both fields are present. Responses without a persistence type produce no persistence line. The platform model excludes `persistence_settings`, which can contain connection strings and certificate secrets. The support export includes only the mapped persistence type. Built-in custom-check `healthDetails` can include both the failure summary and a `Reported at: ` line. diff --git a/src/Frontend/src/stores/PlatformHealthStore.spec.ts b/src/Frontend/src/stores/PlatformHealthStore.spec.ts index 0630287b7..f6cfbf62c 100644 --- a/src/Frontend/src/stores/PlatformHealthStore.spec.ts +++ b/src/Frontend/src/stores/PlatformHealthStore.spec.ts @@ -50,12 +50,12 @@ describe("PlatformHealthStore", () => { expect(primaryRow.infoDetails).toContain("Error log queue: error.log"); expect(primaryRow.infoDetails).toContain("Forward error messages: Yes"); expect(primaryRow.infoDetails).toContain("Error retention: 14 days"); - expect(primaryRow.infoDetails).toContain("Storage Type: SQLServer"); + expect(primaryRow.infoDetails).toContain("Storage type: SQLServer"); const auditRow = store.rows[1]; expect(auditRow.infoDetails).toContain("API: http://Particular.ServiceControl.Audit/api/"); expect(auditRow.infoDetails).toContain("Audit retention: 7 days"); - expect(auditRow.infoDetails).toContain("Storage Type: PostgreSQL"); + expect(auditRow.infoDetails).toContain("Storage type: PostgreSQL"); expect(auditRow.infoDetails).not.toContain(expect.stringContaining("Transport")); }); diff --git a/src/Frontend/src/views/PlatformHealthView.spec.ts b/src/Frontend/src/views/PlatformHealthView.spec.ts index cac63246b..9504a55e2 100644 --- a/src/Frontend/src/views/PlatformHealthView.spec.ts +++ b/src/Frontend/src/views/PlatformHealthView.spec.ts @@ -252,7 +252,7 @@ describe("PlatformHealthView", () => { await user.click(screen.getAllByRole("button", { name: /Healthy/i })[0]); expect(screen.getByText("API")).toBeInTheDocument(); expect(screen.getByText("http://localhost:33333/api/")).toBeInTheDocument(); - expect(screen.getByText("Storage Type")).toBeInTheDocument(); + expect(screen.getByText("Storage type")).toBeInTheDocument(); expect(screen.getByText("SQLServer")).toBeInTheDocument(); });