Skip to content

fix(corekit): resolve PortEnumField misses for any proto; restate its peek (#1774) - #1781

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/1774-portenumfield-peek
Oct 15, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/1774-portenumfield-peek

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • fix — corrects a defect
  • feat — adds a feature
  • perf — changes performance, not behaviour
  • refactor — changes neither behaviour nor performance
  • test — tests only
  • docs — documentation only
  • ci — workflows or build tooling
  • release — bumps the version or rolls up a distribution
  • chore — anything else

Summary

PortEnumField.post_process peeks at the registry before calling AppType.get. Its Notes said the peek stops get minting a member per ephemeral port, but since #860 get no longer mints. The peek is still needed for a different reason: get's miss member does not pickle, and it dumps as TCP::unknown, not TCP::<unassigned>.

  • Fix: the miss branch takes the transport from owner.__transport__, as get does. A str proto ('tcp') or a composite (tcp | udp, a bare int) has no .name, so a miss raised AttributeError.
  • Docs: the Notes give the real reason, and EnumField._unregistered_member drops the claim that get mints PORT_54321_tcp. Rebased onto main past docs(corekit): version directives and render fixes (#1103) #1762's edits to the same docstrings.
  • Bite: the new tests fail with the peek or the transport fix reverted. Runs: tests/project green.

Closes #1774

… peek (#1774)

PortEnumField.post_process peeks at the registry rows and _missing_'s
spans before calling AppType.get. Its Notes said this stops get minting
a member per ephemeral port; since #860 get no longer mints, and neither
path grows the registry (measured on TCP, UDP, SCTP and DCCP).

The peek is still needed: get's miss member has no __reduce_ex__, so
pickle.loads raises "'unknown [50000 - tcp]' is not a valid TCP", and
is named 'unknown', so it dumps as TCP::unknown, not TCP::<unassigned>.

- Notes: give that reason, and drop EnumField._unregistered_member's
  claim that get mints PORT_54321_tcp.
- Miss branch: take the transport from owner.__transport__, as get
  does. A str proto ('tcp') or a composite (tcp | udp, a bare int) has
  no .name, so a miss raised AttributeError.
- New tests fail with the peek or the transport fix reverted.

Closes #1774
@JarryShaw JarryShaw added the fix Pull requests that fix a defect (fix: subject prefix) label Oct 15, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 61b142439. A Sonnet cross-review (author: Opus) checked 2fd6fcfae, after a prose fix round and a rebase past #1762. This head changes only the subject, from refactor to fix, because the miss-transport change fixes an AttributeError; the tree is identical. The new tests fail with the peek or the transport fix reverted.

@JarryShaw JarryShaw added the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 15, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 15, 2026
@JarryShaw
JarryShaw merged commit 23eaa8d into main Oct 15, 2026
56 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 15, 2026
@JarryShaw
JarryShaw deleted the refactor/1774-portenumfield-peek branch October 15, 2026 22:14
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 15, 2026
JarryShaw added a commit that referenced this pull request Oct 15, 2026
…1803)

Entries:
- add #1791 (breaking: pack() leaves its instance unchanged), #1778
  (Protocol in protocol.__all__), #1781 (PortEnumField miss with a
  nameless proto), #1779 (vendor.ipx _path), #1780 (examples READMEs to
  Markdown, build leftovers) and #1790 (36 ambiguous cross-references)
- fold #1776 into the RPL 0x23 entry and #1381 into the dump-schema one

Accuracy:
- the benchmark and legacy_smoke READMEs are README.md since #1780
- EngineBase stays out of __all__, as #1016 settled
- the #575 peek calls get() only once the value resolves
- the #647 and #764 entries point at #775/#860, under which nothing mints
- the #861 entry names #869 and #874 for the EnumRegistry move

Figures:
- preamble: 685 citations, #340 to #1791
- process.rst pin: 298 entries; CHANGELOG.md regenerated

Refs #1103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

refactor(corekit): check whether PortEnumField.post_process still needs its peek

1 participant