Skip to content

Conversation

@ih-codes
Copy link
Collaborator

@ih-codes ih-codes commented Nov 6, 2025

📜 Tickets

Jira ticket
Github issue

💡 Description

Annotate misc. warning completion handlers with @Sendable and main actor / threading warnings that come from adding @Sendable to closures.

Sample of the type of errors this work resolves:
Screenshot 2025-11-06 at 3 43 02 PM

cc @Cramsden @lmarceau @dataports | Swift 6 Migration

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@ih-codes ih-codes requested a review from Foxbolts November 6, 2025 22:03
@ih-codes ih-codes requested a review from a team as a code owner November 6, 2025 22:03
} else {
let logMessage = isPinned ? "Could not remove pinned site" : "Could not add pinne site"
logger.log(logMessage, level: .debug, category: .library)
MainActor.assumeIsolated {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Safe here since this is executed upon the .main queue above.

isCurrentFolderEditable(at: indexPath) {
presentContextMenu(for: bookmarkNode, indexPath: indexPath)
viewModel.getSiteDetails(for: indexPath) { site in
ensureMainThread { [weak self] in
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By marking some closures as @Sendable, the call sites had errors because the compiler was able to detect that we were (potentially) hopping threads, so we add ensureMainThread here for safety. 👀

[weak self] gets moved a level lower so we don't pass the non-Sendable self from the closure thread to the main thread.

var localEncryptionKeys: [String: String] = [:]
var rustEngines: [String] = []
// FIXME: FXIOS-14052 Unprotected properties should not be mutated on background threads
nonisolated(unsafe) var rustEngines: [String] = []
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is suppressing an error for how this var gets (mis)used below.

@mobiletest-ci-bot
Copy link

Warnings
⚠️ Changes detected in files: firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift, firefox-ios/Client/TabManagement/Tab.swift. Ensure that necessary updates are also ported to the WebEngine project if required (cc @lmarceau).
Messages
📖 Project coverage: 38.65%

🥇 Perfect PR size

Smaller PRs are easier to review. Thanks for making life easy for reviewers! ✨

🙌 Friday high-five

Thanks for pushing us across the finish line this week! 🙌

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

❌ Per-file test coverage gate

The following changed file(s) are below 35.0% coverage:

File Coverage Required
firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift 9.7% 35.0%

Client.app: Coverage: 37.18

File Coverage
PasswordManagerViewModel.swift 33.77% ⚠️
RustSyncManager.swift 42.36% ⚠️
BrowserViewController+WebViewDelegates.swift 20.77% ⚠️
SearchLoader.swift 0.0% ⚠️
TemporaryDocument.swift 74.24%
Tab.swift 58.99%
UpdateViewModel.swift 89.16%
BookmarksPanelViewModel.swift 61.87%
PasswordDetailViewController.swift 3.28% ⚠️
BreachAlertsClient.swift 0.0% ⚠️
BookmarksViewController.swift 9.68% ⚠️
FirefoxAccountSignInViewController.swift 33.78% ⚠️

CredentialProvider.appex: Coverage: 27.97

File Coverage
RustSyncManager.swift 42.36% ⚠️

NotificationService.appex: Coverage: 33.69

File Coverage
RustSyncManager.swift 42.36% ⚠️

ShareTo.appex: Coverage: 29.1

File Coverage
RustSyncManager.swift 42.36% ⚠️

Generated by 🚫 Danger Swift against f4b3c5a

@ih-codes ih-codes merged commit 7842184 into main Nov 7, 2025
9 checks passed
@ih-codes ih-codes deleted the ih/FXIOS-12796-misc-Sendable-closures-1 branch November 7, 2025 19:34
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

🚀 PR merged to main, targeting version: 145.2

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.

4 participants