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.

Harden demo commercial settings boundary

rcourtman84949d9c3519
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 747c992f0e..ecf3845cf9 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -83,6 +83,7 @@ agreement, and cloud-specific enforcement rules.
61. `frontend-modern/src/utils/pricingHandoff.ts`
62. `frontend-modern/src/utils/selfHostedPlans.ts`
63. `frontend-modern/src/utils/upgradePresentation.ts`
+64. `frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts`
## Shared Boundaries
@@ -191,6 +192,15 @@ trial urgency, observed usage counts, or checkout handoff state. The
commercial posture store and billing-entitlements store must also fail closed
locally until the shared presentation policy resolves, then stay fail-closed
in demo mode so hidden routes are not probed from the browser shell.
+Deep-linkable commercial panels must consume the same resolved presentation
+policy directly, not rely only on settings navigation to keep public-demo
+browsers away from commercial routes. `ProLicensePanel` may instantiate its
+license/trial/recovery state only after the policy resolves and only when
+commercial surfaces are visible. `MonitoredSystemLedgerPanel` must also defer
+ledger reads until that policy resolves and suppress them while commercial
+surfaces are hidden. Public demo mode therefore renders a redacted
+presentation-policy state instead of creating a fake entitlement, probing
+hidden commercial endpoints, or showing monitored-system usage pressure.
The governed browser proof for that posture lives in
`tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts` and is
expected to stay runnable through
diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
index 1612827f4d..9c95e27699 100644
--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
@@ -26,12 +26,18 @@ import {
formatMonitoredSystemSurfaceAttribution,
getMonitoredSystemLedgerErrorState,
getMonitoredSystemLedgerDescription,
+ getMonitoredSystemLedgerHiddenState,
getMonitoredSystemLedgerLoadingState,
+ getMonitoredSystemLedgerPolicyLoadingState,
getMonitoredSystemLedgerUnavailableState,
getMonitoredSystemCountingDetailsToggleLabel,
getMonitoredSystemLedgerPresentation,
} from '@/utils/monitoredSystemPresentation';
import { MonitoredSystemDefinitionDisclosure } from '@/components/Commercial/MonitoredSystemDefinitionDisclosure';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
interface MonitoredSystemLedgerPanelProps {
embedded?: boolean;
@@ -93,7 +99,13 @@ function formatCapturedAt(value: number | undefined): string | null {
}
export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProps = {}) {
- const [explanation, { refetch }] = createResource(() => MonitoredSystemLedgerAPI.explain());
+ const ledgerRequestKey = () =>
+ sessionPresentationPolicyResolved() && !presentationPolicyHidesCommercialSurfaces()
+ ? 'visible'
+ : false;
+ const [explanation, { refetch }] = createResource(ledgerRequestKey, () =>
+ MonitoredSystemLedgerAPI.explain(),
+ );
const [expandedSystemKey, setExpandedSystemKey] = createSignal<string | null>(null);
const presentation = getMonitoredSystemLedgerPresentation();
@@ -139,7 +151,24 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
setExpandedSystemKey((current) => (current === key ? null : key));
};
- const content = (
+ const policyLoadingState = getMonitoredSystemLedgerPolicyLoadingState();
+ const hiddenState = getMonitoredSystemLedgerHiddenState();
+
+ const policyLoadingContent = (
+ <div class="rounded-lg border border-border bg-surface px-4 py-4 text-sm">
+ <p class="font-semibold text-base-content">{policyLoadingState.title}</p>
+ <p class="mt-1 text-muted">{policyLoadingState.message}</p>
+ </div>
+ );
+
+ const hiddenContent = (
+ <div class="rounded-lg border border-border bg-surface px-4 py-4 text-sm">
+ <p class="font-semibold text-base-content">{hiddenState.title}</p>
+ <p class="mt-1 text-muted">{hiddenState.message}</p>
+ </div>
+ );
+
+ const ledgerContent = (
<>
{/* Summary */}
<div class="space-y-1">
@@ -428,6 +457,14 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
</>
);
+ const content = (
+ <Show when={sessionPresentationPolicyResolved()} fallback={policyLoadingContent}>
+ <Show when={!presentationPolicyHidesCommercialSurfaces()} fallback={hiddenContent}>
+ {ledgerContent}
+ </Show>
+ </Show>
+ );
+
if (props.embedded) {
return <div class="space-y-4">{content}</div>;
}
diff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
index a2aaf9db18..38c26de7a8 100644
--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
@@ -9,13 +9,49 @@ import { useProLicensePanelState } from './useProLicensePanelState';
import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from './selfHostedBillingPresentation';
import { Subtabs } from '@/components/shared/Subtabs';
import { getMonitoredSystemBriefSummary } from '@/utils/monitoredSystemPresentation';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
import {
SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
SELF_HOSTED_PRO_BILLING_RECOVERY_SECTION_ID,
SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID,
} from '@/utils/pricingHandoff';
-export const ProLicensePanel: Component = () => {
+const ProLicensePolicyLoadingPanel: Component = () => (
+ <CommercialBillingShell
+ title={SELF_HOSTED_PRO_BILLING_PRESENTATION.hiddenShellTitle}
+ description={SELF_HOSTED_PRO_BILLING_PRESENTATION.hiddenShellDescription}
+ icon={<ShieldCheck class="w-5 h-5" />}
+ loading={false}
+ >
+ <div class="rounded-lg border border-border bg-surface px-4 py-4 text-sm">
+ <p class="font-semibold text-base-content">
+ {SELF_HOSTED_PRO_BILLING_PRESENTATION.policyLoadingTitle}
+ </p>
+ <p class="mt-1 text-muted">{SELF_HOSTED_PRO_BILLING_PRESENTATION.policyLoadingBody}</p>
+ </div>
+ </CommercialBillingShell>
+);
+
+const ProLicenseHiddenPanel: Component = () => (
+ <CommercialBillingShell
+ title={SELF_HOSTED_PRO_BILLING_PRESENTATION.hiddenShellTitle}
+ description={SELF_HOSTED_PRO_BILLING_PRESENTATION.hiddenShellDescription}
+ icon={<ShieldCheck class="w-5 h-5" />}
+ loading={false}
+ >
+ <div class="rounded-lg border border-border bg-surface px-4 py-4 text-sm">
+ <p class="font-semibold text-base-content">
+ {SELF_HOSTED_PRO_BILLING_PRESENTATION.hiddenStateTitle}
+ </p>
+ <p class="mt-1 text-muted">{SELF_HOSTED_PRO_BILLING_PRESENTATION.hiddenStateBody}</p>
+ </div>
+ </CommercialBillingShell>
+);
+
+const ProLicensePanelContent: Component = () => {
const state = useProLicensePanelState();
return (
@@ -123,4 +159,17 @@ export const ProLicensePanel: Component = () => {
);
};
+export const ProLicensePanel: Component = () => (
+ <div class="space-y-6">
+ <Show when={sessionPresentationPolicyResolved()} fallback={<ProLicensePolicyLoadingPanel />}>
+ <Show
+ when={!presentationPolicyHidesCommercialSurfaces()}
+ fallback={<ProLicenseHiddenPanel />}
+ >
+ <ProLicensePanelContent />
+ </Show>
+ </Show>
+ </div>
+);
+
export default ProLicensePanel;
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index 42352ddc34..266675696d 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -1,4 +1,4 @@
-import { afterEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import type { JSX } from 'solid-js';
@@ -8,6 +8,8 @@ import type {
} from '@/api/monitoredSystemLedger';
const explainMock = vi.fn<() => Promise<MonitoredSystemLedgerExplainResponse>>();
+const presentationPolicyHidesCommercialSurfacesMock = vi.fn(() => false);
+const sessionPresentationPolicyResolvedMock = vi.fn(() => true);
const explainResponse = (
ledger: MonitoredSystemLedgerResponse,
@@ -22,6 +24,11 @@ vi.mock('@/api/monitoredSystemLedger', () => ({
},
}));
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesCommercialSurfaces: () => presentationPolicyHidesCommercialSurfacesMock(),
+ sessionPresentationPolicyResolved: () => sessionPresentationPolicyResolvedMock(),
+}));
+
vi.mock('@/components/shared/SettingsPanel', () => ({
default: (props: { children?: JSX.Element; title?: string; description?: string }) => (
<section data-testid="settings-panel">
@@ -52,11 +59,49 @@ vi.mock('@/utils/format', () => ({
import { MonitoredSystemLedgerPanel } from '../MonitoredSystemLedgerPanel';
describe('MonitoredSystemLedgerPanel', () => {
+ beforeEach(() => {
+ presentationPolicyHidesCommercialSurfacesMock.mockReset();
+ sessionPresentationPolicyResolvedMock.mockReset();
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(false);
+ sessionPresentationPolicyResolvedMock.mockReturnValue(true);
+ });
+
afterEach(() => {
cleanup();
explainMock.mockReset();
});
+ it('waits for the session presentation policy before requesting ledger data', () => {
+ sessionPresentationPolicyResolvedMock.mockReturnValue(false);
+
+ render(() => <MonitoredSystemLedgerPanel />);
+
+ expect(explainMock).not.toHaveBeenCalled();
+ expect(screen.getByText('Checking monitored-system visibility')).toBeInTheDocument();
+ expect(screen.getByText(/before loading usage or plan-limit data/i)).toBeInTheDocument();
+ });
+
+ it('hides monitored-system usage in demo mode without requesting the ledger', () => {
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(true);
+
+ render(() => (
+ <MonitoredSystemLedgerPanel
+ monitoredSystemLimit={{
+ key: 'max_monitored_systems',
+ limit: 5,
+ current: 16,
+ state: 'enforced',
+ }}
+ />
+ ));
+
+ expect(explainMock).not.toHaveBeenCalled();
+ expect(screen.getByText('Monitored-system usage is hidden in demo mode')).toBeInTheDocument();
+ expect(screen.getByText(/instead of creating a demo license/i)).toBeInTheDocument();
+ expect(screen.queryByText('16 / 5')).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Try again' })).not.toBeInTheDocument();
+ });
+
it('shows monitored-system loading copy while the ledger request is pending', () => {
explainMock.mockReturnValue(new Promise<MonitoredSystemLedgerExplainResponse>(() => {}));
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index 09cf3ee84a..ce7e5ce7b1 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -13,8 +13,6 @@ import {
getPublicPricingUrl,
getSelfHostedPurchaseStartUrl,
SELF_HOSTED_PRO_BILLING_PLAN_HREF,
- SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
- SELF_HOSTED_PRO_BILLING_PLAN_RECOVERY_HREF,
SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED,
SELF_HOSTED_PRO_BILLING_PURCHASE_CANCELLED,
SELF_HOSTED_PRO_BILLING_PURCHASE_EXPIRED,
@@ -36,6 +34,8 @@ const activateLicenseMock = vi.fn();
const clearLicenseMock = vi.fn();
const notificationSuccessMock = vi.fn();
const notificationErrorMock = vi.fn();
+const presentationPolicyHidesCommercialSurfacesMock = vi.fn(() => false);
+const sessionPresentationPolicyResolvedMock = vi.fn(() => true);
const useLocationMock = vi.fn(() => ({
search: '',
pathname: '/settings/system/billing/plan',
@@ -72,6 +72,11 @@ vi.mock('@/stores/licenseEntitlements', () => ({
loadLicenseEntitlements: (...args: unknown[]) => loadLicenseEntitlementsMock(...args),
}));
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesCommercialSurfaces: () => presentationPolicyHidesCommercialSurfacesMock(),
+ sessionPresentationPolicyResolved: () => sessionPresentationPolicyResolvedMock(),
+}));
+
vi.mock('@/api/license', () => ({
LicenseAPI: {
activateLicense: (...args: unknown[]) => activateLicenseMock(...args),
@@ -113,6 +118,8 @@ describe('ProLicensePanel', () => {
clearLicenseMock.mockReset();
notificationSuccessMock.mockReset();
notificationErrorMock.mockReset();
+ presentationPolicyHidesCommercialSurfacesMock.mockReset();
+ sessionPresentationPolicyResolvedMock.mockReset();
useLocationMock.mockReset();
navigateMock.mockReset();
getUpgradeActionDestinationMock.mockReset();
@@ -124,6 +131,8 @@ describe('ProLicensePanel', () => {
startProTrialMock.mockResolvedValue(undefined);
activateLicenseMock.mockResolvedValue({ success: true });
clearLicenseMock.mockResolvedValue({ success: true });
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(false);
+ sessionPresentationPolicyResolvedMock.mockReturnValue(true);
getUpgradeActionDestinationMock.mockImplementation((feature?: string) => ({
href: getPublicPricingUrl(feature),
external: true,
@@ -142,6 +151,38 @@ describe('ProLicensePanel', () => {
cleanup();
});
+ it('fails closed until the session presentation policy is resolved', () => {
+ sessionPresentationPolicyResolvedMock.mockReturnValue(false);
+
+ renderPanel();
+
+ expect(loadLicenseEntitlementsMock).not.toHaveBeenCalled();
+ expect(screen.getByText('Loading settings access')).toBeInTheDocument();
+ expect(
+ screen.getByText(/before showing license, billing, or usage details/i),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByRole('button', { name: /start 14-day pro trial/i }),
+ ).not.toBeInTheDocument();
+ });
+
+ it('hides commercial details in demo mode without loading license state', () => {
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(true);
+
+ renderPanel();
+
+ expect(loadLicenseEntitlementsMock).not.toHaveBeenCalled();
+ expect(loadRuntimeLicenseStatusMock).not.toHaveBeenCalled();
+ expect(loadCommercialPostureMock).not.toHaveBeenCalled();
+ expect(screen.getByText('License and billing details are hidden')).toBeInTheDocument();
+ expect(screen.getByText(/instead of creating a demo license/i)).toBeInTheDocument();
+ expect(screen.queryByText('Pulse Pro')).not.toBeInTheDocument();
+ expect(screen.queryByText('Monitored Systems')).not.toBeInTheDocument();
+ expect(
+ screen.queryByRole('button', { name: /start 14-day pro trial/i }),
+ ).not.toBeInTheDocument();
+ });
+
it('shows start trial action only when trial_eligible is true', async () => {
renderPanel();
@@ -733,6 +774,9 @@ describe('ProLicensePanel', () => {
it('keeps Pro license split into shell, runtime, and plan owners', () => {
expect(proLicensePanelSource).toContain('./useProLicensePanelState');
+ expect(proLicensePanelSource).toContain('sessionPresentationPolicyResolved');
+ expect(proLicensePanelSource).toContain('presentationPolicyHidesCommercialSurfaces');
+ expect(proLicensePanelSource).toContain('ProLicensePanelContent');
expect(proLicensePanelSource).toContain('./ProLicensePlanSection');
expect(proLicensePanelSource).toContain('SelfHostedCommercialRecoverySection');
expect(proLicensePanelSource).toContain('SELF_HOSTED_PRO_BILLING_PRESENTATION');
diff --git a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
index e12ec66f2e..e8aaddd61b 100644
--- a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
+++ b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
@@ -10,6 +10,12 @@ export interface SelfHostedProBillingPresentation {
planSectionTitle: string;
planSectionDescription: string;
usageSectionTitle: string;
+ hiddenShellTitle: string;
+ hiddenShellDescription: string;
+ hiddenStateTitle: string;
+ hiddenStateBody: string;
+ policyLoadingTitle: string;
+ policyLoadingBody: string;
monitoredSystemUpgradeArrivalTitle: string;
monitoredSystemUpgradeArrivalBody: string;
monitoredSystemUpgradeArrivalActionLabel: string;
@@ -39,6 +45,14 @@ export const SELF_HOSTED_PRO_BILLING_PRESENTATION: SelfHostedProBillingPresentat
planSectionTitle: 'Plan',
planSectionDescription: 'Review your active plan, expiry, included limits, and paid capabilities.',
usageSectionTitle: 'Usage',
+ hiddenShellTitle: 'Demo mode',
+ hiddenShellDescription: 'Commercial settings are hidden for this session.',
+ hiddenStateTitle: 'License and billing details are hidden',
+ hiddenStateBody:
+ 'This public demo uses sample infrastructure data, so Pulse hides license identity, billing state, monitored-system usage, and upgrade actions instead of creating a demo license.',
+ policyLoadingTitle: 'Loading settings access',
+ policyLoadingBody:
+ 'Pulse waits for the session presentation policy before showing license, billing, or usage details.',
monitoredSystemUpgradeArrivalTitle: 'Need a higher monitored-system cap?',
monitoredSystemUpgradeArrivalBody:
'Open Pulse Account to compare self-hosted plans, complete checkout, and return here with Pulse Pro activated automatically.',
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 70c8e3b957..c9e31faa01 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -2860,7 +2860,8 @@ describe('frontend resource type boundaries', () => {
expect(trialBannerStateSource).toContain('createSignal');
expect(trialBannerStateSource).toContain('createMemo');
expect(trialBannerStateSource).not.toContain('loadCommercialPosture');
- expect(trialBannerStateSource).toContain('commercialPosture');
+ expect(trialBannerStateSource).toContain('isCommercialTrialActive');
+ expect(trialBannerStateSource).toContain('commercialTrialDaysRemaining');
expect(trialBannerStateSource).toContain('presentationPolicyHidesCommercialSurfaces');
expect(trialBannerStateSource).toContain('getUpgradeActionDestination');
expect(trialBannerStateSource).toContain('snoozeUpsell');
diff --git a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
index b0ea727a50..c8426d2bf5 100644
--- a/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/monitoredSystemPresentation.test.ts
@@ -18,8 +18,10 @@ import {
getMonitoredSystemExplanationFallbackSummary,
getMonitoredSystemLedgerDescription,
getMonitoredSystemLedgerErrorState,
+ getMonitoredSystemLedgerHiddenState,
getMonitoredSystemLedgerLoadingState,
getMonitoredSystemLedgerPresentation,
+ getMonitoredSystemLedgerPolicyLoadingState,
getMonitoredSystemLedgerUnavailableState,
getMonitoredSystemLimitInstallCollectorsLabel,
getMonitoredSystemLimitLearnMoreLabel,
@@ -73,6 +75,16 @@ describe('monitoredSystemPresentation', () => {
rebuildPendingMessage:
'Pulse has collected provider-owned inventory and is rebuilding the canonical monitored-system ledger. Usage will appear when that rebuild finishes.',
},
+ policyLoadingState: {
+ title: 'Checking monitored-system visibility',
+ message:
+ 'Pulse waits for the session presentation policy before loading usage or plan-limit data.',
+ },
+ hiddenState: {
+ title: 'Monitored-system usage is hidden in demo mode',
+ message:
+ 'The public demo uses sample infrastructure data, so Pulse hides counted-system totals, plan limits, and upgrade actions instead of creating a demo license.',
+ },
countingDetailsCollapsedLabel: 'View counting details',
countingDetailsExpandedLabel: 'Hide counting details',
currentStatusHeading: 'Current status',
@@ -134,6 +146,16 @@ describe('monitoredSystemPresentation', () => {
rebuildPendingMessage:
'Pulse has collected provider-owned inventory and is rebuilding the canonical monitored-system ledger. Usage will appear when that rebuild finishes.',
});
+ expect(getMonitoredSystemLedgerPolicyLoadingState()).toEqual({
+ title: 'Checking monitored-system visibility',
+ message:
+ 'Pulse waits for the session presentation policy before loading usage or plan-limit data.',
+ });
+ expect(getMonitoredSystemLedgerHiddenState()).toEqual({
+ title: 'Monitored-system usage is hidden in demo mode',
+ message:
+ 'The public demo uses sample infrastructure data, so Pulse hides counted-system totals, plan limits, and upgrade actions instead of creating a demo license.',
+ });
expect(getMonitoredSystemCountingDetailsToggleLabel(false)).toBe('View counting details');
expect(getMonitoredSystemCountingDetailsToggleLabel(true)).toBe('Hide counting details');
expect(getMonitoredSystemExplanationFallbackSummary()).toBe(
diff --git a/frontend-modern/src/utils/monitoredSystemPresentation.ts b/frontend-modern/src/utils/monitoredSystemPresentation.ts
index 8816f722df..715904e0ea 100644
--- a/frontend-modern/src/utils/monitoredSystemPresentation.ts
+++ b/frontend-modern/src/utils/monitoredSystemPresentation.ts
@@ -50,6 +50,16 @@ const MONITORED_SYSTEM_LEDGER_PRESENTATION = {
rebuildPendingMessage:
'Pulse has collected provider-owned inventory and is rebuilding the canonical monitored-system ledger. Usage will appear when that rebuild finishes.',
},
+ policyLoadingState: {
+ title: 'Checking monitored-system visibility',
+ message:
+ 'Pulse waits for the session presentation policy before loading usage or plan-limit data.',
+ },
+ hiddenState: {
+ title: 'Monitored-system usage is hidden in demo mode',
+ message:
+ 'The public demo uses sample infrastructure data, so Pulse hides counted-system totals, plan limits, and upgrade actions instead of creating a demo license.',
+ },
countingDetailsCollapsedLabel: 'View counting details',
countingDetailsExpandedLabel: 'Hide counting details',
currentStatusHeading: 'Current status',
@@ -126,6 +136,14 @@ export function getMonitoredSystemLedgerUnavailableState() {
return MONITORED_SYSTEM_LEDGER_PRESENTATION.unavailableState;
}
+export function getMonitoredSystemLedgerPolicyLoadingState() {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.policyLoadingState;
+}
+
+export function getMonitoredSystemLedgerHiddenState() {
+ return MONITORED_SYSTEM_LEDGER_PRESENTATION.hiddenState;
+}
+
export function formatMonitoredSystemLedgerUnavailableMessage(reason?: string): string {
switch (normalizeMonitoredSystemValue(reason)) {
case 'supplemental_inventory_unsettled':
diff --git a/tests/integration/tests/51-quickstart-cross-surface.spec.ts b/tests/integration/tests/51-quickstart-cross-surface.spec.ts
index abe425df30..6476defd78 100644
--- a/tests/integration/tests/51-quickstart-cross-surface.spec.ts
+++ b/tests/integration/tests/51-quickstart-cross-surface.spec.ts
@@ -656,7 +656,8 @@ test.describe("Quickstart cross-surface browser contract", () => {
await page.getByRole("button", { name: "Enable AI services" }).click();
- expect(surface.updateRequests).toHaveLength(1);
+ await expect.poll(() => surface.updateRequests.length).toBe(1);
+ expect(surface.updateRequests[0]).toMatchObject({ enabled: true });
await expect(page.getByText("Choose a provider to get started")).toHaveCount(0);
});
});
diff --git a/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts b/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts
index 12201257a4..fd9e59b761 100644
--- a/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts
+++ b/tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts
@@ -157,7 +157,7 @@ base.describe('Demo mode commercial boundary', () => {
});
});
- await page.route('**/api/license/monitored-system-ledger', async (route) => {
+ await page.route('**/api/license/monitored-system-ledger**', async (route) => {
monitoredSystemLedgerRequests += 1;
await route.fulfill({
status: 404,
@@ -184,7 +184,9 @@ base.describe('Demo mode commercial boundary', () => {
});
});
- await page.goto('/settings/system/billing', { waitUntil: 'domcontentloaded' });
+ await page.goto('/settings/system/billing/usage?details=counting-rules', {
+ waitUntil: 'domcontentloaded',
+ });
await page.waitForURL('**/settings/infrastructure/install', { timeout: 15_000 });
await expect
@@ -269,7 +271,7 @@ base.describe('Demo mode commercial boundary', () => {
await hiddenNotFound('**/api/license/activate');
await hiddenNotFound('**/api/license/clear');
await hiddenNotFound('**/api/license/trial/start');
- await hiddenNotFound('**/api/license/monitored-system-ledger');
+ await hiddenNotFound('**/api/license/monitored-system-ledger**');
await hiddenNotFound('**/api/admin/orgs/**/billing-state');
await hiddenNotFound('**/api/upgrade-metrics/**');
await hiddenNotFound('**/auth/license-purchase-start**');