Skip to content

fix(corekit): export SchemaField, SwitchField, PortEnumField and nested_packet_context (#2174) - #2191

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2174-fields-all-exports
Oct 25, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2174-fields-all-exports

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — corrects a defect

Description

Closes #2174.

  • Defect: the fields modules' __all__ lists drifted from what they define and re-export:
    • misc.__all__ omits SchemaField and nested_packet_context;
    • SwitchField and PortEnumField are missing from fields/__init__.py, corekit/__init__.py and pcapkit.all;
    • strings.__all__ lost BytesField in 19b98fc91, an accident, since the class stayed public and the package kept exporting it.
  • Fix: each name is added where its siblings live. nested_packet_context stays in misc.__all__ only, like the other field helpers. DeferredPacket.to_dict is annotated OrderedMultiDict[str, Any], which is what it returns.
  • Test: tests/corekit/test_fields_all_exports_2174_unit.py. Every name in pcapkit.corekit.fields.__all__ must be listed by its own defining module, and every listed name must resolve. It records the deliberate non-exports with reasons. On main it fails 14 times, e.g. 'BytesField' not found in ['_TextField', 'StringField', …].
  • Tests run: the exports, layer-grouping, deferred-packet and field tests pass (59), as do the public-API, module-isolation, moved-name, tier and docstring tests (165).
  • Overlap: docs(corekit): fifth whole-repo pass over corekit, const and vendor (#1103) #2156 and fix(corekit): pass the copy to ListField callbacks and size SchemaField templates from it (#2173) #2190 also edit fields/misc.py; all three merge cleanly.

…ed_packet_context (#2174)

fields.misc.__all__ omitted SchemaField and nested_packet_context,
fields.strings.__all__ omitted BytesField (dropped by 19b98fc while the
package kept exporting it), and the fields package, pcapkit.corekit and
pcapkit.all omitted SwitchField and PortEnumField, so import * dropped
documented field classes. DeferredPacket.to_dict was annotated as dict,
widening Info.to_dict's OrderedMultiDict.

Add the field classes to every __all__ that re-lists fields, and
nested_packet_context to misc.__all__ only: like packet_byteorder and
parse_ip_address it is a helper reached by its module path, not a field.
Annotate to_dict as OrderedMultiDict[str, Any].

Test: tests/corekit/test_fields_all_exports_2174_unit.py checks each field
submodule's __all__ against the package's in both directions, with
written-down exclusions, and the to_dict annotation; it fails on origin/main.
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 25, 2026
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 25, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: GOOD TO GO at fa4bf2338 (Sonnet): every added name is documented public API with no existing non-export entry, the new names cause no collision in pcapkit.all or pcapkit.corekit, to_dict really returns an OrderedMultiDict, and 14 fail on main.

@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 25, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.55% (unit tier, Python 3.15, fa4bf2338, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 880 2618 866 92.12%
pcapkit/corekit 2589 75 816 37 96.48%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2971 23 1036 25 98.80%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17418 219 4574 185 98.14%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 504 7 146 5 98.15%
pcapkit/vendor 4432 1988 1018 167 51.87%

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

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at fa4bf2338. Merging closes #2174.

@JarryShaw
JarryShaw merged commit 6500731 into main Oct 25, 2026
67 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 25, 2026
@JarryShaw
JarryShaw deleted the fix/2174-fields-all-exports branch October 25, 2026 14:54
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 25, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(corekit): fields' __all__ omit SchemaField, SwitchField, PortEnumField and nested_packet_context

1 participant