Make the README's references clickable, and check that they land

The two manuals and the CosmOS README were named in prose and nothing else,
so reading about them and getting to them were separate acts. They are links
now, along with every directory in the repository map, which is the other
place somebody reading that page wants to click.

THE MANUALS HAVE SPACES IN THEIR NAMES, so the links carry %20. That detail
is why this is checked rather than eyeballed: a link with a raw space in it
points at a file that exists, so nothing about the filesystem is wrong -
the renderer just stops at the space and the link goes nowhere useful.

Tests/docs.sh now walks every relative link in every tracked markdown file
and complains about both failures: a target that is not there, and a target
with a space that should have been encoded.

Both verified by breaking them. The first attempt at that verification was
itself wrong - I removed the %20 and the check passed, because the file
really does exist under that name. That is what showed the two failures are
different things and both need catching.

13 links, all landing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-08-21 16:29:21 -04:00
co-authored by Claude Opus 5
parent 3f95056eec
commit 4e5710a1e6
2 changed files with 43 additions and 13 deletions
+30
View File
@@ -59,6 +59,36 @@ for name in tracked.split(b"\0"):
% (path, number, ", ".join("%r (U+%04X)" % (c, ord(c)) for c in odd)))
break
# ---- Every link in the documents goes somewhere ----
#
# A link that does not resolve is the same kind of wrong as a stale claim: it looks like
# information and is not, and nobody notices until a stranger clicks it. The manuals have
# SPACES IN THEIR NAMES, so a link to one carries %20 and has to be unquoted before it can
# be looked for - which is the sort of thing that would otherwise be got wrong once and
# then reported as fine.
import os
import urllib.parse
for name in tracked.split(b"\0"):
if not name or not name.endswith(b".md"):
continue
path = name.decode()
here = os.path.dirname(path)
for match in re.finditer(r"\[[^\]]*\]\(([^)]+)\)", read(path)):
target = match.group(1)
if target.startswith(("http://", "https://", "#", "mailto:")):
continue
# A raw space ends the link early in most renderers, so the file existing is not
# enough - the manuals have spaces in their names and must carry %20.
if " " in target:
problems.append("%s links to \"%s\", which has a space in it: most renderers"
" stop at the space. Write it as %%20."
% (path, target))
continue
wanted = urllib.parse.unquote(target.split("#")[0])
if not os.path.exists(os.path.normpath(os.path.join(here, wanted))):
problems.append("%s links to %s, and there is nothing there" % (path, target))
# ---- Every instruction has a row, and every row is an instruction ----
#
# A mnemonic begins with a letter, which is what keeps the offset and size columns of the