Skip to content

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 20, 2026

Benchmark PR from qodo-benchmark#26


Note

Modernizes launch flow and improves testability.

  • Reworks LaunchScreenViewModel to use an explicit, non-optional launchOrder (default empty) and simplifies loadNextLaunchType() to launch the browser when empty
  • Builds launch sequence locally then sets launchOrder; now immediately calls launchBrowser when no screens, otherwise finishedLoadingLaunchOrder
  • Allows dependency injection of IntroScreenManager via IntroScreenManagerProtocol; updates init signature and stores managers as let
  • Adds/clarifies delegate APIs and inline documentation; minor cleanup (naming, comments)
  • Expands tests: sequences (TOS + intro), empty-order behavior, delegate-nil safety, custom intro manager injection, priority between intro/update/survey, app-version handling, and splash experiment flag helpers
  • Updates MockLaunchScreenViewModel to new initializer and behavior tracking

Written by Cursor Bugbot for commit 7177b7e. Configure here.

razvanlitianu and others added 7 commits December 19, 2025 14:59
…sive tests

- Add documentation comments to all public APIs
- Use IntroScreenManagerProtocol for better testability
- Change launchOrder from optional to empty array for clarity
- Add @mainactor to class level
- Make properties immutable where possible
- Add comprehensive unit tests covering edge cases, sequences, and priority logic
- Fix MockLaunchScreenManager initializer to match updated signature
- Extract FxNimbus TOS feature configuration into setTermsOfServiceFeatureEnabled helper
- Set TOS feature to false in setUp() to ensure clean test state
- Update all tests using TOS feature to use helper method
- Improves maintainability: only helper needs updating if YAML config changes
- Add test-only Equatable conformance to LaunchType using @retroactive
- Add assertSavedLaunchType helper method that uses LaunchType directly
- Replace all guard case statements with cleaner helper method calls
- Improves test readability and maintainability
Add hasFinishedLoading flag to prevent loadNextLaunchType from calling
launchBrowser() prematurely when called before startLoading() completes.
This fixes UI test failures in testCloseTour, testFirstRunTour, and
testOnboardingSignIn.
Replace Equatable-based assertions with pattern matching using switch
statements, following the pattern used elsewhere in the codebase to avoid
adding Equatable conformance just for testing purposes.
…n matching

Replace LaunchTypeCase enum with direct LaunchType parameter and use tuple
pattern matching in switch statement to reduce code repetition. This makes
the helper more idiomatic and easier to maintain.
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.

}

let launchType = launchOrder.removeFirst()
delegate?.launchWith(launchType: launchType)
Copy link

Choose a reason for hiding this comment

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

Race condition causes premature browser launch before loading completes

High Severity

The refactored loadNextLaunchType() calls launchBrowser() when launchOrder is empty, but cannot distinguish between "not yet loaded" and "loaded with no screens". In LaunchScreenViewController, viewWillAppear calls loadNextLaunchType() while startLoading() runs asynchronously in a Task. Previously, an empty launchOrder (being nil) caused an early return with no action. Now, the empty array triggers launchBrowser() prematurely, potentially skipping onboarding screens. The hasFinishedLoading flag was added to address this but is never checked.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

3 participants