Skip to content

fix(protocols): annotate the MPL option seed as int | IPv6Address (#1840) - #1866

Merged
JarryShaw merged 1 commit into
mainfrom
fix/1840-mpl-seed-annotation
Oct 16, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/1840-mpl-seed-annotation

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • fix — corrects a defect
  • feat — adds a feature
  • perf — changes performance, not behaviour
  • refactor — changes neither behaviour nor performance
  • test — tests only
  • docs — documentation only
  • ci — workflows or build tooling
  • release — bumps the version or rolls up a distribution
  • chore — anything else

  • MPLOption.seed in the HOPOPT and IPv6-Opts schemas said int, but for
    seed type 0 post_process stores the IPv6 source address. Annotate it
    'int | IPv6Address', and the __init__ stub's seed
    'Optional[int | IPv6Address]', matching the data models.
  • Add a regression test pinning both annotations and the runtime types: an
    IPv6 packet whose HOPOPT or IPv6-Opts MPL option has S=0 yields an
    IPv6Address seed, and S=1 to 3 yield an int.

Closes #1840

)

- `MPLOption.seed` in the HOPOPT and IPv6-Opts schemas said `int`, but for
  seed type 0 `post_process` stores the IPv6 source address. Annotate it
  `'int | IPv6Address'`, and the `__init__` stub's `seed`
  `'Optional[int | IPv6Address]'`, matching the data models.
- Add a regression test pinning both annotations and the runtime types: an
  IPv6 packet whose HOPOPT or IPv6-Opts MPL option has S=0 yields an
  `IPv6Address` seed, and S=1 to 3 yield an `int`.

Closes #1840
@JarryShaw JarryShaw added 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 16, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 860aeeabe. A Sonnet cross-review (author: Opus) confirmed:

  • The runtime behaviour, by parsing: S=0 gives IPv6Address('2001:db8::1') and S=1–3 give int, in both HOPOPT and IPv6-Opts.
  • The annotation tests fail on main and pass here. The runtime test passes on both, because it characterises behaviour that was already correct.
  • mypy output on the schema and protocol files is byte-identical to main.
  • Nothing in pcapkit evaluates schema annotations at runtime, and the same files already carry string unions.

Out of scope, pre-existing: a standalone HOPOPT(bytes) with S=0 gives seed is NO_VALUE. Sibling fields leave the sentinel out of their annotations too, and the consumer at hopopt.py:1137 already handles it.

@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 16, 2026
@JarryShaw
JarryShaw merged commit 7f568b3 into main Oct 16, 2026
25 checks passed
@JarryShaw
JarryShaw deleted the fix/1840-mpl-seed-annotation branch October 16, 2026 23:47
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 16, 2026
@JarryShaw JarryShaw moved this to Done in PyPCAPKit Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(protocols): the MPL option schemas annotate seed as int, but seed type 0 stores an IPv6Address

1 participant