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.

Govern AI settings presentation helper

rcourtman5744499d9ddb
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 467fdaa836..a8c327a85f 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -56,6 +56,7 @@ work extends shared components instead of creating new local variants.
34. `frontend-modern/src/components/Settings/ssoProvidersModel.ts`
35. `frontend-modern/src/utils/ssoProviderPresentation.ts`
36. `frontend-modern/src/utils/systemSettingsPresentation.ts`
+37. `frontend-modern/src/utils/aiSettingsPresentation.ts`
37. `frontend-modern/src/components/Settings/UpdateInstallGuide.tsx`
38. `frontend-modern/src/components/Settings/updatesSettingsModel.ts`
39. `frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx`
@@ -878,6 +879,10 @@ maintenance routes through `AIChatMaintenanceSection.tsx`, and readiness plus
save/test actions route through `AISettingsStatusAndActions.tsx`. Future AI
settings work must extend those section owners instead of re-inlining large
runtime subsections into the shell.
+That same AI settings boundary now also owns
+`frontend-modern/src/utils/aiSettingsPresentation.ts`, so shared loading,
+empty, OAuth, and action/error copy for the settings shell stays on one
+governed helper instead of drifting back into section-local strings.
`frontend-modern/src/components/Settings/AuditLogPanel.tsx`,
`frontend-modern/src/components/Settings/AuditWebhookPanel.tsx`,
`frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`,
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 8f6fca5b6c..8a1dd431af 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2082,6 +2082,7 @@
"frontend-modern/src/features/operations/operationsPageModel.ts",
"frontend-modern/src/features/operations/OperationsPageSurface.tsx",
"frontend-modern/src/pages/Operations.tsx",
+ "frontend-modern/src/utils/aiSettingsPresentation.ts",
"frontend-modern/src/utils/reportingPresentation.ts",
"frontend-modern/src/utils/ssoProviderPresentation.ts",
"frontend-modern/src/utils/systemSettingsPresentation.ts"
@@ -2208,6 +2209,19 @@
"frontend-modern/src/utils/__tests__/reportingPresentation.test.ts"
]
},
+ {
+ "id": "ai-settings-presentation-helper",
+ "label": "AI settings presentation helper proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/utils/aiSettingsPresentation.ts"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts"
+ ]
+ },
{
"id": "dashboard-overview-feature-surface",
"label": "dashboard overview feature proof",
diff --git a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
index 72734f5c1a..9fccfbe1e9 100644
--- a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
@@ -280,7 +280,7 @@ describe('AISettings load failure error state', () => {
renderComponent();
await waitFor(() => {
- expect(screen.getByText(/Failed to load Pulse Assistant settings/)).toBeInTheDocument();
+ expect(screen.getByText(/Unable to load Pulse Assistant settings/)).toBeInTheDocument();
});
// Retry button should be present
@@ -296,7 +296,7 @@ describe('AISettings load failure error state', () => {
renderComponent();
await waitFor(() => {
- expect(screen.getByText(/Failed to load Pulse Assistant settings/)).toBeInTheDocument();
+ expect(screen.getByText(/Unable to load Pulse Assistant settings/)).toBeInTheDocument();
});
// Now mock a successful response for retry
@@ -316,7 +316,7 @@ describe('AISettings load failure error state', () => {
});
// Error banner should be gone
- expect(screen.queryByText(/Failed to load Pulse Assistant settings/)).not.toBeInTheDocument();
+ expect(screen.queryByText(/Unable to load Pulse Assistant settings/)).not.toBeInTheDocument();
// Verify retry actually called getSettings again
expect(getSettingsMock).toHaveBeenCalledTimes(2);
diff --git a/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts b/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts
index a82d2b2f95..75ab8bf788 100644
--- a/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/aiSettingsPresentation.test.ts
@@ -42,16 +42,16 @@ describe('aiSettingsPresentation', () => {
it('returns canonical OAuth callback error messages', () => {
expect(getAIOAuthErrorMessage('missing_params')).toBe(
- 'OAuth callback missing required parameters',
+ 'The authentication callback is missing required parameters.',
);
expect(getAIOAuthErrorMessage('invalid_state')).toBe(
- 'Invalid OAuth state - please try again',
+ 'The authentication session is no longer valid. Try again.',
);
expect(getAIOAuthErrorMessage('token_exchange_failed')).toBe(
- 'Failed to complete authentication with Claude',
+ 'Unable to complete authentication with Claude.',
);
- expect(getAIOAuthErrorMessage('save_failed')).toBe('Failed to save OAuth credentials');
- expect(getAIOAuthErrorMessage('other')).toBe('OAuth error: other');
+ expect(getAIOAuthErrorMessage('save_failed')).toBe('Unable to save OAuth credentials.');
+ expect(getAIOAuthErrorMessage('other')).toBe('Authentication error: other');
});
it('returns canonical ai settings loading and chat-session copy', () => {
@@ -59,7 +59,7 @@ describe('aiSettingsPresentation', () => {
text: 'Loading Pulse Assistant settings...',
});
expect(getAISettingsLoadErrorMessage()).toBe(
- 'Failed to load Pulse Assistant settings. Your configuration could not be retrieved.',
+ 'Unable to load Pulse Assistant settings. Your configuration could not be retrieved.',
);
expect(getAISettingsRetryLabel()).toBe('Retry');
expect(getAIChatSessionsLoadingState()).toEqual({
@@ -68,24 +68,24 @@ describe('aiSettingsPresentation', () => {
expect(getAIChatSessionsEmptyState()).toEqual({
text: 'No chat sessions yet. Start a chat to create one.',
});
- expect(getAIModelsLoadErrorMessage()).toBe('Failed to load models');
+ expect(getAIModelsLoadErrorMessage()).toBe('Unable to load models.');
expect(getAIModelsLoadErrorMessage('Network request failed')).toBe('Network request failed');
- expect(getAIChatSessionsLoadErrorMessage()).toBe('Failed to load chat sessions.');
+ expect(getAIChatSessionsLoadErrorMessage()).toBe('Unable to load chat sessions.');
expect(getAIChatSessionsLoadErrorMessage('Session API offline')).toBe('Session API offline');
});
it('returns canonical ai settings operational failure copy', () => {
- expect(getAISessionSummarizeErrorMessage()).toBe('Failed to summarize session.');
+ expect(getAISessionSummarizeErrorMessage()).toBe('Unable to summarize the session.');
expect(getAISessionSummarizeErrorMessage('provider offline')).toBe('provider offline');
- expect(getAISessionDiffErrorMessage()).toBe('Failed to get session diff.');
+ expect(getAISessionDiffErrorMessage()).toBe('Unable to load the session diff.');
expect(getAISessionDiffErrorMessage('git unavailable')).toBe('git unavailable');
- expect(getAISessionRevertErrorMessage()).toBe('Failed to revert session.');
+ expect(getAISessionRevertErrorMessage()).toBe('Unable to revert the session.');
expect(getAISessionRevertErrorMessage('conflict')).toBe('conflict');
- expect(getAISettingsSaveErrorMessage()).toBe('Failed to save Pulse Assistant settings');
+ expect(getAISettingsSaveErrorMessage()).toBe('Unable to save Pulse Assistant settings.');
expect(getAISettingsSaveErrorMessage('bad request')).toBe('bad request');
- expect(getAICredentialsClearErrorMessage()).toBe('Failed to clear credentials');
+ expect(getAICredentialsClearErrorMessage()).toBe('Unable to clear credentials.');
expect(getAICredentialsClearErrorMessage('permission denied')).toBe('permission denied');
- expect(getAISettingsToggleErrorMessage()).toBe('Failed to update Pulse Assistant setting');
+ expect(getAISettingsToggleErrorMessage()).toBe('Unable to update Pulse Assistant settings.');
expect(getAISettingsToggleErrorMessage('rate limited')).toBe('rate limited');
});
});
diff --git a/frontend-modern/src/utils/aiSettingsPresentation.ts b/frontend-modern/src/utils/aiSettingsPresentation.ts
index 614670f09b..c940ae0fa8 100644
--- a/frontend-modern/src/utils/aiSettingsPresentation.ts
+++ b/frontend-modern/src/utils/aiSettingsPresentation.ts
@@ -5,16 +5,16 @@ export interface AISettingsReadinessPresentation {
}
const AI_OAUTH_ERROR_MESSAGES: Record<string, string> = {
- missing_params: 'OAuth callback missing required parameters',
- invalid_state: 'Invalid OAuth state - please try again',
- token_exchange_failed: 'Failed to complete authentication with Claude',
- save_failed: 'Failed to save OAuth credentials',
+ missing_params: 'The authentication callback is missing required parameters.',
+ invalid_state: 'The authentication session is no longer valid. Try again.',
+ token_exchange_failed: 'Unable to complete authentication with Claude.',
+ save_failed: 'Unable to save OAuth credentials.',
};
-export const AI_SETTINGS_LOAD_MODELS_ERROR = 'Failed to load models';
-export const AI_SETTINGS_LOAD_CHAT_SESSIONS_ERROR = 'Failed to load chat sessions.';
+export const AI_SETTINGS_LOAD_MODELS_ERROR = 'Unable to load models.';
+export const AI_SETTINGS_LOAD_CHAT_SESSIONS_ERROR = 'Unable to load chat sessions.';
export const AI_SETTINGS_LOAD_FAILURE_MESSAGE =
- 'Failed to load Pulse Assistant settings. Your configuration could not be retrieved.';
+ 'Unable to load Pulse Assistant settings. Your configuration could not be retrieved.';
export const AI_SETTINGS_LOAD_RETRY_LABEL = 'Retry';
export function getAIProviderTestResultTextClass(success: boolean): string {
@@ -42,7 +42,7 @@ export function getAISettingsReadinessPresentation(
}
export function getAIOAuthErrorMessage(errorCode: string): string {
- return AI_OAUTH_ERROR_MESSAGES[errorCode] || `OAuth error: ${errorCode}`;
+ return AI_OAUTH_ERROR_MESSAGES[errorCode] || `Authentication error: ${errorCode}`;
}
export function getAISettingsLoadingState() {
@@ -83,30 +83,30 @@ export function getAIChatSessionsEmptyState() {
export function getAISessionSummarizeErrorMessage(message?: string | null) {
const detail = (message || '').trim();
- return detail || 'Failed to summarize session.';
+ return detail || 'Unable to summarize the session.';
}
export function getAISessionDiffErrorMessage(message?: string | null) {
const detail = (message || '').trim();
- return detail || 'Failed to get session diff.';
+ return detail || 'Unable to load the session diff.';
}
export function getAISessionRevertErrorMessage(message?: string | null) {
const detail = (message || '').trim();
- return detail || 'Failed to revert session.';
+ return detail || 'Unable to revert the session.';
}
export function getAISettingsSaveErrorMessage(message?: string | null) {
const detail = (message || '').trim();
- return detail || 'Failed to save Pulse Assistant settings';
+ return detail || 'Unable to save Pulse Assistant settings.';
}
export function getAICredentialsClearErrorMessage(message?: string | null) {
const detail = (message || '').trim();
- return detail || 'Failed to clear credentials';
+ return detail || 'Unable to clear credentials.';
}
export function getAISettingsToggleErrorMessage(message?: string | null) {
const detail = (message || '').trim();
- return detail || 'Failed to update Pulse Assistant setting';
+ return detail || 'Unable to update Pulse Assistant settings.';
}