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

fix: scope voice test imports within the merged suite budget

[._.]/ Adam Eivya5e3adf9d88d
diff --git a/server/lib/apiToolResource.test.js b/server/lib/apiToolResource.test.js
index 020ed90c83..78c2d8ad2d 100644
--- a/server/lib/apiToolResource.test.js
+++ b/server/lib/apiToolResource.test.js
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
-import { buildToolResource, TOOL_RESOURCE_TYPE } from './apiToolResource.js';
-import { API_OPERATION_CONTRACTS } from './apiOperationContracts.js';
-import { ERROR_CODES_BY_STATUS } from './errorHandler.js';
+const { buildToolResource, TOOL_RESOURCE_TYPE } = await import('./apiToolResource.js');
+const { API_OPERATION_CONTRACTS } = await import('./apiOperationContracts.js');
+const { ERROR_CODES_BY_STATUS } = await import('./errorHandler.js');
const resource = buildToolResource({ version: '9.9.9' });
const byName = (name) => resource.tools.find((tool) => tool.name === name);
diff --git a/server/routes/publicApiIntegration.test.js b/server/routes/publicApiIntegration.test.js
index b9611bbca0..d5b7d8ce33 100644
--- a/server/routes/publicApiIntegration.test.js
+++ b/server/routes/publicApiIntegration.test.js
@@ -12,9 +12,9 @@ import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { writeFileSync } from 'fs';
import { join } from 'path';
import express from 'express';
-import { request } from '../lib/testHelper.js';
-import { mockPathsDataRoot } from '../lib/mockPathsDataRoot.js';
-import { bindSettingsFile } from '../lib/settingsTestUtil.js';
+const { request } = await import('../lib/testHelper.js');
+const { mockPathsDataRoot } = await import('../lib/mockPathsDataRoot.js');
+const { bindSettingsFile } = await import('../lib/settingsTestUtil.js');
const { tempRoot, makeProxy, cleanup } = mockPathsDataRoot({ prefix: 'portos-publicapi-' });
diff --git a/server/routes/voice.test.js b/server/routes/voice.test.js
index 2ac865afdd..c0682d2350 100644
--- a/server/routes/voice.test.js
+++ b/server/routes/voice.test.js
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import express from 'express';
-import { request } from '../lib/testHelper.js';
+const { request } = await import('../lib/testHelper.js');
// Mock all voice service modules before importing the router so the route
// file's top-level imports resolve to the mocks.
@@ -69,20 +69,20 @@ vi.mock('../services/voice/facetimeBridge.js', () => ({
hangup: vi.fn(),
}));
-import * as config from '../services/voice/config.js';
-import * as health from '../services/voice/health.js';
-import * as bootstrap from '../services/voice/bootstrap.js';
-import * as tts from '../services/voice/tts.js';
-import * as voiceProfiles from '../services/voice/profiles.js';
-import * as profileBenchmarks from '../services/voice/profileBenchmarks.js';
-import * as qwen3TtsRuntime from '../services/voice/qwen3TtsRuntime.js';
-import * as fineTuning from '../services/voice/fineTuning.js';
-import { ServerError } from '../lib/errorHandler.js';
-import * as piperVoices from '../services/voice/piper-voices.js';
-import * as proactiveSpeech from '../services/voice/proactiveSpeech.js';
-import * as facetimeBridge from '../services/voice/facetimeBridge.js';
-import voiceRoutes from './voice.js';
-import { errorEvents } from '../lib/errorHandler.js';
+const config = await import('../services/voice/config.js');
+const health = await import('../services/voice/health.js');
+const bootstrap = await import('../services/voice/bootstrap.js');
+const tts = await import('../services/voice/tts.js');
+const voiceProfiles = await import('../services/voice/profiles.js');
+const profileBenchmarks = await import('../services/voice/profileBenchmarks.js');
+const qwen3TtsRuntime = await import('../services/voice/qwen3TtsRuntime.js');
+const fineTuning = await import('../services/voice/fineTuning.js');
+const { ServerError } = await import('../lib/errorHandler.js');
+const piperVoices = await import('../services/voice/piper-voices.js');
+const proactiveSpeech = await import('../services/voice/proactiveSpeech.js');
+const facetimeBridge = await import('../services/voice/facetimeBridge.js');
+const { default: voiceRoutes } = await import('./voice.js');
+const { errorEvents } = await import('../lib/errorHandler.js');
// Node's EventEmitter throws if 'error' is emitted with zero listeners.
// asyncHandler emits to errorEvents on every route failure, so swallow it
diff --git a/server/routes/voicePublic.test.js b/server/routes/voicePublic.test.js
index 9ea5ea3a71..60ccd6ec94 100644
--- a/server/routes/voicePublic.test.js
+++ b/server/routes/voicePublic.test.js
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import express from 'express';
-import { request } from '../lib/testHelper.js';
+const { request } = await import('../lib/testHelper.js');
vi.mock('../services/voice/tts.js', async () => ({
synthesize: vi.fn(),
@@ -14,9 +14,9 @@ vi.mock('../services/voice/proactiveSpeech.js', () => ({
MAX_PROACTIVE_TEXT_LEN: 2000,
}));
-import * as tts from '../services/voice/tts.js';
-import * as config from '../services/voice/config.js';
-import voicePublicRoutes from './voicePublic.js';
+const tts = await import('../services/voice/tts.js');
+const config = await import('../services/voice/config.js');
+const { default: voicePublicRoutes } = await import('./voicePublic.js');
const buildApp = () => {
const app = express();
diff --git a/server/services/voice/bootstrap.retirement.test.js b/server/services/voice/bootstrap.retirement.test.js
index 3d0a4837e5..6a05b10137 100644
--- a/server/services/voice/bootstrap.retirement.test.js
+++ b/server/services/voice/bootstrap.retirement.test.js
@@ -19,9 +19,9 @@ vi.mock('../../lib/childProcess.js', () => ({ execFile: vi.fn() }));
vi.mock('../settings.js', () => ({ getSettings: vi.fn(), updateSettings: vi.fn() }));
import { existsSync } from 'fs';
-import { whichFirst } from '../../lib/processEnv.js';
+const { whichFirst } = await import('../../lib/processEnv.js');
const { execPm2 } = await import('../pm2.js');
-import { execFile } from '../../lib/childProcess.js';
+const { execFile } = await import('../../lib/childProcess.js');
const { getProviderById } = await import('../providers.js');
const { VOICE_DEFAULTS } = await import('./config.js');
const { reconcile } = await import('./bootstrap.js');
diff --git a/server/services/voice/config.test.js b/server/services/voice/config.test.js
index d1448eb379..72b39211bb 100644
--- a/server/services/voice/config.test.js
+++ b/server/services/voice/config.test.js
@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
vi.mock('../settings.js', () => ({ getSettings: vi.fn(), updateSettings: vi.fn() }));
-import { getSettings, updateSettings } from '../settings.js';
-import { VOICE_DEFAULTS, getVoiceConfig, updateVoiceConfig, invalidateVoiceConfigCache } from './config.js';
+const { getSettings, updateSettings } = await import('../settings.js');
+const { VOICE_DEFAULTS, getVoiceConfig, updateVoiceConfig, invalidateVoiceConfigCache } = await import('./config.js');
beforeEach(() => { vi.clearAllMocks(); invalidateVoiceConfigCache(); });
diff --git a/server/services/voice/tts.test.js b/server/services/voice/tts.test.js
index 4afbda05d4..8dd2194d4b 100644
--- a/server/services/voice/tts.test.js
+++ b/server/services/voice/tts.test.js
@@ -11,12 +11,12 @@ vi.mock('./profiles.js', () => ({ getProfileForSynthesis: vi.fn() }));
vi.mock('./bootstrap.js', () => ({ which: vi.fn() }));
vi.mock('../../lib/processEnv.js', () => ({ whichFirst: vi.fn().mockResolvedValue(null) }));
-import { getVoiceConfig } from './config.js';
-import { synthesizePiper } from './tts-piper.js';
-import { findPiperVoice } from './piper-voices.js';
-import { synthesizeQwen3 } from './tts-qwen3.js';
-import { getProfileForSynthesis } from './profiles.js';
-import { listVoiceEngines, normalizeVoiceEngine, synthesize } from './tts.js';
+const { getVoiceConfig } = await import('./config.js');
+const { synthesizePiper } = await import('./tts-piper.js');
+const { findPiperVoice } = await import('./piper-voices.js');
+const { synthesizeQwen3 } = await import('./tts-qwen3.js');
+const { getProfileForSynthesis } = await import('./profiles.js');
+const { listVoiceEngines, normalizeVoiceEngine, synthesize } = await import('./tts.js');
const CONFIG = {
tts: {