Skip to content

Split the largest app files and run tests on pull requests - #3

Merged
wanming merged 6 commits into
mainfrom
claude/project-thread-oj33qx
Oct 4, 2026
Merged

wanming merged 6 commits into
mainfrom
claude/project-thread-oj33qx

Conversation

@wanming

@wanming wanming commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Requested by Tom · project thread

Before: SettingsView.swift (2,650 lines), InkletPopoverView.swift (1,897) and AppCoordinator.swift (1,437) each mixed several jobs. The unit tests ran only during DMG release builds.

After: each large file is split by what it does, with no change to app behavior, and every pull request runs the full test suite.

How:

  • Run the unit test suite on pull requests. Adds .github/workflows/test.yml (swift test on macOS 15) and updates both READMEs.
  • Move selection actions out of AppCoordinator. The Translate/Pronounce flow now lives in SelectionActionsController. AppCoordinator (1,437 → ~920 lines) wires it up and runs shutdown and migration maintenance in the same order as before.
  • Split SettingsView into SettingsViewModel.swift, SettingsView.swift (layout) and SettingsControls.swift (AppKit table, prompt editor, hotkey recorder).
  • Split the writing popover into InkletPopoverViewModel.swift, InkletPopoverView.swift (layout) and InkletTextView.swift (AppKit text editor and key handling).

Code was moved verbatim. Visibility only widened where a type now crosses files, and the unused private PromptMode.builtInIDs set was dropped. Many existing tests check the source text of these files; they now read the new files, so every invariant they guarded still applies.

The branch first removed the unused non-OpenAI provider code, then restored it because provider choice is planned. Net, the provider code is unchanged from main.

Manual QA worth a quick pass: open the writing popover, then transform and insert text; use Translate and Pronounce on a selection; check that Settings panels, prompt-mode reordering and the hotkey recorder still work; quit while a translation is running.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw

Inklet is wired to OpenAI only, so the Anthropic, Gemini and
OpenAI-compatible providers, their presets, the provider factory and
the custom endpoint setting were unreachable. Saved configs that still
carry the old keys keep decoding and fall back to OpenAI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
@wanming wanming self-assigned this Oct 4, 2026
claude added 2 commits October 4, 2026 22:55
The full suite previously ran only inside the DMG release workflow, so
a broken test surfaced at release time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
The Translate and Pronounce flow (selection reads, translation,
speech, copy feedback and their task bookkeeping) now lives in
SelectionActionsController. AppCoordinator wires it up, reports its
idle state to migration and update gating, and drives its shutdown and
maintenance steps in the same order as before.

Source tests that pin the selection invariants now read the new file.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
@wanming
wanming force-pushed the claude/project-thread-oj33qx branch from bce870c to 8b6dc73 Compare October 4, 2026 23:02
claude added 3 commits October 4, 2026 23:04
SettingsViewModel and the notification names move to
SettingsViewModel.swift, and the AppKit-backed prompt mode table,
prompt editor and hotkey recorder move to SettingsControls.swift.
SettingsView.swift keeps the SwiftUI layout. The unused private
PromptMode.builtInIDs set is dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
InkletPopoverViewModel moves to its own file, and the AppKit text
editor and key handling (InkletTextView, its container and native text
view, PopoverKeyEventHandler) move to InkletTextView.swift.
InkletPopoverView.swift keeps the SwiftUI layout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
Reverts "Remove unused non-OpenAI providers". Letting users choose a
provider is planned, so the presets, providers, factory and custom
endpoint setting stay. Call sites are restored in their new files.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzisdHuvFVePscX66cn3Lw
@wanming wanming changed the title Simplify code structure: drop unused providers, split large files Split the largest app files and run tests on pull requests Oct 4, 2026
@wanming
wanming marked this pull request as ready for review October 4, 2026 23:14
@wanming
wanming merged commit 33d2152 into main Oct 4, 2026
2 checks passed
@wanming
wanming deleted the claude/project-thread-oj33qx branch October 4, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants