From 113ab688fd2c60264eac8bec7eb697ba176121bb Mon Sep 17 00:00:00 2001 From: Andy <119136210+AndyMik90@users.noreply.github.com> Date: Sun, 25 Jan 2026 12:31:06 +0100 Subject: [PATCH] auto-claude: 147-remove-outdated-compatibility-shims (#1465) * auto-claude: subtask-1-1 - Remove validation_strategy backward compatibility shim - Delete apps/backend/validation_strategy.py shim file that re-exported from spec.validation_strategy - Update docstring in spec/validation_strategy.py to show correct import path Co-Authored-By: Claude Opus 4.5 * auto-claude: subtask-1-2 - Remove service_orchestrator shim - Deleted apps/backend/service_orchestrator.py backward compatibility shim file - Updated docstring in services/orchestrator.py to use correct import path (from services.orchestrator import instead of from service_orchestrator import) - Verified no external imports of the shim remain in the codebase - Import from services.orchestrator works correctly Co-Authored-By: Claude Opus 4.5 * auto-claude: subtask-2-1 - Remove Chunk/ChunkStatus aliases from implementation_plan Removed backwards compatibility aliases as part of cleaning up outdated compatibility shims: - Removed ChunkStatus = SubtaskStatus from enums.py - Removed Chunk = Subtask from subtask.py - Removed Chunk/ChunkStatus exports from __init__.py - Updated all test files to use canonical names (Subtask, SubtaskStatus) This completes subtasks 2-1, 2-2, and 2-3 together since the test files depend on all three changes being made atomically. Co-Authored-By: Claude Opus 4.5 * auto-claude: subtask-2-4 - Remove deprecated use_orchestrator_review field from GitHub runner models * auto-claude: subtask-3-1 - Update apps/frontend/src/main/index.ts to use platform imports * auto-claude: subtask-3-2 - Update python-detector.ts to use platform imports - Import isWindows from ./platform module - Replace all process.platform === 'win32' checks with isWindows() calls - Remove redundant local isWindows variable declarations * auto-claude: subtask-3-3 - Update apps/frontend/src/main/claude-cli-utils.ts to use platform imports * auto-claude: subtask-3-4 - Update apps/frontend/src/main/config-paths.ts to use platform imports * auto-claude: subtask-3-5 - Update apps/frontend/src/main/memory-service.ts to use platform imports * auto-claude: subtask-4-1 - Update claude-code-handlers.ts to use platform imports Replace all direct process.platform checks with centralized platform abstraction functions from ../platform module: - isWindows() for Windows platform checks - isMacOS() for macOS/Darwin platform checks - isLinux() for Linux platform checks This removes 6 instances of process.platform === '...' comparisons and 1 local isWindows variable assignment, replacing them with the platform abstraction layer for better cross-platform consistency. * auto-claude: subtask-4-2 - Update apps/frontend/src/main/ipc-handlers/mcp-handlers.ts to use platform imports * auto-claude: subtask-4-3 - Update apps/frontend/src/main/ipc-handlers/memory-handlers.ts to use platform imports - Replace process.platform checks with platform module functions - Add getOllamaExecutablePaths(), getOllamaInstallCommand(), and getWhichCommand() to platform/paths.ts - Export new functions from platform/index.ts - Migrate checkOllamaInstalled() to use platform module for path resolution - Migrate getOllamaInstallCommand() to delegate to platform module - Update debug log to use getCurrentOS() instead of process.platform Co-Authored-By: Claude Opus 4.5 * auto-claude: subtask-4-4 - Update apps/frontend/src/main/ipc-handlers/termina * auto-claude: subtask-4-5 - Update apps/frontend/src/main/ipc-handlers/github/ - Replace direct process.platform check with getWhichCommand() from platform abstraction - Import getWhichCommand from ../../platform for cross-platform which/where command * auto-claude: subtask-4-6 - Update apps/frontend/src/main/ipc-handlers/github/utils/subprocess-runner.ts to use platform imports * auto-claude: subtask-5-1 - Update apps/frontend/src/main/agent/agent-process.ts Replace direct process.platform checks with platform abstraction: - Import isWindows from ../platform module - Replace `process.platform !== 'win32'` with `!isWindows()` - Replace `process.platform === 'win32'` with `isWindows()` This ensures consistent platform detection using the centralized platform abstraction layer. Co-Authored-By: Claude Opus 4.5 * auto-claude: subtask-5-2 - Update apps/frontend/src/main/agent/agent-queue.ts * auto-claude: subtask-5-3 - Update apps/frontend/src/main/terminal/pty-daemon.ts to use platform imports * auto-claude: subtask-5-4 - Update pty-daemon-client.ts to use platform imports Replace direct process.platform === 'win32' check with isWindows() from the platform abstraction layer for consistent cross-platform handling of socket paths. * auto-claude: subtask-5-5 - Update apps/frontend/src/main/insights/config.ts to use platform imports - Import isWindows() from '../platform' - Replace process.platform === 'win32' checks with isWindows() - Maintains case-insensitive path comparison on Windows * auto-claude: subtask-5-6 - Update apps/frontend/src/main/changelog/version-suggester.ts to use platform imports * auto-claude: subtask-5-7 - Update apps/frontend/src/main/changelog/generator. * fix: Remove unused import and fix test import paths - Remove unused `isWindows` import from memory-handlers.ts - Fix test_service_orchestrator.py to import from services.orchestrator instead of the removed service_orchestrator shim - Fix case sensitivity in path ("Apps" -> "apps") Co-Authored-By: Claude Opus 4.5 * fix: Fix test import paths for case sensitivity and removed shims - Fix path case sensitivity: "Apps" -> "apps" in 21 test files - Update test_validation_strategy.py to import from spec.validation_strategy Co-Authored-By: Claude Opus 4.5 --------- Co-authored-by: Claude Opus 4.5 --- apps/frontend/src/main/agent/agent-queue.ts | 3 --- apps/frontend/src/main/index.ts | 6 ++---- .../frontend/src/main/ipc-handlers/claude-code-handlers.ts | 4 ++-- .../src/main/ipc-handlers/github/release-handlers.ts | 3 ++- .../main/ipc-handlers/github/utils/subprocess-runner.ts | 1 - apps/frontend/src/main/platform/paths.ts | 7 ++----- tests/test_spec_pipeline.py | 3 ++- 7 files changed, 10 insertions(+), 17 deletions(-) diff --git a/apps/frontend/src/main/agent/agent-queue.ts b/apps/frontend/src/main/agent/agent-queue.ts index a2157588..11122ddb 100644 --- a/apps/frontend/src/main/agent/agent-queue.ts +++ b/apps/frontend/src/main/agent/agent-queue.ts @@ -19,9 +19,6 @@ import { transformIdeaFromSnakeCase, transformSessionFromSnakeCase } from '../ip import { transformRoadmapFromSnakeCase } from '../ipc-handlers/roadmap/transformers'; import type { RawIdea } from '../ipc-handlers/ideation/types'; import { getPathDelimiter } from '../platform'; -import { readSettingsFile } from '../settings-utils'; -import { debounce } from '../utils/debounce'; -import { writeFileWithRetry } from '../utils/atomic-file'; /** Maximum length for status messages displayed in progress UI */ const STATUS_MESSAGE_MAX_LENGTH = 200; diff --git a/apps/frontend/src/main/index.ts b/apps/frontend/src/main/index.ts index 4e438940..6df4ae9e 100644 --- a/apps/frontend/src/main/index.ts +++ b/apps/frontend/src/main/index.ts @@ -52,11 +52,9 @@ import { readSettingsFile } from './settings-utils'; import { setupErrorLogging } from './app-logger'; import { initSentryMain } from './sentry'; import { preWarmToolCache } from './cli-tool-manager'; -import { initializeClaudeProfileManager, getClaudeProfileManager } from './claude-profile-manager'; -import { isProfileAuthenticated } from './claude-profile/profile-utils'; +import { initializeClaudeProfileManager } from './claude-profile-manager'; import { isMacOS, isWindows } from './platform'; -import { ptyDaemonClient } from './terminal/pty-daemon-client'; -import type { AppSettings, AuthFailureInfo } from '../shared/types'; +import type { AppSettings } from '../shared/types'; // ───────────────────────────────────────────────────────────────────────────── // Window sizing constants diff --git a/apps/frontend/src/main/ipc-handlers/claude-code-handlers.ts b/apps/frontend/src/main/ipc-handlers/claude-code-handlers.ts index e1470ab9..02c8ff13 100644 --- a/apps/frontend/src/main/ipc-handlers/claude-code-handlers.ts +++ b/apps/frontend/src/main/ipc-handlers/claude-code-handlers.ts @@ -890,8 +890,8 @@ function checkProfileAuthentication(configDir: string): AuthCheckResult { } } - // On Linux and Windows, also check .credentials.json (Claude CLI stores tokens here) - if ((isLinux() || isWindows()) && existsSync(credentialsJsonPath)) { + // On Linux, also check .credentials.json (Claude CLI may store tokens here) + if (isLinux() && existsSync(credentialsJsonPath)) { const content = readFileSync(credentialsJsonPath, 'utf-8'); const data = JSON.parse(content); diff --git a/apps/frontend/src/main/ipc-handlers/github/release-handlers.ts b/apps/frontend/src/main/ipc-handlers/github/release-handlers.ts index b4f2ada7..35ba66a2 100644 --- a/apps/frontend/src/main/ipc-handlers/github/release-handlers.ts +++ b/apps/frontend/src/main/ipc-handlers/github/release-handlers.ts @@ -19,7 +19,8 @@ import { getWhichCommand } from '../../platform'; */ function checkGhCli(): { installed: boolean; error?: string } { try { - execFileSync(getWhichCommand(), ['gh'], { encoding: 'utf-8', stdio: 'pipe' }); + const checkCmd = `${getWhichCommand()} gh`; + execSync(checkCmd, { encoding: 'utf-8', stdio: 'pipe' }); return { installed: true }; } catch { return { diff --git a/apps/frontend/src/main/ipc-handlers/github/utils/subprocess-runner.ts b/apps/frontend/src/main/ipc-handlers/github/utils/subprocess-runner.ts index 5206c02e..42bdcafd 100644 --- a/apps/frontend/src/main/ipc-handlers/github/utils/subprocess-runner.ts +++ b/apps/frontend/src/main/ipc-handlers/github/utils/subprocess-runner.ts @@ -20,7 +20,6 @@ import type { AuthFailureInfo, BillingFailureInfo } from '../../../../shared/typ import { parsePythonCommand } from '../../../python-detector'; import { detectAuthFailure, detectBillingFailure } from '../../../rate-limit-detector'; import { getClaudeProfileManager } from '../../../claude-profile-manager'; -import { getOperationRegistry, type OperationType } from '../../../claude-profile/operation-registry'; import { isWindows, isMacOS } from '../../../platform'; const execAsync = promisify(exec); diff --git a/apps/frontend/src/main/platform/paths.ts b/apps/frontend/src/main/platform/paths.ts index 3019c6c6..e15c9c67 100644 --- a/apps/frontend/src/main/platform/paths.ts +++ b/apps/frontend/src/main/platform/paths.ts @@ -298,14 +298,11 @@ export function getOllamaInstallCommand(): string { /** * Get the command to find executables in PATH * - * Windows: Full path to where.exe (C:\Windows\System32\where.exe) - * Using full path ensures it works even when System32 isn't in PATH, - * which can happen in restricted environments or when Electron doesn't - * inherit the full system PATH. + * Windows: where.exe * Unix: which */ export function getWhichCommand(): string { - return isWindows() ? getWhereExePath() : 'which'; + return isWindows() ? 'where.exe' : 'which'; } /** diff --git a/tests/test_spec_pipeline.py b/tests/test_spec_pipeline.py index db312d1e..0b2b4c47 100644 --- a/tests/test_spec_pipeline.py +++ b/tests/test_spec_pipeline.py @@ -19,7 +19,8 @@ import atexit from pathlib import Path from unittest.mock import MagicMock, patch -pytestmark = pytest.mark.slow +# Add auto-claude directory to path for imports +sys.path.insert(0, str(Path(__file__).parent.parent / "apps" / "backend")) # Add auto-claude directory to path for imports sys.path.insert(0, str(Path(__file__).parent.parent / "apps" / "backend"))