Skip to content

test: align RST fixtures with auto_id_prefix to fix docutils 0.18 CI failures#2087

Merged
zkoppert merged 1 commit into
masterfrom
zkoppert/fix-rst-toc-ids
Jul 10, 2026
Merged

test: align RST fixtures with auto_id_prefix to fix docutils 0.18 CI failures#2087
zkoppert merged 1 commit into
masterfrom
zkoppert/fix-rst-toc-ids

Conversation

@zkoppert

@zkoppert zkoppert commented Jul 9, 2026

Copy link
Copy Markdown
Member

Why

CI has been red on master and on every open PR (for example the Dependabot bump in #2086). Three reStructuredText tests fail: test_rst, test_long.rst, and test_toc.rst.

The root cause traces back to #2081 ("Fix id names in rst renders after docutils 0.18"). That PR set auto_id_prefix: 'id' in lib/github/commands/rest2html to keep the pre-docutils-0.18 table-of-contents anchor scheme (id1, id2, ... idN). The renderer now emits idN as intended, but the committed fixtures were left holding the docutils-0.18 default (toc-entry-1, toc-entry-2, ...). The rendered output never matched the fixtures, so the tests failed on the #2081 merge run and have stayed red ever since.

The old fixtures were also internally broken: RST section headers carry back-references like <a href="#id1">, but the matching TOC anchors were id="toc-entry-1", so those in-page links pointed at anchors that did not exist.

What changed

I regenerated the three affected fixtures (test/markups/README.rst.html, README.long.rst.html, README.toc.rst.html) against the CI-pinned docutils==0.22.4, so they now carry the idN anchors that the existing auto_id_prefix: 'id' setting actually produces. No source code changed; the diff is only the id attribute values on TOC-entry <a> tags, and it repairs the dangling in-page anchors as a side effect.

I chose to complete #2081's approach rather than the alternatives. Loosening the assert_html_equal harness to ignore id differences would mask real drift, and reverting auto_id_prefix would undo the deliberate choice to keep stable idN anchors.

Before After
TOC anchor ids id="toc-entry-1" id="id1"
In-page back-refs (href="#id1") dangling resolve
RST tests (docutils 0.22.4) 3 failures 0 failures

Testing

I reproduced the failure locally with the CI-pinned docutils==0.22.4, regenerated the fixtures with UPDATE=1, and confirmed the full suite passes:

62 runs, 137 assertions, 0 failures, 0 errors, 0 skips
Line Coverage: 100.0% (226 / 226)

I also verified the diff changes nothing but id values: after normalizing every id="..." token to a placeholder, the before and after fixtures are byte-identical. A three-model review (Opus, Sonnet, GPT-5.5) independently confirmed the scope, the id uniqueness, and that the regenerated output matches docutils 0.22.4 exactly.

Rollout

Low risk: the change is test-fixture only, gated behind CI across Ruby 3.3, 3.4, and 4.0. If a future docutils pin bump shifts the global auto-id counter (the long fixture uses id113id138), the fixtures will need regenerating again with UPDATE=1 bundle exec rake. Rollback is a straight revert.

PR #2081 set auto_id_prefix: 'id' in lib/github/commands/rest2html to keep
the pre-docutils-0.18 anchor id scheme, but the committed RST fixtures still
held the docutils-0.18 default (toc-entry-N). The rendered output therefore
never matched the fixtures, so test_rst, test_long.rst, and test_toc.rst
failed on master and on every PR built from it.

I regenerated README.rst.html, README.long.rst.html, and README.toc.rst.html
against the CI-pinned docutils 0.22.4 so the fixtures use the idN scheme that
the auto_id_prefix: 'id' setting actually produces, honoring #2081's intent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Zack Koppert <zkoppert@github.com>
@zkoppert zkoppert self-assigned this Jul 9, 2026
@zkoppert zkoppert requested a review from Copilot July 9, 2026 16:05
@zkoppert zkoppert requested review from TylerDixon and pudiva July 9, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates reStructuredText HTML fixtures so their generated TOC entry id attributes match the renderer’s auto_id_prefix: 'id' behavior (restoring the pre-docutils-0.18 idN scheme) and fixing the currently failing RST-related tests under the CI-pinned docutils version.

Changes:

  • Regenerates RST HTML fixtures to replace id="toc-entry-N" with id="idN" in TOC entry links.
  • Aligns TOC ids with existing in-page back-references (href="#idN") so intra-page links resolve correctly.
  • Removes all remaining toc-entry-* ids from the affected fixtures.
Show a summary per file
File Description
test/markups/README.rst.html Updates TOC entry ids from toc-entry-* to id* to match the renderer output.
test/markups/README.toc.rst.html Updates nested TOC entry ids to id1/id2/id3 to match generated anchors.
test/markups/README.long.rst.html Updates long TOC entry ids to the generated id113–id138 sequence for docutils 0.22.4 output parity.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Low

@zkoppert zkoppert marked this pull request as ready for review July 9, 2026 19:31
@zkoppert zkoppert merged commit fd5b414 into master Jul 10, 2026
12 checks passed
@zkoppert zkoppert deleted the zkoppert/fix-rst-toc-ids branch July 10, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants