Repository navigation
feat(ios): Cloud Voices Settings UI — completes iOS #452 - #482
Conversation
Part of #452. New CloudVoicesSection (Sources/Features/CloudTTS/) wired into SettingsView, shown only when StoreKitBillingManager.isSubscribed. Consent toggle + first-enable disclosure alert, provider picker, per- provider key entry sheet that validates before saving (PRD §6).
…eCloudTtsProvider isSecureField, isSaveEnabled, validateAndSave (including the safety-critical never-saves-on-failed-validation guard), loadConfiguredProviders. New FakeCloudTtsProvider test double mirrors FakeCloudApiKeyStore's shape. Part of #452.
…del.md Per PRD §6/§4: notes iOS's own (permission-manifest-less) equivalent of the play-flavor INTERNET-permission callout, and adds the iOS file paths to the threat model's existing 'Cloud TTS sends reader text to a third-party vendor' row, including the Settings-side key-validation call this PR introduces as the current only live iOS Cloud TTS network path pending #478 (engine wiring). Part of #452.
Marking this PR ready via gh pr ready produced no new pull_request workflow run for iOS App Build & Test / JVM Tests, despite both declaring ready_for_review as a trigger type — matches this issue's own (#452) documented pipeline webhook-delivery flakiness. Empty commit to force a synchronize event now that the PR is non-draft, so CI actually evaluates the real (non-skipped) build jobs.
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
QA verdict for PR #482 vs issue #452Ran: No Xcode/macOS available in this environment (same limitation the PR itself flags), so I verified via the PR's own CI run ( Acceptance criteria (issue #452 scope)
Gap found: no Voice ID input, so Cloud TTS can never actually activate
let providerID = voicePreferences.loadSelectedProvider(),
let voiceID = voicePreferences.loadSelectedVoiceID(), !voiceID.isEmpty,
let credentials = apiKeyStore.load(provider: providerID),
CloudTtsGate.canUseCloudTts(...)
Net effect: a user can subscribe, accept the consent disclosure, pick a provider, and validate+save a real API key — every step this PR's tests cover passes — and still never hear cloud audio. The PR body and its "Closes #452" claim this completes the iOS half of the feature now that #478 has merged. It doesn't yet — the Settings UI needs a Voice ID field (and a call to Other notes (non-blocking)
QA verdict: FAIL |
| QA failed its first round — routing back to the dev agent for one automated retry. |
QA on PR #482 found CloudVoicesSection never captured a Voice ID and never called CloudVoicePreferences.save(selectedVoiceID:), so CloudTtsEngine.performSpeak's gate (merged via #478) could never pass and cloud playback silently fell back to on-device TTS every time. Adds a free-text Voice ID field, shown once a provider is selected (mirrors Android's CloudVoicesSection.kt), bound to CloudVoicePreferences.save(selectedVoiceID:). The field clears when switching to a different provider (extracted as the testable static CloudVoicesSection.voiceID(afterSelecting:previousProvider:currentVoiceID:)) so a voice ID never silently carries over to the wrong vendor. Also merges origin/dev: this branch was cut before #478 (Cloud TTS engine wiring) merged, so TTSEngineType.cloud/CloudTtsEngine didn't exist in this working tree yet. Updates KNOWN_LIMITATIONS.md and docs/threat-model.md, which described #478 as not-yet-merged.
Renamed to nextVoiceID(afterSelecting:previousProvider:currentVoiceID:) so it's unambiguously distinct from the @State voiceID property, since this couldn't be compile-checked locally (no Xcode in this environment).
📱 iOS Build Status: FAILED❌ iOS Simulator Build & Unit Tests - cancelled iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
📱 iOS Build Status: FAILED❌ iOS Simulator Build & Unit Tests - failure iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
CI caught this for real: this branch was cut before #478 merged, and #478 independently added its own FakeCloudTtsProvider test double (CloudTtsEngineTestFakes.swift) with a different shape (a Behavior enum, including hangUntilCancelled for its cancellation regression test) than this PR's own FakeCloudTtsProvider.swift (a simpler validateKeyError/synthesizeResult pair). Merging dev in put both declarations in the same LibraVaultTests target, which Swift rejects outright ("invalid redeclaration"). Renamed this PR's own fake (used only by CloudVoicesSectionTests) to FakeCloudVoicesTtsProvider, distinct from #478's own fake — leaves #478's already-merged CloudTtsEngineTests/CloudTtsEngineTestFakes.swift untouched.
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Addressed QA gapFixed the reachability gap QA found:
CI is green: |
QA verification — PR #482 vs issue #452Scope note: issue #452 is iOS's full Premium Cloud TTS Voices feature, delivered across 4 PRs (#472 foundation, #476 vendor adapters, #478 engine wiring, this PR's Settings UI). Foundation/adapters/engine-gate pieces are already merged to Acceptance criteria (issue #452 checklist)
Tests runNo Xcode/macOS toolchain is available in this environment ( Verified instead via the PR's own CI, which is real (not skipped) for the paths this diff touches:
Test quality check
Regressions / related-area check
Gaps / things I could not verify
No blocking issues found. This PR does what it says: adds the Settings UI, and fixes the specific end-to-end reachability bug a prior QA round on this same PR caught. QA verdict: PASS |
Principal review — verdict:
|
…re picker (#492) Fixes #491, found while reviewing the current state of dev: PR #482 (a parallel, independently-authorized dev-agent run on issue #452 that merged while this session's own from-scratch Settings UI PR for the same scope was still in progress — genuine duplicate work, discarded in favor of this small targeted fix instead of a competing rewrite) implemented provider/key/voice-id configuration but never wired activation: `CloudVoicesSection.swift` never referenced `ttsEngineType` anywhere, and `ttsSection`'s segmented Picker listed `TTSEngineType .allCases` unfiltered, making ".cloud" directly selectable there with nothing configured — CloudTtsEngine's own gate would just silently fall back to on-device every time, a confusing dead end disconnected from the Cloud Voices section below it. - `ttsSection`'s Picker now filters out `.cloud` — mirrors Android's `TtsSettingsSection` never listing CLOUD as a bare radio option. Footer copy fixed too (still claimed "no network access"). - New "Use Cloud Voices for Read Aloud" toggle inside `CloudVoicesSection`, shown once a provider is merely *selected* — not gated on already being configured, which is exactly the gating bug Android's own PR #470 hit and fixed (hiding it until configured leaves no discovery path at all). Disabled + explained until the selected provider actually has credentials saved and a non-blank voice id is set. Re-checks `CloudTtsGate.canUseCloudTts` before actually activating, not just relying on the toggle's own `.disabled` affordance. Disabling always reverts to `.system`, gate irrelevant. - Extracted the enable/disable decision as a pure `static func canActivateCloudEngine`, matching this file's own established `isSaveEnabled`/`nextVoiceID` precedent for testability without ViewInspector/snapshot infrastructure (which this repo doesn't have). - `#Preview` needed the two new `@EnvironmentObject`s added. Testing: 6 new `CloudVoicesSectionTests` cases covering `canActivateCloudEngine`'s every branch (no provider selected, wrong provider configured, empty/whitespace voice id, the happy path). The gate re-check itself already has full coverage via `CloudTtsGateTests` (#472) — nothing new to test there. No Xcode/macOS available in this environment — verified by careful manual review against the actual merged file content on dev (`git show origin/dev:...`, not a stale local assumption) and this file's own established static-helper testing convention. Real verification is this PR's own CI run. Closes #491. Part of #452.
What
PR 4 of 4 for iOS's half of Premium Cloud TTS Voices (BYOK) — completes
#452. Builds only on the already-merged foundation (#472) and vendor
adapters (#476); deliberately does not depend on the engine-wiring PR
(#478, still open/
status:needs-human-merge) — the Settings UI only needsCloudVoicePreferences/CloudApiKeyStore/CloudTtsProvider, none of which#478 touches, so this is buildable against
devas it stands today.Mirrors Android's Settings UI PR (#470).
Security-sensitive: human authorization already given
This issue carries the
securitylabel (BYOK key-storage risk profile).Per the dev-agent triage gate, a security-labeled issue normally stops at
status:needs-inforather than proceeding autonomously — but a human(
libravault-xyz,MEMBER) already reviewed and explicitly authorizedproceeding on this issue, in writing, twice (2026-08-23 08:18 and 08:21
UTC comments: "Human authorization to proceed (security-sensitive gate
acknowledged)... Proceeding under this constraint" / "Human authorization
to proceed stands"). The second comment also corrected an earlier
suggestion to stub
isSubscribed— this PR wires straight to the realStoreKitBillingManager.isSubscribed, per that correction and PRD §8, nomock/stub. Flagging this reasoning explicitly rather than silently
proceeding, per the dev-agent persona.
Changes
Sources/Features/CloudTTS/CloudVoicesSection.swift:CloudVoicesSection— aSection(embedded directly inSettingsView'sForm, not a separate screen), owning its own@Statebacked directlyby
CloudVoicePreferences/CloudApiKeyStore— same "local state, ownpersistence, no
AppStateinvolvement" shapeSettingsView's existingscreenSecurityEnabled/loggingEnabledalready use.only shows the first-enable disclosure alert (PRD §6); the switch only
actually commits to on if the user taps "Accept & Enable". Turning off
is immediate, no confirmation needed. Mirrors Android's
toggleable(value = consentEnabled, onValueChange = toggleConsent).showing "✓ Configured" once a key is saved, with "Configure/Update API
Key" and "Remove" actions.
CloudVoicesKeyEntrySheet— per-provider key entry, one field perCloudCredentialFields.requiredFields(for:),SecureFieldfor everyfield except
.region(nothing secret about a region string).CloudVoicesSection.validateAndSave(...)— validates against the realvendor via
CloudTtsProvider.validateKeybefore ever callingCloudApiKeyStore.save(PRD §6: "validated with a single cheap testcall, then stored") — a failed validation never reaches the key store.
A plain
staticasync function, not a method on the live view, so it'sdirectly testable against fakes.
SettingsView.swift: rendersCloudVoicesSection()only whenbillingManager.isSubscribed— real signal, no stub, per the correctionabove. Also updated the "Does LibraVault need an internet connection?"
FAQ answer in
HelpView, which was about to go stale (it claimedunconditional offline operation) — now notes the opt-in exception.
Testing
CloudVoicesSectionTests.swift—isSecureField(region vs. every otherfield),
isSaveEnabled(blank/whitespace-only required field, mid-flightvalidation, all-filled happy path),
validateAndSave(saves on successfulvalidation; never saves when validation fails — the single most
safety-critical assertion here, PRD §6; propagates a key-store-side
failure like a field-count mismatch),
loadConfiguredProviders. NewFakeCloudTtsProvidertest double (mirrors the existingFakeCloudApiKeyStore's shape) added alongside.This project has no ViewInspector/snapshot UI-testing infrastructure (see
EncryptedVaultContentsViewTests.swift's doc comment), so — same as thatprecedent — the view itself stays thin and every piece of actual logic
(
isSecureField/isSaveEnabled/validateAndSave/loadConfiguredProviders)is pulled out as a
staticfunction tested directly, rather than onlybeing exercised implicitly through a
bodyno test here can render.Known limitation of this PR
No Xcode/macOS available in the environment this was written in — verified
by careful manual review against this codebase's established conventions
(
CloudApiKeyStoreTests,EncryptedVaultContentsViewTests,AppStateSettingsTests) rather than a local build. Real verification isthis PR's own CI run.
Part of #452.
Closes #452