Skip to content

feat(electron-updater): add ignoreStagingPercentage option for checking updates#9016

Closed
Lemonexe wants to merge 1 commit intoelectron-userland:masterfrom
Lemonexe:force-update-through-staging-percentage
Closed

feat(electron-updater): add ignoreStagingPercentage option for checking updates#9016
Lemonexe wants to merge 1 commit intoelectron-userland:masterfrom
Lemonexe:force-update-through-staging-percentage

Conversation

@Lemonexe
Copy link
Copy Markdown
Contributor

@Lemonexe Lemonexe commented Apr 7, 2025

Description

Add ignoreStagingPercentage option to the interface of AppUpdater.checkForUpdates(), so that you can override the staging percentage and get offerred an update if the other necessary conditions are met.

Usecase

staging rollout is observed when automatically querying for updates in background, but we also have a manual "Check for updates" button in Settings. This will allow the manual check to always offer you the latest version.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 7, 2025

⚠️ No Changeset found

Latest commit: 43d4733

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Lemonexe
Copy link
Copy Markdown
Contributor Author

Lemonexe commented Apr 7, 2025

Thoughts 🤔

The staging percentage feature is a great tool, but I think it'd greatly benefit from having two version definitions: the stable & the new one.
If all users are on app v7, and latest.yml specifies v8, then it totally makes sense that the staging percentage is applied and update offered to those in the "test group".

However, if I understand it correctly, even users with a very outdated version, say v2, they will be offered v8 only if in test group, and nothing at all if in control group. It'd be ideal to offer v7 to those in control group. But I do realize it'd require a major refactoring, so that you can publish two versions v7 & v8 when releasing v8.

What do you think? Is it worth creating an issue, or did I misunderstand how it works?
Would love to hear your view @mmaietta 🙂

@Lemonexe Lemonexe marked this pull request as ready for review April 7, 2025 15:35
@mmaietta
Copy link
Copy Markdown
Collaborator

mmaietta commented Apr 8, 2025

Thanks for submitting a PR!

I think this functionality already exists with set isUpdateSupported(hook) functionality, where you can override the is UpdateSupported default logic with your own hook/validation of the UpdateInfo

/**
* Allows developer to override default logic for determining if an update is supported.
* The default logic compares the `UpdateInfo` minimum system version against the `os.release()` with `semver` package
*/
get isUpdateSupported(): VerifyUpdateSupport {
return this._isUpdateSupported
}

@Lemonexe
Copy link
Copy Markdown
Contributor Author

Lemonexe commented Apr 10, 2025

@mmaietta I believe that's a different case 🤔
If I understand correctly, then isUpdateSupported lets me block update on any arbitrary criteria, in case I need some more complex logic than that provided by the default checkIfUpdateSupported (blocking update based on updateInfo?.minimumSystemVersion).

But I meant the case when isUpdateSupported() is true, but still, isUpdateAvailable() results to false because of isStagingMatch logic. I'd like an option to force update available when it is supported, but below the rollout threshold.

💡 Though your suggestion did give me an idea – instead of the new parameter, I could create similar get/set/protected logic for isStagingMatch, like there is for isUpdateSupported (so that the API is consistent).
What do you think?
EDIT: anyway here's the PR #9021 🙂

@mmaietta
Copy link
Copy Markdown
Collaborator

Closing in favor of #9021

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants