Skip to content

Reorder protocol class members to the member-order convention #2490

Open

Description

@JarryShaw

Reorder protocol class members on main to the member-order convention. Ruled by the owner: HTTP v1 is a violation; dunders (__init__, __new__, __post_init__, __index__, __length_hint__, and the rest) are Data Models; the old protocols (IPv4, TCP, UDP, ARP, Ethernet, IPv6) are the reference.

Order inside a protocol class body: properties, public methods (id, read, make, register_*), dunders (Data Models), then utilities (_read_xxx before its _make_xxx).

Landed violations (ref: audit on 545ad0ca7): application/application.py, application/httpv1.py (HTTP), application/httpv2.py, application/ospf.py, application/ssl.py, data/application/httpv2.py, internet/esp.py, internet/hip.py, internet/ipv6_route.py, internet/ipx.py, internet/mh.py, misc/pcap/frame.py, misc/pcap/header.py, misc/pcapng.py, protocol.py (ProtocolBase), schema/misc/pcapng.py, schema/schema.py, transport/sctp.py.

Open PR-only violations are fixed by each PR's own rework (#2444, #2446, #2465, #2466).

Mechanical reorder only; no behaviour change. Split by file group, one PR per group.

Activity

  1. added
    refactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 31, 2026
  2. JarryShaw commented on Oct 31, 2026

    @JarryShaw
    OwnerAuthor

    Held: Actions queue at 78 (well above the hold line). The member-order reorder dispatches when the queue drops below 40.

  3. moved this to Pending in PyPCAPKiton Oct 31, 2026
  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 31, 2026
  5. moved this from Pending to WIP in PyPCAPKiton Oct 31, 2026
  6. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Dispatched now; the Actions queue is below the hold line. The worker re-audits current main, makes one branch per file group, and AST-checks each as a pure reorder. Files that other streams are editing right now are deferred until those land: the LinuxSLL/ARPHRD link files, IGMP, the checksum protocols, DTLS, and IPX/Loopback/SCTP for the registry work.

  7. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Decisions needed for the rest of this issue. protocol-member-order.rst does not settle these:

    1. Helpers that neither read() nor make() calls and no registry reaches (e.g. HTTPv1._decode_text, PCAPNG._check_block_floor, IPv6._exthdr_key): where do they go? Options: (a) last in Utilities, (b) next to their first caller. Recommendation: (a).
    2. Rule c, ordering specific readers and makers by enum value, is not applied anywhere yet. Options: (a) apply it, with the registry default first, as IPv4 has it; (b) drop rule c for registry-table order. Recommendation: (a), in its own PRs.
    3. Registry fallbacks that read()/make() name directly (_read_*_unknown) were treated as specific readers, as refactor(protocols): order application protocol members #2491's review did. Options: confirm that, or file them as helpers. Recommendation: confirm, and write it on the page.
    4. ARP, a reference protocol, is reordered on Reorder protocol class members to the member-order convention #2490's link branch, because its read/read/make/make layout breaks rule b. Options: keep the change, or drop it and record ARP as an exception. Recommendation: keep.
    5. A guard test that runs the group-order audit with a known-exceptions table. Recommendation: add it now; the reviewer showed it can go green with the deferred files listed.
  8. added
    needs: decisionWaiting on the maintainer to decide — not blocked by other work
    on Nov 1, 2026
  9. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor
    1. (a)
    2. (a)
    3. confirm
    4. keep
    5. add it now
  10. JarryShaw commented on Nov 1, 2026

    @JarryShaw
    OwnerAuthor

    Owner took all five recommendations, paraphrased:

    1. A helper that neither read() nor make() calls and no registry reaches goes last in Utilities.
    2. Rule c applies: specific readers and makers in enum-value order, with the registry default first, as IPv4 has it. It lands in its own PRs.
    3. Registry fallbacks that read()/make() name directly (_read_*_unknown) count as specific readers, and the page says so.
    4. ARP's reorder on the link branch stays.
    5. A guard test is added now.

    Reconciled: items 1, 2 and 3 are written onto protocol-member-order.rst, and item 5's guard test is dispatched now in one PR. That guard carries a known-exceptions table, so it passes on main today and keeps passing as #2522, #2523 and the held link/misc branches merge. Applying item 1's moves and rule c is another mechanical reorder of the same files, so it follows in its own PRs once the in-flight streams release them (the checksum, TLS, HTTP, IGMP and link streams).

  11. 15 remaining items

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

    @JarryShaw
    OwnerAuthor

    #2586 (checksum move) and #2590 (IGMP names) have both merged, so this is unblocked. A worker is reordering the remaining classes (OSPF, IGMPv3 with its schema classes, IPv4, IPX, IP_Pseudo, SCTP and TCP) and deleting their KNOWN_EXCEPTIONS entries. Each module comes with an AST-identity proof that the reorder is pure, as the earlier #2490 reorders did.

  15. 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
  16. moved this from Blocked to WIP in PyPCAPKiton Nov 2, 2026
  17. added this to the PyPCAPKit v1.6 milestone on Nov 2, 2026
  18. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The remaining guard exceptions are reordered in #2613, which leaves the guard's KNOWN_EXCEPTIONS empty. Three parts of the page are not applied anywhere yet, and the guard does not check them: rule c (option readers in their registry's declaration order), subgroup d (helpers that read/make do not reach go last) and registry-map entry order. This issue stays open for them, as the earlier thread assigned them to follow-up reorder PRs.

  19. JarryShaw commented on Nov 2, 2026

    @JarryShaw
    OwnerAuthor

    The remaining items are rule c (option readers in registry declaration order), subgroup d (unreachable helpers last) and registry-map entry order. They reorder members across many protocol modules that open PRs still edit: #2595 (TLS), #2602 (SSLv3), #2603 (DTLS), #2607 (802.11) and #2609 (HTTP/2), plus #2574's family rollout. Blocked: this unblocks when those PRs merge (gh pr view <n> --json state -q .state prints MERGED).

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

    @JarryShaw
    OwnerAuthor

    The PRs this waited on (#2595, #2602, #2603, #2607, #2609) and #2574's rollout have all merged. The reorder touches most protocol modules, so it runs in the serial window with #2594 and #2534, once no open PR edits pcapkit/protocols/. It stays blocked, but now on that window rather than on those PRs.

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

    blockedDeferred pending another issue or decision; see the last comment for what unblocks itrefactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

    Projects

    • Status
      Blocked

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions