fix: give repeated documentation headings distinct anchors - #1787
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 4:04 AM ET / 08:04 UTC. ClawSweeper reviewWhat this changesThe PR shares collision handling between the documentation renderer and link checker so repeated headings receive distinct links, with regression coverage and an Unreleased note. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v0.50.0 still generate duplicate heading destinations. No blocking correctness findings remain, and the revision-specific browser proof still applies. Priority: P3 Review scores
Verification
How this fits togetherCrabbox’s documentation builder turns Markdown into static pages and derives each page’s table of contents from its rendered headings. Heading IDs determine where section links and browser navigation land. flowchart LR
A[Markdown headings] --> B[Documentation renderer]
B --> C[Per-page anchor allocation]
C --> D[HTML section IDs]
D --> E[Table of contents]
E --> F[Browser section navigation]
G[Markdown link checker] --> C
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Use the shared per-document allocator to keep section destinations unique while retaining existing first-occurrence links and slug normalization. Do we have a high-confidence way to reproduce the issue? Yes: current main renders the two Cache volumes headings with the same ID and copies that ID into both table-of-contents links; the supplied browser report demonstrates the corresponding wrong destination. Is this the best way to solve the issue? Yes: extracting and reusing the checker’s collision allocator repairs the renderer without introducing competing normalization rules or dependencies. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bcd8ffc9bb5f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Summary
Give repeated documentation headings distinct anchors and table-of-contents destinations. The generated Cache, Capsules, and Agent Sandbox pages currently reuse heading IDs, so selecting the later TOC entry jumps to the earlier section.
Reuse the link checker's existing per-document collision allocator in the renderer. First-occurrence URLs remain unchanged; literal suffix collisions remain safe. The Markdown parsers and slug normalization rules stay separate, and no dependency is added.
Verification
node --test scripts/check-docs-links.test.js scripts/build-docs-site.test.js: 17 passed, 0 failed, 0 skipped.scripts/check-docs.shpassed, including a fresh site build, generated-page tests, links, discovery, and navigation checks.git diff --checkand managed pre-commit review passed with no actionable findings.Real Chrome proof
Verified through the actual Chrome extension browser against locally built documentation, not an isolated browser or DOM-only substitute. On the tested main baseline (
14ca854eb1f417a46ad621dc3cd22768a898e861), clicking the later cache volumes item in the Cache Controls page's table of contents navigates to#cache-volumesand displays the earlier Cache volumes overview. With the integrated fix (bba8e5e5fdd46de9ea80455b736cb9a6740054e9), that item navigates to#cache-volumes-1and displays the intended command section and its examples.The attached captures show the settled rendered destinations after the same real click. They contain only public project documentation; the task-owned tab and all three loopback proof servers were closed afterward. The initial mid-scroll capture was not used.
The updated branch retains only the six-file anchor allocation change against current main. The 17 targeted tests pass with no skips, and the complete docs check passes, including the generated site, links, discovery, and navigation checks. Managed Codex review is P0 scoped-clean. The Unreleased entry is maintainer-added; published 0.50.0 and older release notes are unchanged.
Current head
ae7be4cc2aa70a1dd476b9619a54ac181744dcbeintegrates the Freestyle landing without changing the renderer, shared allocator, link checker, or Cache Controls source used in this browser proof.