Skip to content

fix(protocols): re-export what each data and schema submodule exports (#1807) - #1815

Open
JarryShaw wants to merge 1 commit into
mainfrom
fix/1807-package-reexports
Open

JarryShaw wants to merge 1 commit into
mainfrom
fix/1807-package-reexports

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

#1797 found pcapkit.protocols.data.link missing the L2TP data model (fixed in #1806). The same gap was open across the data and schema packages: names a submodule lists in __all__ that its package and aggregator did not re-export.

  • Re-exported, in each intermediate package and in the data/schema aggregators, under the prefixes the siblings use:
    • the MH messages, options, suboptions, attributes and extensions (MH_*);
    • the HOPOPT and IPv6-Opts SMFDPDOption and QuickStartOption (HOPOPT_*, IPv6_Opts_*);
    • ipv4.Option and ipv6_route.RoutingType on the schema side;
    • PCAP-NG PacketBlock and the PACK_* options (PCAPNG_*);
    • HTTP/2 Settings (HTTPv2_Settings).
  • Module-only by design: the schema.internet.ipv6_option field callbacks. No package re-exports field callbacks, the same names exist in sibling modules, and ipv6_option.rst documents them on their own page. They are recorded in the new test's allowlist.
  • Guard: tests/protocols/test_package_reexports_1807_unit.py walks every data and schema package and checks re-export by identity, a tight allowlist, and no shadowed star-imports. It fails on main.
  • Safety: no name maps to two objects in either aggregator, and pcapkit's own top-level names are unchanged. Additions only.

Closes #1807

…#1807)

- data/schema internet: re-export the MH messages, options, suboptions,
  attributes and extensions, and the HOPOPT and IPv6-Opts SMFDPDOption and
  QuickStartOption bases, under their MH_/HOPOPT_/IPv6_Opts_ prefixes.
- schema internet: re-export ipv4.Option as IPv4_Option and
  ipv6_route.RoutingType as IPv6_Route_RoutingType.
- data/schema misc: re-export PacketBlock and the PACK_* options as PCAPNG_*.
- data application: re-export httpv2.Settings as HTTPv2_Settings.
- data and schema aggregators list every new name.
- ipv6_option's field callbacks stay module-only, recorded in the test.
- tests: walk every data and schema package and check it re-exports its
  children's __all__ by identity, that the allowlist is tight, and that no
  star-import is shadowed. Fails on origin/main; protocol suites pass.

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

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 7bd02d2f1. A Sonnet cross-review (author: Opus) re-ran the inventory by object identity: every gap is closed and only the justified ipv6_option callbacks remain. It found no star-import clash, and pcapkit's public surface is unchanged (additions only, in data and schema). The new test fails on main, and removing any one re-export fails it where no other test notices. tests/project and the protocol suites pass.

@JarryShaw JarryShaw added the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 16, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 16, 2026

This branch has not been deployed

No deployments
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) review: good-to-go Cross-review at the current head says ready; CI state is separate

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

fix(protocols): data and schema packages omit names their submodules export

1 participant