Skip to content

refactor!: drop the surviving re-exports of moved names (#1744) - #1754

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/1744-drop-moved-name-reexports
Oct 15, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/1744-drop-moved-name-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

Description

Closes #1744. It applies the owner's rulings on #1715, #1103 and #1744 (D1–D5): a moved name keeps no explicit re-export at its old path. An explicit re-export here means an alias assignment, a name in a non-home module's __all__, or prose saying the name is importable there. Ordinary imports that a module uses itself stay.

Breaking. These old paths no longer resolve:

  • protocols.misc.pcapng.TLSKeyLabel and corekit.fields.field.NoValueType shipped in 1.4.x, so both now carry versionremoved:: 1.5.0, in the docstring and on the docs page.
  • The beta-only names are deleted with no directive:
    • NO_VALUE, NO_DEFAULT/NoDefaultType, NULL/NullType and ABSENT/AbsentType, from their non-home __all__ or bindings;
    • the _get_null pickle shim (D2);
    • DeferredPacket in the reassembly and traceflow data modules;
    • the ngap aliases ProcedureCode and ProtocolIE.
  • Registry NULL gets versionchanged:: 1.5.0, because in 1.4.x it was '(null)' (D4).

Every reader now imports from the new home. The vendor ftp and apptype templates, and the two const modules they generate, change identically. The sentinel docs no longer describe re-exporting the sentinels from each module.

Guard, tests/project/test_no_moved_name_re_exports_1744_unit.py. It fails on any of these for a removed (module, name) pair:

  • the name in that module's __all__, or still bound there;
  • an ImportFrom reader, or an attribute read through the old module;
  • an auto* directive naming the old path;
  • prose under pcapkit/ or docs/ claiming the name is importable there.

It also checks that both versionremoved blocks are present.

Tests, narrow runs on Python 3.14: the guard plus tests/corekit, the tests/foundation reassembly, traceflow and registry suites, pcapng, ngap, the const modules and the tests/project gates. All pass, 1,600+ tests.

- pcapng: delete the TLSKeyLabel alias; readers import it from
  const.pcapng.tls_key_label. versionremoved:: 1.5.0 on module and page.
- field: drop NO_VALUE from __all__, NoValueType to TYPE_CHECKING
  (versionremoved:: 1.5.0); its readers import from corekit.sentinels.
- enum, module, protocol: drop NO_DEFAULT/NULL from __all__ and unbind the
  types; the objects stay where used, other readers use corekit.sentinels.
- module: remove the _get_null pickle shim, unused by the library (D2).
- vendor ftp/apptype templates and their two generated const modules
  import NO_DEFAULT from corekit.sentinels, with identical text.
- reassembly/traceflow data: drop the DeferredPacket re-exports.
- ngap: delete the ProcedureCode/ProtocolIE aliases; readers use const.ngap.
- registry: versionchanged:: 1.5.0 for NULL, formerly '(null)' (D4).
- docs: remove the old-path entries; rewrite the re-export-per-module
  design in sentinels.py and sentinel-convention.rst.
- tests: add a tests/project guard; update the pins on the re-exports.
Targeted suites pass; the guard fails on each re-added alias.

Closes #1744
@JarryShaw JarryShaw added breaking Breaks public-facing behaviour or API (apply alongside the type label) refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) labels Oct 15, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 15, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 79c92af89. A Sonnet cross-review checked two rounds (author: Opus).

  • Round 1 found one blocker: the DeferredPacket docstring (corekit/packet.py) still said the class was importable from its three old paths, and the guard had no check for that kind of prose. Everything else held when the reviewer re-derived it independently:
    • the re-export scans and the readers;
    • the version directives, against tags v1.4.0…v1.4.1.post2: only TLSKeyLabel and NoValueType shipped;
    • the vendor-template text;
    • 9 of 10 mutants.
  • Round 2:
    • the sentence is gone;
    • the guard now also catches attribute reads through an old module and re-export prose;
    • the branch is rebased onto 3946bf527 with an identical patch (git range-diff);
    • 11 mutants all fail the guard, including the reviewer's own (import pcapkit; pcapkit.corekit.module.NULL, a claim wrapped over three lines, readers under examples/ and util/).
  • Non-blocking: partial-package aliases (import pcapkit.corekit as ck; ck.module.NULL), importlib lookups and rarer wordings ("can still be imported from") still pass the guard. No such case exists in the tree.
  • My own check: the guard plus test_unit_tests_queue, test_public_api and both sentinel test files give 82 passed and 1055 subtests, with pcapkit.__file__ printed inside the PR's worktree.

@JarryShaw JarryShaw added the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 89.59% (unit tier, Python 3.15, 79c92af89, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 3 20 3 95.16%
pcapkit/const 18862 954 2368 868 91.06%
pcapkit/corekit 2461 69 780 35 96.54%
pcapkit/dumpkit 276 3 100 3 98.40%
pcapkit/foundation 2915 164 1016 34 93.59%
pcapkit/interface 138 7 52 5 93.68%
pcapkit/protocols 17184 224 4574 189 98.08%
pcapkit/toolkit 872 177 298 8 77.18%
pcapkit/utilities 512 2 158 4 99.10%
pcapkit/vendor 4417 2342 1010 157 43.38%

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

@JarryShaw
JarryShaw merged commit 005c705 into main Oct 15, 2026
57 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/1744-drop-moved-name-reexports branch October 15, 2026 02:40
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaks public-facing behaviour or API (apply alongside the type label) 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!: remove every surviving re-export of a moved name or module

1 participant