Repository navigation
refactor(protocols)!: make() takes an enum member or an int, with no keyword groups (#2594) - #2692
Conversation
|
NEEDS CHANGES at
|
22fb952 to
e7bc62c
Compare
|
Pushed the fix round
A Sonnet re-review is running. |
|
NEEDS CHANGES at
Timed words remain in four test docstrings and comments: |
…keyword groups (#2594) - _make_index: takes (value, enumeration, bits=, name=), checks the code as _make_uint does, and returns what get resolves; where get raises for a code the field carries, the code comes back as an int. The field width alone decides a refusal. The frame inspection and its helpers go. - Protocol.resolve_index: public helper taking the name/default/namespace/ reversed group explicitly, for a caller holding a name. - Every make() and _make_* maker, and every (code, arguments) option, sub-option, extension and chunk list: the groups are removed with no shim, each enumeration field is typed Enum | int and resolved by _make_index; a name, a wide bool or a code its field cannot carry raises ProtocolError. Also SCTP, DCCP, NGAP, IGMPv3, IPv6_Ext and the transport ports, and MH Binding Error's status, typed BindingError. - Breaking: an int HTTP/1 status with no message writes its member's phrase, as a member did: 404 writes "404 Not Found" where it wrote "404 ", and a code the registry does not assign writes its minted member's phrase ("299 Unassigned", "600 Unknown"). - Docs: versionchanged/versionremoved on every class that shipped the keywords; pep.rst and registry-protocol.rst record the rule. - Tests: a guard against the groups and frame inspection, refusal tables per family and a PCAP dumper test that fail on main; name-inference tests rewritten. Every tests/ leg matches main's results. Closes #2693
e7bc62c to
3d1dea6
Compare
|
GOOD TO GO at
Merging this first will make the other protocol PRs cheaper to rebase. |
… helpers, MH options 6 and 27, the cut SCTP and option-area schemas and dict-built secrets into 1.6.0 (#2449) - Breaking: a make() enumeration field takes a member or an int, its X_default/X_namespace/X_reversed keywords removed with no alias, and names, wide codes and wide option codes are refused (#2692); the schema helpers move to pcapkit.corekit.schema and pcapkit.corekit.fields.byteorder is removed (#2704); MobileNetworkPrefixOption gains prefix_length and keeps an IPv6Address prefix, and TimestampOption's timestamp is None past 9999 (#2709). Folded into the MH data-model entry; old values measured against v1.5.1. - Fixed: the SCTP schema cut inside its padding and a header schema cut inside an option area pack back as captured (#2682), into the SCTP entry; a Decryption Secrets Block rebuilds from its dict as captured (#2707), into the DSB entry. - Folded into unreleased entries: FRAD's Q.922 address refusal and quiet cut rebuild (#2719); a from_data rebuild's checksum status (#2712); a failed ListField fill's ledger (#2706); pad_length's path (#2704); TLS's enumeration fields (#2692); the make() and schema-helper rulings, into the conventions entry (#2692, #2704); the GraalPy shards, into the CI-legs entry (#2720). - 1.5.0's corekit.fields.byteorder role points at corekit.schema.byteorder, where #2704 moved it, so the nitpicky build does not warn on it; 1.5.0's text unchanged. - No entry for the test-only 72b2bd8 (#2715), or the docs-and-test-only 0c07940 (#2718). - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
refactor— changes neither behaviour nor performanceDescription of your pull request and other information
The owner's option 1 on #2593 and #2594. A
make()field that holds an enum takes the member or anint, resolved with the enum'sget. TheX_default/X_namespace/X_reversedkeyword groups and_make_index's inspection of the caller's frame are removed from everymake()and_make_*, SCTP and 802.11 included.Protocol._make_index(value, Enum, *, bits, name)checks the code as_make_uintdoes, then returns the member. A name, aboolwider than one bit, or a code that does not fit raisesProtocolError. This settles refactor(protocols)!: range-check the registry codes, timestamp counts and byte fields the makers still mask #2676's first bullet:IPv4(protocol=256)andIPv6_Route(next=256)raise where they wrote0x00. The enum's own range is not applied: a code that fits its field resolves to the membergetgives, which minting registries create, or to anintwheregetrefuses. Captures with unassigned codes therefore still rebuild.Protocol.resolve_index(name, default=None, *, namespace, reversed=False), which pep.rst describes.versionchangedandversionremovednotes.make()regains a group, or if_make_indexinspects a frame.Breaking: the shipped keywords are removed with no deprecation, per the owner's ruling. NGAP criticality no longer takes a
str.HTTPv1(status=404)writes404 Not Found, where it used to write404; an unassigned status writes its registry phrase.Every leg passes, apart from the CI-script failures
mainhas too, with the same ids. Shipped captures parse identically tomain.Closes #2594
Closes #2693