Files
amethyst/commons/src
Claude a7209a70b6 test: cover the meta-tag variants the suite never saw, and fix title/textarea
Reviewing what the tests actually reach turned up one live defect and a suite
that mostly did not run.

The defect is the comment bug again, in the elements whose content is text
rather than markup. `<title>5 < 6, that's math</title>` is ordinary HTML: the
`<` opened a phantom tag, the apostrophe opened a phantom attribute value, and
every tag after it -- the whole og: block -- was swallowed. Same for
`<textarea>`, and a `<meta>` written inside title text was parsed as a real one
and won over the page's own. Title and textarea now skip to their end tag like
script and style; the three tests for it fail without that change.

The suite: MetaTagsParserTest lived in `androidDeviceTest`, so every attribute
shape it covers -- unquoted values, single quotes, valueless attributes,
duplicate-attribute rejection, `</head>` inside a value -- was unguarded in CI.
Nothing in it is Android-specific, so it moves to commonTest. OpenGraphParser
and HtmlCharsetParser had no tests at all.

New coverage, all of it variants nothing exercised before:

- end of scan: `</HEAD>`, `</head >`, `</head>` inside an attribute value, and
  a document with no `</head>` at all.
- truncation: a body cut after a `/`, inside a quoted value, and right after a
  `<` -- the first is the crash the previous commit guarded and never pinned.
- tag shapes: uppercase `<META>`, `<meta/>`, `/>` inside a quoted value,
  `<![CDATA[]]>`, and meta tags inside `<noscript>` (which must still be read).
- attributes: a trailing valueless attribute, a value spanning lines, unknown
  attributes.
- character references: query-string `&` left intact (og:image URLs are full of
  them), astral references (`&#128512;`), unknown references left alone.
- laziness: the sequence stops when the consumer does.
- OpenGraphParser: property / name / itemprop sources, twitter and plain-name
  fallbacks, and that a field is taken in document order -- so a plain
  `<meta name="description">` above the og: one wins. That is why the
  brainstorm.world card shows the site description; pinned, not changed.
- HtmlCharsetParser / HtmlParser: charset attribute, http-equiv content-type,
  the UTF-8 default, the 1 KB sniff window, and the response-charset > BOM >
  document-declaration precedence.

49 tests in the package, from 8 that ran.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FumxeDJPEgPqX8mz3xkM6b
2026-08-21 20:16:12 +00:00
..