Well-formed is not correct

My RSS feed shipped 17 links that broke in a feed reader, for 16 days, while xmllint reported the file well-formed. Both facts were true. A parser checks that a file follows the grammar. Only a consumer can show that the file works. The W3C feed validator found the links the first time I ran it.

What the feed got wrong

The feed at /rss.xml carries whole post bodies in content:encoded, not excerpts. Each body is the same HTML the page renders. On the page, a link to another post is root-relative: href="/spec-driven-development". On the page that is correct, because the browser resolves it against https://umar.codes.

A feed reader shows that HTML in its own document. RSS 2.0 does not give content:encoded a base URL, so the reader chooses one. If it resolves the link against its own address, /spec-driven-development points at a page on the reader’s site, and that page does not exist. I did not test each reader. The file gave them nothing correct to resolve against, and that is the defect.

The feed went live with the rebuild on 2026-07-27. By 2026-08-11 the post bodies in it held 17 root-relative href values. The fix merged on 2026-08-12, 16 days after launch.

Why xmllint could not see it

The July verification run has this line: “RSS checked with xmllint (well-formed, correct rss/channel structure, full-content items)”. The same line says the W3C validator was not run, because nothing was deployed yet.

xmllint answered the question I asked. The file was well-formed XML: every tag closed, every entity escaped. The bodies sit inside the XML as escaped text, so to a parser a broken link is a string of characters. The string href="/spec-driven-development" is as well-formed as any other.

I ran it again today on two builds of the feed, one with the fix and one with the fix removed. xmllint --noout (libxml 2.9.13) exits 0 on both. Nothing about the broken file is malformed, so no XML check can fail on it.

The validator that reads a feed as a consumer does

On 2026-08-11 I ran production through the W3C feed validator. The result was valid, 0 errors, 2 warnings:

Warning Count Meaning
ContainsRelRef 17 A relative URL inside content:encoded
MissingAtomSelfLink 1 The channel does not state its own address

The validator does one thing that xmllint does not: it decodes the body and reads it as HTML, as a reader does. That is the whole difference. The check that found the defect was the first one that behaved like a consumer.

The same run found a second defect of the same shape, in the structured data. One validator resolved a reference across pages and reported 0 warnings. The other did not resolve it and reported an author with no name. I wrote the conclusion in the verification record that day: one clean validator is not a clean result when the consumer that matters is the other one.

The fix is one regular expression with one guard

absolutizeHtml in src/lib/feed.ts rewrites root-relative href and src values to absolute URLs before the body goes into the feed:

const ROOT_RELATIVE = /\b(href|src)="\/(?!\/)([^"]*)"/g;

It leaves absolute, fragment and scheme URLs (mailto:, tel:) as written, because each one resolves without a base. The negative lookahead on // is load-bearing. A protocol-relative URL starts with two slashes, and without the guard //example.com/x becomes https://umar.codes//example.com/x. No post uses a protocol-relative URL yet, so a test holds that case. 10 tests pin the function and the atom:link rel="self" element the channel gained in the same change. The validator’s second run, on 2026-08-12, reported 0 errors and 0 warnings.

What the same defect would cost today

The feed had 50 items this morning, before this post. I built it twice and read each file with a short probe. The probe decodes each body and resolves every href and src against a reader’s address, https://reader.example/, with new URL(). A URL that lands on the reader’s origin is a broken link.

Measure With the rewrite Without it
URLs in post bodies 112 112
Resolve to the reader’s origin 0 96
Items with one or more broken links 0 46 of 50
Distinct broken targets 0 29
xmllint exit code 0 0

The 17 links of August would be 96 now, and 7 in the worst item. Of the 112 URLs, 16 are absolute links to other sites. The other 96 are links between my own posts: the links I most want a reader to follow are the ones that broke. The two files differ by 1,728 bytes, which is 96 times the 18 characters of https://umar.codes.

The gate still passes with the fix removed

This is the part I did not expect. I removed the one call to absolutizeHtml from src/pages/rss.xml.ts and ran all eight steps of the gate. Every step exits 0. The tests report 93 of 93 passing. The built feed has 96 broken links.

The 10 tests pin the function. They do not pin its use. check-links walks the built HTML pages and does not open rss.xml. check-content opens the feed, but only to confirm that it exists and holds no draft. So the defect that the tests were written against can come back with one deleted line, and no check I own will report it.

This is the same mistake one level up. In July I had a parser where I needed a consumer. Now I have a unit test where I need a check on the built file. The probe above is that check: it reads dist/rss.xml the way a reader does, and it fails on the file that everything else passes. It is not in the gate yet. I restored the call, and today’s feed has 0 root-relative links.

The contrast check on this site taught the same thing from the other side: a tool that passes because it did not look is not evidence. A validator tells you about the question it asks. Before I trust a green result now, I name the consumer and ask if the check reads the file as that consumer does.

Revisions

  1. Created from the 2026-08-12 decision entry, the 2026-07-27, 2026-08-11 and 2026-08-12 verification runs, the feed code and its tests, and two builds of the feed that day (with and without the link rewrite), each read by xmllint and by a short probe, plus a run of the full gate with the rewrite removed.
  2. Published on its Nov 27 slot; auto-drafted by the publishing run because no draft existed for the row.