fix(hip): register R1CounterParameter under HIPv1's code 128 too - #721
Conversation
|
❌ NEEDS CHANGES — cross-review on Opus of Sonnet-authored work at head |
Cross-review detail — Opus, head
|
| selection | data/…/hip.py |
internet/hip.py |
schema/internet/hip.py |
|---|---|---|---|
| both files | 118/0/0 100% | 925/0/314 100% | 384/0/28 100% |
| both files, new test deselected | 100% | 100% | 100% |
The new test adds zero lines and zero branches. That is the right outcome: the defect was the value of a class keyword argument on a line that executes at import either way, so line/branch coverage is structurally blind to it. The test discriminates behaviourally instead — §3 above proves it fails without the fix.
7. Minor — the test docstring's two-copy rationale does not reproduce
It says one copy "would raise ProtocolError: HIPv1: invalid format before dispatch is even reached and never exercise the registry lookup". Measured:
- this head: one copy does not raise. It parses, warns
SchemaWarning: packet length < 0: -4, and yieldscounter=0instead of0xaabbccdd. - main: one copy raises the
AttributeError— i.e. it does reach the lookup.
The ProtocolError belongs to the round-trip harness's construct phase (#690's own table), not to the parse path this test builds by hand. Harmless to the fix, but it is presented as measured. Separately: that silent counter=0 on a 12-octet record is a quiet corruption path, and it is another reason to land #696.
Could not verify
- Full-suite coverage and the "100% before" figure on
8af2cfda7itself — I was scoped to these two files and did not run the suite; the before/after table above is the same-selection substitute. - fix(hip): correct R1_COUNTER's counter width and LOCATOR_SET's Length unit (#672) (#679) #696's own correctness beyond its two-line
R1CounterParameterwidth change; I read its diff and merged it, but did not review it. - Real HIPv1 captures. Every byte above is synthesised from the RFC diagrams, so conformance is checked against the spec, not against an implementation in the wild.
f1b5b2a to
32e9966
Compare
Prior verdict superseded — rebased and correctedThe cross-review's ❌ NEEDS CHANGES (head
New head: Tests on the rebased tree ( Still one commit, same author/committer ( |
|
❌ NEEDS CHANGES — cross-review on Opus of Sonnet-authored work: the fix, the derived test and the |
|
Cross-review on Opus (authored by Sonnet). Head
Item 1 answered directly: tautological on the 4/8 split alone — What needs changing — prose only, no code:
Could not verify: CI (every check Minor, no action: all 49 |
- HIPv1's R1_Counter parameter (code 128) parsed as UnassignedParameter, raising AttributeError: 'UnassignedParameter' object has no attribute 'counter'. R1CounterParameter's schema code= registered 129 (R1_COUNTER, HIPv2) only, so the parse-side OptionField lookup in Parameter.registry fell through to the default schema for 128, even though __parameter__'s hand-written dict entries and _make_param_r1_counter already handled both. - Register R1CounterParameter for both R1_Counter (128) and R1_COUNTER (129), via EnumSchema's existing code=[...] multi-code form. - Delete the now-stale hip-parameter/R1_Counter entry (and reword the surrounding comment) in EXPECTED_FAILURES, test_option_roundtrip_unit.py. - Add test_hip_r1_counter_code_128_resolves_to_its_own_schema; derives its expected wire bytes from R1CounterParameter's own field widths (asserting they still sum to _make_param_r1_counter's hardcoded len=12) instead of a hex literal, so it survives a width change without hardcoding either. - Update two prose sites this fix falsifies elsewhere: the "code 128 is not exercised" docstring in test_hip_r1_counter_width_unit.py, and examples/generators/options.py's "three remain"/enumeration-member-name comment (now two: HOST_ID, HIP_TRANSFORM; measured 47 OK of 49 HIP codes). Tests: 40 passed, 528 subtests in test_hip_unit.py + test_option_roundtrip_unit.py, rebased onto origin/main 4391dc7. Fixes #690.
32e9966 to
818e179
Compare
Second cross-review addressed — prose-only, no code changeBoth flagged sites fixed, rebased onto
The New head: |
|
✅ GOOD TO MERGE @ |
|
✅ GOOD TO MERGE @ Cross-review #3, on Opus (authored by Sonnet). The 22:22Z ❌ verdict referred to
Merge safety, established without merging. As shipped, The judgement calls, neither a blocker.
Could not verify: the full suite (only the four named files, as briefed); the coverage claim (no coverage run); real HIPv1 captures — every octet above is synthesised from the RFC diagrams, so this is conformance to the spec, not to a deployed implementation. ✅ GOOD TO MERGE @ |
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort) — scoped to touched files/lines; mypy clean, no new pylint/isort findings on my diffmake testpasses, and a test case covers the change — not run in full per instruction; see test counts belowAdded a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, changelog centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Fixes #690: HIPv1's
R1_Counter(128) parsed asUnassignedParameter— the schema registry hadonly
code=129registered, even though method dispatch and the maker already handled both codes.Registers
R1CounterParameterfor both viaEnumSchema's existingcode=[...]form.test_hip_unit.pytest_option_roundtrip_unit.pyAlso corrects two prose sites this fix falsifies elsewhere:
test_hip_r1_counter_width_unit.py's"code 128 not exercised" docstring, and
options.py's "three remain" / enumeration-member-namecomment (now two —
HOST_ID,HIP_TRANSFORM— 47 OK of 49). Rebased three times asmainmovedduring review; see PR comments for the cross-review trail and falsification evidence.