test: align RST fixtures with auto_id_prefix to fix docutils 0.18 CI failures#2087
Merged
Conversation
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>
There was a problem hiding this comment.
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"withid="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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CI has been red on
masterand on every open PR (for example the Dependabot bump in #2086). Three reStructuredText tests fail:test_rst,test_long.rst, andtest_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'inlib/github/commands/rest2htmlto keep the pre-docutils-0.18 table-of-contents anchor scheme (id1,id2, ...idN). The renderer now emitsidNas 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 wereid="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-pinneddocutils==0.22.4, so they now carry theidNanchors that the existingauto_id_prefix: 'id'setting actually produces. No source code changed; the diff is only theidattribute 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_equalharness to ignore id differences would mask real drift, and revertingauto_id_prefixwould undo the deliberate choice to keep stableidNanchors.id="toc-entry-1"id="id1"href="#id1")docutils 0.22.4)Testing
I reproduced the failure locally with the CI-pinned
docutils==0.22.4, regenerated the fixtures withUPDATE=1, and confirmed the full suite passes:I also verified the diff changes nothing but
idvalues: after normalizing everyid="..."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 matchesdocutils 0.22.4exactly.Rollout
Low risk: the change is test-fixture only, gated behind CI across Ruby 3.3, 3.4, and 4.0. If a future
docutilspin bump shifts the global auto-id counter (the long fixture usesid113–id138), the fixtures will need regenerating again withUPDATE=1 bundle exec rake. Rollback is a straight revert.