Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Remove hasAIAlertsFeature and runtimeCapabilitiesLoading from alert surfaces

rcourtman85a2dd06d4ee
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index f4937f3731..fe4a828dbe 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -72,6 +72,16 @@ operator-facing alert routing behavior for live runtime alerts.
## Current State
+Alert browser surfaces no longer manage their own runtime-capabilities fetch or
+`hasAIAlertsFeature` prop chain. `frontend-modern/src/pages/Alerts.tsx` and the
+shared alert overview surfaces (`OverviewTab.tsx`, `HistoryTab.tsx`,
+`AlertOverviewActiveAlertsSection.tsx`, `AlertHistoryTableSection.tsx`,
+`AlertHistoryTableAlertRow.tsx`, `AlertOverviewAlertCard.tsx`) must source AI
+alert feature gating from the shared entitlements layer, not from a per-surface
+`loadRuntimeCapabilities` fetch. Alert surfaces must not re-introduce their own
+`hasAIAlertsFeature`, `runtimeCapabilitiesLoading`, or direct
+`/api/license/runtime-capabilities` reads.
+
Canonical alert identity and evaluation are the live runtime model. Remaining
legacy references should exist only in explicit migration or negative test
boundaries.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 1adb23fd47..333cabd21d 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -577,6 +577,12 @@ connections` visible as the API-backed alternative for Proxmox and
`settingsNavCatalog.ts`, `settingsPanelRegistry.ts`, and
`settingsNavigationModel.ts` replaces both. Panel routing within the
infrastructure area uses `InfrastructurePanelStep` in-page state.
+Shared alert presentation surfaces (`OverviewTab.tsx`, `HistoryTab.tsx`,
+`AlertOverviewActiveAlertsSection.tsx`, `AlertHistoryTableSection.tsx`,
+`AlertHistoryTableAlertRow.tsx`, `AlertOverviewAlertCard.tsx`) no longer accept
+`hasAIAlertsFeature` or `runtimeCapabilitiesLoading` props. Feature gating for
+AI alerts flows through the shared entitlements layer; surfaces must not
+re-introduce per-surface capability fetch props.
The frontend already has several guardrail tests. The next step is to keep
turning repeated local patterns into explicit shared primitives with hard usage
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
index 18b8e378a9..59026efd4e 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
@@ -20,8 +20,6 @@ type AlertHistoryAlert = ReturnType<AlertHistoryState['groupedAlerts']>[number][
interface AlertHistoryTableAlertRowProps {
alert: AlertHistoryAlert;
state: AlertHistoryState;
- hasAIAlertsFeature: () => boolean;
- runtimeCapabilitiesLoading: () => boolean;
}
export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps) {
@@ -140,7 +138,6 @@ export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps)
resourceType={props.alert.resourceType}
variant="icon"
size="sm"
- licenseLocked={!props.hasAIAlertsFeature() && !props.runtimeCapabilitiesLoading()}
/>
</Show>
</div>
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
index 90bf764044..73c7e58761 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
@@ -19,8 +19,6 @@ import type { AlertHistoryState } from './useAlertHistoryState';
interface AlertHistoryTableSectionProps {
state: AlertHistoryState;
- hasAIAlertsFeature: () => boolean;
- runtimeCapabilitiesLoading: () => boolean;
}
export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
@@ -85,8 +83,6 @@ export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
<AlertHistoryTableAlertRow
alert={alert}
state={props.state}
- hasAIAlertsFeature={props.hasAIAlertsFeature}
- runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading}
/>
)}
</For>
diff --git a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
index 89f0cfad98..eed1902d7a 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
@@ -17,8 +17,6 @@ interface AlertOverviewActiveAlertsSectionProps {
timelineState: AlertIncidentTimelineState;
activeAlerts: Record<string, Alert>;
alertsDisabled: boolean;
- hasAIAlertsFeature: boolean;
- runtimeCapabilitiesLoading: boolean;
showAcknowledged: boolean;
setShowAcknowledged: (value: boolean) => void;
}
@@ -127,8 +125,6 @@ export function AlertOverviewActiveAlertsSection(props: AlertOverviewActiveAlert
alert={alert}
state={props.state}
timelineState={props.timelineState}
- hasAIAlertsFeature={props.hasAIAlertsFeature}
- runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading}
/>
)}
</For>
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index e9e6e2278c..9ca2175ed4 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -20,8 +20,6 @@ interface AlertOverviewAlertCardProps {
alert: Alert;
state: AlertOverviewState;
timelineState: AlertIncidentTimelineState;
- hasAIAlertsFeature: boolean;
- runtimeCapabilitiesLoading: boolean;
}
export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
@@ -110,7 +108,6 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
}
variant="text"
size="sm"
- licenseLocked={!props.hasAIAlertsFeature && !props.runtimeCapabilitiesLoading}
/>
</div>
</div>
diff --git a/frontend-modern/src/features/alerts/OverviewTab.tsx b/frontend-modern/src/features/alerts/OverviewTab.tsx
index e9c332be93..111351df12 100644
--- a/frontend-modern/src/features/alerts/OverviewTab.tsx
+++ b/frontend-modern/src/features/alerts/OverviewTab.tsx
@@ -18,8 +18,6 @@ export function OverviewTab(props: {
showAcknowledged: () => boolean;
setShowAcknowledged: (value: boolean) => void;
alertsDisabled: () => boolean;
- hasAIAlertsFeature: () => boolean;
- runtimeCapabilitiesLoading: () => boolean;
}) {
const location = useLocation();
let hashScrollRafId: number | undefined;
@@ -77,8 +75,6 @@ export function OverviewTab(props: {
timelineState={timelineState}
activeAlerts={props.activeAlerts}
alertsDisabled={props.alertsDisabled()}
- hasAIAlertsFeature={props.hasAIAlertsFeature()}
- runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading()}
showAcknowledged={props.showAcknowledged()}
setShowAcknowledged={props.setShowAcknowledged}
/>
diff --git a/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx b/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx
index fef705495b..ba4af596d4 100644
--- a/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx
@@ -51,8 +51,6 @@ describe('HistoryTab', () => {
it('renders against the current history-state contract without depending on legacy filteredAlerts', () => {
render(() => (
<HistoryTab
- hasAIAlertsFeature={() => true}
- runtimeCapabilitiesLoading={() => false}
getResource={() => undefined}
allResources={() => []}
/>
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
index 9b4d4d327a..fb21ee4c9f 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
@@ -33,8 +33,6 @@ function defaultProps(overrides: Record<string, unknown> = {}) {
showAcknowledged: () => false,
setShowAcknowledged: vi.fn(),
alertsDisabled: () => false,
- hasAIAlertsFeature: () => true,
- runtimeCapabilitiesLoading: () => false,
...overrides,
};
}
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
index c76f4ebf05..8b7e9ee870 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
@@ -53,8 +53,6 @@ function defaultProps(overrides: Record<string, unknown> = {}) {
showAcknowledged: () => false,
setShowAcknowledged: vi.fn(),
alertsDisabled: () => false,
- hasAIAlertsFeature: () => true,
- runtimeCapabilitiesLoading: () => false,
...overrides,
};
}
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
index 2f38e4ce64..d97e850c62 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
@@ -48,8 +48,6 @@ function defaultProps(overrides: Record<string, unknown> = {}) {
showAcknowledged: () => true,
setShowAcknowledged: vi.fn(),
alertsDisabled: () => false,
- hasAIAlertsFeature: () => true,
- runtimeCapabilitiesLoading: () => false,
...overrides,
};
}
diff --git a/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx b/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx
index bae2651a2b..42cc328661 100644
--- a/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx
+++ b/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx
@@ -13,8 +13,6 @@ import { AlertResourceIncidentsPanel } from '../AlertResourceIncidentsPanel';
import { useAlertHistoryState } from '../useAlertHistoryState';
export interface HistoryTabProps {
- hasAIAlertsFeature: () => boolean;
- runtimeCapabilitiesLoading: () => boolean;
getResource: (resourceId: string) => Resource | undefined;
allResources: () => Resource[];
}
@@ -75,8 +73,6 @@ export function HistoryTab(props: HistoryTabProps) {
<AlertResourceIncidentsPanel state={historyState} getResource={props.getResource} />
<AlertHistoryTableSection
state={historyState}
- hasAIAlertsFeature={props.hasAIAlertsFeature}
- runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading}
/>
<AlertHistoryAdministrationCard state={historyState} />
</div>
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 274f869997..6d9e8f6468 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -1,13 +1,7 @@
-import { createSignal, Show, For, createMemo, createEffect, onMount, onCleanup } from 'solid-js';
+import { createSignal, Show, For, createMemo, createEffect, onCleanup } from 'solid-js';
import { useBeforeLeave } from '@solidjs/router';
import type { JSX } from 'solid-js';
-import {
- hasFeature,
- runtimeCapabilitiesLoaded,
- runtimeCapabilitiesLoading as entitlementsLoading,
- loadRuntimeCapabilities,
-} from '@/stores/license';
import { useLocation, useNavigate } from '@solidjs/router';
import { logger } from '@/utils/logger';
import { Card } from '@/components/shared/Card';
@@ -18,8 +12,6 @@ import Calendar from 'lucide-solid/icons/calendar';
import { useWebSocket } from '@/contexts/appRuntime';
import { useResources } from '@/hooks/useResources';
-import { aiChatStore } from '@/stores/aiChat';
-import { trackPaywallViewed } from '@/utils/upgradeMetrics';
import {
getAlertActivationFailure,
getAlertActivationPresentation,
@@ -163,26 +155,6 @@ export function Alerts() {
localStorage.getItem('hideAlertsQuickTip') !== 'true',
);
- const runtimeCapabilitiesLoading = createMemo(
- () => !runtimeCapabilitiesLoaded() || entitlementsLoading(),
- );
- const hasAIAlertsFeature = createMemo(
- () => !runtimeCapabilitiesLoaded() || hasFeature('ai_alerts'),
- );
-
- createEffect((wasPaywallVisible) => {
- const isPaywallVisible =
- runtimeCapabilitiesLoaded() && aiChatStore.enabled === true && !hasFeature('ai_alerts');
- if (isPaywallVisible && !wasPaywallVisible) {
- trackPaywallViewed('ai_alerts', 'alerts_page');
- }
- return isPaywallVisible;
- }, false);
-
- onMount(() => {
- void loadRuntimeCapabilities();
- });
-
const dismissQuickTip = () => {
setShowQuickTip(false);
localStorage.setItem('hideAlertsQuickTip', 'true');
@@ -410,8 +382,6 @@ export function Alerts() {
showAcknowledged={showAcknowledged}
setShowAcknowledged={setShowAcknowledged}
alertsDisabled={alertsConfigurationLocked}
- hasAIAlertsFeature={hasAIAlertsFeature}
- runtimeCapabilitiesLoading={runtimeCapabilitiesLoading}
/>
</Show>
@@ -433,8 +403,6 @@ export function Alerts() {
<Show when={activeTab() === 'history'}>
<HistoryTab
- hasAIAlertsFeature={hasAIAlertsFeature}
- runtimeCapabilitiesLoading={runtimeCapabilitiesLoading}
getResource={getResource}
allResources={allResources}
/>