Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

lint(app): route the second violation main grew through config

Nguyen Thanh Dat90d4650d053f
diff --git a/app/src/services/socketService.ts b/app/src/services/socketService.ts
index 06673892f4..c3e9d16500 100644
--- a/app/src/services/socketService.ts
+++ b/app/src/services/socketService.ts
@@ -10,7 +10,7 @@ import { setBackend } from '../store/connectivitySlice';
import { resetForUser, setSocketIdForUser, setStatusForUser } from '../store/socketSlice';
import type { ChannelAuthMode, ChannelConnectionStatus, ChannelType } from '../types/channels';
import type { UserErrorScope } from '../types/userError';
-import { IS_DEV } from '../utils/config';
+import { IS_DEV, IS_TEST } from '../utils/config';
import { createSafeLogData, sanitizeError } from '../utils/sanitize';
import { getCoreRpcToken, getCoreRpcUrl } from './coreRpcClient';
import { createCoreSocket } from './coreSocket';
@@ -26,11 +26,11 @@ const socketWarn = debug('socket:warn');
const socketError = debug('socket:error');
// Enable socket logging in development by default — but never under test.
-// `IS_DEV` is truthy in vitest, so without the MODE guard this force-enable
+// `IS_DEV` is truthy in vitest, so without the `IS_TEST` guard this force-enable
// floods every test file that imports this service (measured: 412 lines /
// 46KB of `flow:approval_request` listener churn in a single run), inflating
// runtime enough to push suites past the runner's foreground timeout.
-if (IS_DEV && import.meta.env.MODE !== 'test') {
+if (IS_DEV && !IS_TEST) {
debug.enable('socket*');
}
diff --git a/app/src/test/setup.ts b/app/src/test/setup.ts
index 9f35c1b4bc..a9afbc1035 100644
--- a/app/src/test/setup.ts
+++ b/app/src/test/setup.ts
@@ -255,6 +255,7 @@ vi.mock('../utils/config', () => ({
CORE_RPC_TIMEOUT_MS: 30_000,
IS_DEV: true,
IS_DEV_LIKE: true,
+ IS_TEST: true,
IS_PROD: false,
E2E_DEFAULT_CORE_MODE: '',
E2E_RESTART_APP_AS_RELOAD: false,
diff --git a/app/src/utils/config.ts b/app/src/utils/config.ts
index 1da0a7f16b..caf548de54 100644
--- a/app/src/utils/config.ts
+++ b/app/src/utils/config.ts
@@ -77,6 +77,13 @@ export const E2E_DEFAULT_CORE_MODE =
*/
export const IS_DEV_LIKE = IS_DEV || import.meta.env.MODE === 'development';
+/**
+ * True under vitest. Distinct from `IS_DEV`, which is *also* true there — so a
+ * dev-only default that must stay off in tests needs both, and reading `MODE`
+ * at the call site is exactly the direct access this module exists to absorb.
+ */
+export const IS_TEST = import.meta.env.MODE === 'test';
+
/** Dev only: skip `.skip_onboarding` workspace check and ignore onboarded state so `/onboarding` always shows. Set `VITE_DEV_FORCE_ONBOARDING=true` in `.env.local`. */
export const DEV_FORCE_ONBOARDING =
import.meta.env.DEV && import.meta.env.VITE_DEV_FORCE_ONBOARDING === 'true';