fix(docs): qualify the ambiguous Type refs in the foundation rst tree - #714
Merged
Merged
Conversation
Sphinx defines several classes named Type across pcapkit (including pcapkit.const.l2tp.type.Type), so a bare `Type` in a hand-written :type: field is ambiguous and resolves silently to the wrong one -- confirmed by a docs build showing engine.rst's `Type[EngineBase]` linking to the L2TP enum instead of typing.Type. Qualify the four remaining bare-Type :type: fields in the docs/source tree to `typing.Type[...]`, matching the fully-qualified form already used at traceflow.rst:30: - docs/source/pcapkit/foundation/engines/engine.rst:40 - docs/source/pcapkit/foundation/reassembly/reassembly.rst:33,43 - docs/source/pcapkit/foundation/traceflow/traceflow.rst:40 Two more bare-Type sites remain in pcapkit/foundation/traceflow/ traceflow.py's `#:` comments (lines 146 and 406); those belong to the still-open #712 and are left untouched here. Part of #709. Verified with a full `make docs` warning diff: the four "more than one target found for cross-reference 'Type'" warnings drop to zero with no new warnings, and the built HTML now links `Type` to typing.Type instead of the L2TP enum.
Owner
Author
|
Cross-review verdict: GOOD TO GO (independent review on a different model, read-only, ran its own before/after docs builds in a separate scratch checkout). Full cross-review notesVerified firsthand by rebuilding both pristine
No disputes. |
JarryShaw
added a commit
that referenced
this pull request
Sep 23, 2026
… new entries Cross-review on issuecomment-5800589100 (PR #657) found the eight new 1.5.0 entries wrong in several places, spot-checked against source before each fix: - #709 entry: dropped the false "no PR yet filed" clause -- PR #714, opened five minutes before the commit claiming otherwise, covers exactly the four sites named. Corrected the inertness explanation for line 146: the real ``# type:`` comment is at line 162 (sixteen lines below, not two), it also carries a bare ``Type[Dumper]``, and the likely mechanism is ``sphinx_autodoc_typehints`` rather than ``napoleon_attr_annotations``. - #702 entry: "six of seven guard lines" is seven of seven -- #677's sweep exempts nothing and reaches ``tcp/flags.py`` too. Split the conflated claim about "one tuple ending in 65536 swept every registry" into the two tests that actually exist. Reworded the "seven registries are not, at four distinct widths" line, which reads as self-contradicting two of its own examples. - #684 entry: "one write-up apiece" -> one unified write-up; "every automodule" -> there are zero, the exclusion works through ``autoclass`` and ``autodoc_default_options``; "built-in and third-party engines' own _backend" -> only the third-party ones gained it, built-in gained a different attribute set. Also fixed the "bare-\n``Type``" line wrap that renders as "bare- `Type`" -- the only trailing-hyphen wrap in the file. - #708 entry: only one of the two tests re-derives against git; the sibling still compares the module to itself. Dropped "today's six tracked names", which contradicts the #685 entry naming 2. - #700 entry: only ``_tiers.py`` cited "six"; ``test_tier_guard.py`` said "seventh capture" instead. Two smaller imprecisions, fixed as flagged: the #672/#679 entry's "both codes reach this class" now says packing explicitly (parsing only reaches 129, per #690, already stated later in the same entry), and its claim of a pre-fix ``R1_COUNTER`` override is corrected to a schema default. The #685 entry's "shown failing" is now qualified to the 2 of 5 tests (5 of 8 subtests) that actually fail against the pre-change tree. Checked but not changed: no entry in the file asserts the "issue numbers only" citation convention the review tested, so there was nothing to correct there; the five inline PR references it flagged as legitimate are untouched. Verified: docutils 0.22.4 ``publish_doctree`` over the changed block -- zero system messages, one bullet_list of 8 items.
5 tasks
JarryShaw
added a commit
that referenced
this pull request
Sep 23, 2026
A third cross-review found the same failure mode again: the last pass replaced vague prose with false prose. This round deletes rather than corrects. - #702 entry: dropped the attribution of the seven guard raise lines to specific PRs. "the four mh.* guards came from #632" was false and self-contradicts the file's own #623 entry three sections earlier ("The range guard above it is untouched" -- a05f461's own commit message says the same). The entry does not need to say which PR added which guard; it only needs to say the lines were already covered. - #709 entry: dropped the `TraceFlowBase.__dict__['__annotations__']` citation. Measured: that lookup raises KeyError, not "is empty" -- `TraceFlowBase.__annotations__` (the resolved, non-dict-shortcut form) is `{'__cached__': ...}`, non-empty. The conclusion (`__output__` is unannotated) holds, but the cited evidence does not, so it's dropped rather than replaced with a corrected measurement. - #709 entry: rewritten to the present tense of a merged world. #709 closed once #712 landed (the two traceflow.py sites this entry describes); the four docs/*.rst sites are fixed separately by #714, also merged. No more "does not close" / "stays open" hedging. Refs #657
JarryShaw
added a commit
that referenced
this pull request
Sep 24, 2026
…tale tense Round 5: fixed the two defects the fourth cross-review found at head 93a4126 (NEEDS CHANGES). - `:2389` -- "This pair of sites is what closes #709" was false: #712 and #714 both state in their own bodies that they are `Part of #709`, not a close, and #709's closed timeline event carries `commit_id: null` (a manual close). Made non-causal: "This pair of sites is part of #709." - `:2325` -- "#709 tracks it" was present tense describing an issue that is now closed, contradicting the #709 entry itself. Changed to past tense: "#709 tracked it." Regenerated CHANGELOG.md from the edited entry. | check | result | |---|---| | `changelog_md.py --check` | exit 0 | | `pytest tests/project/test_changelog_md.py -q` | 47 passed, 37 subtests |
JarryShaw
added a commit
that referenced
this pull request
Sep 26, 2026
… new entries Cross-review on issuecomment-5800589100 (PR #657) found the eight new 1.5.0 entries wrong in several places, spot-checked against source before each fix: - #709 entry: dropped the false "no PR yet filed" clause -- PR #714, opened five minutes before the commit claiming otherwise, covers exactly the four sites named. Corrected the inertness explanation for line 146: the real ``# type:`` comment is at line 162 (sixteen lines below, not two), it also carries a bare ``Type[Dumper]``, and the likely mechanism is ``sphinx_autodoc_typehints`` rather than ``napoleon_attr_annotations``. - #702 entry: "six of seven guard lines" is seven of seven -- #677's sweep exempts nothing and reaches ``tcp/flags.py`` too. Split the conflated claim about "one tuple ending in 65536 swept every registry" into the two tests that actually exist. Reworded the "seven registries are not, at four distinct widths" line, which reads as self-contradicting two of its own examples. - #684 entry: "one write-up apiece" -> one unified write-up; "every automodule" -> there are zero, the exclusion works through ``autoclass`` and ``autodoc_default_options``; "built-in and third-party engines' own _backend" -> only the third-party ones gained it, built-in gained a different attribute set. Also fixed the "bare-\n``Type``" line wrap that renders as "bare- `Type`" -- the only trailing-hyphen wrap in the file. - #708 entry: only one of the two tests re-derives against git; the sibling still compares the module to itself. Dropped "today's six tracked names", which contradicts the #685 entry naming 2. - #700 entry: only ``_tiers.py`` cited "six"; ``test_tier_guard.py`` said "seventh capture" instead. Two smaller imprecisions, fixed as flagged: the #672/#679 entry's "both codes reach this class" now says packing explicitly (parsing only reaches 129, per #690, already stated later in the same entry), and its claim of a pre-fix ``R1_COUNTER`` override is corrected to a schema default. The #685 entry's "shown failing" is now qualified to the 2 of 5 tests (5 of 8 subtests) that actually fail against the pre-change tree. Checked but not changed: no entry in the file asserts the "issue numbers only" citation convention the review tested, so there was nothing to correct there; the five inline PR references it flagged as legitimate are untouched. Verified: docutils 0.22.4 ``publish_doctree`` over the changed block -- zero system messages, one bullet_list of 8 items.
JarryShaw
added a commit
that referenced
this pull request
Sep 26, 2026
A third cross-review found the same failure mode again: the last pass replaced vague prose with false prose. This round deletes rather than corrects. - #702 entry: dropped the attribution of the seven guard raise lines to specific PRs. "the four mh.* guards came from #632" was false and self-contradicts the file's own #623 entry three sections earlier ("The range guard above it is untouched" -- a05f461's own commit message says the same). The entry does not need to say which PR added which guard; it only needs to say the lines were already covered. - #709 entry: dropped the `TraceFlowBase.__dict__['__annotations__']` citation. Measured: that lookup raises KeyError, not "is empty" -- `TraceFlowBase.__annotations__` (the resolved, non-dict-shortcut form) is `{'__cached__': ...}`, non-empty. The conclusion (`__output__` is unannotated) holds, but the cited evidence does not, so it's dropped rather than replaced with a corrected measurement. - #709 entry: rewritten to the present tense of a merged world. #709 closed once #712 landed (the two traceflow.py sites this entry describes); the four docs/*.rst sites are fixed separately by #714, also merged. No more "does not close" / "stays open" hedging. Refs #657
JarryShaw
added a commit
that referenced
this pull request
Sep 26, 2026
…tale tense Round 5: fixed the two defects the fourth cross-review found at head 93a4126 (NEEDS CHANGES). - `:2389` -- "This pair of sites is what closes #709" was false: #712 and #714 both state in their own bodies that they are `Part of #709`, not a close, and #709's closed timeline event carries `commit_id: null` (a manual close). Made non-causal: "This pair of sites is part of #709." - `:2325` -- "#709 tracks it" was present tense describing an issue that is now closed, contradicting the #709 entry itself. Changed to past tense: "#709 tracked it." Regenerated CHANGELOG.md from the edited entry. | check | result | |---|---| | `changelog_md.py --check` | exit 0 | | `pytest tests/project/test_changelog_md.py -q` | 47 passed, 37 subtests |
JarryShaw
added a commit
that referenced
this pull request
Sep 26, 2026
… new entries Cross-review on issuecomment-5800589100 (PR #657) found the eight new 1.5.0 entries wrong in several places, spot-checked against source before each fix: - #709 entry: dropped the false "no PR yet filed" clause -- PR #714, opened five minutes before the commit claiming otherwise, covers exactly the four sites named. Corrected the inertness explanation for line 146: the real ``# type:`` comment is at line 162 (sixteen lines below, not two), it also carries a bare ``Type[Dumper]``, and the likely mechanism is ``sphinx_autodoc_typehints`` rather than ``napoleon_attr_annotations``. - #702 entry: "six of seven guard lines" is seven of seven -- #677's sweep exempts nothing and reaches ``tcp/flags.py`` too. Split the conflated claim about "one tuple ending in 65536 swept every registry" into the two tests that actually exist. Reworded the "seven registries are not, at four distinct widths" line, which reads as self-contradicting two of its own examples. - #684 entry: "one write-up apiece" -> one unified write-up; "every automodule" -> there are zero, the exclusion works through ``autoclass`` and ``autodoc_default_options``; "built-in and third-party engines' own _backend" -> only the third-party ones gained it, built-in gained a different attribute set. Also fixed the "bare-\n``Type``" line wrap that renders as "bare- `Type`" -- the only trailing-hyphen wrap in the file. - #708 entry: only one of the two tests re-derives against git; the sibling still compares the module to itself. Dropped "today's six tracked names", which contradicts the #685 entry naming 2. - #700 entry: only ``_tiers.py`` cited "six"; ``test_tier_guard.py`` said "seventh capture" instead. Two smaller imprecisions, fixed as flagged: the #672/#679 entry's "both codes reach this class" now says packing explicitly (parsing only reaches 129, per #690, already stated later in the same entry), and its claim of a pre-fix ``R1_COUNTER`` override is corrected to a schema default. The #685 entry's "shown failing" is now qualified to the 2 of 5 tests (5 of 8 subtests) that actually fail against the pre-change tree. Checked but not changed: no entry in the file asserts the "issue numbers only" citation convention the review tested, so there was nothing to correct there; the five inline PR references it flagged as legitimate are untouched. Verified: docutils 0.22.4 ``publish_doctree`` over the changed block -- zero system messages, one bullet_list of 8 items.
JarryShaw
added a commit
that referenced
this pull request
Sep 26, 2026
A third cross-review found the same failure mode again: the last pass replaced vague prose with false prose. This round deletes rather than corrects. - #702 entry: dropped the attribution of the seven guard raise lines to specific PRs. "the four mh.* guards came from #632" was false and self-contradicts the file's own #623 entry three sections earlier ("The range guard above it is untouched" -- a05f461's own commit message says the same). The entry does not need to say which PR added which guard; it only needs to say the lines were already covered. - #709 entry: dropped the `TraceFlowBase.__dict__['__annotations__']` citation. Measured: that lookup raises KeyError, not "is empty" -- `TraceFlowBase.__annotations__` (the resolved, non-dict-shortcut form) is `{'__cached__': ...}`, non-empty. The conclusion (`__output__` is unannotated) holds, but the cited evidence does not, so it's dropped rather than replaced with a corrected measurement. - #709 entry: rewritten to the present tense of a merged world. #709 closed once #712 landed (the two traceflow.py sites this entry describes); the four docs/*.rst sites are fixed separately by #714, also merged. No more "does not close" / "stays open" hedging. Refs #657
JarryShaw
added a commit
that referenced
this pull request
Sep 26, 2026
…tale tense Round 5: fixed the two defects the fourth cross-review found at head 93a4126 (NEEDS CHANGES). - `:2389` -- "This pair of sites is what closes #709" was false: #712 and #714 both state in their own bodies that they are `Part of #709`, not a close, and #709's closed timeline event carries `commit_id: null` (a manual close). Made non-causal: "This pair of sites is part of #709." - `:2325` -- "#709 tracks it" was present tense describing an issue that is now closed, contradicting the #709 entry itself. Changed to past tense: "#709 tracked it." Regenerated CHANGELOG.md from the edited entry. | check | result | |---|---| | `changelog_md.py --check` | exit 0 | | `pytest tests/project/test_changelog_md.py -q` | 47 passed, 37 subtests |
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.
Summary
Sphinx defines several classes named
Typeacrosspcapkit(includingpcapkit/const/l2tp/type.py:18'sclass Type(IntEnum)), so a bareTypein a hand-written:type:field is ambiguous. Worse, it doesn't just warn — it silently resolves to the wrong target. Confirmed by a full docs build:engine.rst'sType[EngineBase]linked topcapkit.const.l2tp.type.Type(the L2TP enum) instead oftyping.Type.This fixes the four remaining bare-
Type:type:fields in thedocs/sourcetree:docs/source/pcapkit/foundation/engines/engine.rst:40docs/source/pcapkit/foundation/reassembly/reassembly.rst:33docs/source/pcapkit/foundation/reassembly/reassembly.rst:43docs/source/pcapkit/foundation/traceflow/traceflow.rst:40Which form was chosen, and why
There are two conventions in this repo:
pcapkit/**/*.py's#:autodoc comments use~typing.Type[...](tilde, short display text), whiledocs/source/pcapkit/foundation/traceflow/traceflow.rst:30already readstyping.Type[pcapkit.protocols.protocol.ProtocolBase]— fully qualified, no tilde.I defaulted to the
.rsttree's own precedent (fully qualified, no tilde), since that's the established local convention for hand-written:type:fields, and one of the four sites being fixed is in the very file that already uses it. The inner type parameter (EngineBase,Protocol,ReassemblyBase,TraceFlowBase) was left unqualified, matching how traceflow.rst:40's ownTraceFlowBaseand reassembly.rst'sReassemblyBase/Protocolwere already written elsewhere in these same files — only the ambiguousTypeneeded a qualifier. This is a judgement call; the maintainer may prefer the~typing.Typetilde form instead, since that's what the.pyautodoc comments use.Verification -- the warning diff, not just the exit code
Built with
PCAPKIT_SPHINX=1 python -m sphinx -b html docs/source docs/build/html(no-W), once on pristinemainand once with this change, and diffed the warnings.Baseline (pristine
main, 699f757): 5 occurrences ofmore than one target found for cross-reference 'Type'— 4 at the sites this PR fixes, plus 1 atpcapkit/foundation/traceflow/traceflow.py's_foutio#:comment (line 406), which belongs to the still-open #712 and is untouched here.Fixed: 1 occurrence — only the
_foutiosite remains (out of scope, owned by #712). The 4 targeted warnings are gone, no new warnings of any kind appeared (verified with a full sorted diff of everyWARNING:line between the two builds).HTML anchor check -- confirmed the links now resolve to the right targets, not just quiet:
Typehref)Typehref)../../const/l2tp.html#pcapkit.const.l2tp.type.Type(wrong)https://docs.python.org/3/library/typing.html#typing.Type(correct)typing.Typetyping.Typetyping.TypeThe inner class references (
EngineBase,Protocol,ReassemblyBase,TraceFlowBase) all resolve to their correct internal targets in both builds and were unaffected by this change.Not part of #709, left alone: the same signatures also show
dictresolving topcapkit.const.reg.apptype.AppType.dictinstead of the builtin -- a separate, pre-existing ambiguity bug unrelated toType, present in both the before and after builds. Out of scope here.Test coverage
No test added.
tests/project/test_documentation_claims.py's module docstring states the project's explicit policy on exactly this category:That is exactly this change, so the measured counts above are the test. Ran the existing
tests/project/test_documentation_claims.py(3 tests) under coverage as a sanity check -- still passes unchanged, since this is a doc-only change with nopcapkit/lines touched.Scope note -- Closes vs. Part of
Grepped both
pcapkit/anddocs/source/for remaining bareType[sites. Two remain, both inpcapkit/foundation/traceflow/traceflow.py(#:comments at lines 146 and 406) -- owned by the still-open #712, which this PR does not touch per instructions. So this is Part of #709, not a close.Closes: N/A (Part of #709)