Skip to content

Conversation

@serhii-londar
Copy link
Collaborator

@serhii-londar serhii-londar commented Jan 28, 2026

Closes #362


Note

Low Risk
Small, localized change that primarily adds error handling and conditional cleanup around filesystem operations; risk is limited to fallback paths and deintegrate behavior.

Overview
Prevents crashes during SDK initialization by replacing several try! calls that create localization subfolders (Crowdin, RealtimeUpdates, XCStrings) with do/catch, logging failures and falling back to CrowdinFolder.shared.

Tightens deintegration cleanup to avoid removing the Crowdin root folder when it’s being used as the active localizationFolder fallback, reducing the chance of deleting shared storage unexpectedly.

Written by Cursor Bugbot for commit 75652d3. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings January 28, 2026 14:24
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 36.36364% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.88%. Comparing base (b3b685b) to head (75652d3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...Operations/CrowdinXcstringsDownloadOperation.swift 0.00% 12 Missing ⚠️
...calization/Provider/LocalLocalizationStorage.swift 71.43% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #369      +/-   ##
==========================================
- Coverage   55.96%   55.88%   -0.08%     
==========================================
  Files         136      136              
  Lines        6309     6327      +18     
==========================================
+ Hits         3530     3535       +5     
- Misses       2779     2792      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical crash during SDK initialization caused by force-unwrapping folder creation operations. The crash was occurring when CrowdinFolder.shared.createFolder() failed, causing the app to crash on launch as reported in issue #362.

Changes:

  • Replaced try! (force try) with optional try (try?) and fallback values for folder creation in three locations
  • Changed LocalLocalizationStorage to fall back to the root CrowdinFolder when subfolder creation fails
  • Changed XCStringsStorage to use lazy initialization with a fallback to root CrowdinFolder
  • Changed RULocalLocalizationStorage to conditionally set the folder only if creation succeeds

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Sources/CrowdinSDK/CrowdinSDK/Localization/Provider/LocalLocalizationStorage.swift Replaced force try with optional try and nil-coalescing fallback to CrowdinFolder.shared
Sources/CrowdinSDK/Providers/Crowdin/LocalizationDownloader/Operations/CrowdinXcstringsDownloadOperation.swift Changed static property to use lazy initialization with optional try and fallback to CrowdinFolder.shared
Sources/CrowdinSDK/Features/RealtimeUpdateFeature/LocalizationProvider/RULocalLocalizationStorage.swift Added conditional folder assignment instead of force try, falling back to parent class's folder

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash after app launch

2 participants