Skip to content

docs: retarget Protocol/ProtocolBase cross-references to match the #1103 display rule - #2422

Merged
JarryShaw merged 1 commit into
mainfrom
docs/1103-protocol-display-split
Oct 29, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
docs/1103-protocol-display-split

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

  • docs — documentation only

Description of your pull request and other information

Follow-up to #2420, applying the owner's #1103 ruling: a ProtocolBase.<member> cross-reference should display as Protocol.<member> for one consistent public vocabulary.

Round 3 implemented that literally — display Protocol.<member>, link target ProtocolBase.<member>, via Sphinx's split role syntax — but found the stated premise backwards: a real docs build on the pinned toolchain showed the full rendered entry (signature + docstring) lives at Protocol.<member>, not ProtocolBase.<member> (ProtocolBase's block is :no-members: with link-only stubs).

This round flips the target to match: 37 sites now have display AND target reading Protocol.<member> (fully-qualified — the bare dotted-short form resolves nowhere outside pcapkit.protocols.protocol), on top of the 9 display-only fixes already in the PR — 46 sites total, 24 files, net vs main.

5 sites in docs/source/changelog/1.5.0.rst stay on ProtocolBase: each names the class a built-in protocol inherits the member from (0 of 44 shipped protocol classes have Protocol in their MRO), and CHANGELOG.md is generated from this file where the role flattens to an unlinked code span — retargeting would rewrite release-note prose, not a docs href. 1461 is the weakest of the five (ext.rst:284 already says the same fact using Protocol.__init__); flagged, not flipped unasked.

Carve-outs untouched: 6 __init_subclass__ sites (Protocol genuinely overrides this), schema.py:853, protocol-layer-placement.rst:209 (MRO set-difference discussion naming ProtocolBase on purpose). register's Raises: clause is unchanged (names the class issubclass actually tests, per #2316/#1016, test-locked).

Not reached this round: ipv6_ext.py:96/ipv6_ext.rst:129 still target the ProtocolBase stub — same shape as the flipped 37, missed; and tests//examples/ sites (not part of the Sphinx render) remain for a dedicated #1103 pass.

Verification

  • AST-structure guard (all string-expression statements stripped): 26/26 touched .py files structurally identical to main; all 125 differing lines are comments/docstrings.
  • Role-canonicalisation guard over all 384 Protocol/ProtocolBase roles in the touched files: 46 changed, 0 added/removed, 0 remaining with display class ≠ target class outside the documented carve-outs.
  • Docs build, pinned toolchain (Sphinx 9.2.0): exit 0, byte-identical single pre-existing warning (TransType ambiguity, unrelated) before/after. Rendered-link audit: display/target mismatches 27→0 vs main-plus-round-3, 9→0 vs round 3's own baseline.
  • tests/project 2107 passed/80 skipped; wider tier (protocols, corekit, utilities, foundation, dumpkit, interface, toolkit, cli) 3769 passed/35 skipped/0 failed, 62944 subtests; root-level tests/test_*.py 246 passed.

@JarryShaw JarryShaw added the docs Pull requests that change documentation only (docs: subject prefix) label Oct 28, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.5 milestone Oct 28, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 28, 2026
@JarryShaw JarryShaw added the review: running A cross-review is in flight against the current head - no verdict yet label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Coverage: 91.73% (unit tier, Python 3.15, a6cc56074, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19609 879 2620 866 92.13%
pcapkit/corekit 2596 74 818 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 3046 24 1062 26 98.78%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17592 193 4678 179 98.32%
pcapkit/toolkit 924 36 334 10 95.55%
pcapkit/utilities 502 7 144 5 98.14%
pcapkit/vendor 4449 1961 1020 167 52.64%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at eb35d4b47 (Sonnet) as a literal implementation of the requested format — but holding the merge for one thing worth your eye first.

Independently confirmed (second measurement, different method): the "doc lives at ProtocolBase" premise is backwards for the rendered page. Built the actual docs on the pinned toolchain (Sphinx 9.2.0) and checked all 62 members, including the 18 this PR links to, with no exceptions: Protocol.X renders as a standalone entry with full signature + docstring (register → classmethod register(code, protocol) plus ~1.5k chars of docs); ProtocolBase.X renders as one line in a shared stub block of 12-32 entries whose body is just links back to the Protocol.* entries. The general index lists only Protocol.*. Nuance: the docstrings are authored on ProtocolBase in the source — but the page a reader's link actually lands on is Protocol.X.

So this PR's current form (display Protocol.X, target ProtocolBase.X) sends a reader to the stub, not the real entry — the opposite of "link to where the doc lives". Recommendation: flip the 37 targets to Protocol.X (display and target both Protocol.X) — mechanical, changes hrefs only, removes the stub detour, and also fixes an inconsistency #2420 left (some sibling sites already point at Protocol, others at ProtocolBase, for the same kind of member).

Everything else checks out: 46 roles changed exactly as described, 0 scope creep (26/26 files AST-identical), carve-outs justified (__init_subclass__, the two self-contradicting-prose sites), test counts match (2140 passed/80 skipped on the narrow set, 3769/0 on the wider tier). Non-blocking: 5 sites in docs/source/changelog/1.5.0.rst still show ProtocolBase.X, probably deliberate historical notes but the PR doesn't say so explicitly.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 29, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Good to go or needs changes? (the label mismatch the verdict)

@JarryShaw

Copy link
Copy Markdown
Owner Author

Needs changes — my mistake posting it confusingly. The cross-review's GOOD TO GO was narrowly scoped to "does this correctly implement the literal split-display-target format as asked" (it does). But that same review independently confirmed the format's premise is backwards for the rendered page (doc renders at Protocol.X, not ProtocolBase.X), so I decided to act on that and requested the mechanical flip to plain Protocol.X targets rather than merge the literal-but-misdirected form — hence needs-changes. Fix is already in flight.

Applying the #1103 ruling to the member references #2420 left behind: a
`ProtocolBase.<member>` cross-reference now reads `Protocol.<member>`, for one
consistent public vocabulary, and links there too.

Both halves move, because on the rendered page that is where the documentation
is. `protocol.rst` documents the members with nested
`autoproperty`/`automethod` directives under `.. autoclass:: ...Protocol`, so
`Protocol.<member>` carries the signature and the docstring; the `ProtocolBase`
block is `:no-members:` plus grouped `:no-index-entry:` stubs whose body only
links back to the `Protocol.*` entries, and the general index lists `Protocol.*`
alone. Measured on the pinned docs toolchain (`Sphinx==9.2.0`).

* 46 sites in `pcapkit/` and `docs/source/`. 37 move display *and* target to
  `Protocol.<member>`; the other 9 already targeted `Protocol` and only needed
  the display text. The explicit target is the fully-qualified spelling the
  house style asks for -- the form 124 existing references already use.
* `from_data` is consistent again: `internet.py` and `application.py` pointed
  at `ProtocolBase.from_data` where `link.py` and `transport.py` pointed at
  `Protocol.from_data` for the same kind of reference. All four now read alike.
* `__init_subclass__` keeps `ProtocolBase` (6 sites), since `Protocol`
  overrides it and naming `Protocol` would name a different method. So do
  `schema.py` and `protocol-layer-placement.rst`, whose adjacent prose would
  otherwise contradict itself, and `register`'s `Raises:` clause, which names
  the class the guard's `issubclass` tests (#2316/#1016).
* `changelog/1.5.0.rst` keeps its five `ProtocolBase.<member>` references.
  Each names the class a *built-in* protocol inherits the member from -- the
  built-ins derive from `ProtocolBase`, not `Protocol` -- and `CHANGELOG.md` is
  generated from that file by `util/changelog_md.py`, where a role flattens to
  a code span with no link, so moving them would rewrite release-note prose
  rather than an href.
* `tests/` and `examples/` are untouched (28 sites): their docstrings are not
  part of the Sphinx render.

Hrefs only. A role-canonicalisation guard reports no role and no display-text
change beyond the above, and an AST-structure guard (`ast.dump` with docstrings
stripped) is identical for every touched `.py` file.
@JarryShaw
JarryShaw force-pushed the docs/1103-protocol-display-split branch from eb35d4b to a6cc560 Compare October 29, 2026 01:09
@JarryShaw JarryShaw added review: pending No verdict for the current head - never reviewed, or the head moved since the last one and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 29, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Flipped the 37 split-form sites to plain Protocol.X (display + target, fully-qualified — the dotted short form resolves nowhere outside pcapkit.protocols.protocol, so the fully-qualified form stays, matching 124 existing sites). New head a6cc56074f5.

Verified independently: AST guard shows 22/22 touched files prose-only; a role-canonicalisation guard shows exactly 37 target changes, 0 display/role changes elsewhere; a docs build on the pinned toolchain is byte-identical warning-count before/after (1 pre-existing, unrelated); a rendered-HTML link audit shows the Protocol.*-display-to-ProtocolBase.*-target mismatch dropping from 27 to 0; full test tiers clean (3769 passed/35 skipped, 62944 subtests).

The 5 docs/source/changelog/1.5.0.rst sites stay on ProtocolBase — each names the class a built-in protocol inherits the member from (built-ins derive from ProtocolBase, not Protocol, which overrides only __init_subclass__), and CHANGELOG.md is generated from that file, where the role flattens to an unlinked code span — retargeting would rewrite release-note prose, not a docs href. One of the five (the __init__ site) is the weakest of the five by this test; flagging rather than flipping unasked.

Dispatching the next cross-review round against this head.

@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one review: running A cross-review is in flight against the current head - no verdict yet labels Oct 29, 2026
@JarryShaw JarryShaw changed the title docs: display Protocol in ProtocolBase member cross-references (#1103) docs: retarget Protocol/ProtocolBase cross-references to match the #1103 display rule Oct 29, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: NEEDS CHANGES at a6cc56074 (Sonnet). Only finding was metadata — title/body still described round 3's split-form approach and contradicted this head's actual diff (target now Protocol, not ProtocolBase). Fixed directly (title + body rewritten to describe the 46-site flip accurately).

Everything else verified independently: single commit on current main, round 3→4 diff is exactly 37 target-only flips in 24 files (nothing lost), 0 of 384 roles left with display≠target outside the documented carve-outs, docs build byte-identical warning count, full test tier clean (3769 passed/35 skipped, 62944 subtests).

Two real but small follow-ups noted, not blocking: ipv6_ext.py:96/ipv6_ext.rst:129 still target the ProtocolBase stub (same shape as the 37 flipped, just missed) — will fold into the next #1103 round rather than another revision here. And my earlier "124 existing references" claim doesn't reproduce (reviewer counted 163) — noting the correction rather than re-asserting it.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 29, 2026
@JarryShaw
JarryShaw merged commit b8aaff1 into main Oct 29, 2026
69 checks passed
@JarryShaw
JarryShaw deleted the docs/1103-protocol-display-split branch October 29, 2026 02:29
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 29, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Pull requests that change documentation only (docs: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant