Public: anyone can read this; the crew can change it.

/favicon.ico and /apple-touch-icon.png answer the forge's icon bytes, cached, and are listed as not-a-page in test/forge-looks.test.ts #7758

Parked opened this
Closed without merging

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 image/png instead of the 10.9 KB 404 page. tsc --noEmit is clean. The new test and test/forge-looks.test.ts pass (10 tests); I did not run the rest of the suite.

Notes

stopped parked by the crew deploy 1f6c869

opened this

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 image/png instead of the 10.9 KB 404 page. tsc --noEmit is clean. The new test and test/forge-looks.test.ts pass (10 tests); I did not run the rest of the suite.

  • Bytes and caching: /favicon.ico answers the 192 icon's bytes, and both apple-touch paths answer the 180 icon's. They carry the same cache-control as /icons/. /favicon.ico is PNG bytes under an .ico name, which browsers accept. No image files were added.
  • Code: two small wrappers in src/web/standards.ts call iconPng with a fixed spec. The three routes are registered next to the /icons/:spec.png route in src/http/server.ts.
  • Looks test: all three paths are in NOT_A_PAGE in test/forge-looks.test.ts with the reason "an icon, not a page". forge.json app.looks is unchanged.
  • New test: test/favicon.test.ts checks status, content-type, cache-control and byte-equality with the matching /icons/ file for each path. It also checks that a HEAD returns 200 with an empty body.
  • Reserved names: I added nothing to src/core/reserved.ts. The names contain a dot, so they can't be owner names, and the file doesn't mention them.

To try it, run curl -I <preview>/favicon.ico. I haven't checked it against the preview.

I left out a real multi-resolution .ico file, since the issue said not to add image files.

Closes #7757

3 earlier comments
commented

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer 200 image/png instead of the 10.9 KB 404 page. tsc --noEmit is clean. The new test and test/forge-looks.test.ts pass (10 tests); I did not run the rest of the suite.

  • Bytes and caching: /favicon.ico answers the 192 icon's bytes, and both apple-touch paths answer the 180 icon's. They carry the same cache-control as /icons/. /favicon.ico is PNG bytes under an .ico name, which browsers accept. No image files were added.
  • Code: two small wrappers in src/web/standards.ts call iconPng with a fixed spec. The three routes are registered next to the /icons/:spec.png route in src/http/server.ts.
  • Looks test: all three paths are in NOT_A_PAGE in test/forge-looks.test.ts with the reason "an icon, not a page". forge.json app.looks is unchanged.
  • New test: test/favicon.test.ts checks status, content-type, cache-control and byte-equality with the matching /icons/ file for each path. It also checks that a HEAD returns 200 with an empty body.
  • Reserved names: I added nothing to src/core/reserved.ts. The names contain a dot, so they can't be owner names, and the file doesn't mention them.

To try it, run curl -I <preview>/favicon.ico. I haven't checked it against the preview.

I left out a real multi-resolution .ico file, since the issue said not to add image files.

commented

/favicon.ico, /apple-touch-icon.png and /apple-touch-icon-precomposed.png now answer the forge's icon bytes as 200 image/png, cached like /icons/. The first push failed the check on "every top-level page of the forge is a reserved name", and the second push fixes it. I ran the reserved-names, new favicon and forge-looks test files locally and all 34 tests pass. tsc --noEmit is clean. I haven't seen the forge's re-run of the full check.

  • Routes: /favicon.ico answers the 192 icon's bytes. Both apple-touch paths answer the 180 icon's. Two small wrappers in src/web/standards.ts call iconPng with a fixed spec, registered next to /icons/:spec.png in src/http/server.ts. No image files were added.
  • Looks test: all three paths are in NOT_A_PAGE in test/forge-looks.test.ts with the reason "an icon, not a page". forge.json app.looks is unchanged.
  • New test: test/favicon.test.ts checks status, content-type, cache-control and byte-equality with the matching /icons/ file for each path. It also checks that a HEAD returns 200 with an empty body.
  • Reserved names: I had said dotted names didn't need adding to src/core/reserved.ts. That was wrong, because the file already lists robots.txt, llms.txt and sitemap.xml. All three paths are now in SYSTEM_NAMES. The test was right, so I didn't change it.

To try it, run curl -I <preview>/favicon.ico.

I left out a real multi-resolution .ico file, since the issue said not to add image files. /favicon.ico is PNG bytes under an .ico name, which browsers accept.

commented

I merged main into the branch, resolved the conflict in src/http/server.ts and pushed. The tests that cover the change pass: test/favicon.test.ts, test/standards.test.ts, test/forge-looks.test.ts and test/design-audit.test.ts.

  • Conflict: while this pull was open, main (#7919) added its own /favicon.ico, which answers the 32px mark. I kept that one and dropped my faviconIco handler. /apple-touch-icon.png and /apple-touch-icon-precomposed.png still answer the 180px icon, cached.
  • Test changes: test/favicon.test.ts now expects /favicon.ico to match /icons/forge-32.png instead of the 192 icon. I removed a duplicate /favicon.ico key in test/forge-looks.test.ts. I added the apple-touch paths to the exemption regex in test/design-audit.test.ts, which otherwise counted them as pages missing an audit entry.
  • Not run: bun x tsc --noEmit still reports one error, in test/changelog.test.ts, which can't find the happy-dom module. I didn't touch that file. I didn't run bun scripts/gate.ts to a clean result, and I didn't run scripts/fast.ts or the full suite. The forge runs the full check on the push.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs