Repository navigation
feat(changelog): cite issues, PRs and discussions with Sphinx roles - #1008
Conversation
* Converts 455 bare `#NNN` citations in `docs/source/changelog/` into `:issue:`, `:pr:` and `:discussion:` roles -- 434 in `1.5.0.rst`, 21 across 13 older release notes. Each number's kind was resolved against the GitHub API, not guessed from context. * Teaches `util/changelog_md.py` the five `extlinks` roles, so the generated `CHANGELOG.md` carries real Markdown links. Without this the generator rejects every converted entry: `_RESIDUAL` makes an unconvertible role fatal, and it knew only `:rfc:`. * Holds the role table as a module constant rather than reading `docs/source/conf.py` at run time, because `MANIFEST.in` prunes `docs` and re-includes only the changelog entries -- an sdist has the entries but not the config. A test pins the constant against `conf.py` and skips when `docs/` is absent. * Leaves bare: `GH-nnn`, citations inside literals, and another repository's numbers. `tests/project/` passes 268 tests / 864 subtests, and 59 with `conf.py` moved aside. Docs build unchanged at 61 warnings.
|
GOOD TO GO at Where it was stronger than my own verification. My nested-inline-markup proof was a per-line regex scan. It found 36 lines carrying Independently derived, not re-read: 274 distinct numbers resolved via GraphQL in batches — 152 issues, 120 pull requests, 2 discussions — 0 kind mismatches across all 455 occurrences, and no number cited under two kinds. Collapse-back equality per file, 372 lines each side. Necessity measured by reverting one line: exactly the 14 converted entries fail, no others. The sdist claim measured by running My two errors it caught. The Three non-blocking findings, recorded rather than fixed, since all are unexercised — every one of the 455 role contents is plain digits, and changing the diff would invalidate this verdict for a new head:
It did not run a real |
|
Ready to merge at The three skipped legs are the conditional ones that do not apply to this change, not suppressed failures. Unpublished and unmerged, awaiting you. |
|
The one gap the cross-review left open is closed: a real Sphinx build ran on this PR and passed. It flagged that it had used docutils parsing rather than I checked which leg covers that, because So the five roles render through real Sphinx with |
Please follow the guide below
make pylint,make mypy,make isort)make testpasses, and a test case covers the changedocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visibleA test case covers the change: 5 new tests in
tests/project/test_changelog_md.py, each shown to fail without the fix. Themake testbox is left unticked deliberately — the full suite exhausts memory on the machine this was prepared on, so I rantests/project/and the docs build rather than claiming a green run I did not observe. CI's matrix is the authority on the rest.What is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
Part of #719, finishing what #989 settled for
pcapkit/: a bare#NNNrenders as plain text in the documentation, so 455 citations acrossdocs/source/changelog/become:issue:,:pr:and:discussion:roles — 434 in1.5.0.rstover 253 distinct numbers, 21 across 13 older release notes. Every number's kind was resolved against the GitHub API rather than inferred: 267 issues, 186 pull requests (#30and#121among them) and 2 discussions (#106,#251).The markup changes and the rendered text does not. Collapsing every role back to
#NNNover the whole diff, with whitespace normalised, gives removed text identical to added text — 16 lines in the older notes, 356 in1.5.0.rst. A separate scan asserts no role sits inside**bold**,*italic*or a literal, which renders as literal text with no Sphinx warning at all. The docs build stays at exit 0 and 61 warnings, with the warning lists line-for-line identical.util/changelog_md.pyhad to learn the roles, which is why this is not a docs-only change. The rootCHANGELOG.mdis generated from these entries, and the generator's_RESIDUALguard makes any role it cannot convert fatal — it knew only:rfc:. Unchanged, it rejects all 14 converted entries. It now converts the fiveextlinksroles fromdocs/source/conf.pyinto Markdown links, followingsphinx.ext.extlinksfor the link text and target, including the explicit-title form. The guard itself is untouched, so an unknown role such as:mod:is still fatal.The role table is a module constant, not a run-time read of
conf.py.MANIFEST.inprunesdocsand then re-includes onlydocs/source/changelog/*.rst, so an sdist carries the converted entries and the generator but not the config; reading it live made a missing config a fatalResidualMarkupErrorinstead of a degradation. A test pins the constant againstconf.py'sextlinksand skips whendocs/is absent — drift-proof where it can be checked, correct where it cannot.Left bare deliberately, and these are the only 3 bare citations left in the 14 files:
#439at1.5.0.rst:708, where the literal text is the point and the number is still cited as:issue:439at `:1523` and `:1624`; and **two** of another project's numbers,JarryShaw/DictDumper#125andJarryShaw/DictDumper#121``, at:1090and `:1095`. `GH-nnn` would also have been left alone as this repository's alternative issue form, but that exclusion is vacuous here — there are 0 `GH-nnn` occurrences in any of these files or in `CHANGELOG.md`, so nothing was there to preserve.Verification.
tests/project/gives 268 passed / 1 skipped / 864 subtests, and 59 passed / 1 skipped withconf.pymoved aside. The regeneratedCHANGELOG.mdhas an exact bijection with the source: 434 roles ↔ 434 links, 248/issues/, 185/pull/, 1/discussions/, no number whose link text and target disagree.