Skip to content

fix(pwa): hand Chrome the current manifest on the first launch after an upgrade - #165

Merged
devswha merged 1 commit into
mainfrom
fix/pwa-manifest-first-launch
Sep 29, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/pwa-manifest-first-launch

Conversation

@devswha

@devswha devswha commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Change

Follow-up to #159. Reports kept coming after v0.3.32 that the installed Android app still rotates with auto-rotate locked.

Cause. A service worker from 0.3.31 or older serves /manifest.webmanifest cache-first. On the first launch after the server upgrades, that old worker still controls the page, so the document's manifest is the cached one with orientation: "any". The document keeps that manifest after the new worker activates. Chrome's WebAPK update check (WebApkUpdateManager, at most once per 24 h per launch) compares against this stale manifest, finds no change, and records the check. The rotation fix then waits at least another day, plus Chrome's charging + unmetered requirement for the re-mint.

  • index.html: the manifest link is /manifest.webmanifest?v=2. No old worker has that URL cached, so its cache-first path misses and fetches the current manifest from the network. The server serves it by pathname (no-cache, application/manifest+json). The installed app keeps its identity: webapk_update_data_fetcher.cc accepts a new manifest URL when the manifest id (/) matches.

Existing 0.3.32 installs that already launched once are unaffected by this change and update on the next daily check. Reinstalling applies the fix at once.

Validation

  • Chrome 151 + Playwright: installed with v0.3.31's sw.js and manifest, then switched the server to the current files and relaunched. Page.getAppManifest on the first launch after upgrade: orientation: "any" with the plain link (no network request for the manifest), none with ?v=2 (manifest fetched from the network). The second launch has no orientation in both cases.
  • bun run build: dist/index.html links /manifest.webmanifest?v=2.
  • Real server: GET /manifest.webmanifest?v=2 answers 200, application/manifest+json, Cache-Control: no-cache, no orientation.
  • HERDR_TEST_MODE=unit bun test ./src/pwa.test.ts: 2 pass.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 5a5a758f-bf15-4c6e-8aad-ce3069afbb86

📥 Commits

Reviewing files that changed from the base of the PR and between 6980f2c and fc27728.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • index.html

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a delay in Android installed-app updates after upgrading from version 0.3.31 or earlier. The app now avoids relying on a stale cached manifest during the first launch.

Walkthrough

The manifest link now includes ?v=2 to differ from the URL cached by older service workers. The Unreleased changelog describes the Android installed-app update delay associated with the stale manifest.

Changes

Android manifest cache update

Layer / File(s) Summary
Versioned manifest link
index.html, CHANGELOG.md
The manifest URL adds ?v=2. The changelog describes how a stale cached manifest could delay the Android auto-rotate fix after upgrades from version 0.3.31 or older.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: yoonwoo-ha

Merge Risk: ⚪ Minimal · up to fc277

The manifest URL change addresses the identified stale-cache path, and no merge-blocking issue remains after normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to fc277

The change affects 2 systems.

Changed systems: CHANGELOG.md, index.html

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — CHANGELOG.md (service) was modified; 1 changed file maps to changed impact.
  • observed — index.html (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in CHANGELOG.md: Added an Unreleased Fixed entry describing how a stale manifest cached by the previous service worker could delay the Android auto-rotate fix after upgrading from 0.3.31 or older; Chrome checks the installed app against the manifest at most once daily.
  • observed — Modified behavior in index.html: The manifest link changes from /manifest.webmanifest to /manifest.webmanifest?v=2; a comment describes the prior service-worker cache behavior for the plain URL.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: serving the current manifest to Chrome on the first launch after an upgrade.
Description check ✅ Passed The description includes both required sections. It explains the stale service worker cache problem, the versioned manifest URL behavior, and the resulting update behavior. It also lists relevant vali…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit 736de12 into main Sep 29, 2026
3 checks passed
@devswha
devswha deleted the fix/pwa-manifest-first-launch branch September 29, 2026 13:59
devswha added a commit that referenced this pull request Sep 29, 2026
## Change

Installed apps are on v0.3.32. Prepare v0.3.33: bump the app and plugin
versions together and move the Unreleased notes into the dated release
section.

This release includes:
- the chat finding an omo pane's conversation through the holder records
current omo publishes (#162)
- the installed Android app getting the 0.3.32 auto-rotate fix a day
sooner: the first launch after an upgrade no longer hands Chrome the old
cached manifest (#165)

## Validation

- `releaseNotes("0.3.33", …)` passes (package.json, herdr-plugin.toml
and a single CHANGELOG heading agree).
- The required Fast checks and Integration and browser checks must pass
before squash merge. Publish through release.yml after merge; it
validates the release commit again before creating the tag.
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.

1 participant