Skip to content

Split launcher, hotkey and windows-layout into parse/plan/exec and platform modules#936

Open
multiplex55 wants to merge 3 commits intomodulesfrom
codex/refactor-execution-heavy-modules-for-testability
Open

Split launcher, hotkey and windows-layout into parse/plan/exec and platform modules#936
multiplex55 wants to merge 3 commits intomodulesfrom
codex/refactor-execution-heavy-modules-for-testability

Conversation

@multiplex55
Copy link
Owner

Motivation

  • Reduce surface area of code that performs OS side effects by isolating pure parsing and planning logic into testable modules.
  • Make hotkey parsing and normalization unit-testable separately from the runtime listener.
  • Centralize Windows-specific adapters (mouse position, mocks) to a platform area so platform calls are isolated and easier to mock.

Description

  • Split src/launcher.rs into three pieces: src/launcher/parse.rs (action classification and parse_action_kind), src/launcher/plan.rs (pure plan_action/LaunchPlan), and src/launcher/exec.rs (side-effectful execution, launch_action delegates to execute_plan); updated src/launcher.rs to re-export the new surface.
  • Split src/hotkey.rs into src/hotkey/parse.rs (pure parse_hotkey, parse_key, parser tests) and src/hotkey/runtime.rs (listener, HotkeyTrigger/HotkeyListener and runtime helpers), keeping src/hotkey.rs as a thin façade exporting the parse/runtime API.
  • Extract Windows mouse-position/mocks into a new src/platform/windows_api.rs and added pub mod platform; in src/lib.rs, then re-exported platform helpers from src/window_manager.rs so existing callers continue to work.
  • Split src/windows_layout.rs into a small façade plus src/windows_layout/plan.rs with pure matching/score/selection logic (is_rule_match, match_score, restore_plan_select_best and unit tests) and src/windows_layout/apply.rs for applying plans (keeps runtime side effects).
  • Added targeted unit tests: hotkey parser tests in hotkey/parse.rs, launcher planning tests in launcher/plan.rs, and layout rule scoring / best-candidate selection tests in windows_layout/plan.rs.

Testing

  • Ran cargo fmt as part of the work (code formatting/fixups applied).
  • Started cargo check --lib / dependency build to validate the changes, but the full compile was not allowed to complete before handoff so a full build verification is not claimed.
  • Added and exercised unit tests for the pure logic (hotkey parser, launcher planning, layout match scoring) in their respective modules; these tests were written and committed but a complete cargo test run was interrupted during the session.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant