Skip to content

refactor(registry): split foundation.registry.protocols by layer - #2635

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/2578-registry-split
Nov 2, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/2578-registry-split

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

pcapkit.foundation.registry.protocols becomes a package with one submodule per layer:

  • protocol: the generic registrars and the lease machinery;
  • link, internet, transport and application;
  • misc: Frame, PCAP-NG and register_linktype.

The layout follows the owner's choices on #2578. The package star-imports the submodules, so __all__ and every public register_* stay the same objects through pcapkit.foundation.registry, through the package, and through the defining submodule. No old-path alias is kept for private helpers. After import, the class-level maps and the by-name registry dump identically to main, and every registration path works and restores.

Visible side effects:

  • Each registrar's __module__ names its submodule.
  • Log records carry the submodule's logger name, a child of the old one, so configuring the parent still applies.
  • Intersphinx links to the old object paths change.

The docstring cross-references under pcapkit/ follow the move. Three references in 1.5.0.rst are retargeted in #2483, where changelog edits are centralised.

A Sonnet cross-review checked identity and behaviour in separate processes against main, and confirmed that nothing in the v1.5.1 or main __all__ disappears.

Closes #2578

- protocols.py becomes a package: link, internet, transport, application and
  misc hold the wrappers of their pcapkit.protocols subpackage; protocol holds
  register_protocol, register_protocol_code and the shared helpers.
- The package star-imports its submodules, so every registrar is the same
  object at its old paths; both __all__ lists are unchanged.
- Code moved verbatim; three docstrings retarget their own xrefs.
- docs: a module directive per submodule; xrefs in docs, const, corekit and
  protocols name the defining module; registry-protocol.rst records the layout.
- tests: internals, patches and sources are read from the submodule that
  owns them; a layout test pins placement and exports.

Registry tests, project guards and mypy match main. The three 1.5.0.rst xrefs
to the old path are retargeted in #2483.
@JarryShaw JarryShaw added this to the PyPCAPKit v1.6 milestone Nov 2, 2026
@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 2, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at ffd3872aa. A Sonnet cross-review compared this commit with main in separate processes:

  • All 39 registrars are the same object through registry, through the package and through their defining submodule.
  • Both __all__ lists are identical, order included.
  • With docstrings stripped, the code of all 49 definitions is identical.
  • The by-name registry and all 50 class-level maps dump byte-identically.
  • Nothing in the v1.5.1 or main __all__ disappears.

Its one finding was that the commit message wrongly claimed the nitpicky docs build matches main. The message is fixed; the three 1.5.0.rst references are retargeted in #2483.

@JarryShaw
JarryShaw merged commit 0ba2270 into main Nov 2, 2026
29 checks passed
@github-project-automation github-project-automation Bot moved this to Done in PyPCAPKit Nov 2, 2026
@JarryShaw
JarryShaw deleted the refactor/2578-registry-split branch November 2, 2026 05:46
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 2, 2026
JarryShaw added a commit that referenced this pull request Nov 2, 2026
…types and the registry split into 1.6.0 (#2449)

- Breaking: Quick-Start values their fields cannot carry raise, reversing
  1.5.0's round-down of a TCP rate under 80 kbps (#2630).
- Folded into unreleased entries: tls12_cid records and DTLSContext
  (#2631), LinkType 105 and 127 in Frame and PCAP-NG (#2632), and
  DTLS.analyze_handshake behind dtls_handshake and packet (#2634).
- Changed: foundation.registry.protocols split into per-layer submodules
  (#2635); 1.6.0's register_* roles and 1.5.0's three register_protocol*
  roles point at their submodules, 1.5.0's text unchanged.
- The conventions entry records the per-layer wrapper placement (#2635)
  and parse ownership (#2634). No entry for #2629, which changes no
  released behaviour.
- 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(registry): split foundation.registry.protocols into registry.protocols.<layer> submodules

1 participant