Repository navigation
Description
Problem
A site links a web app manifest with <link rel="manifest" href="/site.webmanifest"> and then forgets about it. A redesign renames the icons, a deploy drops the file, or a framework starter ships a manifest that still says "name": "My App" with icons that were never generated. Nothing breaks visibly on a desktop browser. On Android, "Add to Home screen" falls back to a screenshot icon and a generic name, the splash screen is blank, and the browser chrome takes a color that clashes with the page.
squirrel does not read the manifest today. The only nearby checks are:
core/favicon(packages/rules/src/core/favicon.ts) checks that<link rel="icon">and<link rel="apple-touch-icon">are declared (an Apple touch icon that is missing is already reported there, as info). It never fetches an icon.social/asset-divergencecompares<meta name="theme-color">across pages, not against the manifest.security/mixed-contentflags anhttp:manifest URL on an HTTPS page.ax/well-known-agentmentions manifests, but those are agent manifests (MCP, A2A), not the web app manifest.
Proposal
New rule mobile/web-app-manifest, site scope, reading the manifest the pages link to (normally one per site, so one fetch) plus its declared icons.
- Error: the linked manifest answers 4xx/5xx, or its body is not valid JSON.
- Warn: the manifest is served with a content type other than
application/manifest+jsonorapplication/json(some browsers ignore it), it has neithernamenorshort_name, it has nostart_urlor astart_urlon another origin, it has nodisplayvalue, or it lacks a 192px and a 512px PNG icon. - Warn: a declared icon answers 4xx/5xx, or its real pixel size differs from its declared
sizes(read from the image header, as the image rules already do). - Warn: the page's
theme-colormeta and the manifest'stheme_colordisagree. A light/dark pair oftheme-colormetas scoped bymediacounts as agreeing when either matches. - Info: no icon with
purposeincludingmaskable(Android crops non-maskable icons into a circle). - Info: no page links a manifest at all. Plenty of sites legitimately have none, so this is advice, not a problem, and it does not affect the score.
- One finding per manifest URL, listing the pages that link it, not one per page.
Not reported here:
- A missing
apple-touch-iconor favicon:core/faviconalready covers it. - Pages whose
theme-colordiffers from other pages:social/asset-divergencecovers it. - Full installability (service worker, offline behaviour). That needs a browser and is out of scope.
Category: mobile
The manifest controls what a phone shows when the site is installed or pinned: the home-screen icon and name, the splash screen and the browser chrome color. That is the same audience as the existing mobile/ rules (viewport, tap targets, font size). core is page-level meta that search engines read, and search engines do not use the manifest.
Notes
- Cost: one request for the manifest plus at most a handful for its icons, fetched once per site through the existing resource fetch (caps, timeouts and cache apply). The image header parser in
packages/audit-engine/src/image-header.tsalready reads dimensions without downloading whole files. - False-positive risk: low. A catch-all server that answers the manifest URL with an HTML page fails the JSON check, which is the right answer: the browser cannot use it either. The content-type check only warns.
- Relative URLs:
start_url,scopeand iconsrcresolve against the manifest URL, not the page URL. Easy to get wrong; the fixtures should cover it. - Spec: https://www.w3.org/TR/appmanifest/
Acceptance Criteria
- Fixture: a page linking
/site.webmanifestthat returns 404 produces an error finding naming the manifest URL and the linking pages - Fixture: a manifest whose body is not valid JSON (or is an HTML page served with 200) produces an error finding
- Fixture: a valid manifest served as
text/plainproduces a content-type warning; the same file asapplication/manifest+jsondoes not - Fixture: a manifest missing both
nameandshort_name, one missingstart_url, and one missingdisplayeach produce a warning naming the missing field - Fixture: a manifest with no 512px PNG icon produces a warning; one with 192px and 512px PNG icons does not
- Fixture: an icon declared
sizes="512x512"whose file is 256x256 produces a warning showing both sizes; an icon that returns 404 produces a warning naming its URL - Icon
srcandstart_urlare resolved against the manifest URL (fixture: manifest at/static/m.jsonwith"src": "icon.png"checks/static/icon.png) - Fixture:
<meta name="theme-color" content="#000">with manifest"theme_color": "#fff"produces a warning; a light/dark pair where one matches does not - A manifest with no
maskableicon produces an info result, not a warning - A site with no
<link rel="manifest">on any page produces one info result and no score penalty - Ten pages linking the same manifest produce one finding listing those pages, and the manifest is fetched once
- A missing
apple-touch-iconis not reported by this rule (it stays withcore/favicon) - The rule has a docs page under
docs/rules/mobile/
Activity
Merge origin/main into claude/710-web-app-manifest
feat(rules): mobile/web-app-manifest checks the linked manifest and i…