Repository navigation
Description
Summary
Two cross-ADR links in adr/008-reputation.md point at #anchors that do not exist in the target file. Both still land on the correct file in a browser — GitHub just ignores an unresolvable fragment and renders the top of the page — so they read as working links.
The check-md-anchors guard in adr/Makefile is meant to catch exactly this class of drift and cannot: it verifies that a cross-ADR link carries an anchor, never that the anchor resolves to a heading in the target.
The two broken links
| Location | Current link | Target's H1 | Correct anchor |
|---|---|---|---|
adr/008-reputation.md:14 |
003-payments.md#adr-003-payments |
# ADR 003: Payment Model |
#adr-003-payment-model |
adr/008-reputation.md:115 |
028-slashing-appeals.md#adr-028-slashing-appeals |
# ADR 028: Slashing Appeals and Dispute Escalation |
#adr-028-slashing-appeals-and-dispute-escalation |
Why the guard misses them
The target's own comment states the intent:
# check-md-anchors : every cross-ADR *.md link must carry a #heading
# anchor, so a retitled/renamed ADR breaks the link
# (drift caught) vs silently pointing at the wrong file.The goal is drift detection — a retitled ADR should break the link visibly. But the implementation only greps for links that have no anchor:
grep -E '\]\((\./)?([0-9]{3}-[a-z0-9-]+|appendix-[a-z0-9-]+|architecture|glossary)\.md\)'Any link with a #fragment passes, resolving or not. So the failure mode the check exists to prevent — link text and anchor drifting away from the heading they name — is the one thing it lets through, and make check-refs reports all ADR cross-links carry a #anchor on a tree containing both links above.
Suggested fix
Two separable parts:
- Correct the two anchors in ADR 008.
- Teach the target to resolve anchors — extend
check-md-anchors, or add a siblingcheck-anchor-targets: build the set of heading slugs per file, then assert everyfile.md#anchorlink names one of them.
Two constraints worth flagging for whoever picks up part 2:
- The Makefile documents a "basic tools only (awk/sed/grep), no perl/python" rule, so the resolver should be awk rather than a scripting-language helper.
- It must reproduce GitHub's slug algorithm exactly: lowercase, strip everything except word characters / spaces / hyphens, then spaces → hyphens. The tree already depends on the double-hyphen artifact that
—produces (#tier-1--minor-no-coordination,#tier-2--medium-new-message-types-no-alpn-bump), so an approximation will generate false positives on links that are actually correct. Headings inside fenced code blocks must be skipped, same as the existing guards do.
Scope
An ad-hoc resolver run across adr/*.md (fenced code excluded, same-file and cross-file links) finds exactly these two and nothing else:
adr/008-reputation.md:14 -> 003-payments.md#adr-003-payments
adr/008-reputation.md:115 -> 028-slashing-appeals.md#adr-028-slashing-appeals
So part 1 is a two-line fix; the value is mostly in part 2 keeping it that way.
Context
Found while reviewing #1447 (docs-only ADR 013 condensation) — the resolver above was written to confirm that PR left no dangling anchors, and turned up these two as a side effect. Both predate #1447 and are unrelated to it, so they were deliberately left out of that PR's scope.
Activity
docs(adr): fix three cross-ADR links whose anchors resolve to nothing
build(adr): add check-anchor-targets, resolving every #anchor to a he…
docs(adr): fix three cross-ADR links whose anchors resolve to nothing
build(adr): add check-anchor-targets, resolving every #anchor to a he…