refactor: phase 3 tail — migrate 7 ViewModels and 2 coordinators to AppServices#1120
refactor: phase 3 tail — migrate 7 ViewModels and 2 coordinators to AppServices#1120
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18719e253c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| do { | ||
| if !password.isEmpty && !promptForPassword { | ||
| ConnectionStorage.shared.savePassword(password, for: testConn.id) | ||
| services.connectionStorage.savePassword(password, for: testConn.id) |
There was a problem hiding this comment.
Avoid retaining the form during connection tests
Because services is an instance property, referencing it unqualified inside this [weak self] task makes the closure strongly capture the coordinator before any weak self check. If the user closes the connection form while a slow test is running, the coordinator stays alive and the task can still save temporary secrets and later update or present errors for a dismissed form; capture services explicitly before creating the task (or in the capture list) to preserve the weak-self behavior.
Useful? React with 👍 / 👎.
Summary
Phase 3 tail. 7 ViewModels and 2 coordinators migrated to AppServices DI per the recipe in /tmp/audit/phase3-migration-pattern.md. Pattern proven by PR #1117 QuickSwitcherViewModel exemplar. Mechanical, no behavior change.
Migrated (commit order)
Container changes
AppServices grew by 1 service (FeedbackAPIClient). Followed the "don't over-eagerly containerize" rule: services accessed only by one VM stay as direct .shared rather than bloating the container. Pure single-touch singletons left as is: ToolApprovalCenter, AIKeyStorage, ChatToolRegistry, ERDiagramPositionStorage, GroupStorage, AppSettingsStorage, LinkedFolderWatcher, WelcomeRouter, WindowOpener, TabRouter, WindowLifecycleMonitor, SchemaProviderRegistry, ConnectionDataCache, WindowManager, PluginMetadataRegistry.
Out of scope
MainContentCoordinator's 35 extension files (
Views/Main/Extensions/MainContentCoordinator+*.swift) NOT touched. Those accessservicesvia the main coordinator. Phase 4 territory; would explode this PR.Test plan
Pattern doc
/tmp/audit/phase3-migration-pattern.md unchanged — the recipe held for every migration. No pattern bending needed.