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

test(cos): pin the live socket path for the named health issue

Adam Eivyb9d56ca387a4
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index eef7082561..efdcd4324c 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -213,8 +213,8 @@ export const summarizeHealthIssues = (issues) => {
// StatCard tone for the Issues tile. `error`-type issues mean something is
// broken; a warning-only check (e.g. a memory-hungry process) stays amber
-// rather than screaming red — matching how HealthTab colors the same list.
-// 'default' (not null) so a zero-issue tile keeps its explicit gray icon.
+// rather than screaming red — the same severity split HealthTab draws when it
+// renders the list. 'default' (not null) so a zero-issue tile keeps its gray icon.
export const healthIssueTone = (issues) => {
if (!Array.isArray(issues) || issues.length === 0) return 'default';
return issues.some((issue) => issue?.type === 'error') ? 'critical' : 'warning';
diff --git a/client/src/pages/ChiefOfStaff.test.jsx b/client/src/pages/ChiefOfStaff.test.jsx
index ecfebba51d..6dbf61ac55 100644
--- a/client/src/pages/ChiefOfStaff.test.jsx
+++ b/client/src/pages/ChiefOfStaff.test.jsx
@@ -646,6 +646,28 @@ describe('ChiefOfStaff Issues card', () => {
expect(within(panel).getByText(memoryWarning.message)).toBeInTheDocument();
});
+ // The live path: a health check finishing while the page is open pushes the
+ // issue over the socket rather than through fetchData.
+ it('names the issue arriving on a live health-check socket event', async () => {
+ renderWithIssues([]);
+ // Wait for the clean first paint so the socket handler is registered.
+ for (const card of await issueCards()) expect(within(card).getByText('0')).toBeInTheDocument();
+
+ const handleHealthCheck = socketStub.on.mock.calls.find(([evt]) => evt === 'cos:health:check')?.[1];
+ expect(handleHealthCheck).toBeTypeOf('function');
+ await act(async () => {
+ handleHealthCheck({ metrics: { timestamp: '2026-01-02T00:00:00.000Z' }, issues: [memoryWarning] });
+ });
+
+ expect(await screen.findByText(memoryWarning.message)).toBeInTheDocument();
+ for (const card of await issueCards()) {
+ expect(card).toHaveAttribute('title', memoryWarning.message);
+ expect(within(card).getByText('1')).toBeInTheDocument();
+ }
+ // Drain the >0 branch's speaking timer so no state update escapes act.
+ await act(async () => { await new Promise((resolve) => setTimeout(resolve, 2100)); });
+ });
+
it('stays a click-through to Health when there are no issues at all', async () => {
renderWithIssues([]);