Skip to content

Make apps installable with a web app manifest - #393

Merged
tnkuehne merged 2 commits into
mainfrom
installable-apps
Nov 25, 2026
Merged

tnkuehne merged 2 commits into
mainfrom
installable-apps

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Every app page links a web app manifest, so Chrome and Edge offer to install the app, and Safari on Mac, iPhone and Android home screens use its name and icon.
  • The runtime serves /manifest.webmanifest with the app's Widefleet name, start_url and scope /, display: standalone, and the icons the app ships: favicon.svg (sizes: any) plus apple-touch-icon.png and favicon.png with their real PNG dimensions.
  • The link uses crossorigin="use-credentials", because browsers fetch manifests without cookies otherwise and app pages require sign-in.
  • Apps keep control: a page that links its own manifest gets no second link, and an app that serves /manifest.webmanifest itself keeps its response.
  • The name is part of the published app snapshot (displayName), written at deployment by the Cloudflare publisher and the agent. A rename reaches the manifest with the next deployment.

Checks

  • RUN_DYNAMIC_TESTS=1 runtime suite on pinned celld (24 passed), including the new manifest link and manifest test.
  • RUN_CLOUDFLARE_TESTS=1 runtime suite in workerd (73 passed), including the new manifest test.
  • cargo test -p platform-core -p platform-agent, cargo fmt --check, pnpm check.
  • Not checked: a real install prompt in a browser.

Docs: #394

RetriggerView in GreptileConfidence Score: 4/5

The PR should preserve manifests served by app workers before merging.

Findings

  1. P1 App manifests get replaced ▶
  2. P2 Cached pages miss manifest links ▶

Summary

Adds generated web app manifests and links them from HTML pages.

  • App pages now link to a generated install manifest.

Reviews (2) · Last reviewed commit: "Serve the platform manifest before rewri..." · Reviewed by Greptile

Apps get a web app manifest named after the app, so browsers offer to
install them as desktop and home-screen apps. The runtime links it from
every HTML page and serves it at /manifest.webmanifest, listing the
app's favicon.svg, apple-touch-icon.png and favicon.png. A page that
links its own manifest, or an app that serves one, keeps its own.

The app name is part of the published app snapshot, written at
deployment by the control plane and the agent.
Comment thread crates/platform-agent/src/execution.rs Resolved
Comment thread packages/app-runtime/src/loader.ts Resolved
Comment on lines +40 to +41
const result = new Response(rewritten.body, rewritten);
result.headers.delete("content-length");

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 Cached pages miss manifest links

The rewritten HTML keeps the original etag. A returning visitor may already have the same file cached without the new link. After deployment, serveAsset matches that unchanged tag and returns 304 before linkManifest runs, so a normal reload keeps the page without a manifest link.

Give rewritten HTML a different cache tag and use it when checking conditional requests. Deleting the tag here alone would not fix the earlier 304 response.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This only affects pages a browser cached before this release: revalidation keeps their copy until the file changes with a later deployment. Every response produced by this runtime carries the link, so the ETag stays stable for its representation from here on. No change.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see the rollout is limited to clients with a pre-release cached page. One detail: serveAsset handles If-None-Match before linkManifest, so those clients get a 304 with the old HTML; because the source ETag remains unchanged, repeated revalidations can keep that copy indefinitely—not just until the next reload. If that legacy-cache gap is an accepted tradeoff, understood, but it does not self-correct without an asset change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Accepted tradeoff: those copies refresh when the file changes with a later deployment.

Comment on lines +234 to +241
if (
app.displayName &&
url.pathname === manifestPath &&
request.method === "GET" &&
!app.manifest[manifestPath]
)
return browserPolicy(
await webManifest(environment, app, app.displayName),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 App manifests get replaced

When an app worker serves /manifest.webmanifest without a static file at that exact path, this branch returns the generated manifest before calling the worker. The app loses its custom icons, launch path, and other install settings, contrary to the promised app override.

Preserve app-provided manifest responses while still bypassing generic HTML fallbacks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Intended, and the inverse of the previous finding: answering before the app is what keeps catch-all routes and _redirects fallbacks from hiding the manifest. An app that generates its manifest links it from its pages under any other path, and a static /manifest.webmanifest file is served as is. The docs PR describes both.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for clarifying. You're right: I treated a worker-generated response at /manifest.webmanifest as an override, but the intended contract reserves that URL for the generated manifest unless the app ships a static asset there. Serving it before the worker is what prevents catch-all routes and rewrite fallbacks from masking it; apps that generate their own manifest can link it under another path. This finding was based on the wrong assumption and should be withdrawn.

@tnkuehne
tnkuehne merged commit fe88052 into main Nov 25, 2026
16 of 17 checks passed
@tnkuehne
tnkuehne deleted the installable-apps branch November 25, 2026 14:19
tnkuehne added a commit that referenced this pull request Nov 25, 2026
## Summary
- HTML assets that receive the manifest link now use the ETag
`"<hash>-manifest"` instead of the uploaded file's `"<hash>"`.
- A browser that cached a page before #393 sends the old ETag, gets the
linked page with `200` and can install the app. Previously it received
`304` and kept its copy without the link for as long as the file stayed
unchanged, so redeploying an app with unchanged HTML did not make it
installable for returning visitors.
- Copies cached with the link still revalidate with `304`.

## Checks
- `RUN_DYNAMIC_TESTS=1` runtime suite on pinned celld (24 passed),
extended with the old-ETag and new-ETag revalidation cases.
- `RUN_CLOUDFLARE_TESTS=1` runtime suite in workerd (73 passed).
- `pnpm check`.




<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=119530182&amp;sig=788a85a7d46d490fb8508ad172e5ebff20eecde5e1626d230b3f4b0420657463"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F402&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge; the
previous cache issue is fixed.

<details open><summary><h3>Summary</h3></summary>

HTML assets use a separate ETag for pages eligible for the manifest
link, so browsers replace older cached copies.
- Manifest-linked app pages use a separate cache tag.
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (2) · Last reviewed commit: ["Choose the page ETag after
header
rules"](cbd1cae)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
tnkuehne added a commit that referenced this pull request Nov 29, 2026
## Summary
- Adds **Install apps on phones and computers**: every Widefleet app
installs on iPhone, iPad, Android, Mac and Windows from the same
deployment. Covers the install steps per device (iPhone steps match the
**Open app** dialog on Home), the installed name, icons rendered from
`favicon.svg`, own icons or manifest, and that name and icon are
readable without signing in.
- **App development** says that every app installs on phones and
computers and links the guide, so readers looking for a phone app find
it.
- **Applications** keeps a short section that links the guide.

Documents #393, #403 and #405, released in v0.7.23.

## Checks
- `blume validate` and Oxfmt pass.
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