Skip to content

fix(ipv6_ext): stop the base make's keywords leaking into subclasses that ignore them (#2286) - #2358

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2286-ipv6-ext-make-keywords
Oct 27, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2286-ipv6-ext-make-keywords

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — bug fix

Description

Closes #2286.

  • Fix: a new marker, ProtocolBase.__own_make_keywords__, lets IPv6_Ext keep len and data to its own make rather than leaking them to every subclass that overrides make and never reads them. IPv6_Route(len=99) now raises UnsupportedCall instead of being silently dropped; subclasses that declare their own data (IPv6_Route, MH) still accept it.
  • Fail-without-fix: 17 failed on origin/main. Passing on the rebased head.

@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 27, 2026
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) fix Pull requests that fix a defect (fix: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: NEEDS CHANGES at acde3dcbb (Sonnet) — two change-relative test docstrings, code is correct.

  • Confirmed: __own_make_keywords__ restricts len/data to the 8 IPv6_Ext subclasses only (37 other ProtocolBase subclasses byte-identical); subclasses that declare their own data still accept it; next=/__keywords__ are unaffected; 23 captures/6833 layers parse-rebuild byte-exact. Fail-without-fix: 17 failed on origin/main. On the head, 523+44+91+166+56 passed. Mutation checks confirm the tests aren't vacuous.
  • Required: reword both new test docstrings ("used to stay", "now accepts", "still counts") to state the behaviour, matching the docs: #719-style prose sweep after the #1090–#1102 defect wave #1103 sweep's last five commits on main.
  • Non-blocking: ext.rst and IPv6_Ext.make's "every class in the MRO" prose now has one opt-in exception worth a note; a third-party subclass forwarding len=/data= would need __keywords__ as the escape hatch.

@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 27, 2026
…that ignore them (#2286)

Problem: _declared_keywords unions make signatures over the whole MRO, so
IPv6_Ext.make's len and data stayed allowed on every extension header
subclass, whose own make ignores them: IPv6_Route(len=99) built the same
octets as IPv6_Route(), and a misspelling was steered to the dead keyword.

Fix: a new ProtocolBase.__own_make_keywords__ marker, read per class like
the __keywords__ None opt-out, keeps a base's make parameters out of the
allowlist once a subclass overrides make. IPv6_Ext sets it; the
IPv6_Ext.make note on allowlist widening is corrected.

Test: every IPv6_Ext subclass refuses len/data unless its own make declares
them and still accepts next; a unit test pins the marker's scope.
@JarryShaw
JarryShaw force-pushed the fix/2286-ipv6-ext-make-keywords branch from 5f182c5 to 64ab232 Compare October 27, 2026 03:06
@JarryShaw

Copy link
Copy Markdown
Owner Author

Amended 5f182c576 → 64ab2326b: reworded both new test docstrings to state the behaviour rather than its history. test_ipv6_ext_unit.py + test_construction_keyword_check_unit.py + test_docstring_contract.py give 61 passed.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 27, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at 64ab2326b. Closes #2286.

  • Review: NEEDS CHANGES → fixed (two change-relative test docstrings) → self-certified, prose-only change.
  • CI: Required checks passed SUCCESS, 0 failures, KTLO clean.
  • Ordering leg: protocols gave 1970 tests with 0 failures, run with the PR merged into current main.
  • Merge state: mergeable.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.58% (unit tier, Python 3.15, 64ab2326b, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 881 2618 867 92.11%
pcapkit/corekit 2596 74 818 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 3029 23 1050 25 98.82%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17447 217 4588 185 98.17%
pcapkit/toolkit 914 36 334 10 95.51%
pcapkit/utilities 502 7 144 5 98.14%
pcapkit/vendor 4432 1988 1018 167 51.87%

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

@JarryShaw
JarryShaw merged commit fca7d50 into main Oct 27, 2026
63 checks passed
@JarryShaw
JarryShaw deleted the fix/2286-ipv6-ext-make-keywords branch October 27, 2026 14:53
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 27, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment) fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(ipv6_ext): IPv6_Ext.make's len and data stay allowed in subclasses and are dropped

1 participant