Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: derive System Health drill-ins from the remediation map (#3790)

[._.]/ Adam Eivyfc9ee39c74ad
diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsx
index cfa260eaf8..fc57ac7d3f 100644
--- a/client/src/pages/SystemHealthPage.jsx
+++ b/client/src/pages/SystemHealthPage.jsx
@@ -30,12 +30,9 @@ const REMEDIATION = {
// Drill-in links shown directly under the alerts so at least one next step is
// above the fold at phone widths (375px), where the metric cards alone push
-// every control off-screen.
-const DRILL_INS = [
- { to: '/data', label: 'Disk usage breakdown' },
- { to: '/devtools/processes', label: 'All processes' },
- { to: '/apps', label: 'Apps' },
-];
+// every control off-screen. Derived from REMEDIATION so a link's label and
+// destination can't drift between the banner and the nav.
+const DRILL_INS = ['disk', 'process', 'apps'].map(type => REMEDIATION[type]);
function pctTone(pct, warn, critical) {
if (pct >= critical) return 'text-port-error';
@@ -141,7 +138,7 @@ export default function SystemHealthPage() {
{health.warnings.map((w, i) => {
const remedy = REMEDIATION[w.type];
return (
- <Banner key={`${w.type}-${i}`} tone="warning" size="md" icon={AlertTriangle} align="start">
+ <Banner key={`${w.type || 'warning'}-${i}`} tone="warning" size="md" icon={AlertTriangle} align="start">
<div>{w.message}</div>
{remedy && (
<Link to={remedy.to} className="inline-block mt-1 font-medium underline underline-offset-2 hover:no-underline">
diff --git a/client/src/pages/SystemHealthPage.test.jsx b/client/src/pages/SystemHealthPage.test.jsx
index 288d42c323..84900f881a 100644
--- a/client/src/pages/SystemHealthPage.test.jsx
+++ b/client/src/pages/SystemHealthPage.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { render, screen, waitFor, within } from '@testing-library/react';
+import { render, screen, within } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
const HEALTH = {
@@ -71,11 +71,11 @@ describe('SystemHealthPage remediation links', () => {
]));
renderPage();
- await screen.findByText('GitHub CLI unusable (unauthenticated)');
+ const banner = (await screen.findByText('GitHub CLI unusable (unauthenticated)')).closest('div');
+ expect(within(banner).queryByRole('link')).toBeNull();
+ // The drill-in nav is unaffected — it always offers its three destinations.
const nav = screen.getByRole('navigation', { name: 'System drill-downs' });
- // Only the drill-in nav's three links exist — the forge alert adds none.
expect(within(nav).getAllByRole('link')).toHaveLength(3);
- expect(screen.getAllByRole('link')).toHaveLength(4);
});
it('renders the drill-in links above the metric cards', async () => {
@@ -84,6 +84,6 @@ describe('SystemHealthPage remediation links', () => {
const nav = await screen.findByRole('navigation', { name: 'System drill-downs' });
const cards = screen.getByText('Memory').closest('section');
- await waitFor(() => expect(nav.compareDocumentPosition(cards) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy());
+ expect(nav.compareDocumentPosition(cards) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
});