docs(conventions): harvest the settled rulings, correct the stale prose (#918) - #929
Conversation
…se (#918) * Retitle *Registry Conventions* -> *House Conventions* and widen the preamble: the page now carries a protocol-class ruling as well as `pcapkit.const` ones, and records the standing ask that a ruling is written here in the same change that implements it. * Correct the five passages #927 left for this issue: the `FEATCode` name miss raises `EnumKeyError` rather than a bare `KeyError`; a `_validate_value` rejection propagates unwrapped with no usable `default`; #877's phase 2 has landed for 17 of the 24 non-registry enumerations rather than "not happened yet"; `TransportProtocol.get` is now only a case fold and `Criticality.get` is gone. * New "What a Failed Lookup Raises" for #923's provenance-and-shape ruling. * New "Which bases an IPv6 extension header names" for #924's subclassing ruling, the RFC census behind it, the retired `IPv6_GenericExt` name, and why ESP is an extension header that still cannot short-circuit the chain walk. * Document `EnumValueError`, which had no `autoexception` entry, so five references to it on this page rendered as plain text. 15 new tests pin the checkable claims. tests/project 193 OK, test_sentinel_exports_unit 18 OK, test_ipv6_ext_unit + FEATCode + enum-lookup-base 77 OK; docs build clean, every new cross-reference resolved in the rendered HTML.
|
GOOD TO GO at The reviewer wrote that The class is alive, exported in The document itself is correct — line 487 reads " Everything else re-derived and confirmed:
One cosmetic imprecision, not worth a revision: the page calls AH's and ESP's RFC sentences "the same sentence", where RFC 4302 §3.1.1 says "calls for" and RFC 4303 §3.1.1 "translates to" — parallel, not identical. Note the page will need one edit shortly. It states seven enumerations remain outside |
… onto EnumLookup (#930) Finishes #877's phase 2, which #921 left seven classes out of because their files were held by #913/#904 at the time: CommandType and ConformanceRequirement (const/ftp/command.py), ESPStatus (protocols/internet/esp.py), and FastBindingAcknowledgmentStatus, IPv6AddressPrefixCode, LMAAddressCode and LocalizedRoutingStatus (protocols/internet/mh.py). Both blockers have since merged. Each now mixes in EnumLookup ahead of its enum base; member-table sizes are unchanged. FastBindingAcknowledgmentStatus and IPv6AddressPrefixCode kept their own get, still a staticmethod that never calls super() -- left untouched, since #923's EnumKeyError name-miss conversion already matches the base's shape. mypy's [override] and pylint's arguments-differ against the kept decorator are suppressed rather than resolved by widening it. The other five are pure re-parents. Brought conventions.rst and its own doc-claims test in line with #929, which merged in the interim: phase 2 is now 24 of 24, zero enumerations outside the hierarchy. Added test_enum_lookup_reparent_930_unit.py pinning the re-parenting, the kept overrides, no growth, and the zero-outside census; fixed three tests whose claims this change made stale (test_const_enum_get, test_const_ftp_featcode_case_903_unit, test_mh_unit). Build: mypy/pylint/isort clean against baseline; affected test files pass.
… onto EnumLookup (#930) Finishes #877's phase 2, which #921 left seven classes out of because their files were held by #913/#904 at the time: CommandType and ConformanceRequirement (const/ftp/command.py), ESPStatus (protocols/internet/esp.py), and FastBindingAcknowledgmentStatus, IPv6AddressPrefixCode, LMAAddressCode and LocalizedRoutingStatus (protocols/internet/mh.py). Both blockers have since merged. Each now mixes in EnumLookup ahead of its enum base; member-table sizes are unchanged. FastBindingAcknowledgmentStatus and IPv6AddressPrefixCode kept their own get, still a staticmethod that never calls super() -- left untouched, since #923's EnumKeyError name-miss conversion already matches the base's shape. mypy's [override] and pylint's arguments-differ against the kept decorator are suppressed rather than resolved by widening it. The other five are pure re-parents. Brought conventions.rst and its own doc-claims test in line with #929, which merged in the interim: phase 2 is now 24 of 24, zero enumerations outside the hierarchy. Added test_enum_lookup_reparent_930_unit.py pinning the re-parenting, the kept overrides, no growth, and the zero-outside census; fixed three tests whose claims this change made stale (test_const_enum_get, test_const_ftp_featcode_case_903_unit, test_mh_unit). Build: mypy/pylint/isort clean against baseline; affected test files pass.
… onto EnumLookup (#930) Finishes #877's phase 2, which #921 left seven classes out of because their files were held by #913/#904 at the time: CommandType and ConformanceRequirement (const/ftp/command.py), ESPStatus (protocols/internet/esp.py), and FastBindingAcknowledgmentStatus, IPv6AddressPrefixCode, LMAAddressCode and LocalizedRoutingStatus (protocols/internet/mh.py). Both blockers have since merged. Each now mixes in EnumLookup ahead of its enum base; member-table sizes are unchanged. FastBindingAcknowledgmentStatus and IPv6AddressPrefixCode kept their own get, still a staticmethod that never calls super() -- left untouched, since #923's EnumKeyError name-miss conversion already matches the base's shape. mypy's [override] and pylint's arguments-differ against the kept decorator are suppressed rather than resolved by widening it. The other five are pure re-parents. Brought conventions.rst and its own doc-claims test in line with #929, which merged in the interim: phase 2 is now 24 of 24, zero enumerations outside the hierarchy. Added test_enum_lookup_reparent_930_unit.py pinning the re-parenting, the kept overrides, no growth, and the zero-outside census; fixed three tests whose claims this change made stale (test_const_enum_get, test_const_ftp_featcode_case_903_unit, test_mh_unit). Build: mypy/pylint/isort clean against baseline; affected test files pass.
… onto EnumLookup (#932) Finishes #877's phase 2, which #921 left seven classes out of because their files were held by #913/#904 at the time: CommandType and ConformanceRequirement (const/ftp/command.py), ESPStatus (protocols/internet/esp.py), and FastBindingAcknowledgmentStatus, IPv6AddressPrefixCode, LMAAddressCode and LocalizedRoutingStatus (protocols/internet/mh.py). Both blockers have since merged. Each now mixes in EnumLookup ahead of its enum base; member-table sizes are unchanged. FastBindingAcknowledgmentStatus and IPv6AddressPrefixCode kept their own get, still a staticmethod that never calls super() -- left untouched, since #923's EnumKeyError name-miss conversion already matches the base's shape. mypy's [override] and pylint's arguments-differ against the kept decorator are suppressed rather than resolved by widening it. The other five are pure re-parents. Brought conventions.rst and its own doc-claims test in line with #929, which merged in the interim: phase 2 is now 24 of 24, zero enumerations outside the hierarchy. Added test_enum_lookup_reparent_930_unit.py pinning the re-parenting, the kept overrides, no growth, and the zero-outside census; fixed three tests whose claims this change made stale (test_const_enum_get, test_const_ftp_featcode_case_903_unit, test_mh_unit). Build: mypy/pylint/isort clean against baseline; affected test files pass.
Please follow the guide below
make pylint,make mypy,make isort)make testpasses, and a test case covers the changedocs/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 defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
Both halves of #918, on top of
4f3d43df7. Nothing underpcapkit/changes.Half 1 — the five passages #927 left here. All verified against the merged tree,
not copied from the issue:
FEATCode.get('ZZ-NOT-REAL')now named as raisingEnumKeyError, adding that itis a
KeyErrorso anexcept KeyErroris unaffected._validate_valuebullet gains the unwrapped path: with no usabledefault,getre-raises an in-libraryValueErroras it stands. Measured — an overrideraising
EnumValueError('CUSTOM 99')reaches the caller with that message andone
CRITICALrecord, not two.plus the quiet/loud asymmetry (name miss
quiet=True, 0 log records; value missloud, 1 — both measured).
TransportProtocol.getis now only a case fold(its whole body is two
super().get()calls) and thatCriticality.getis gone —its override's only remaining job was the conversion fix(corekit,utilities): raise pcapkit exceptions from EnumLookup.get, following stdlib Enum's shape #923 retired.
#877phase-2.. note::said the phase "has not happened yet". It haspartly happened: 17 of the 24 non-registry enumerations are on
EnumLookup,and seven are not (
CommandType,ConformanceRequirement,ESPStatus, and thefour
mhhelpers). A runtime walk reproduces the page's own census exactly —151 enumerations, 127 registries, 24 non-registry, 7 outside.
Half 2 — the five harvested rulings. #1 (sentinel housing, "Okay one module for
all four it is.") was already on the page from #911/#922, so it is unchanged. The
other four land in a new Which bases an IPv6 extension header names section:
the criterion, since
IPv4.__proto__ is Internet.__proto__isTrue(measured) anda classification derived from dispatch would make all eight headers standalone.
AH RFC 4302 §3.1.1, ESP RFC 4303 §3.1.1 (both with IPv4 diagrams), HIP RFC 7401
App. C.2 (
Next Header: 139under an IPv4 header) and §5.1.MHfails onRFC 6275 §6.1.1's IPv6-only pseudo-header plus RFC 5944's UDP 434;
Shim6likewise.The section says plainly that own-protocolhood alone is not sufficient, since
that reading was put to you on refactor(ipv6): rename IPv6_GenericExt to IPv6_Ext and make it the shared base (#917) #924 and not taken.
IPv6_GenericExtname: it lived onmainfromb3551cb63to93cf940b3, under four hours, after the newest tag —git grepfinds it in norelease.
fetched: 11 rows,
50,Encapsulating Security Payload,[RFC4303]among them, 147absent. RFC 8200 §4.5's exclusion opens "For this purpose," — confirmed in the RFC
text, where it is line-wrapped, which is why a line-oriented grep misses it. The
short-circuit reason is cross-referenced to
IPv6.__generic_ext_codes__andpcapkit.protocols.internet.ipv6_extrather than restated.On splitting the page (#918 part 2): not done here, deliberately. It cannot be
done without a test change.
tests/corekit/test_sentinel_exports_unit.py:157-164opensdocs/source/contributing/conventions.rstand slicestext.index('.. _sentinel-convention:')throughtext.index('.. _registry-protocol:', start)— put those two anchors in different filesand it raises
ValueError, not a wrong answer. A split also wants theindex.rsttoctree entry, and seven prose citations of the path across
pcapkit/andtests/.Landing that as a pure move, in its own commit, is reviewable; landing it under +300
lines of new prose is not. Part 2 of #918 therefore stays open.
Two side-effects worth naming. The page's own title is now House Conventions —
it carries a protocol-class ruling, and a preamble reading "design rulings for
pcapkit.const" would have been false. The three prose references to the old title intests/const/test_const_ftp_featcode_case_903_unit.pyfollow. AndEnumValueErrorhadno
autoexceptionentry indocs/source/pcapkit/utilities/exceptions.rstwhileEnumKeyErrordid, so every:exc:reference to it — five on this page alone —rendered as plain text; one entry added.
Still unresolved on this page, all pre-existing and none introduced here:
pcapkit.corekit.sentinelshas no docs page at all (5 dead:mod:refs, plusNoValueType),FEATCodehas noautoclassentry (3), andaenumhas nointersphinx inventory (3). Each wants its own change;
sentinelsin particular needsa toctree decision.
Tests.
tests/project/test_conventions_doc_claims.py, 15 new, pinning what ischeckable: the four
.. _label:anchors (the guard a later split has to keep passing),the three phase-2 figures against a runtime walk, the bases-per-header table against
__bases__and againstSTANDALONE_MEMBERS, the absence ofIPv6_GenericExtfrompcapkit/, and theFEATCodename miss. Proven to fail without the prose — fivemutations (
Seven→Six,17→20,EnumKeyError→KeyError, HIP's row flipped toextension-only, the new anchor deleted) each fail with a message naming the drift.
RetiredNameTestsis the exception and is a forward guard rather than a test of thischange: nothing here could make it fail without editing
pcapkit/.Counts:
tests/project193 OK (178 before),test_sentinel_exports_unit18 OK,test_ipv6_ext_unit+test_const_ftp_featcode_case_903_unit+test_enum_lookup_base_unit77 OK. Docs-only, so no coverage delta is claimed.
sphinx-buildsucceeded with thesame 61 warnings as before and none on either edited page; verified in the rendered
HTML rather than by warning count, since this project builds without
-Wand withoutnitpicky— all 24 cross-references in the new section resolve to real<a href>s, and:ref:extension-header-subclassing`` renders as a link. The build was run withPYTHONPATHexported and the log confirms it documented this worktree.