Skip to content

[client] avoid overwriting state manager on iOS #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025

Conversation

pascal-fischer
Copy link
Collaborator

Describe your changes

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 11:12
Copy link

Copy link
Contributor

@Copilot 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 centralizes how the engine’s state manager path is determined, ensuring that on iOS the mobile-specific path isn’t subsequently overwritten by the default.

  • Introduced a path variable set to the default state path before the iOS check
  • Overrode path with mobileDep.StateFilePath when runtime.GOOS == "ios"
  • Consolidated engine.stateManager = statemanager.New(path) into one call
Comments suppressed due to low confidence (3)

client/internal/engine.go:245

  • [nitpick] Consider renaming the local variable path to statePath to avoid confusion with the Go path package and improve readability.
path := statemanager.GetDefaultStatePath()

client/internal/engine.go:246

  • Errors from createFile are currently ignored. You may want to return or log the error to make failures creating the state file visible.
if runtime.GOOS == "ios" {

client/internal/engine.go:257

  • Add unit tests to verify that on iOS mobileDep.StateFilePath is used, and on other platforms the default path is used for the state manager.
engine.stateManager = statemanager.New(path)

@pascal-fischer pascal-fischer merged commit a0482eb into main May 23, 2025
32 checks passed
@pascal-fischer pascal-fischer deleted the fix/state-manager-from-path branch May 23, 2025 12:04
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.

2 participants