Repository navigation
fix(desktop): revert Settings toggles to the confirmed value on a failed save (#22780) - #22798
Merged
Merged
Conversation
…led save (#22780) Daily Summary, Store Recordings, and Private Cloud Sync bind their switch directly to the value shown on screen. A failed save (offline, server error, expired session) was only logged: the switch stayed on the side the user picked while the account kept its old value, and the next Settings load quietly flipped it back with no message — for Store Recordings/Private Cloud Sync this means a user believes they changed a privacy-relevant setting when the account never stored the change. #22403 fixed the same symptom for Custom Vocabulary by tracking the value the account last confirmed and restoring it on failure. This extracts that pattern into a small, directly testable BooleanSettingSaver and applies it to the three toggles. Tested: added BooleanSettingSaverTests (new file) exercising save/restore through the production save function with a fake account that can refuse a write; xcrun swift build succeeds; swift-format lint clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Daily Summary, Store Recordings, and Private Cloud Sync switches in macOS Settings
bind directly to the value shown on screen. A failed save (offline, server error,
expired session) was only logged: the switch stayed on the side the user picked
while the account kept its old value, and the next Settings load quietly flipped
it back with no message. For Store Recordings/Private Cloud Sync this means a user
can believe they changed a privacy-relevant setting when the account never stored
it. Fixes #22780.
#22403 fixed the identical symptom for Custom Vocabulary by tracking the value the
account last confirmed and restoring it on failure. This extracts that pattern into
a small, directly testable
BooleanSettingSaver(mirrorsTranscriptionVocabularySaver)and applies it to the three toggles, surfacing a short inline error on failure.
Product invariants affected
INV-BETA-1 —
SettingsContentView+Controls.swiftis on this invariant's path globbecause it also hosts beta-identity UI. This change only adds an optional
errorText: String? = nilparameter toprivacyToggleRow(used solely by the twoprivacy toggles); it does not touch beta-identity gating, storage, or Sparkle
channel code.
AppBuildBetaIdentityTests(8 tests) still pass unmodified.How it was verified
xcrun swift build -c debug --package-path Desktop— succeeds.xcrun swift test -c debug --package-path Desktop --filter "BooleanSettingSaverTests|TranscriptionVocabularySaverTests|AppBuildBetaIdentityTests"— all 17 tests pass../scripts/swift-format-wrapper.sh lint <changed files>— clean.python3 scripts/check_desktop_test_quality.py— at or below baseline.pass). The behavioral test exercises the exact save/restore code path
(
BooleanSettingSaver.save) through a fake account that can refuse a write,which is the mechanism the bug report and the fix are both about.
Tests
Added
Desktop/Tests/BooleanSettingSaverTests.swift: a failed save restores theaccount's last-confirmed value, a failed save before Settings has read the account
reports no value to restore, and a successful save records the stored value.
Mirrors the existing
TranscriptionVocabularySaverTestsfor the list case.UI evidence
UI-Evidence: none -- autonomous hourly pass; verified via the extracted save/restore
unit under
BooleanSettingSaverTests, not a GUI screenshot. The change is additive(an optional inline error line) and the existing toggle layout is unchanged.
Failure class (fixes)
Failure-Class: none
🤖 automated by hourly watchdog — tested and merged