docs(hopopt): cite RFC 8200 section 4.2 for the Opt Data Len sentence (#530) - #538
Conversation
|
✅ GOOD TO MERGE — independently confirmed against the RFC 8200 text itself that Section 4.2 (not 4.3) defines |
Detailed review (independent verification, falsify-not-bless)Head sha reviewed: What changed
Independent verification of the core claimI did not take the PR's RFC reading on faith. I fetched
This independently confirms the PR's central claim: §4.2 is the right citation for the I also spot-checked the PR's claim about sibling issue #517 ( Falsification attemptsWorking in my own worktree, checked out to the PR head commit (detached), I made two targeted edits to
Both experiments were reverted ( Pre-existing, unrelated observationRunning the full Numbers re-derived
What remains unverified
|
Closes #530. - `_hopopt_option_length` quoted "the length of the Option Data field of this option, in octets" and attributed it to RFC 8200 section 4.3. That sentence is the `Opt Data Len` definition from section 4.2; section 4.3 defines no `Opt Data Len` at all and its only length field is `Hdr Ext Len`, the whole header in 8-octet units. Now cites 4.2 for the quote and keeps 4.3 as the header this class implements, matching the two-part treatment #528 landed for the IPv6-Opts sibling. - `tests/test_docstring_contract.py` grows a fourth property: every verbatim RFC 8200 sentence this package quotes must be introduced by a citation naming the section that contains it. Keyed on the quote rather than the file, so it covers the next copy-paste of these paragraphs. - Drops the rotted `KNOWN_DEFECTS` entry for `pcapkit/vendor/ipx/packet.py`, whose `process` now takes and documents `data`. Unrelated to #530: #524 renamed the parameter and #535 added the rot guard four commits later, so `main` has been red on that subtest since the guard landed. No behavioural change: the docstring is prose, and `_hopopt_option_length` still returns `schema_len + 2`. Verified on .venv python 3.14.7 with PYTHONSAFEPATH=1 and pcapkit.__file__ asserted inside the worktree. The new check fails on unfixed hopopt.py (1 defect) and passes with the fix (0). Suite now fully green, exit code read from a file rather than a pipe: 66 passed, 449 subtests passed, EXIT=0.
01eef2b to
e24f17d
Compare
|
✅ GOOD TO MERGE (re-review of amended head |
Detailed review (independent verification, falsify-not-bless) — re-review of amended headHead sha reviewed: What changed since my last review
Deletion scope, independently confirmed: exactly one Green confirmation, independently run (not taken from the coordinator's numbers): on the clean amended head, The RFC §4.2 claim — carried forward, not re-verified this roundNothing in the amend touches New falsification: naive "cited anywhere in the docstring" vs. the shipped "nearest preceding" checkThis is the substantive new work this round, in response to a specific request to confirm the check depends on nearest preceding and not mere presence. I constructed a synthetic misattribution in my own worktree (checked out to Changed the docstring to read
This is a clean, decisive confirmation that "nearest preceding" is load-bearing, not cosmetic: a materially simpler and more obvious implementation of this same idea would have missed the defect class the test exists to catch. I did not additionally reconstruct the historical pre-fix #517/#530 sentences byte-for-byte to check whether a naive check happens to have passed on those specific historical diffs — the synthetic case above is a direct, reproducible demonstration of the same principle and I judged it sufficient without re-deriving git archaeology on already-merged, already-fixed files. Sibling false-positive check
The dropped §4.6 table entryChecked whether CI statusNot verified in CI. Per the coordinator, the runner is backed up and this head has not been observed going green in CI, only locally by both the coordinator and me independently. Reporting that plainly: local test run only, CI pending. What remains unverified
|
Closes #530.
One commit on top of
122d32795.The correction, verified against the RFC rather than the issue
pcapkit/protocols/internet/hopopt.py:456cited RFC 8200 §4.3 while quoting a sentence verbatim. I checked the citation against rfc8200.txt rather than taking the issue's word, because the sibling #517 asked for a section that turned out to be wrong:Opt Data Lendefinition, and it sits at rfc8200.txt lines 580-581, inside §4.2 (Options), which spans lines 567-691.Opt Data LenorOption Data fieldreturns nothing: §4.3 defines onlyNext Header,Hdr Ext Len("Length of the Hop-by-Hop Options header in 8-octet units, not including the first 8 octets") andOptions, and it defers TLV encoding with "Contains one or more TLV-encoded options, as described in Section 4.2."So the issue is right, and it is right for the reason it gives:
Hdr Ext Lenis the whole header in 8-octet units, which is a different quantity from one option'sOpt Data Lenin octets.This is milder than #517 and the docstring now says why. For
ipv6_opts.py, §4.3 was simply the wrong header — that class implements §4.6. For HOPOPT, §4.3 is the header this class implements, so the old citation was not wrong about the class, only about the sentence. A reviewer who learned to spot "cites a header it does not implement" catches #517 and reads straight past #530. The docstring now cites §4.2 for the quote, keeps §4.3 as the header reference, and points at the existingNote:further down that legitimately cites §4.3 for the multiple-of-8 rule — the same two-part treatment #528 landed, adapted to the milder case.No behavioural effect, stated plainly
This is a docstring change.
_hopopt_option_lengthstill returnsschema_len + 2and no code path is touched. Nothing about the parsed output, the wire format, or the arithmetic changes, and the PR claims no coverage of behaviour it does not affect.The sibling sweep found nothing else
Every RFC 8200 section citation in the repo was enumerated, and every docstring that quotes the RFC verbatim (
*"sites) was checked against the section it names. Four verbatim-quote sites exist in total:pcapkit/protocols/internet/hopopt.py:456pcapkit/protocols/internet/ipv6_opts.py:467pcapkit/protocols/internet/ipv6_route.py:223Hdr Ext Lenwording verbatimpcapkit/protocols/schema/internet/ipv6_route.py:43The other §4.3 citations in
hopopt.py(lines 1241 and, post-change, the header reference) are right: §4.3'sOptionsfield really does require the complete header be "an integer multiple of 8 octets long".hopopt.py:446and:1254cite §4.2 for the unknown-option action bits and forPad1, both of which §4.2 genuinely defines. No sibling miscitation was found, so none is fixed and none is left outstanding.A test that can actually fail
The issue suggests any test here would only "pin a previously unpinned citation". That is true of the obvious test —
assert 'section-4.2' in __doc__is a snapshot with no derivation — so this does something else.tests/test_docstring_contract.pygains a fourth property: a docstring that quotes one of these RFC 8200 sentences verbatim must be introduced by a citation naming the section the sentence is in. It is keyed on the quote rather than on the file, walks module, class and function docstrings underpcapkit/, and takes the nearest preceding citation — which is what gives it teeth, since #517 and #530 both cited the correct section elsewhere in the same paragraph while misattributing the quote. An "is §4.2 mentioned anywhere" test passes on both defects.What it cannot prove, said in the code:
RFC8200_QUOTED_SENTENCESmaps four sentences to their sections, and those section numbers were read out of the RFC — the RFC is not vendored here and the suite does not fetch it. So the table is a recorded reading and the test does not verify the RFC. What it verifies is the pairing, at every site, which is the invariant that broke twice. A companion rot-guard asserts every table key still matches some docstring, so a reworded paragraph fails loudly instead of silently narrowing coverage — the same reasoning as the existingtest_known_defects_are_still_defects, pointed the other way.I dropped a fifth entry (§4.6's
Hdr Ext Len) because nothing quotes it; carrying a key that matches no site is exactly what the rot-guard exists to prevent. Values are frozensets because the TLV-deferral sentence is worded identically in §4.3 and §4.6 (lines 722 and 1268), so demanding one section would fail a correct citation in the sibling header.Fails-without evidence
Environment:
.venv/bin/python3.14.7,PYTHONSAFEPATH=1 PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=<worktree>, withpcapkit.__file__andtests._tiers.ROOTboth asserted to resolve inside the worktree rather than the editable install, and printed.pytest-subtestsis not installed; pytest 9.1.1's native subtests print a failing subtest's parent asPASSED, so the exit code is the signal below, not the summary line.The check run against
hopopt.pyas it stands on122d32795, withipv6_opts.pyandipv6_route.pyat the same commit alongside it:That the two already-correct siblings produce no defect in the red run is the other half of the result: the check does not false-positive on #528's landed fix.
Regression run,
tests/test_docstring_contract.py+tests/protocols/internet/test_ipv6_extension_unit.py+tests/protocols/test_option_roundtrip_unit.py, with pytest's exit code persisted to a file rather than read through a pipe:One unrelated deletion, which turns
maingreenThis also deletes the
KNOWN_DEFECTSentry namingpcapkit/vendor/ipx/packet.py'sprocess, and that has nothing to do with #530.mainhas been red ontest_known_defects_are_still_defectssince the rot guard landed, through an ordering accident:a8912b46f(#524) renamed that parameter todata, and48c6f07f8(#535) added this list four commits later without re-running against the newer base. The guard was working exactly as designed — it fires when an entry describes a bug that is gone.The defect really is fixed rather than merely undetected:
pcapkit/vendor/ipx/packet.py:180readsdef process(self, data: 'dict[int, tuple[str, str]]')and its docstring documentsdataat:184, so signature and docstring agree and there is nothing left for the entry to describe. Confirmed pre-existing and independent of this change by running the unmodifiedHEAD:tests/test_docstring_contract.pyagainst the same tree, which failed on that subtest and nothing else. So this PR turnsmaingreen rather than papering over a live defect, and every otherKNOWN_DEFECTSentry is left untouched. The module docstring records the removal and its cause, next to the equivalentipx/socket.pyremoval it already described.