Skip to content

fix(hip): three BitField namespaces leave reserved bits unnamed, so they rebuild as zero - #1419

Merged
JarryShaw merged 1 commit into
mainfrom
fix/1417-hip-reserved
Oct 8, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/1417-hip-reserved

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Closes #1417
Refs #1288

Names reserved at HIP.ver (4, 3) and at RouteDstParameter.flags / RouteViaParameter.flags (2, 14), per #654, carried through the reader, the data model and make() (default 0). The new make() keywords are version_reserved and flags_reserved.

Rebuilt through HIP.from_data(p.info).data: ver 2f→21 before, 2f after; ROUTE_DST/ROUTE_VIA flags ffff→c000 before, ffff after.

Breaking: data.internet.hip.HIP and data.internet.hip.Flags gain a required reserved field. test_hip_unit.py built the old namespace dicts and Flags without it, so I updated it.

New tests/protocols/internet/test_hip_reserved_bits_unit.py: 4 tests, 19 subtests, all passing; all 4 tests fail with the fix reverted.

Rebase note: #1416 has not merged. When rebasing over it, remove the 3 HIP entries from KNOWN_GAPS in tests/protocols/schema/test_bitfield_coverage_unit.py.

…hey rebuild as zero

Name a `reserved` sub-field at each site (#654 policy) and carry it through
the reader, data model and make() (default 0):

- HIP.ver (4, 3): Data_HIP.reserved, make(version_reserved=)
- RouteDstParameter.flags / RouteViaParameter.flags (2, 14):
  Data Flags.reserved, _make_param_route_*(flags_reserved=)

test_hip_unit.py built the old namespace dicts and Flags without the new
field; updated to supply it.
@JarryShaw JarryShaw added fix Pull requests that fix a defect (fix: subject prefix) breaking Breaks public-facing behaviour or API (apply alongside the type label) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 8, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Verdict: GOOD TO GO at 222c01161 (Sonnet cross-review; author ran on Opus).

  • Repro: on main, version 2f→21 and ROUTE_DST/ROUTE_VIA flags ffff→c000. All are byte-exact here; make()→parse is exact for version_reserved=0b101 and flags_reserved=0x1234. The new module fails 20 on main.
  • RFCs (fetched): 7401 §5.1 gives the header octet as Version(4) | RES.(3) | 1. RFC 6028 Flags define only SYMMETRIC (bit 0) and MUST_FOLLOW (bit 1), so reserved(2,14) is right, MSB-first.
  • Blast radius: nothing outside this PR constructs Data_HIP or Flags or hand-builds these dicts. Every other HIP-touching module passes. The test_hip_unit.py edits only add reserved; no assertion was dropped.
  • Fixtures: 23 captures, 1614 frames. 49 frames differ, and only by the new reserved keys (all 0). All 49 HIP layers rebuild byte-exact.
  • Leg: protocols/internet 570, OK.
  • test(schema): every BitField namespace covers all of its bits #1416: with its test applied on top, the only failure is these 3 HIP KNOWN_GAPS entries going stale. Whichever merges second deletes them.
  • Nit (reviewer-reported, not blocking): the new test's docstring cites RFC 6028 §5; the reviewer places the Flags definition in §4.1.

@JarryShaw JarryShaw removed the review: running A cross-review is in flight against the current head - no verdict yet label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Coverage: 89.43% (unit tier, Python 3.14, 222c01161, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 4 93.55%
pcapkit/const 18791 968 2352 869 90.90%
pcapkit/corekit 2038 89 634 25 94.76%
pcapkit/dumpkit 234 2 84 2 98.74%
pcapkit/foundation 2637 98 928 48 94.78%
pcapkit/interface 112 7 40 5 92.11%
pcapkit/protocols 16506 219 4420 183 98.04%
pcapkit/toolkit 539 74 168 3 84.58%
pcapkit/utilities 429 4 122 4 98.55%
pcapkit/vendor 4409 2342 1006 157 43.25%

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

@JarryShaw JarryShaw added the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 8, 2026
@JarryShaw
JarryShaw merged commit a3f0354 into main Oct 8, 2026
64 of 66 checks passed
@JarryShaw
JarryShaw deleted the fix/1417-hip-reserved branch October 8, 2026 17:22
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 8, 2026
JarryShaw added a commit that referenced this pull request Oct 8, 2026
#1419 (HIP, #1417) and #1421 (MH, #1418) merged after #1416, so all 27
allowlisted sites now name every bit and the exact-match assertion failed
on main. The allowlist stays, empty, for future filed gaps.
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaks public-facing behaviour or API (apply alongside the type label) fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(hip): three BitField namespaces leave reserved bits unnamed, so they rebuild as zero

1 participant