Skip to content

Fix isTooSoon to reset when a newer app store version is available - #551

Merged
larryaasen merged 2 commits into
mainfrom
copilot/fix-upgrader-is-too-soon-logic
May 24, 2026
Merged

Fix isTooSoon to reset when a newer app store version is available#551
larryaasen merged 2 commits into
mainfrom
copilot/fix-upgrader-is-too-soon-logic

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown
Contributor

isTooSoon() only checked elapsed time since the last alert, ignoring _lastVersionAlerted. If a user tapped "Later" on v1.0.1 and the store updated to v1.0.2 before the durationUntilAlertAgain window elapsed, the v1.0.2 alert would be silently suppressed.

Changes

  • lib/src/upgrader.dart: Added a version check in isTooSoon() — returns false immediately when the current app store version differs from _lastVersionAlerted, bypassing the time gate for genuinely new versions.
// New check: a different available version is never "too soon"
if (_lastVersionAlerted != null &&
    versionInfo?.appStoreVersion != null &&
    _lastVersionAlerted != versionInfo?.appStoreVersion) {
  return false;
}
  • test/upgrader_test.dart: Two new unit tests covering the new branch — one asserting false when the store version advances past the alerted version, one asserting true is preserved when the version is unchanged and within the alert window.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)
  • https://storage.googleapis.com/flutter_infra_release/flutter/4c525dac5ebe5971c5708ef73558ed8edcf4a362/dart-sdk-linux-x64.zip
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter-git/bin/cache/dart-sdk-linux-x64.zip REDACTED (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json
    • Triggering command: /snap/flutter/current/usr/bin/curl curl -o releases_linux.json REDACTED (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.19.5-stable.tar.xz
    • Triggering command: /usr/bin/curl curl -L REDACTED -o flutter.tar.xz (http block)
  • https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.24.0-stable.tar.xz
    • Triggering command: /usr/bin/curl curl -L REDACTED -o flutter.tar.xz (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix Upgrader.isTooSoon logic to compare _lastVersionAlerted Fix isTooSoon to reset when a newer app store version is available May 21, 2026
Copilot AI requested a review from larryaasen May 21, 2026 11:55
@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.12%. Comparing base (26b31fe) to head (67f82ce).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #551      +/-   ##
==========================================
+ Coverage   91.95%   92.12%   +0.16%     
==========================================
  Files          12       12              
  Lines        1317     1320       +3     
==========================================
+ Hits         1211     1216       +5     
+ Misses        106      104       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@larryaasen larryaasen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@larryaasen
larryaasen marked this pull request as ready for review May 21, 2026 23:39
Copilot AI review requested due to automatic review settings May 21, 2026 23:39
@larryaasen larryaasen added this to the 13.4.0 milestone May 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Upgrader.isTooSoon() suppression logic so that the “alert again” time gate is bypassed when the available store version has changed since the last alert, preventing a newer store version prompt from being silently suppressed within the cooldown window.

Changes:

  • Updated isTooSoon() to immediately return false when versionInfo.appStoreVersion differs from _lastVersionAlerted.
  • Added unit tests to verify isTooSoon() returns false for a newer store version and remains true for the same store version within the cooldown window.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/src/upgrader.dart Adds a version-difference check to bypass the cooldown when the store version changes.
test/upgrader_test.dart Adds regression tests covering the new isTooSoon() branch for changed vs unchanged store versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kirara-shiroyoru kirara-shiroyoru left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It seems like it work

@larryaasen
larryaasen merged commit 33af073 into main May 24, 2026
15 of 17 checks passed
larryaasen added a commit that referenced this pull request May 24, 2026
* 'main' of https://github.com/larryaasen/upgrader:
  Fix isTooSoon to reset when a newer app store version is available (#551)
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.

The logic of Upgrader.isTooSoon should also compare _lastVersionAlerted

4 participants