docs: mark the Type Stubs copies of four TypedDicts :no-index: - #532
Conversation
#520 made the `if SPHINX_TYPE_CHECKING:` TypedDicts importable during the build, which exposed that four of them are documented twice on the same page -- once under "Header Schemas" beside the option they belong to, and again in the "Type Stubs" appendix. Before #520 both occurrences failed to import, so nothing collided. - add `:no-index:` to the appendix copy of `RPLFlags`, `MPLFlags` and `DFFFlags` in `hopopt.rst` and `ipv6_opts.rst`, and of `Flags` in `tcp.rst`, keeping the inline "Header Schemas" occurrence canonical Measured with sphinx-build 9.1.0: 83 warnings -> 50, `duplicate object description` 36 -> 3, `failed to import` stays 0, no new warning appears. The 3 remaining duplicates pre-date #520 and are untouched. Also repairs cross references, which resolved to the appendix via `#id0` rather than to the canonical name anchor.
|
✅ GOOD TO MERGE — independently confirmed via |
Detailed review (independent verification, falsify-not-bless)Reviewed at head 1. The diff. Confirmed all 7 2. Build comparison, independently re-derived (not copied from the PR).
3. The decisive claim — cross-reference resolution — inspected directly on both sides, not accepted from any summary. Loaded
All 26 field-level members showed the identical pattern. On 4. Mechanism verified from Sphinx 9.1.0 source directly, not from the PR's assertion. 5. Minor wording nitpick, non-blocking. The PR description calls the pre-existing Judgment on "no test, deliberately"Reasonable as scoped — a test merely asserting "these 7 lines contain What could not be verified furtherNothing had to be abandoned — both full builds completed end-to-end, including the confirmed-benign ~13-14 minute VerdictThe load-bearing claim is confirmed true by direct inspection: this fixes broken navigation, not just warning noise. Recommend merge. |
Follow-up to #520. The owner merged #520 earlier than intended and asked for the
duplicate-object warnings it surfaced to be fixed separately, which is what this does.
What #520 left behind
#520 moved
os.environ['PCAPKIT_SPHINX'] = '1'aboveimport pcapkitindocs/source/conf.py. That took autodoc'sfailed to importwarnings from 96 to 0, butit also made the
if SPHINX_TYPE_CHECKING:TypedDicts real for the first time — andexposed that four of them are listed twice on the same page.
It is not a cross-module or
const/vendorcollision. Every warning'sother instance in …clause names the same document it came from. Each class appearsonce under Header Schemas, next to the option it belongs to, and again in the
Type Stubs appendix. Before #520 both occurrences independently failed to import, so
there was no target to collide with.
internet/hopopt.rstRPLFlags,MPLFlags,DFFFlagsinternet/ipv6_opts.rstRPLFlags,MPLFlags,DFFFlagstransport/tcp.rstFlagsThe change
Seven added lines.
:no-index:on the Type Stubs occurrence in each case, keeping theinline Header Schemas copy canonical — it sits beside its parent option
(
RPLOption/RPLFlags,MPLOption/MPLFlags,IPDFFOption/DFFFlags,TCP/Flags),which is where a reader looking the type up will be.
Only the class-level directive is marked; the
:members:fields are not touched. One:no-index:per class suppresses registration for the class and everything:members:pulls in, because_document_membersinsphinx/ext/autodoc/_generate.pypasses the same
optionsobject to each member's_generate_directives, and_renderer.pyemits:no-index:for any directive whoseoptions.no_indexis set. Thatwas verified by the build rather than assumed: if it covered classes only, 7 of the 33
would have gone and 26 would have remained.
Build comparison
Two full
sphinx-build9.1.0 runs off this worktree, before and after the seven lines,with
PYTHONSAFEPATH=1andpcapkit.__file__asserted to be this tree on each run (thevenv has pcapkit installed editable against a different checkout and would otherwise
shadow it).
duplicate object descriptionfailed to importmore than one target found for cross-referenceComparing warning sets with line numbers normalised, the after-set is a strict subset
of the before-set: no new warning of any kind appears, and the 33 removed are exactly
the 7 classes plus their 26 fields.
The 3 surviving duplicates pre-date #520, are unrelated to it, and are deliberately left
alone —
pcapkit.corekit.infoclass.Info.__post_init__,pcapkit.foundation.reassembly.data.tcp.BufferID, andpcapkit.protocols.misc.pcap.header.Header.__post_init__(that last one from two literalback-to-back
.. automethod:: __post_init__lines inpcap.rst).It also fixes cross-references
Worth calling out, since it makes this more than warning cleanup. A duplicate target
forced Sphinx to fall back to numbered anchors, and the inventory pointed at the wrong
copy —
objects.invresolved these seven names to#id0/#id5/#id9, the Type Stubsappendix occurrence, rather than to the canonical Header Schemas one. After the change
each resolves to its proper name anchor:
(
#$is the inventory's shorthand for "anchor equals the object name".) Confirmed in thegenerated HTML too:
hopopt.htmlcarried bothid="id0"andid="pcapkit.protocols.schema.internet.hopopt.RPLFlags"before, and only the latter after.No test
No test accompanies this, and inventing one would be theatre — it is a docs-only change
of seven directive options, with no importable behaviour to assert against. The two-build
warning-set comparison above is the evidence.