Skip to content

fix(registry): thirteen code-keyed registrars warn "already registered, overwriting" on re-registering the identical object #1362

Closed

Description

@JarryShaw

Describe the bug
#718 and #739 moved the registrars that store a class to an identity guard (incumbent is not x), but the registrars that store a parser (str or tuple) still test presence only, so handing back the object already stored warns about a displacement that did not happen.

Site Guard
protocols/internet/ipv4.py:502 register_option
protocols/internet/hopopt.py:387 register_option
protocols/internet/ipv6_opts.py:379 register_option
protocols/internet/ipv6_route.py:347 register_routing
protocols/internet/hip.py:690 register_parameter
protocols/transport/tcp.py:638,651 register_option, register_mp_option
protocols/transport/sctp.py:645,658,671 register_chunk, register_parameter, register_cause
protocols/internet/mh.py:1521,1534,1547 register_message, register_option, register_extension

To Reproduce
For each class, take code, value = next(iter(cls.__option__.items())) and call cls.register_option(code, value): 13 of 13 emit RegistryWarning: ... already registered, overwriting.

Expected behavior
Silent when the incumbent is the same object (incumbent is not None and incumbent is not meth), as in #718. The auditor also listed extraction.py (4 sites) and traceflow.py:244; those already have the identity guard and are not part of this issue.

Found by the round-trip audit of pcapkit/foundation. Run /tmp/rtissues/foundation-repro.py from the repo root (it prints pcapkit.__file__ first).

Found by the foundation round-trip audit (#1202). The repro was re-checked by an independent verifier, and I re-ran it on main at c9676c563.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  2. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until the open per-protocol PRs that edit these registrar files merge: #1344 (ipv4.py), #1342 (hip.py), #1345 (mh.py), #1348 (tcp.py) and #1310 (hopopt.py, ipv6_opts.py). A sweep across all thirteen sites now would conflict with each of them.

  3. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  4. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Still blocked, narrower now: #1342 (hip.py) and #1310 (hopopt.py, ipv6_opts.py) have merged. #1344 (ipv4.py), #1345 (mh.py) and #1348 (tcp.py) are still open.

  5. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Still blocked, but only on #1367 now. #1344, #1345 and #1348 have merged. The remaining overlap is protocols/internet/hip.py: this issue's :690 site and #1367 both edit that file. The issue unblocks when #1367 merges.

  6. JarryShaw commented on Oct 8, 2026

    @JarryShaw
    OwnerAuthor

    Still blocked, now on different PRs. #1367 has merged, so hip.py is clear. But this issue's sites still overlap two open PRs:

    Blocked until #1390 and #1376 merge.

  7. JarryShaw commented on Oct 8, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1376 and #1390 have merged. A worker is starting on it. The IPv4 TS and SEC code is being worked in parallel for #1391–#1393, so this worker keeps to register_option in ipv4.py.

  8. 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 Oct 8, 2026
  9. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 8, 2026
  10. added this to the PyPCAPKit v1.5 milestone on Oct 26, 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

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions