Skip to content

Conversation

@ih-codes
Copy link
Collaborator

📜 Tickets

Jira ticket
Github issue

💡 Description

Just picking up some random warnings here and there. This PR fixes strict concurrency warnings in history related classes, as well as FxAWebViewModel.

Examples of some of the warnings fixed:

  • Screenshot 2025-10-29 at 3 54 54 PM
  • Screenshot 2025-10-29 at 3 11 56 PM
  • Screenshot 2025-10-29 at 3 02 33 PM

Created a few followup tickets in Epic 2

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 Cramsden October 29, 2025 22:06
@ih-codes ih-codes requested a review from a team as a code owner October 29, 2025 22:06
@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Oct 29, 2025

Messages
📖 Project coverage: 38.92%

💪 Quality guardian

3 tests files modified. You're a champion of test coverage! 🚀

🥇 Perfect PR size

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

💬 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/ClearHistorySheetProvider.swift 2.6% 35.0%
firefox-ios/Client/Frontend/Library/HistoryPanel/HistoryPanel.swift 33.4% 35.0%
firefox-ios/RustFxA/FxAWebViewModel.swift 14.0% 35.0%

Client.app: Coverage: 37.1

File Coverage
HistoryPanel.swift 33.37% ⚠️
HistoryDeletionUtility.swift 97.06%
HistoryPanelViewModel.swift 85.34%
ClearHistorySheetProvider.swift 2.56% ⚠️
GleanWrapper.swift 66.2%
FxAWebViewModel.swift 14.02% ⚠️

Generated by 🚫 Danger Swift against bd7a120

viewModel.reloadData { [weak self] success in
DispatchQueue.main.async {
viewModel.reloadData { success in
DispatchQueue.main.async { [weak self] in
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need the weak self here too but I guess it is also fine if you want to have it. Do we want to be using ensureMainThread here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just left it in because it was already there (but moved because of a warning).

Looks like the viewModel calls an async fetch to get fresh history items though, so it's probably good to keep this weak in case the user navigates away from the screen while loading is happening.

I can update to ensureMainThread but it will never be called on the main thread from that fetch from the looks of it! (rust Deferred code on background queues I believe)

final class HistoryDeletionUtility: HistoryDeletionProtocol, Sendable {
private let profile: Profile
// FIXME: FXIOS-13957 All properties should be truly Sendable
private nonisolated(unsafe) let gleanWrapper: GleanWrapper
Copy link
Contributor

Choose a reason for hiding this comment

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

How come this needs to be nonisolated(unsafe)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The underlying Glean type is not Sendable. 😅

Image Image

I did ask them if the Glean singleton was Sendable a while back and they were like 94% sure it was thread safe. 👀 Here is the bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1978613

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I'll move the nonisolated(unsafe) up one layer so the GleanWrapper appears Sendable in the meantime. Makes more sense I think!

Copy link
Contributor

@Cramsden Cramsden left a comment

Choose a reason for hiding this comment

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

two small questions but seems fine to me!

@ih-codes
Copy link
Collaborator Author

Hm.
Bitrise:

GleanWrapper.swift:48:13: warning: 'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'Glean', consider removing it

But in Xcode if I remove the nonisolated(unsafe):
Screenshot 2025-10-31 at 2 04 43 PM

Glean is definitely not Sendable either. 🤔

Screenshot 2025-10-31 at 2 05 27 PM

I guess I need to update to Xcode 26.0.1 to see if that's the cause of the discrepancy.

@ih-codes ih-codes force-pushed the ih/FXIOS-12796-history-and-fxAWebViewModel-errors branch from 583e112 to 80d1fab Compare November 3, 2025 15:31
@ih-codes
Copy link
Collaborator Author

ih-codes commented Nov 3, 2025

Ok, I updated to Xcode 26.0.1 and I see the warning now. Seems more like my local Glean did not update until I did a deep clean. Anyway, I think this should be fixed now, we'll see what Bitrise says. 🤞

@ih-codes ih-codes merged commit cd3ef61 into main Nov 3, 2025
11 checks passed
@ih-codes ih-codes deleted the ih/FXIOS-12796-history-and-fxAWebViewModel-errors branch November 3, 2025 20:04
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

🚀 PR merged to main, targeting version: 145.1

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

Labels

None yet

4 participants