readme_toc.py generates duplicate fragment links for repeated headings
メンテナーはふだん 1 日以内に返信
@akhil9tiet がすでに取り組んでいます。
2026年10月28日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
調査の方向性
まず scripts/readme_toc.py を確認し、generate_toc_lines を調べてから、issue に記載された対象の回帰ケースを実行してください。見出しの重複と、同じフラグメントに正規化される異なるタイトルのケースを追加してください。生成されるアンカーが一意で、見出しの重複に対して期待される数値サフィックスを使う状態が完了の基準です。
索引モデルが issue の本文から書いたものです。
説明
Summary
scripts/readme_toc.py generates the same fragment for repeated Markdown headings. GitHub assigns unique heading anchors (#setup, #setup-1, ...), so the second and later entries in a generated table of contents navigate to the first heading instead.
Minimal reproduction
On current main (inspected commit e742db9f7ba98e63e502b310857d49d047888518), run the existing helper:
from scripts.readme_toc import generate_toc_lines
print(generate_toc_lines("## Setup\n\n## Setup\n"))
Actual:
['- [Setup](#setup)', '- [Setup](#setup)']
Expected:
['- [Setup](#setup)', '- [Setup](#setup-1)']
Impact
When --fix writes a ToC for a Markdown document with repeated section titles, later entries silently point at the wrong section. The check mode can then accept that incorrect ToC because it compares against the same generator.
Validation
- Reproduced by executing the
generate_toc_linesimplementation from the current source in an isolated Python environment. - A focused
unittestasserting unique links for two## Setupheadings fails: 1 test, 1 failure, with the second generated fragment#setupinstead of#setup-1. - This is a source-level / isolated regression test; no full repository test suite or GitHub renderer integration test was run.
Suggested fix
Track collisions of the normalized fragment, assign numeric suffixes matching GitHub heading-anchor behavior, and add regression cases for two and three repeated headings (including collisions between different raw titles that normalize to the same fragment).
Related reports checked
I checked issue/PR searches for readme_toc.py, toc, and duplicate heading/anchor wording. Existing issue #41077 concerns fenced-code parsing, not duplicate heading IDs. This report is intentionally separate.
Source: https://github.com/openai/codex/blob/e742db9f7ba98e63e502b310857d49d047888518/scripts/readme_toc.py
- 主要言語
- Rust
- スター
- 131k
- フォーク
- 20.7k
- 平均マージ
- 1分
- マージ済み PR(30日)
- 997
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/codex のほかの issue
-
app bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
app bug
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Package archive builder deletes existing file with unsupported suffix under --force対応中かも @akhil9tiet が 2 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openai/codex#57727 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
CLI enhancement TUI
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
area:ci kind:bug priority:p3 ready
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
srikanth235/centraid#1155 ·
メンテナーはふだん 1 日以内に返信
-
dotfiles: failed batch untrack removes earlier tracking declarations対応中かも @jdx が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信