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

address review: always update version on successful probe, mock heavy deps in health test

Adam Eivy74d0a38a9ae9
diff --git a/server/routes/health.test.js b/server/routes/health.test.js
index 2cb393b721..68dc0815a7 100644
--- a/server/routes/health.test.js
+++ b/server/routes/health.test.js
@@ -1,8 +1,24 @@
-import { describe, it, expect } from 'vitest';
+import { describe, it, expect, vi } from 'vitest';
import express from 'express';
import request from 'supertest';
import systemHealthRoutes from './systemHealth.js';
+vi.mock('../services/pm2.js', () => ({
+ listProcesses: vi.fn().mockResolvedValue([])
+}));
+
+vi.mock('../services/apps.js', () => ({
+ getAllApps: vi.fn().mockResolvedValue([])
+}));
+
+vi.mock('../services/cos.js', () => ({
+ getStatus: vi.fn().mockResolvedValue(null)
+}));
+
+vi.mock('../lib/db.js', () => ({
+ checkHealth: vi.fn().mockResolvedValue({ connected: false, hasSchema: false })
+}));
+
describe('System Health Routes', () => {
const app = express();
app.use('/api/system', systemHealthRoutes);
diff --git a/server/services/instances.js b/server/services/instances.js
index 15d5e8a60e..2b24acea94 100644
--- a/server/services/instances.js
+++ b/server/services/instances.js
@@ -189,7 +189,7 @@ export async function probePeer(peer) {
entry.lastHealth = lastHealth;
entry.lastApps = remoteApps ?? entry.lastApps ?? null;
if (remoteInstanceId) entry.instanceId = remoteInstanceId;
- if (remoteVersion) entry.version = remoteVersion;
+ if (status === 'online') entry.version = remoteVersion;
// Auto-update name from hostname if current name is just an IP address
const remoteHostname = validName(lastHealth?.hostname, null);
if (remoteHostname && /^\d+\.\d+\.\d+\.\d+$/.test(entry.name)) {