Fix crash risks, race conditions, and silent failures#46
Open
John Dlugokecki (jdlugo) wants to merge 1 commit into
Open
Fix crash risks, race conditions, and silent failures#46John Dlugokecki (jdlugo) wants to merge 1 commit into
John Dlugokecki (jdlugo) wants to merge 1 commit into
Conversation
- Replace force unwraps with safe unwrapping across 6 files (URL construction, Int parsing) to prevent runtime crashes - Fix isNotificationAllowed() race condition: was returning synchronously before async callback completed, now uses async/await properly - Fix BGTask.setTaskCompleted called prematurely before background work finishes; now completes only after all refresh tasks are done - Fix KeychainHelper.save() silently failing on duplicate items by falling back to SecItemUpdate when SecItemAdd returns errSecDuplicateItem - Add error logging to Core Data save() instead of silently swallowing failures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
URL(string:)!andInt()!force unwraps with safe unwrapping in 6 files to prevent runtime crashesNotificationManager.isNotificationAllowed()was returning synchronously before its async callback completed (always returnedfalse) — now usesasync/awaittask.setTaskCompleted(success: true)was called immediately before background work finished — now only completes after all refresh tasks are doneKeychainHelper.save()silently failed on duplicate items — now falls back toSecItemUpdateonerrSecDuplicateItemPersistenceController.save()silently swallowed save errors — now logs failures viaos.LoggerFiles changed (9)
CronicaApp.swift— BGTask completion timingPersistenceController.swift— Error logging for save()ItemContent-Extensions.swift— 8 force unwraps replacedWatchlistItem-Extension.swift— 1 force unwrap replacedKeychainHelper.swift— Duplicate item handlingAccountManager.swift— 1 force unwrap replacedExternalWatchlistManager.swift— 1 force unwrap replacedNotificationManager.swift— Race condition fix + 1 force unwrapWatchlistButton.swift— 1 force unwrap replacedTest plan
🤖 Generated with Claude Code