Refactor worker port handling and improve logging
- Replaced hardcoded migration port with dynamic port retrieval using `getWorkerPort()` in worker-cli.ts. - Updated context generator to clarify error handling comments. - Introduced timeout constants in ProcessManager for better maintainability. - Configured SQLite settings using constants for mmap size and cache size in DatabaseManager. - Added timeout constants for Git and NPM commands in BranchManager. - Enhanced error logging in FormattingService and SearchManager to provide more context on failures. - Removed deprecated silentDebug function and replaced its usage with logger.debug. - Updated tests to use dynamic worker port retrieval instead of hardcoded values.
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
*/
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { sampleObservation, featureObservation } from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Context Injection (SessionStart)', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
const PROJECT_NAME = 'claude-mem';
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,9 +14,10 @@ import {
|
||||
grepScenario,
|
||||
sessionScenario
|
||||
} from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Observation Capture (PostToolUse)', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
*/
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { sampleObservation, featureObservation } from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Search (MCP Tools)', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
*/
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { sessionScenario } from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Session Cleanup (SessionEnd)', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
*/
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { bashCommandScenario, sessionScenario } from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Session Initialization (UserPromptSubmit)', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
*/
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { sessionSummaryScenario, sessionScenario } from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Session Summary (Stop)', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
@@ -11,9 +11,10 @@ import {
|
||||
sessionScenario,
|
||||
sampleObservation
|
||||
} from '../helpers/scenarios.js';
|
||||
import { getWorkerPort } from '../../src/shared/worker-utils.js';
|
||||
|
||||
describe('Full Observation Lifecycle', () => {
|
||||
const WORKER_PORT = 37777;
|
||||
const WORKER_PORT = getWorkerPort();
|
||||
let sessionId: string;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user