uttrflow / uttrflow/uttrflow-swift
No test covers how the app reports the speech model's state after loading it at launch
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`AppDelegate.loadSpeechModel()` (`Sources/Uttrflow/AppDelegate.swift:256-279`) decides what every dictation surface shows after the recogniser loads:
```swift
speechReadiness =
isReady ? .ready : modelStore.isInstalled(.default) ? .loadFailed : .notInstalled
```
(lines 274-275), and before loading, `.notInstalled` if the model is not on disk (lines 257-260). #363 added the loading state that depends on this, and #403 changed what counts as installed, which this decision reads. `.loadFailed` leads to the repair path (`repairSpeechModel()`, reached from `perform(_:)` at line 1813). `AppDelegate.swift` is excluded from coverage, and no test checks this decision: swapping `.loadFailed` and `.notInstalled` would send users to the wrong recovery (download instead of repair) with every test still green.
## How to check
`Tests/UttrflowUXTests/SpeechModelLoadingSurfacesTests.swift` tests how each `SpeechModelReadiness` is drawn, but nothing tests which readiness a load produces.
## Acceptance criteria
- The decision moves into a pure function next to `SpeechModelReadiness` in `Sources/UttrflowUX/MenuBarPresentation.swift`, for example `static func afterLoad(isReady: Bool, isInstalled: Bool) -> SpeechModelReadiness`, and `loadSpeechModel()` uses it. Behaviour is unchanged.
- Tests cover all four combinations: ready and installed; ready but no longer reported installed (still `.ready`); not ready and installed (`.loadFailed`); not ready and not installed (`.notInstalled`).
## Where to start
- `Sources/Uttrflow/AppDelegate.swift:256-279`
- `Sources/UttrflowUX/MenuBarPresentation.swift:15` (`SpeechModelReadiness`)
- Tests to extend: `Tests/UttrflowUXTests/SpeechModelLoadingSurfacesTests.swift`.
- Before pushing, run `make verify` (export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer first). It is the same command CI runs, and it enforces the 95% coverage floor per module.
- Read [CONTRIBUTING.md](https://github.com/uttrflow/uttrflow-swift/blob/main/CONTRIBUTING.md) first, and say on this issue that you are taking it.
**Size:** S, about 2 hours.
Contributor guide
Research direction
Read CONTRIBUTING.md, then inspect AppDelegate.swift:256-279 and SpeechModelReadiness in Sources/UttrflowUX/MenuBarPresentation.swift. Extend Tests/UttrflowUXTests/SpeechModelLoadingSurfacesTests.swift to cover all four readiness combinations, verify the launch-loading path uses the shared decision, and run make verify with the specified DEVELOPER_DIR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop, testing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100