Skip to content

fix: make update checks resilient to stale registrations#333

Merged
Just-Insane merged 4 commits into
integrationfrom
codex/bug-issue-327-update-check-unreliable
Jun 23, 2026
Merged

fix: make update checks resilient to stale registrations#333
Just-Insane merged 4 commits into
integrationfrom
codex/bug-issue-327-update-check-unreliable

Conversation

@Just-Insane

Copy link
Copy Markdown
Collaborator

Description

Make app update checks inspect every available service worker registration instead of only the current getRegistration() result, so stale registrations can no longer hide a deploy until the user clears caches manually.

Fixes #327

Related to #320

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).
    This PR changes checkForAppUpdates() and applyPendingAppUpdate() to gather the app's known service worker registrations from getRegistration(), getRegistrations(), and ready, dedupe them by scope, and then detect/apply pending updates across that full set instead of trusting one potentially stale registration. The tests cover the new stale-secondary-registration cases for both detection and apply so a hidden waiting worker still surfaces the update banner and the About action can apply it.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Sentry Preview Error Triage

No Sentry errors found for this PR's preview deployment as of Tue, 23 Jun 2026 15:21:45 GMT.

This comment updates automatically after each push.

@Just-Insane Just-Insane added the bug Something isn't working label Jun 23, 2026
@Just-Insane Just-Insane enabled auto-merge (squash) June 23, 2026 14:42
@github-code-quality

github-code-quality Bot commented Jun 23, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: JavaScript

JavaScript / code-coverage/vitest

The overall coverage in the branch remains at 27%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 5b46f5b 988cc4f +/-
src/app/hooks/u...ateAvailable.ts 89% 92% +3%
src/app/utils/appUpdates.ts 87% 93% +6%

Updated June 23, 2026 15:24 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Comment thread src/app/utils/appUpdates.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d3e2a7869

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/utils/appUpdates.ts
Comment thread src/app/utils/appUpdates.ts Outdated
Comment thread src/app/utils/appUpdates.ts
Comment thread src/app/utils/appUpdates.ts Outdated
Comment thread src/app/utils/appUpdates.ts Outdated
Comment thread src/app/hooks/useSwUpdateAvailable.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7772f0bc9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/utils/appUpdates.ts Outdated
Comment thread src/app/utils/appUpdates.ts
Comment thread src/app/utils/appUpdates.ts
@github-actions

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-333-charm.justin-tech.workers.dev 01c4806 pr-333 Tue, 23 Jun 2026 15:24:38 GMT

@Just-Insane Just-Insane merged commit 4eaf335 into integration Jun 23, 2026
18 checks passed
@Just-Insane Just-Insane deleted the codex/bug-issue-327-update-check-unreliable branch June 23, 2026 15:26

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 988cc4f24d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +112 to 114
if (directRegistrations.length > 0) {
return directRegistrations;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep unrelated registrations out of the fallback

The fresh path is this fallback after the scope filter: when getRegistration() has not found Charm's registration yet but getRegistrations() returns only registrations whose scopes do not match the current URL (for example, first load on an origin that also has a /legacy/ service worker), this returns those unrelated registrations instead of falling through to ready or reporting no app registration. The later pending/update/apply checks can then surface or message a worker that cannot control this page, reintroducing the out-of-scope registration problem whenever no matching scope is present.

Useful? React with 👍 / 👎.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check for Updates Unreliable

1 participant