Skip to content

fix: address the 0.9.0 pre-release review - #225

Merged
lnorton89 merged 7 commits into
mainfrom
fix/review-minor
Nov 26, 2026
Merged

lnorton89 merged 7 commits into
mainfrom
fix/review-minor

Conversation

@lnorton89

Copy link
Copy Markdown
Collaborator

Summary

A final review of everything going into 0.9.0 found no blockers in the code. It did find three should-fix defects and several minor ones in features that are not released yet. This PR fixes all of them, so no CHANGELOG Fixed entries are needed: the affected Added entries now describe the corrected behavior.

Should-fix

  • metaplate/takumi no longer lets Takumi fetch images. Takumi's own fetcher used to load <img src> and CSS url() with no address policy; a loopback URL was fetched, while metaplate/node refuses the same plate. Takumi now gets an images.allowUrl and fetch that refuse every URL. A non-data: source fails the render before any request, with an error pointing to fetchImageLoader. data: URIs and emoji still draw. This is stricter than Satori, which fetches public URLs itself; docs/takumi.md documents the difference.
  • fontFallback uses each renderer's tag defaults. Satori makes h1–h6, b and strong bold and em and i italic, and Takumi has its own table (strong is bolder, th bold, cite italic, and so on). The guard used to assume 400 normal everywhere. That made a correct <h1> plate fail at error level and missed bold or italic text falling back to the wrong face. var() values in inline styles are resolved now, and an unresolved var() family is skipped instead of being checked against the first font.
  • metaplate render keeps a UTF-8 BOM in HTML pages. It used to reject any page that started with a BOM, with an error about crawlers that pointed at the wrong cause.

Minor

  • HTML pages: the block goes before the </head> a crawler reads. A commented-out </head> (or one inside a script, style or template) is skipped; it used to receive the block and leave a stray --> in the body.
  • fetchImageLoader: the time budget settles the load even when an injected fetch ignores its abort signal or returns a body stream not tied to it. Before, the load hung and the cache served the pending promise to every later call. localhost. and *.localhost. are refused like localhost. The docs show a service binding's fetch wrapped so it keeps its binding.
  • Takumi emoji: the plate's emoji loader gets the grapheme as the copy spells it (1️⃣, not 1⃣), and missingGlyphs reports it in that form.
  • definePlate rejects a contentType that every renderer factory would reject later ("IMAGE/PNG", "image/jpeg; q=1").

Test plan

  • New tests for each fix. The HTML tests fail on the old code (13 of them), and the Takumi no-fetch tests fail with the fix removed.
  • lint, typecheck, typecheck:examples
  • Full suite on Windows: 1,525 of 1,531 pass; the 6 failures were 5-second timeouts while the machine was at 94% CPU from unrelated processes, and they pass when rerun alone.
  • CI on Linux, macOS, and Windows

…checks

From the 0.9.0 pre-release review:

- fetchImageLoader's time budget relied on the injected fetch honoring its
  abort signal. A fetch that ignored it, or a body stream not tied to it,
  never settled, and the cache then handed the pending promise to every
  later load of that URL. The budget now settles the load itself, and the
  failed load is dropped from the cache as before. The docs show a service
  binding's fetch wrapped so it keeps its binding.
- `localhost.` and `*.localhost.` (fully qualified) are refused like
  `localhost` without allowPrivate.
- definePlate rejects a contentType that is not a lowercase media type with
  no parameters (such as "IMAGE/PNG" or "image/jpeg; q=1"), which every
  renderer factory would otherwise reject later as a mismatch.
…tatic HTML pages

A page saved with a byte order mark failed preflight, because the mark read as
body text: it is now split off before splicing and the crawler scan and put
back on write, so the file keeps its bytes and a re-run stays byte-identical.

The block was inserted before the first </head> in the text, even one inside a
comment, which could end the head early and leave a stray --> in the body. The
insertion point now comes from the same tokenizer extractPageSocialMetadata
uses, so a </head> in a comment, <script>, <style>, or <template> is skipped;
a page whose head ends before its </head> is refused with a clear message.
…i does

Takumi's own image fetcher fetched <img src> and CSS url() with no address policy. Render options now refuse every URL (allowUrl plus a refusing fetch), so a render makes no request: data URIs still draw, and any other source fails the render with an error naming the URL and pointing to fetchImageLoader.

The emoji loader now receives the grapheme as the copy spells it (1️⃣, ❤️ with U+FE0F) instead of Takumi's stripped image name, and missingGlyphs reports that spelling.
The guard started every element at weight 400, style normal, so a heading drawn bold with only the bold face loaded was reported, and bold or italic text from <h1>, <strong>, or <em> with only the regular face was not. Each element now starts from Satori's default style for its tag (Takumi's under createTakumiOg), and var() in font properties resolves from custom properties declared in inline styles; an unresolvable var() family is skipped.
@lnorton89
lnorton89 merged commit d0cd7f2 into main Nov 26, 2026
11 of 12 checks passed
@lnorton89
lnorton89 deleted the fix/review-minor branch November 26, 2026 04:03
@lnorton89 lnorton89 mentioned this pull request Nov 26, 2026
2 of 3 tasks
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