Repository navigation
refactor(corekit): merge the two DeferredPacket classes into corekit.packet (#1516) - #1532
Merged
Merged
Conversation
JarryShaw
force-pushed
the
refactor/1516-deferred-packet
branch
from
October 9, 2026 23:03
3159f4e to
19a217f
Compare
Owner
Author
|
Verdict: GOOD TO GO at
Non-blocking test gap: two mutants survive, |
Contributor
|
Coverage: 90.02% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Resolve conflicts |
Owner
Author
…packet (#1516) - pcapkit.corekit.packet.DeferredPacket replaces the copies in reassembly/data/data.py and traceflow/data/data.py. Their method bodies were AST-identical; the one difference, which module's Deferred the isinstance named, is now the __deferred__ class attribute each subclass sets, so the module imports nothing from foundation or protocols. - __init_subclass__ refuses a subclass that does not list 'packet' in __additional__ or name a class in __deferred__, either of which would otherwise fail silently on the first read. - ip.Datagram, tcp.Datagram and traceflow Index import it from corekit and set __deferred__ to their own Deferred, which stays where it was. - DeferredPacket stays importable from its three old public paths, now re-exported from corekit.packet. New docs page corekit/packet.rst; the two foundation pages point to it instead of documenting a copy. - tests/corekit/test_deferred_packet_1516_unit.py pins laziness, the hook, the guard, the import layering, the three models' wiring and the old paths. Refs #1516
JarryShaw
force-pushed
the
refactor/1516-deferred-packet
branch
from
October 10, 2026 02:09
19a217f to
9fb7ad0
Compare
Owner
Author
|
Verdict: GOOD TO GO at
|
5 of 13 tasks
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
This merges the two
DeferredPacketmixins intopcapkit.corekit.packet.DeferredPacket, as ruled on #1516.Deferredtheirisinstancecheck named. Each subclass now names it in__deferred__, socorekitimports nothing fromfoundationorprotocols.__init_subclass__refuses a subclass that is missing'packet'in__additional__, or is missing__deferred__. Either omission used to fail silently on the first read.ip.Datagram,tcp.Datagramand the traceflowIndexnow take the mixin fromcorekit. BothDeferredclasses stay where they are.DeferredPacketcan still be imported from its three old public paths,pcapkit.foundation.reassembly.dataand bothdata.datamodules. Each re-exports the one class and keeps it in__all__, and a test pins all three as the same object.pcapkit.corekitdoes not export it, becausecorekit/__init__.pybelongs to refactor(corekit)!: Info.to_dict() returns an OrderedMultiDict; add MultiInfo and OrderedMultiInfo (#1484) #1523.docs/source/pcapkit/corekit/packet.rst. The reassembly and traceflow pages link to it instead of documenting a copy.Output is byte-identical. I compared canonical
to_dict()JSON and every trace file written, for all 23examples/capturesin four passes: pcap withtrace_analyse, json, and pcap with the dpkt and scapy engines. That is 588 files, anddiff -ragainst16fbea054is clean. Laziness is unchanged:.packetresolves once, and iteration,inandlendo not resolve it.Tests run, all green: the new test,
tests/foundation/{reassembly,traceflow,engines},tests/toolkit/test_engine_pcap_trace_runtime.py,tests/corekit,tests/project,tests/test_docstring_contract.pyandtests/test_tier_guard.py. Onmainall 12 new tests fail. Each of 5 mutations ofpacket.pymakes at least one test fail, and so does dropping a re-export. Rebased over #1511, keeping itsFrameRecord.Refs #1516