Skip to content

refactor(corekit): move the Internet checksum into corekit.checksum.internet - #2586

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/2580-corekit-checksum
Nov 1, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/2580-corekit-checksum

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • refactor — changes neither behaviour nor performance

Description of your pull request and other information

The owner's option 1(a) on #2580. The Internet checksum helpers move into pcapkit.corekit.checksum.internet: ChecksumStatus, internet_checksum, compute_checksum, verify_checksum, partial_checksum, fragment_payload and the private _rebuilding. Protocol code no longer imports them from protocols-level modules. pseudo_header and verify_upper sit beside IP_Pseudo in pcapkit.protocols.misc.checksum.ip_pseudo.

Not breaking: the old module was never released and _rebuilding is private, so there is no re-export. test_checksum_import_boundary_2580_unit keeps corekit.checksum free of protocols and foundation imports; the review's mutation run showed it fails on each injected violation. utilities-or-corekit.rst records the ruling.

The worker's questions were settled on their recommendations: keep the strict boundary test, leave the lazy imports lazy, and do not aggregate into corekit or pcapkit.all.

Closes #2580

@JarryShaw JarryShaw added refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) review: good-to-go Cross-review at the current head says ready; CI state is separate labels Nov 1, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at c73728dd9. A Sonnet review covered the move, and I checked its nit fold myself.

  • Nothing moved changes: every moved definition is AST-identical apart from imports, and no reference to the old paths is left in pcapkit/, the docs, the examples or the tests.
  • The old module is in no release tag, so it gets no re-export or versionremoved.
  • The boundary test catches each of the 5 injected violations, and the docs warning set is unchanged against main.
  • 113 modules pass, and the corekit leg (947 tests) is OK. The one protocols/internet error, in test_mh_timestamp_info_1886_unit, fails the same way on main.

…nternet (#2580)

pcapkit.corekit.checksum is a package with one module per checksum family;
internet.py holds the protocol-independent part of the old
pcapkit.protocols.misc.checksum.checksum: ChecksumStatus, the RFC 1071 sum,
verify_checksum, fragment_payload and its _in_fragment, and _rebuilding, moved
from pcapkit.protocols.protocol. It imports nothing from pcapkit.protocols.

The IP-specific pseudo_header and verify_upper join IP_Pseudo in ip_pseudo.py,
and checksum.py is gone. The old path never shipped, so there is no re-export
and no versionremoved.

Every import and reference is retargeted; the docs get a corekit page, and the
placement is recorded on utilities-or-corekit.rst.
test_checksum_import_boundary_2580_unit checks the package's imports.
@JarryShaw

Copy link
Copy Markdown
Owner Author

Resolve conflicts

@JarryShaw

Copy link
Copy Markdown
Owner Author

On it. The conflicts come from #2544 and #2583 merging into main. A rebase of c73728dd9 onto main is in progress. It keeps both sides and retargets any new main code that imports the checksum names from their old paths. I'll push it with a lease and post the rebase note here, giving old to new heads, the patch-id check and the review status.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Rebased onto main (5145a10d8): c73728dd9 → e54460d28, still one commit.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.02% (unit tier, Python 3.15, e54460d28, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 20093 144 2712 125 98.78%
pcapkit/corekit 2664 74 836 37 96.60%
pcapkit/dumpkit 281 3 100 3 98.43%
pcapkit/foundation 3360 27 1186 32 98.70%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 20291 221 5352 205 98.32%
pcapkit/toolkit 961 28 342 10 96.32%
pcapkit/utilities 506 7 144 5 98.15%
pcapkit/vendor 5009 2222 1148 182 52.31%

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

@JarryShaw
JarryShaw merged commit a25eb0e into main Nov 1, 2026
61 checks passed
@JarryShaw
JarryShaw deleted the refactor/2580-corekit-checksum branch November 1, 2026 23:53
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 1, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 1, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…1.6.0 (#2449)

- Added: DCCP, its checksum over the IP pseudo-header, register_dccp and
  register_dccp_option, and the pcapkit.const.dccp registries (#2593).
- Folded into unreleased entries: LinuxSLL's stop on its ARPHRD path
  (#2587) and ARPHRD's __proto_dest__ (#2598), SSLv2 records chained in a
  segment (#2585), the checksum's move to pcapkit.corekit.checksum.internet
  (#2586), and IGMPv2's and IGMPv3's versioned name (#2590).
- Breaking: InARP moves to pcapkit.protocols.link.inarp with no re-export,
  joining the DRARP entry (#2596).
- Changed: the conventions' new rulings (#2599), the milestone workflow's
  next-open-milestone lookup (#2591), the PyPy protocols shards (#2604).
  Fixed: a handled next-layer refusal is quiet under beholder (#2597); the
  IPX crawlers restore sys.path (#2601).
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

refactor(corekit): move the Internet checksum helpers to corekit.internet_checksum

1 participant