Skip to content

refactor(protocols)!: make() takes enum members or ints, dropping the X_default/X_namespace/X_reversed groups #2594

Closed

Description

@JarryShaw

The owner's ruling on #2593 (option 1) sets the convention: make() takes an enum-valued field as the enum member or an int, resolved with the enum's get, with no string-to-member inference inside make(). It also asks that every other make() be reworked to follow it. This carries out the direction pep.rst records under "Deterministic Construction Arguments", which had not been scheduled.

Scope (on main): the make() methods that take the four-argument group X, X_default, X_namespace and X_reversed, resolved by Protocol._make_index inspecting the caller's frame. The heaviest users are mh.py, hip.py, misc/pcapng.py, ipv4.py, ipv6_opts.py and hopopt.py; others include ARP, SSLv2, HTTPv1/HTTPv2, TCP, VLAN, OSPF, the ICMPs, IGMP, AH/ESP, TLS and DTLS. Each such field becomes Enum | int. pep.rst's public resolving helper takes the old four-argument group explicitly, for callers holding a bare string.

Decision needed: what happens to the shipped X_default/X_namespace/X_reversed keywords?

  1. Remove them in 1.6.0 (breaking), as moved shipped names are removed with no re-export, and point callers to the resolving helper (recommended).
  2. Deprecate them for one release with a warning, then remove them.

Recommendation: 1. It matches the house rule against shims, and 1.6.0 already carries other breaking construction changes.

Timing: the change touches most protocol modules, which several open PRs and held branches also edit. Once this is answered, it is blocked until those land.

Activity

  1. added
    breakingBreaks public-facing behaviour or API (apply alongside the type label)
    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 1, 2026
  2. moved this to Needs decision in PyPCAPKiton Nov 1, 2026
  3. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Take 1

  4. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Owner chose 1, paraphrased: the shipped X_default/X_namespace/X_reversed keywords are removed in 1.6.0, with no deprecation period. Each enum field of make() takes the member or an int, and pep.rst's public helper resolves a bare string for callers that hold one. This is breaking.
    Blocked: the change touches most protocol modules. It unblocks when no open PR edits pcapkit/protocols/ (gh pr list --state open --json files shows none), so that it lands in one pass without a rebase per protocol.

  5. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 1, 2026
  6. moved this from Needs decision to Blocked in PyPCAPKiton Nov 1, 2026
  7. added this to the PyPCAPKit v1.6 milestone on Nov 2, 2026
  8. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    A worker is preparing this now, for the 1.6.0 release, on top of #2677. It covers every family except radiotap/802.11 and SCTP, which #2657 and #2673 still edit. The PR opens once those have merged. Moved from blocked to wip.

  9. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Nov 2, 2026
  10. moved this from Blocked to WIP in PyPCAPKiton Nov 2, 2026
  11. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The PR is #2692. A sharded Sonnet cross-review is running: one reviewer per protocol family plus the core resolver, with each required change re-checked independently.

  12. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingBreaks public-facing behaviour or API (apply alongside the type label)refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions