refactor/updatetestsuite#103
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR modularizes the app by introducing a new MiddleDragCore framework target, moving most logic into the framework for improved module boundaries (notably for Swift concurrency behavior in tests) while keeping the app target as a thin entry point.
Changes:
- Added
MiddleDragCoreandMiddleDragCoreTeststargets and updated the Xcode project/scheme to support the new module. - Promoted key managers/helpers/models to
publicso the app target can consume the framework. - Updated unit tests to
@testable import MiddleDragCoreand added documentation describing the framework extraction.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/FRAMEWORK_EXTRACTION.md | New guide documenting the framework extraction and test target migration. |
| MiddleDrag/Utilities/UpdateManager.swift | Makes UpdateManager (and delegate methods) public for framework consumption. |
| MiddleDrag/Utilities/SystemGestureHelper.swift | Exposes helper and key APIs publicly for cross-module use. |
| MiddleDrag/Utilities/PreferencesManager.swift | Makes manager and key APIs public for framework/app boundary. |
| MiddleDrag/Utilities/LaunchAtLoginManager.swift | Makes manager and key APIs public for framework/app boundary. |
| MiddleDrag/Utilities/AnalyticsManager.swift | Exposes logging/telemetry types publicly for framework consumers. |
| MiddleDrag/UI/MenuBarController.swift | Makes controller public and exports notification names used by the app. |
| MiddleDrag/UI/AlertHelper.swift | Makes helper class and key static APIs public. |
| MiddleDrag/Models/GestureModels.swift | Makes config/preferences types public for framework boundary. |
| MiddleDrag/MiddleDragTests/*.swift | Switches tests to @testable import MiddleDragCore. |
| MiddleDrag/Managers/MultitouchManager.swift | Makes manager APIs public for use from the app module. |
| MiddleDrag/Managers/AccessibilityWrappers.swift | Makes DI protocols/wrappers public to support testing and modularization. |
| MiddleDrag/Managers/AccessibilityMonitor.swift | Makes monitor APIs public for use from the app module. |
| MiddleDrag/AppDelegate.swift | Imports MiddleDragCore in the app entry point. |
| MiddleDrag.xcodeproj/xcshareddata/xcschemes/MiddleDrag.xcscheme | Adds MiddleDragCoreTests to the scheme’s test action. |
| MiddleDrag.xcodeproj/project.pbxproj | Adds framework/test targets, embeds the framework, and updates build/link settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… for improved encapsulation
…raction documentation and adjusting test suite for improved concurrency handling
…nitor to prevent hangs in CI environments and improve thread safety in multitouch operations
…ses, preventing potential dereferencing issues.
…roper cleanup of status item on deallocation
… tests in headless CI environments, improving test reliability.
… in headless CI environments, preventing potential hangs during mouse location retrieval.
…e process and focus on running tests with coverage.
…kflow, and update test methods to conditionally skip based on environment variables, improving test flexibility and reliability.
…ent tests in the CI workflow, simplifying the test configuration and enhancing clarity.
…Services and set a timeout for the build and test job, improving stability and preventing hangs during execution.
…allel testing and limit workers to one, preventing hangs during DeviceMonitor/Multitouch tests.
…it/integration tests, improving test execution flow and preventing unnecessary initialization.
… status item on deallocation, ensuring proper cleanup on both main and background threads.
…ruct for improved memory management and safety during deinitialization, ensuring proper cleanup on both main and background threads. Additionally, modify Xcode project settings to enable Objective-C header installation and adjust build script for debug symbol uploads.
… AppKit screen API calls from background queues in CI environments, ensuring stability and avoiding potential hangs during mouse location retrieval.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
…nt blocking during cleanup operations, ensuring smoother start/stop transitions and enhancing thread safety.
…read mouse location using AppKit on the main thread, ensuring thread safety and improving fallback handling for Quartz coordinates.
This pull request introduces a new
MiddleDragCoremodule and refactors the codebase to support modularization and improved testability. The most important changes include making key manager classes public, updating protocols and dependency injection helpers for accessibility and app lifecycle management, and updating all test imports to use the new core module. Additionally, the Xcode scheme was updated to include tests for the new module.Modularization and Public API Changes
AccessibilityMonitor,MultitouchManager, and their related protocols and helpers to public classes and protocols, enabling their use outside the main app module. This includes making constructors, properties, and methods public where needed. (MiddleDrag/Managers/AccessibilityMonitor.swift,MiddleDrag/Managers/MultitouchManager.swift,MiddleDrag/Managers/AccessibilityWrappers.swift) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]Dependency Injection and Testability
MiddleDrag/Managers/AccessibilityWrappers.swift) [1] [2] [3]Test Infrastructure Updates
MiddleDragtoMiddleDragCoreto target the new module for unit testing. (MiddleDrag/MiddleDragTests/*.swift) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Xcode Scheme Improvements
MiddleDragCoreTestsas a testable target, ensuring tests for the new module are run in CI and development. (MiddleDrag.xcodeproj/xcshareddata/xcschemes/MiddleDrag.xcscheme)App Module Integration
MiddleDragCore, reflecting the new modular structure. (MiddleDrag/AppDelegate.swift)Note
Medium Risk
Moderate risk due to significant Xcode project/target restructuring and widened public API surface, plus concurrency/CI-specific behavioral changes that could affect runtime initialization and event handling.
Overview
Introduces a new
MiddleDragCoreframework target (plusMiddleDragCoreTests) and updates the Xcode scheme/test plan so CI runs the new test bundle instead of the prior app test target; the app target now embeds and depends onMiddleDragCore.To support modularization, many previously-internal types are made
public(e.g.,MultitouchManager,AccessibilityMonitor,Log/CrashReporter,PreferencesManager,LaunchAtLoginManager,UpdateManager, UI helpers), and all unit tests switch@testable importtoMiddleDragCore.Stabilizes CI and test runs by disabling parallel test workers in the GitHub
xcodebuildaction, adding a workflow timeout, skipping app bootstrap and Sentry initialization under XCTest, avoiding postingCGEvents in CI/headless environments, and serializingDeviceMonitorstart/stop with a global lock; several hardware/CGEvent-dependent tests are made opt-in via environment flags.Written by Cursor Bugbot for commit 46c807e. This will update automatically on new commits. Configure here.