Skip to content

docs(pep,tests): correct the checksum protocol count and the registry-leak lineage - #1007

Merged
JarryShaw merged 1 commit into
mainfrom
docs/719-lineage-and-counts
Oct 3, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
docs/719-lineage-and-counts

Conversation

@JarryShaw

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

Two accuracy fixes for #719, both measured rather than inferred.

1. docs/source/contributing/pep.rst:744 undercounted by two. It said eight protocols parse a checksum or CRC field. Measured on main by matching field declarations named checksum/chksum/crc across pcapkit/protocols/{data,schema}/: ten — the list was missing IPX (ipx.chksum) and MH (mh.chksum). The "exactly one of them checks whether the value is right" claim still holds: checksum_valid exists only on SCTP, so "the other seven" becomes "the other nine".

2. The lineage in tests/protocols/test_dispatch_default_resolution_unit.py:8 named the wrong reporter for this layer. #1006 fixed the issue-versus-pull-request kinds there but left #425 credited with the defect these tests actually pin. Established from the PR bodies and git log -S:

The sentence now reads: #421 reported, #426 fixed at this layer, #428 extended to the option, chunk and block registries, #560 fixed the schema layer. The paragraph is re-wrapped to ~80 columns, which is why that hunk is larger than the edit.

Correcting my own note on #719: I wrote there that #428 added the guard at this layer. It did not — git log -S'if proto in registry' attributes that to #426; #428 added _lookup_registry.

The sweep also checked ~40 other counting claims across docs/source/** and pcapkit/** docstrings against the code — registry counts, enum members, subclass counts, workflow and job counts, the "48 of the 52 resolutions" in this very docstring — and every one of them already matched. Prose only: ast.dump with docstrings blanked is identical to main, docs build warning sets identical at 53 each, and 0 roles nested inside inline markup.

@JarryShaw JarryShaw added docs Pull requests that change documentation only (docs: subject prefix) review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 3, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

NEEDS CHANGES at 82785e827 — opus cross-review, a different model from the sonnet agent that wrote the diff. Every one of the seven claims it checked held, including both of mine. The defect is completeness: correcting the test docstring leaves the identical mis-attribution in the production source, so the tree now contradicts itself.

pcapkit/protocols/protocol.py:1744 — inside _lookup_next_layer, the __proto__ path these very tests call — reads :issue:`425` at this layer and :issue:`555` at the schema layer. By this PR's own corrected lineage, this layer's defect is #421. Being fixed, along with pcapkit/corekit/sentinels.py:366, which relays that note as "#425 and #555" and has to track it.

docs/source/changelog/1.5.0.rst:540 carries the pre-PR wording verbatim ("the defect #425/#428 fixed at this layer"). That file belongs to #657 and is deliberately out of scope here; I am recording it there rather than widening this change.

The review also settled the question my brief could not: all three tests call Dummy._lookup_next_layer(Dummy.__proto__, 99), and git log -S'_lookup_next_layer' returns only 209eabb19 (#426) while _lookup_registry returns only f137a5b5a (#428). So #421/#426 is this layer and the old #425/#428 was wrong.

On the checksum count it derived ten independently with a stricter method — ast class attributes at any depth named checksum/chksum/cksum/crc — and widened the search to fcs|crc32|digest|hmac|icv|mic|integrity, finding no eleventh: AH.icv/ESP.icv are cryptographic MACs, and pcapng's fcs_len/crc_error are metadata and a flag. It also inverted one of my worries usefully: IPX.chksum and MH.chksum are protocol-header fields, whereas hopopt and ipv6_opts reach the list only through CALIPSOOption.checksum — so the two additions are the list's most defensible members.

One claim I will not repeat: the PR body says the docs build warning sets are identical at 53 each. The reviewer measured 61 in its own environment, the difference being three pcapfile guarded-import warnings plus env-dependent ref.python ambiguity counts, and it did not build the base. The load-bearing part does hold — zero warnings or errors cite pep.rst or contributing/ — but treat 53 as environment-specific rather than a property of the change.

@JarryShaw JarryShaw added 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 labels Oct 3, 2026
… count (#719)

- tests/protocols/test_dispatch_default_resolution_unit.py: this layer's
  reporter is #421 and its fix #426 (next-layer __proto__); #428 extended it
  to the option/chunk/block registries and #560 is the schema layer. The
  paragraph is re-wrapped to ~80 columns.
- pcapkit/protocols/protocol.py (_lookup_next_layer): the same note cited
  #425 as this layer; it now cites #421 here, #425 for the sibling option,
  chunk and block registries, and #555 for the schema layer.
- pcapkit/corekit/sentinels.py: the pointer to that note tracks it.
- docs/source/contributing/pep.rst: ten protocols parse a checksum field, not
  eight -- IPX and MH were missing; "the other seven" is now nine.

Prose only. Docs build warning set identical to origin/main.
@JarryShaw
JarryShaw force-pushed the docs/719-lineage-and-counts branch from 82785e8 to 237b15f Compare October 3, 2026 17:44
@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 3, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Fixed at 237b15f62 (was 82785e827). The delta touches only the two source files, 6 insertions / 4 deletions, and I verified it is nothing else; the whole change is now 4 files, +15/−10, still one commit on 79fce29c5.

pcapkit/protocols/protocol.py:1744, in _lookup_next_layer:

-stale; :issue:`425` at this layer and :issue:`555` at the schema layer are all that same defect.
+stale; :issue:`421` at this layer, :issue:`425` for the option, chunk and block registries
+beside it, and :issue:`555` at the schema layer are all that same defect.

and pcapkit/corekit/sentinels.py:366 now relays all three.

Naming all three rather than swapping one token was the right call, and it is the answer to the ambiguity I flagged. The sentence asserts that these are the same defect class — writing a registry miss or a resolved class into a class-level store — and that is true of #421, #425 and #555 alike. #421 is the precise citation for this function, since git log -S'_lookup_next_layer' returns only #426's commit, but dropping #425 would have narrowed the "same defect" claim and hidden the sibling registries. Each role is now named explicitly.

Two added lines run to 88 and 81 characters. Nothing in the repo lints line length, and both are inside docstrings that reST reflows, so I am not spending a CI round on it.

Label back to review: pending — the head moved, so the earlier verdict no longer tracks it. A delta review is running.

@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 237b15f62 — opus delta round. The completeness gap is closed and all seven items confirmed, several on stronger evidence than I had.

One non-blocking nuance, which I verified and which pre-dates this change. The sentence ends "…are all that same defect", and the clause immediately before it is about a class that importlib.reload makes stale. Against that narrower framing the generalisation does not reach #425, because those registries hold a method-name string or a (parser, constructor) tuple rather than a class — pcapkit/protocols/transport/tcp.py:744-750 branches on isinstance(name, str) and otherwise takes name[0] — and a reload cannot make a string stale. Against insertion-on-miss, which the preceding paragraph establishes explicitly and which all three issue bodies describe, it holds for all three. The framing and the matching wording in sentinels.py both pre-date this delta, which only changed which issues are named, so it is a strict improvement on the base and not worth another round.

On line length we agree: no max-line-length or E501 config exists anywhere in the repo, and protocol.py already carries 256 lines over 79 (max 164), so 88 and 81 are inside house norms.

Not ready to merge yet — 6 CheckRun legs still in flight, 0 failures.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 3, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at 237b15f62 — closing the "not yet" on the verdict above. CI is complete: 69 CheckRun legs green, 3 skipped, 0 failures, 0 in flight, mergeStateStatus CLEAN. The opus delta verdict stands at this head; nothing has been pushed since.

Yours to merge. Two things left out of this change and recorded rather than dropped: the third copy of the old lineage at docs/source/changelog/1.5.0.rst:540 is noted on #657, and the wording imprecision I described above — "that same defect" reading against the reload-staleness clause rather than against insertion-on-miss — pre-dates this change and is unaltered by it.

@JarryShaw
JarryShaw merged commit 711e3a9 into main Oct 3, 2026
73 checks passed
@JarryShaw
JarryShaw deleted the docs/719-lineage-and-counts branch October 3, 2026 19:10
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 3, 2026
@JarryShaw JarryShaw added this to the 1.5 milestone Oct 6, 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