fix(desktop): map backend settings keys for recording-permission and private-cloud-sync#6420
Conversation
…teCloudSyncResponse Map Swift `enabled` field to actual backend keys: `store_recording_permission` and `private_cloud_sync_enabled`. Fixes decode errors on Settings page load. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 tests covering RecordingPermissionResponse and PrivateCloudSyncResponse decode with correct backend keys and failure with wrong keys. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR fixes a JSON decoding bug in the macOS desktop app where Confidence Score: 5/5Safe to merge — targeted bug fix with correct key mappings verified against the backend source and covered by dedicated unit tests. The CodingKeys additions are confirmed correct by reading backend/routers/users.py (lines 209 and 259). All remaining findings are P2 or absent. Tests are comprehensive. No files require special attention.
|
| Filename | Overview |
|---|---|
| desktop/Desktop/Sources/APIClient.swift | Added CodingKeys to RecordingPermissionResponse and PrivateCloudSyncResponse to correctly map Swift enabled to backend JSON keys; fix verified against backend routers. |
| desktop/Desktop/Tests/SettingsResponseTests.swift | New test file with 6 unit tests covering both structs for true/false decoding and explicit rejection of the old wrong key enabled. |
Sequence Diagram
sequenceDiagram
participant App as Desktop App
participant API as Backend API
App->>API: GET /v1/users/store-recording-permission
API-->>App: {"store_recording_permission": true}
Note over App: CodingKeys maps<br/>store_recording_permission → enabled
App->>App: RecordingPermissionResponse(enabled: true) ✅
App->>API: GET /v1/users/private-cloud-sync
API-->>App: {"private_cloud_sync_enabled": false}
Note over App: CodingKeys maps<br/>private_cloud_sync_enabled → enabled
App->>App: PrivateCloudSyncResponse(enabled: false) ✅
Reviews (1): Last reviewed commit: "test(desktop): add unit tests for settin..." | Re-trigger Greptile
All checkpoints passed — ready for merge
Awaiting human merge approval. by AI for @beastoin |
CP9 + E2E Test Results — Mac Mini (pr6420 named bundle)Build
CP9: Settings Decode Fix Verification ✅Before fix (v0.11.251): After fix (pr6420 build): Zero decode errors — both Privacy Settings Loaded Correctly
ScreenshotsGotcha Found During TestingInitial build used stale cached binary from by AI for @beastoin |
|
lgtm |
…private-cloud-sync (BasedHardware#6420)


Summary
CodingKeystoRecordingPermissionResponsemappingenabled→store_recording_permissionCodingKeystoPrivateCloudSyncResponsemappingenabled→private_cloud_sync_enabledTests
6 unit tests in
SettingsResponseTests.swift:store_recording_permission: truestore_recording_permission: falseenabledprivate_cloud_sync_enabled: trueprivate_cloud_sync_enabled: falseenabledAll 6 tests pass locally.
Risks / Edge Cases
{"enabled": ...}, these CodingKeys would need updatingFixes #6417
🤖 Generated with Claude Code