Skip to content

feat(internet): add IGMPv1/IGMPv2 as concrete classes over an abstract base - #2444

Open
JarryShaw wants to merge 1 commit into
mainfrom
feat-igmp-v1-v2-2439
Open

JarryShaw wants to merge 1 commit into
mainfrom
feat-igmp-v1-v2-2439

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Test plan

  • tests/protocols/internet/test_igmp_unit.py, tests/protocols/test_dispatch_registry_unit.py: 40 passed, 169 subtests
  • IGMP modules: 100% line and branch coverage
  • examples/generators/make_samples.py runs clean
  • isort clean on changed files; internet.py fails isort on main as well
  • pylint on igmp.py: C0301, R0913/R0917 on make, W0622 on _classify's type
  • Full suite not run; CI pending

@github-actions github-actions Bot added this to the PyPCAPKit v1.5 milestone Oct 30, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 30, 2026
@JarryShaw JarryShaw added feat Pull requests that add a new capability (feat: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage: 94.41% (unit tier, Python 3.15, b0d444da8, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19647 133 2630 120 98.85%
pcapkit/corekit 2605 74 818 37 96.52%
pcapkit/dumpkit 281 3 100 3 98.43%
pcapkit/foundation 3070 24 1072 26 98.79%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17732 193 4706 179 98.33%
pcapkit/toolkit 924 36 334 10 95.55%
pcapkit/utilities 502 7 144 5 98.14%
pcapkit/vendor 4485 1878 1030 168 54.89%

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

@JarryShaw

Copy link
Copy Markdown
Owner Author

NEEDS CHANGES (cross-review, different model from the author).

Required: (1) a plain # comment at igmp.py:131 uses the :issue: role instead of bare #2439, breaking tests/project/test_issue_refs_in_comments.py; (2) only types 0x11/0x12/0x16/0x17 are handled — a v3 Report, DVMRP or MRD message still decodes through the v1/v2 layout instead of falling back to Raw, giving a garbage group/max_resp_time; (3) versionadded:: 1.5.0 should read 1.6.0, and the PR has no 1.6.0 changelog bullet.

Should-fix: wrong :rfc:1112#section-4`` citation (the header is really Appendix I, not §4); checksum docstring wrongly says "8-octet message" for v2 (only v1 is 8 octets fixed); no IGMPv3 follow-up issue exists despite the PR describing one.

Type codes, field layout, checksum fixtures and protocol wiring for v1/v2 all independently confirmed correct. Relaying all three required fixes to the original agent.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 30, 2026
@JarryShaw
JarryShaw force-pushed the feat-igmp-v1-v2-2439 branch from 90169ae to 41b5735 Compare October 30, 2026 06:34
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 30, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

All required fixes applied and verified directly (new head 41b5735ef): plain #2439 instead of the :issue: role in a #-comment; a new _V1_V2_TYPES check raises ProtocolError for any non-v1/v2 type (IGMPv3 Report, DVMRP, etc.), falling back to Raw; versionadded corrected to 1.6.0 with a changelog bullet added. Should-fix items (RFC 1112 Appendix I citation, version-correct checksum wording) also applied. Spot-verified: 15 passed/12 subtests on the targeted regression tests. One item flagged back rather than fixed: the PR body claims an IGMPv3 follow-up issue exists when it doesn't — I'll address that directly rather than re-looping on it. Cross-review re-dispatched.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Auto-resolved conflict (standing rule): #2444 went CONFLICTING against origin/main because both this branch and main independently added docs/source/changelog/1.6.0.rst as new files — the branch's version replicated the header text by hand rather than inheriting it, so git saw an add/add conflict rather than a clean extension.

Old head 41b5735ef → new head d1e4b4e2f. Resolution: docs/source/changelog/1.6.0.rst took the branch's version (a strict superset — header text byte-identical to main's, plus the IGMP bullet); CHANGELOG.md was regenerated via util/changelog_md.py rather than hand-merged. Patch-id on every other file is unchanged (git patch-id --stable matches before/after). tests/project/test_changelog_md.py: 68 passed/45 subtests on the rebased tree.

Old head's CI was still early (only 2 check-runs posted, both non-failing) when this landed, so there's no completed-green state to bypass checks against — the rebase just needs its own CI run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Round 2 verdict: substantively GOOD, one timing note.

The reviewer's one "blocker" (head not rebased onto main, CONFLICTING) was reviewed against head 41b5735ef — which I'd already superseded with a real rebase (to d1e4b4e2f, confirmed origin/main is now an ancestor) in a prior tick, before this review's results came back. Current head is already correctly rebased; that finding is moot.

All substantive checks passed: _V1_V2_TYPES matches RFC 1112 Appendix I/RFC 2236 §2.1 exactly; dispatch-to-Raw verified for 9 different non-v1/v2 message types including a v3 Report with real (non-zero) group records; checksum wording genuinely distinguishes v1 (8-octet) from v2 (whole payload); all 11 RFC citations now say Appendix I; tests/project/tests/const/tests/vendor: 2697 passed/36794 subtests, 0 new failures vs. main; no cross-PR registration collision.

Two should-fix items found: the RFC 1112 Appendix I citation has no working #appendix-I anchor on the rendered RFC (dead link); pep.rst wrongly says IGMP landed "ahead of wave 2" (it's part of wave 2) and cites the wrong issue for the v3 follow-up. Both relayed for a quick fix. Also: I've corrected #2448's body myself — the reviewer found my own issue text was wrong about v3 Queries (they share type 0x11 with v1/v2 and correctly decode with the extra octets as trailing Raw per RFC 2236 §2.5; the real v3 gap is the floating-point Max Resp Code encoding, now documented there instead).

Noted for later: all three sibling wave-2 PRs will conflict with this one on pep.rst/changelog text once any of them merges — whichever lands last needs a rebase with count-pins re-derived.

@JarryShaw
JarryShaw force-pushed the feat-igmp-v1-v2-2439 branch from d1e4b4e to ce2f5e6 Compare October 30, 2026 07:01
@JarryShaw

Copy link
Copy Markdown
Owner Author

Both should-fix items applied and verified directly (new head ce2f5e6df): all 11 RFC anchors now point at #page-11 (confirmed against the real datatracker page); pep.rst's "ahead of wave 2" corrected to "within wave 2" in both spots, and the follow-up issue cite corrected to #2448. With round 2's substantive findings already clean and the stale rebase concern resolved, this is GOOD TO GO at ce2f5e6df, pending CI.

@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 30, 2026
@JarryShaw
JarryShaw force-pushed the feat-igmp-v1-v2-2439 branch from ce2f5e6 to 63a93e7 Compare October 30, 2026 07:07
@JarryShaw

Copy link
Copy Markdown
Owner Author

Re-resolved the conflict (my own process gap this time, not the worker's): the previous fix-relay agent amended the branch inside the live worktree, which still held the pre-rebase history — my earlier out-of-band rebase (pushed from a separate scratch worktree) never got synced back into the live one, so that agent's force-push silently reverted it, and #2444 went CONFLICTING again.

Old head ce2f5e6df → new head 63a93e719, rebased directly in the live worktree this time so it stays in sync going forward. Resolution identical to before (git's rerere reused the recorded resolution): 1.6.0.rst takes the branch's superset version, CHANGELOG.md regenerated. tests/protocols/internet/test_igmp_unit.py + tests/project/test_changelog_md.py: 78 passed/57 subtests. origin/main confirmed an ancestor this time.

@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: good-to-go Cross-review at the current head says ready; CI state is separate review: running A cross-review is in flight against the current head - no verdict yet labels Oct 30, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Confirmed by direct diff: content at new head 63a93e719 is byte-identical to the already-approved ce2f5e6df outside the two conflict-resolution files, which carry the same resolution as before (verified by git rerere reusing the recorded pattern, plus a clean test run). Restoring GOOD TO GO without a fresh review round — nothing substantive changed.

@JarryShaw

JarryShaw commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner Author

We do not need a dispatcher logic for IGMP i think. And we can use dynamic properties and log/error messages, so to avoid duplicate/similar code.

@JarryShaw

Copy link
Copy Markdown
Owner Author

My reading of your 02:15Z comment: drop the IGMP dispatcher, and use dynamic properties and log/error messages instead.

This changes #2444, which is currently good-to-go, and #2465 and #2448 wait on it. Confirm that reading, and I'll open the fix round. If you meant something else, say so.

@JarryShaw JarryShaw added the needs: decision Waiting on the maintainer to decide — not blocked by other work label Oct 31, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Yes correct, move similar/duplicate code to the base class.

@JarryShaw
JarryShaw force-pushed the feat-igmp-v1-v2-2439 branch from b0d444d to 7514811 Compare October 31, 2026 02:22
@JarryShaw

Copy link
Copy Markdown
Owner Author

Rebased onto main (b6efe6663, #2441 merged). Old head b0d444da8, new head 7514811de.

  • Conflicts were test count assertions only (5 files), resolved as main's value plus this PR's delta.
  • Patch-id changed only in the conflict hunks and their context.
  • Tests: 273 passed on the touched IGMP and count modules.
  • Review reset to pending; fresh review queued. The dispatcher question on this PR is still open and is not changed by this rebase.

@JarryShaw JarryShaw added review: pending No verdict for the current head - never reviewed, or the head moved since the last one and removed review: good-to-go Cross-review at the current head says ready; CI state is separate labels Oct 31, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Anything needs decision?

@JarryShaw

Copy link
Copy Markdown
Owner Author

Yes, one item: #2444's IGMP dispatcher. My reading of your 02:15Z comment is to drop the dispatcher and use dynamic properties with log/error messages. Confirm, and I'll open the fix round; the PR is on hold until you do.

@JarryShaw

Copy link
Copy Markdown
Owner Author

yes, drop the dispatcher. confirmed.

@JarryShaw JarryShaw added wip Work in flight - a covering PR is open or an agent is actively on it and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one needs: decision Waiting on the maintainer to decide — not blocked by other work labels Oct 31, 2026
@JarryShaw
JarryShaw force-pushed the feat-igmp-v1-v2-2439 branch from 7514811 to e4584a4 Compare October 31, 2026 02:38
@JarryShaw

Copy link
Copy Markdown
Owner Author

NEEDS CHANGES (Sonnet, e4584a4d8). Behaviour is unchanged; the dispatcher is gone; the new refusal tests hold.

  • test_igmp_unit.py module docstring is 16 lines, internet_checksum prose 9; line 74 "the version it must dispatch to" and lines 7-8 "classifies each message with its own alias". Reword to match _classify.
  • Title still says "behind an IGMP dispatcher"; retitle to the commit subject. Pylint bullet also lists W0622 (_classify type) and W0613; add autoattribute:: _pinned to igmp.rst.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Held: Actions queue at 44 (above the hold line). Fix round dispatches when the queue drops.

@JarryShaw

JarryShaw commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner Author

Prefer to use an abstract property @version in IGMP base class then return 1/2 in IGMPv1/2 respectively than _pinned and _version attributes.

@JarryShaw

Copy link
Copy Markdown
Owner Author

My reading of your 03:37Z comment: an abstract @version property on the IGMP base, returning 1 and 2 in IGMPv1 and IGMPv2, replaces _pinned and _version. This is a rework of the PR, so it goes back to needs-changes; the fix round is dispatched.

@JarryShaw

Copy link
Copy Markdown
Owner Author

An abstract version on the IGMP base cannot work as written: the base is the registry entry for TransType.IGMP and is built directly by about 20 tests, so it becomes uninstantiable (checked: 49 failed).

Two options:

  1. Concrete base version returning None, overridden to 1 and 2 in IGMPv1 and IGMPv2. Parsed version on the base comes from the message.
  2. Keep _pinned and _version.

I recommend option 1. Which do you want?

@JarryShaw

Copy link
Copy Markdown
Owner Author

No, IGMP base class should never be instantiable.

@JarryShaw

Copy link
Copy Markdown
Owner Author

My reading of your 03:49Z comment: the IGMP base stays abstract and non-instantiable. The rework repoints the TransType.IGMP registry entry and the tests at the concrete IGMPv1/IGMPv2 classes, with version abstract on the base. Back to needs-changes; the fix round is dispatched.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Held: Actions queue at 50 (above the hold line). The rework dispatches when the queue drops below 40.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Member order is in scope for this rework. Group the class body as: properties, public methods (id, read, make, register_xxx), dunders (__index__, __length_hint__), then utilities (_read_xxx before its _make_xxx). Use the old protocols (IPv4, TCP, UDP, ARP) as the reference.

…t base

- igmp.py: IGMP is abstract (version is an abstract property). It holds the
  schema, data model, read path and make; _classify places a message in a
  version. Refuses other types and non-8-octet Queries (RFC 9776 s7.1).
- igmpv1.py / igmpv2.py: IGMP with version 1 / 2; id() is the family and
  version. alias is dynamic from version.
- TransType.IGMP registry entry points at igmpv2.IGMP. IGMPv1 messages on
  IP proto 2 fall back to Raw; the registry has one slot per code.
- Schema, data model, IANA Type registry, docs and tests added.
@JarryShaw

Copy link
Copy Markdown
Owner Author

Rework pushed as 226a0685f: version is abstract on the base, IGMPv1 and IGMPv2 return 1 and 2, and the old _pinned/_version are gone.

Decision needed: TransType.IGMP now points at IGMPv2. That makes IGMPv1 messages on IP protocol 2 fall back to Raw. Which should the registry entry point at, and is the Raw fallback for IGMPv1 acceptable?

@JarryShaw

Copy link
Copy Markdown
Owner Author

hmm, in this case, sounds like we'd still need a dispatcher logic then.

@JarryShaw

Copy link
Copy Markdown
Owner Author

My reading of your 04:44Z comment: the IGMP registry entry needs dispatch logic to choose between IGMPv1 and IGMPv2, so the earlier no-dispatcher direction is reversed for this case. This is a rework: #2444 goes back to needs-changes, held until the Actions queue is below 40.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Held: Actions queue at 78 (well above the hold line). The dispatch rework dispatches when the queue drops below 40.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Pull requests that add a new capability (feat: subject prefix) review: needs-changes Cross-review at the current head says changes are required; see the verdict comment

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant