Skip to content

refactor(corekit): move the stream proxy classes into corekit.io (#1516) - #1521

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/1516-corekit-io-streams
Oct 10, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/1516-corekit-io-streams

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

  • refactor — changes neither behaviour nor performance

Description of your pull request and other information

_PeekableStream (foundation/extraction.py) and _NamedStream (foundation/engines/pypcapfile.py) move to pcapkit.corekit.io as the public PeekableStream and NamedStream, beside SeekableReader, and join its __all__. Class bodies are unchanged; only the names and one cross-reference differ. Both importers take them from corekit.io, and the io docs page documents them.

Closes #1516

@JarryShaw JarryShaw added refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) 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 and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Coverage: 90.08% (unit tier, Python 3.14, 0f6dce8aa, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18795 843 2356 756 92.08%
pcapkit/corekit 2177 66 700 33 96.28%
pcapkit/dumpkit 242 2 88 2 98.79%
pcapkit/foundation 2650 98 934 42 94.98%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 17086 238 4628 190 97.98%
pcapkit/toolkit 539 74 168 3 84.58%
pcapkit/utilities 431 4 124 4 98.56%
pcapkit/vendor 4409 2342 1006 157 43.25%

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

@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 5aff8a5aa. Cross-reviewed on Sonnet at bf6796e55; the author ran Opus. I then made a pure rebase onto 5f4da2301 (range-diff =, patch-id c32f86965bbd); 79 passed on the rebased tree.

  • Both class bodies are AST-identical to the old ones after normalising names and docstrings. Only the class names and one docstring cross-reference changed.
  • BytesIO extraction gives identical frames and digests on the default, dpkt and pypcapfile engines, and the fix(extraction): accept a file object without a name as fin (#1506) #1509 scapy refusal is unchanged. The reviewer also ran the real pypcapfile load_savefile against NamedStream.
  • Fail-before is 15 on main. On top of that, 11 of 12 code mutations made the new tests fail; an existing test catches the twelfth.
  • There is no import cycle: corekit.io imports only utilities. The docs page builds.

Your call, not blocking: pcapkit.corekit re-exports SeekableReader, but not the two new classes. Re-exporting them would be consistent with that; leaving pcapkit.corekit.io as their only address matches EnumLookup, ContextRegistry and others.

Pre-existing defect, to be filed separately: copy.copy and pickling a _PeekableStream both raise RecursionError on main. Measured. __getattr__ reads self._stream before it is set.

@JarryShaw
JarryShaw force-pushed the refactor/1516-corekit-io-streams branch from bf6796e to 5aff8a5 Compare October 9, 2026 22:08
@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 9, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict carried to b1ab653cd: GOOD TO GO. This is a pure rebase onto main ffca64637, after #1508 merged: the range-diff is = and the patch-id is unchanged at c32f86965bbd. On the rebased tree, the PR's tests plus #1508's engine-agreement module gave 48 passed, 828 skipped and 433 subtests.

@JarryShaw
JarryShaw force-pushed the refactor/1516-corekit-io-streams branch from 5aff8a5 to b1ab653 Compare October 9, 2026 22:44
- `_PeekableStream` (foundation/extraction.py) and `_NamedStream`
  (foundation/engines/pypcapfile.py) move to `pcapkit.corekit.io` as the
  public `PeekableStream` and `NamedStream`, beside `SeekableReader`, and
  join its `__all__`. Bodies are unchanged; both importers now take them
  from there.
- Document both on the corekit io page.
- tests/corekit/test_io_stream_proxies_1516_unit.py pins peek semantics,
  attribute forwarding, `.name` and read forwarding from the new module;
  the `_NamedStream` test in test_pypcapfile_engine.py moves there.
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict carried to 0f6dce8aa: GOOD TO GO. This is a pure rebase onto main 81efa6035, after #1525 merged; the range-diff is = and the patch-id is unchanged at c32f86965bbd. main moved only in the HTTP files, which this PR does not touch, and the PR's tests pass on the rebased tree: 79 passed.

@JarryShaw
JarryShaw force-pushed the refactor/1516-corekit-io-streams branch from b1ab653 to 0f6dce8 Compare October 9, 2026 23:18
@JarryShaw
JarryShaw merged commit 945c3c3 into main Oct 10, 2026
36 checks passed
@JarryShaw
JarryShaw deleted the refactor/1516-corekit-io-streams branch October 10, 2026 00:16
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 10, 2026
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 stream proxy classes such as _PeekableStream into corekit.io

1 participant