From ed45a1d87c8bb1ee53c5d6ffafa338fbf1eeb4f0 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 11 Feb 2026 20:44:10 +0900 Subject: [PATCH] Enhance build configuration and testing - Added notarization configuration for macOS builds to support app distribution. - Updated CI workflow to run on Ubuntu instead of macOS for improved compatibility. - Modified test cleanup process to include retry logic for file removal. - Refactored path handling in tests to use path.join for better cross-platform compatibility. --- .github/workflows/ci.yml | 2 +- electron-builder.yml | 2 ++ .../services/discovery/ProjectPathResolver.test.ts | 2 +- test/main/utils/pathDecoder.test.ts | 13 +++++++------ test/main/utils/pathValidation.test.ts | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af55ce4b..0345676d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/electron-builder.yml b/electron-builder.yml index cf2aae91..61c1c22b 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -22,6 +22,8 @@ mac: hardenedRuntime: true gatekeeperAssess: false icon: resources/icons/mac/icon.icns + notarize: + teamId: ${env.APPLE_TEAM_ID} dmg: sign: false diff --git a/test/main/services/discovery/ProjectPathResolver.test.ts b/test/main/services/discovery/ProjectPathResolver.test.ts index 3bdb27b7..085b07cb 100644 --- a/test/main/services/discovery/ProjectPathResolver.test.ts +++ b/test/main/services/discovery/ProjectPathResolver.test.ts @@ -20,7 +20,7 @@ describe('ProjectPathResolver', () => { afterEach(() => { for (const tempDir of tempDirs) { - fs.rmSync(tempDir, { recursive: true, force: true }); + fs.rmSync(tempDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); } tempDirs.length = 0; }); diff --git a/test/main/utils/pathDecoder.test.ts b/test/main/utils/pathDecoder.test.ts index c7e7d293..409871ab 100644 --- a/test/main/utils/pathDecoder.test.ts +++ b/test/main/utils/pathDecoder.test.ts @@ -1,3 +1,4 @@ +import * as path from 'path'; import { describe, expect, it } from 'vitest'; import { @@ -173,13 +174,13 @@ describe('pathDecoder', () => { describe('buildSessionPath', () => { it('should construct correct session path', () => { expect(buildSessionPath('/base', 'project-id', 'session-123')).toBe( - '/base/project-id/session-123.jsonl' + path.join('/base', 'project-id', 'session-123.jsonl') ); }); it('should handle paths with special characters', () => { expect(buildSessionPath('/home/user/.claude/projects', '-Users-name', 'abc123')).toBe( - '/home/user/.claude/projects/-Users-name/abc123.jsonl' + path.join('/home/user/.claude/projects', '-Users-name', 'abc123.jsonl') ); }); }); @@ -187,7 +188,7 @@ describe('pathDecoder', () => { describe('buildSubagentsPath', () => { it('should construct correct subagents path', () => { expect(buildSubagentsPath('/base', 'project-id', 'session-123')).toBe( - '/base/project-id/session-123/subagents' + path.join('/base', 'project-id', 'session-123', 'subagents') ); }); }); @@ -195,20 +196,20 @@ describe('pathDecoder', () => { describe('buildTodoPath', () => { it('should construct correct todo path', () => { expect(buildTodoPath('/home/user/.claude', 'session-123')).toBe( - '/home/user/.claude/todos/session-123.json' + path.join('/home/user/.claude', 'todos', 'session-123.json') ); }); }); describe('getProjectsBasePath', () => { it('should return projects base path', () => { - expect(getProjectsBasePath()).toBe('/home/testuser/.claude/projects'); + expect(getProjectsBasePath()).toBe(path.join('/home/testuser', '.claude', 'projects')); }); }); describe('getTodosBasePath', () => { it('should return todos base path', () => { - expect(getTodosBasePath()).toBe('/home/testuser/.claude/todos'); + expect(getTodosBasePath()).toBe(path.join('/home/testuser', '.claude', 'todos')); }); }); }); diff --git a/test/main/utils/pathValidation.test.ts b/test/main/utils/pathValidation.test.ts index bb3e1ef9..0da3fdfd 100644 --- a/test/main/utils/pathValidation.test.ts +++ b/test/main/utils/pathValidation.test.ts @@ -16,7 +16,7 @@ import { describe('pathValidation', () => { const homeDir = os.homedir(); const claudeDir = path.join(homeDir, '.claude'); - const testProjectPath = '/home/user/my-project'; + const testProjectPath = path.resolve('/home/user/my-project'); describe('isPathWithinAllowedDirectories', () => { it('should allow paths within ~/.claude', () => { @@ -150,7 +150,7 @@ describe('pathValidation', () => { it('should handle normalized paths with ..', () => { // This path resolves correctly but starts outside project const result = validateFilePath( - '/home/user/my-project/../other-project/file.ts', + path.join(testProjectPath, '..', 'other-project', 'file.ts'), testProjectPath ); // Should be rejected because final path is outside project