Skip to content

fix: docs MD anchor broken — RST label slug not heading slug (#316)#323

Open
kiyotis wants to merge 14 commits intomainfrom
316-fix-docs-md-anchor-heading-slug
Open

fix: docs MD anchor broken — RST label slug not heading slug (#316)#323
kiyotis wants to merge 14 commits intomainfrom
316-fix-docs-md-anchor-heading-slug

Conversation

@kiyotis
Copy link
Copy Markdown
Contributor

@kiyotis kiyotis commented Apr 28, 2026

Closes #316

Approach

_anchor_for_label in scripts/common/labels.py was slugifying the RST label name (e.g. universal-dao) instead of the heading text (ユニバーサルDAO). GitHub auto-anchors headings from their rendered text, so all 2,744 cross-reference anchor links in docs MD silently failed to navigate.

Fix: replace _anchor_for_label(label) with _anchor_for_title(title), passing LabelTarget.title (the resolved heading text) to github_slug. This aligns the generated #fragment with GitHub's actual auto-anchor for each heading.

Tasks

See tasks.md.

Expert Review

Expert review will be conducted before merging.

Success Criteria Check

Criterion Status Evidence
_anchor_for_label uses heading text via github_slug ✅ Met labels.py: _anchor_for_title(title) using github_slug(title)
Generated anchor fragments match GitHub auto-anchors ✅ Met Task 0: libraries-universal-dao.md — OK: 7 self + 60 cross, MISS: 0
All existing verify checks pass ✅ Met All 5 versions: FAIL 0 → 0 (no regression)
Horizontal check: all versions (v6/v5/v1.4/v1.3/v1.2) verified ✅ Met rbkc create + verify on all 5 versions, notes.md
Root cause identified with reproducible test ✅ Met TestHeadingTextAnchor::test_anchor_differs_from_label_slug_for_japanese
Issue verified as resolved in test environment ✅ Met 5 new tests GREEN; Task 0 live anchor verification
Horizontal check completed with method, results, and status ✅ Met All 5 versions: 0 FAIL diff — notes.md
Recurrence prevention measures implemented ✅ Met TestHeadingTextAnchor (5 tests) prevents regression

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kiyotis kiyotis added the bug Something isn't working label Apr 28, 2026
Comment thread .work/00316/tasks.md Outdated
Comment thread .work/00316/tasks.md Outdated
Comment thread .work/00316/tasks.md Outdated
kiyotis and others added 13 commits April 28, 2026 16:58
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ete steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…RED)

Issue #316: labels.py anchor must be github_slug(title), not github_slug(label).
These 5 tests are currently RED; implementation follows in the next commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Issue #316: _anchor_for_label(label) → _anchor_for_title(title).
Anchor in generated docs MD now matches GitHub's auto-anchor for the
heading, so #fragment links resolve correctly on GitHub.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Issue #316: §3-2-2 label resolution rule updated.
Sphinx-following exception added to §3-2 preamble: #anchor in docs MD
must match GitHub heading auto-anchor (github_slug(heading_title)),
not Sphinx HTML id (github_slug(label_name)).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Task 4: all 5 versions show FAIL 0→0 (no regression).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Issue #316: anchor in generated JSON/docs MD now uses github_slug(heading_title)
instead of github_slug(label_name), matching GitHub's heading auto-anchor.
All 5 versions regenerated: v6 (353), v5 (533), v1.4 (489), v1.3 (327), v1.2 (321).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: docs MD page anchors broken — RST label slug used instead of heading text slug

1 participant