fix(const,vendor): bring 8 bespoke registries onto EnumRegistry, stop them minting - #869
Conversation
|
NEEDS CHANGES on 1. Two The PR body's claim that an unregistered lookup "can't grow that side table" is false for the public Convert both sites. The reasoning is already in the PR. If you would rather defer, it needs to be stated in the PR body rather than discoverable only in a test docstring, plus a follow-up issue — but the coverage number tells against deferral: 2. Three new static-analysis findings, each against a 3. Two numbers in the PR body do not reproduce. "452 tests" re-derives as 236 methods across the seven touched files, 0 failing (pytest separately reports Verified and sound, for the record: all eight
|
bc19137 to
3977c03
Compare
|
NEEDS CHANGES on 1. An undocumented casing change in
2. The AST checker's narrowing leaves the hole PR 2 walks into. 3. The PR body's "401 total" is wrong — it is 331. 238 across the seven touched suites (33/8/50/74/9/59/5) plus 93 in Non-blocking: the new Confirmed and not disputed: no minting on any path ( |
3977c03 to
517b177
Compare
|
NEEDS CHANGES on 1. Two false statements in the new
2.
3. 4. The re-keyed checker is disarmed by any outer wrapper. Verified and not disputed: |
517b177 to
e9c76d7
Compare
|
Correction to my round-3 verdict, item 1. I said
What stands from that item: |
|
NEEDS CHANGES on 1. The pickle clause in The base helper sets 2. The
Verified and not disputed: the Latent, not live, and worth closing while we are here: |
e9c76d7 to
c8396d0
Compare
… them minting (#860) - StatusCode, ReturnCode, ResponseKind, GroupingInformation, OptionType, Command, Method and FEATCode now inherit EnumRegistry, gaining get_all/register/register_alias for the first time. - Convert their 15 _missing_ branches -- plus Command's, Method's and OptionType's own get(), independent mint sites bypassing _missing_ entirely -- to _unregistered_member, per the owner's #860 ruling: get/_missing_ cannot supply the attributes a real member needs, so only register() may mint. OptionType's get() has two such sites (an int/namespace path and a str path); both convert. - Add per-class _unregistered_member overrides for StatusCode, ReturnCode, Command and Method, reconstructing the extra attributes a custom __new__ sets that the base's generic helper would otherwise leave unset. OptionType's is fully bespoke, to avoid growing its own __members_ns__ side table the way the base's helper is not entitled to -- verified on all three of its get()/_missing_ paths, including the live pcapng parse path that calls get() with wire bytes. - Command, Method and FEATCode share one convention for an unregistered member's value: the caller's own casing, unchanged -- only the lookup name is canonicalised to upper case. This matches FEATCode's and Command's own pre-#860 behaviour exactly (so `Command('xyzw') == 'xyzw'` still holds, which an earlier revision of this change broke by canonicalising the value too). Method's own __new__ is untouched and left with its existing, separate defect (all 40 registered members' str payload is permanently empty, e.g. `Method.GET == 'GET'` is False) -- tracked as #870, not fixed here, so an unregistered Method member now carries real content while every registered one still does not. - Declare FEATCode's 10 per-command keywords as real members instead of minting them as a side effect of evaluating Command's own rows at import time. - Replace StatusCode's and ReturnCode's hand-written get() with the base's (no caller in this tree relies on the retired `default == -1` form); keep Command's, Method's and OptionType's own get(), each of which does real dispatch (case-insensitive matching; multi-namespace lookup) the base does not replicate. - Regenerate all 5 crawlers via `python -m pcapkit.vendor`. - Fix the mypy/pylint findings the EnumRegistry mixin and the new _unregistered_member overrides introduced (generic-instance-access ambiguity, a now-redundant type: ignore, an outside-__init__ attribute). - The AST sweep guarding every _unregistered_member call's name argument keys on which operand is combined into the result -- via %, +, f-string, format, join, or any wrapping call around one, walking every call argument (not just its receiver) for a value/key reference regardless of nesting -- so a %s/.format()/f-string/concatenation/join/format_map that embeds the value is caught however it is spelled or wrapped. The argument walk is intentionally blunt (documented as such, with its known false-positive classes named): a false positive is loud and gets a fixture, a false negative ships quietly, and no real call site under pcapkit/const or pcapkit/vendor is affected either way. One heuristic gap is knowingly left latent and named in the docstring: an attribute alias like `self._value_` in place of the `value` parameter name itself. - Correct pcapkit/corekit/enum.py's own docstring, which cited FEATCode and then AppType as registries whose _missing_ still mints directly -- neither reachable as a witness for the sentence it sits in (FEATCode no longer mints after this change; AppType never goes through this base's get() at all) -- with an honest statement that the restriction is defensive with no live witness in this tree, and that the registries which do still mint (Socket, CGAType, EtherType) are int-valued and so unreachable by it regardless. Build: coverage run -m unittest across the touched const/vendor/protocol suites plus tests/protocols/misc/test_pcapng_unit.py, 332 methods, all pass. Every changed const module lands at 92-100% (status_code.py's one miss is an unreachable exhaustive-guard fallback; option_type.py's remaining misses are pre-existing comparison dunders and an already-declared-member lookup branch, neither touched by this diff).
c8396d0 to
4d9ccbd
Compare
|
GOOD TO GO on Round 6 is provably prose-only. Tokenizing The replaced rationale is accurate clause by clause. Measured: Its Two optional wording nits, not worth a seventh round. The sweep figure is const-only ( Six rounds: two on code, four on the accuracy of docstrings the earlier rounds wrote. 332 test methods, 0 failures, on two independent runs at this head. Not reporting it ready to merge yet — 4 of 58 CheckRuns are still in flight (54 green, 0 failed). I will confirm when they land; the verdict itself does not change. |
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential auto(), per the owner's follow-up ruling once composite `|` values stopped being parsed at all; delete the stale comment claiming the values must stay power-of-two. No test pins the one accepted consequence (a composed proto can now silently resolve to another transport's real declared member -- e.g. AppType.get(80, proto=tcp|udp) returns SCTP.http, where main raised), per the owner's explicit instruction. - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin, which asserted the old bare-literal-vs-auto() distinction that no longer exists now that every TransportProtocol member (undefined included) is auto()-valued and cast; the mypy-backed sibling test already tolerated the new shape unchanged. - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 403 test methods pass across the complete tests/const/ and tests/protocols/transport/ directories, plus 87 across tests/vendor/ (excluding the live-network crawler-reachability test) and 55 across the TransportProtocol-consuming suites outside those directories.
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential auto(), per the owner's follow-up ruling once composite `|` values stopped being parsed at all; delete the stale comment claiming the values must stay power-of-two. AppType._dispatch treats a composed or bare int identically as a whole either way, so the renumbering changes what specific integers mean, not only what hand-composed ones do -- e.g. a bare, uncomposed 4 (previously sctp's value) now silently resolves as dccp's, with no exception, since a real member sits at 4 under either numbering. No test pins any of this, per the owner's explicit instruction; the class comment states it instead. - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin, which asserted the old bare-literal-vs-auto() distinction that no longer exists now that every TransportProtocol member (undefined included) is auto()-valued and cast; the mypy-backed sibling test already tolerated the new shape unchanged. Narrowed the docstring's claim to what the mypy run actually depends on (undefined alone -- measured: unwrapping tcp leaves the same mypy invocation clean), and corrected the second guard's own justification (it does not catch a single-edit "wrapper dropped" regression, the primary containment check already does; it catches a two-edit one, the correct line left in place alongside a stray unwrapped duplicate). - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 403 test methods pass across the complete tests/const/ and tests/protocols/transport/ directories, plus 87 across tests/vendor/ (excluding the live-network crawler-reachability test) and 55 across the TransportProtocol-consuming suites outside those directories.
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential auto(), per GitHub issue #836's ruling retiring `|`-composite decoding and the owner's further #860 ruling that the spacing itself then had nothing left to protect; delete the stale comment claiming the values must stay power-of-two. AppType._dispatch treats a composed or bare int identically as a whole either way, so the renumbering changes what specific integers mean, not only what hand-composed ones do -- e.g. a bare, uncomposed 4 (previously sctp's value) now silently resolves as dccp's, with no exception, since a real member sits at 4 under either numbering. No test pins any of this, per the owner's explicit instruction; the class comment states it instead. - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin, which asserted the old bare-literal-vs-auto() distinction that no longer exists now that every TransportProtocol member (undefined included) is auto()-valued: under auto(), a member's own value infers as Any, which is assignable to TransportProtocol with no cast at all, so no single member's wrapper is load-bearing against a mypy error any more -- measured directly against all three shapes (baseline, undefined unwrapped, undefined reverted to the bare literal 0). What the mypy test still depends on is staying on auto() at all, not on which member is wrapped; its own "4 errors" claim is corrected to the 3 [assignment] + 762 [arg-type] this tree's own get()/get_all() Union-typed proto (tolerates a bare int default) and the new _unregistered_member site (still plainly typed) actually produce once reverted that far. - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 403 test methods pass across the complete tests/const/ and tests/protocols/transport/ directories, plus 87 across tests/vendor/ (excluding the live-network crawler-reachability test) and 55 across the TransportProtocol-consuming suites outside those directories.
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential auto(), per PR #836's ruling retiring `|`-composite decoding and the owner's further #860 ruling that the spacing itself then had nothing left to protect; delete the stale comment claiming the values must stay power-of-two. AppType._dispatch treats a composed or bare int identically as a whole either way, so the renumbering changes what specific integers mean, not only what hand-composed ones do -- e.g. a bare, uncomposed 4 (previously sctp's value) now silently resolves as dccp's, with no exception, since a real member sits at 4 under either numbering. No test pins any of this, per the owner's explicit instruction; the class comment states it instead, and every docstring that used to claim a hand-built composite is refused unconditionally (_dispatch's and get's own) is corrected to say it is looked up as a whole and resolves or is refused depending on whether some real member happens to equal it. - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin, which asserted the old bare-literal-vs-auto() distinction that no longer exists now that every TransportProtocol member (undefined included) is auto()-valued: under auto(), a member's own value infers as Any, which is assignable to TransportProtocol with no cast at all, so no single member's wrapper is load-bearing against a mypy error any more -- measured directly against all three shapes (baseline, undefined unwrapped, undefined reverted to the bare literal 0). What the mypy test still depends on is staying on auto() at all, not on which member is wrapped; its "4 errors" claim is corrected to the 3 [assignment] + 762 [arg-type] this tree produces once reverted that far, and to the two separate changes that moved the count there: PR #836 widened get()/get_all()'s own proto annotations to tolerate a bare int default before this issue touched anything, and this issue's own new _unregistered_member site is what brought the count back up from 2 to 3. - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 403 test methods pass across the complete tests/const/ and tests/protocols/transport/ directories, plus 87 across tests/vendor/ (excluding the live-network crawler-reachability test) and 55 across the TransportProtocol-consuming suites outside those directories.
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential auto(), per PR #836's ruling retiring `|`-composite decoding and the owner's further #860 ruling that the spacing itself then had nothing left to protect; delete the stale comment claiming the values must stay power-of-two. AppType._dispatch treats a composed or bare int identically as a whole either way, so the renumbering changes what specific integers mean, not only what hand-composed ones do -- e.g. a bare, uncomposed 4 (previously sctp's value) now silently resolves as dccp's, with no exception, since a real member sits at 4 under either numbering. No test pins any of this, per the owner's explicit instruction; the class comment states it instead, and every docstring that used to claim a hand-built composite is refused unconditionally (_dispatch's and get's own) is corrected to say it is looked up as a whole and resolves or is refused depending on whether some real member happens to equal it. Also fixed a generator-only comment (process()'s own, no const twin) still claiming a member's proto "is a single bit" -- true under the old power-of-two spacing, not under auto(). - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin, which asserted the old bare-literal-vs-auto() distinction that no longer exists now that every TransportProtocol member (undefined included) is auto()-valued: under auto(), a member's own value infers as Any, which is assignable to TransportProtocol with no cast at all, so no single member's wrapper is load-bearing against a mypy error any more -- measured directly against all three shapes (baseline, undefined unwrapped, undefined reverted to the bare literal 0). What the mypy test still depends on is staying on auto() at all, not on which member is wrapped; its "4 errors" claim is corrected to the 3 [assignment] + 762 [arg-type] this tree produces once reverted that far, and to the two separate changes that moved the count there: PR #836 widened get()/get_all()'s own proto annotations to tolerate a bare int default before this issue touched anything, and this issue's own new _unregistered_member site is what brought the count back up from 2 to 3. - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 403 test methods pass across the complete tests/const/ and tests/protocols/transport/ directories, plus 87 across tests/vendor/ (excluding the live-network crawler-reachability test) and 55 across the TransportProtocol-consuming suites outside those directories.
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential ones, per PR #836's ruling retiring `|`-composite decoding and the owner's further #860 ruling that the spacing itself then had nothing left to protect; delete the stale comment claiming the values must stay power-of-two. undefined is declared as an explicit cast('TransportProtocol', 0) and tcp/udp/sctp/dccp continue from it via plain auto(), per the owner's own final ruling on the declaration shape ("undefined direct uses 0. then other real transport use auto. so we don't have to define a _start_ and the undefined declaration is explicit") -- an earlier revision of this same change used an explicit _start_ = 0 with every member on auto(), which the owner's ruling superseded. AppType._dispatch treats a composed or bare int identically as a whole either way, so the renumbering changes what specific integers mean, not only what hand-composed ones do -- e.g. a bare, uncomposed 4 (previously sctp's value) now silently resolves as dccp's, with no exception, since a real member sits at 4 under either numbering. No test pins any of this, per the owner's explicit instruction; the class comment states it instead, and every docstring that used to claim a hand-built composite is refused unconditionally (_dispatch's and get's own) is corrected to say it is looked up as a whole and resolves or is refused depending on whether some real member happens to equal it. - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin: undefined is once again the one bare-literal-under-cast member among four auto()-valued siblings, exactly as #770 first shaped it, so its wrapper is load-bearing against a mypy error again -- measured directly, stripping it alone (leaving auto() elsewhere) now reproduces 3 [assignment] + 762 [arg-type] errors (765 total), while stripping tcp's wrapper instead stays clean. The two separate changes behind the 3-not-4 count: PR #836 widened get()/get_all()'s own proto annotations to tolerate a bare int default before this issue touched anything, and this issue's own new _unregistered_member site is what brought the count back up from 2 to 3. - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 216 test methods pass across test_const_apptype_split_unit.py, test_const_enum_no_mint.py, test_const_enum_builtin_parity.py, test_const_registry_protocol.py and test_vendor_reg_apptype_generator_unit.py, plus 87 across tests/vendor/ (excluding the live-network crawler- reachability test) and 55 across the TransportProtocol-consuming suites outside those directories.
…t minting (#860) Step 2 of #860 (PR 2 of 2, following AppType's 8 non-AppType siblings in #869). - Mix pcapkit.const.reg.apptype.apptype.AppType into EnumRegistry, alongside its four transport subclasses (TCP/UDP/SCTP/DCCP). AppType keeps its own get/get_all/register_alias, which already dispatch by transport protocol, and gains a working register (previously absent -- the base's generic one would have built a member with svc='<null>') and an _unregistered_member override reconstructing svc/port/proto. - Convert AppType._missing_'s 766 range-bounded extend_enum calls, plus the one more inside get()'s own second mint site, to _unregistered_member -- owner ruling: "only IANA registered ones are legit values ... get will not have sufficient information to create new ones." All 766+1 branches convert uniformly, including the 8 that named a real (if span-assigned rather than individually declared) service, since none of them mints at import time -- unlike FEATCode's earlier fix, there is no self-mutation defect here to address by declaring members statically. - Move TransportProtocol from power-of-two values to sequential ones, per PR #836's ruling retiring `|`-composite decoding and the owner's further #860 ruling that the spacing itself then had nothing left to protect; delete the stale comment claiming the values must stay power-of-two. undefined is declared as an explicit cast('TransportProtocol', 0) and tcp/udp/sctp/dccp continue from it via plain auto(), per the owner's own final ruling on the declaration shape ("undefined direct uses 0. then other real transport use auto. so we don't have to define a _start_ and the undefined declaration is explicit") -- an earlier revision of this same change used an explicit _start_ = 0 with every member on auto(), which the owner's ruling superseded. AppType._dispatch treats a composed or bare int identically as a whole either way, so the renumbering changes what specific integers mean, not only what hand-composed ones do -- e.g. a bare, uncomposed 4 (previously sctp's value) now silently resolves as dccp's, with no exception, since a real member sits at 4 under either numbering. No test pins any of this, per the owner's explicit instruction; the class comment states it instead, and every docstring that used to claim a hand-built composite is refused unconditionally (_dispatch's and get's own) is corrected to say it is looked up as a whole and resolves or is refused depending on whether some real member happens to equal it. - Update corekit/enum.py's own docstring, which described AppType's EnumRegistry mixin as future work ("stays as it is until tier two lands"), and its get() docstring's str-valued-registry census (119 -> 124). - Update tests/vendor/test_vendor_reg_apptype_generator_unit.py's #770 pin: undefined is once again the one bare-literal-under-cast member among four auto()-valued siblings, exactly as #770 first shaped it, so its wrapper is load-bearing against a mypy error again -- measured directly, stripping it alone (leaving auto() elsewhere) now reproduces 3 [assignment] + 762 [arg-type] errors (765 total), while stripping tcp's wrapper instead stays clean. The two separate changes behind the 3-not-4 count: PR #836 widened get()/get_all()'s own proto annotations to tolerate a bare int default before this issue touched anything, and this issue's own new _unregistered_member site is what brought the count back up from 2 to 3. - Fix four tests in the existing suite that pinned the old minting/power-of- two behaviour directly (test_const_apptype_split_unit.py, test_const_enum_builtin_parity.py), and add 17 new tests plus prose/count updates in test_const_enum_no_mint.py and test_const_registry_protocol.py. All 5 crawlers regenerate byte-identically on a second run; git status is clean relative to this commit. mypy/pylint deltas are the same classes of finding this codebase already tolerates elsewhere (aenum stub gaps, import-outside-toplevel/protected-access/no-member in test internals), suppressed with # type: ignore[override]/pylint: disable=arguments-differ, arguments-renamed where the codebase's own convention already does so. 216 test methods pass across test_const_apptype_split_unit.py, test_const_enum_no_mint.py, test_const_enum_builtin_parity.py, test_const_registry_protocol.py and test_vendor_reg_apptype_generator_unit.py, plus 87 across tests/vendor/ (excluding the live-network crawler- reachability test) and 55 across the TransportProtocol-consuming suites outside those directories (tests/corekit/test_fields_numbers_port_option_ no_mint_unit.py, tests/dumpkit/test_nameless_enum_rendering_unit.py, tests/dumpkit/test_common_unit.py, tests/foundation/registry/ test_protocols.py, tests/utilities/test_compat.py).
Three factual errors in test prose, found while surveying #NNN citations under tests/ for #719: - test_http_unit.py:2356-2365 claimed PR #457 was "still-open" and that the SETTINGS round trip "remains unreachable until that lands". Both were stale: #457 merged 2026-09-18, the `httpv2-frame/SETTINGS` key no longer exists in `EXPECTED_FAILURES` (verified by importing it: 43 keys, only httpv2 key is PRIORITY), and the round trip itself passes (reproduced: `httpv2.roundtrip()` reports 'OK' for that case). Rewrote the paragraph: the round trip works; what still raises `KeyError: 'flags'` is a bare `SettingsFrame(...).pack()` with no enclosing packet (reproduced directly), which is an unsupported invocation, not a round-trip defect. Cited `FrameType.post_process` by name rather than the stale `httpv2.py:144` line number (the real raise is at `packet['flags'][name]`, confirmed by traceback). `GH-445` is left alone -- it is this repo's own issue shorthand, used throughout pcapkit/ and tests/, and #445 is in fact an issue. - test_base_class_contract.py:45 called #547 and #570 "issues"; both are pull requests. - test_const_str_payload_870_unit.py:12 called #869 a "GitHub issue"; it is a pull request. No behaviour or citation-style changes -- tests/** is exempt from the #719 PR-citation rule. Ran each file individually under pytest and plain unittest (all three use subTest): 6/6, 7/7, 60/60 passed both ways.
Three factual errors in test prose, found while surveying #NNN citations under tests/ for #719: - test_http_unit.py:2356-2365 claimed PR #457 was "still-open" and that the SETTINGS round trip "remains unreachable until that lands". Both were stale: #457 merged 2026-09-18, the `httpv2-frame/SETTINGS` key no longer exists in `EXPECTED_FAILURES` (verified by importing it: 43 keys, only httpv2 key is PRIORITY), and the round trip itself passes (reproduced: `httpv2.roundtrip()` reports 'OK' for that case). Rewrote the paragraph: the round trip works; what still raises `KeyError: 'flags'` is a bare `SettingsFrame(...).pack()` with no enclosing packet (reproduced directly), which is an unsupported invocation, not a round-trip defect. Cited `FrameType.post_process` by name rather than the stale `httpv2.py:144` line number (the real raise is at `packet['flags'][name]`, confirmed by traceback). `GH-445` is left alone -- it is this repo's own issue shorthand, used throughout pcapkit/ and tests/, and #445 is in fact an issue. - test_base_class_contract.py:45 called #547 and #570 "issues"; both are pull requests. - test_const_str_payload_870_unit.py:12 called #869 a "GitHub issue"; it is a pull request. No behaviour or citation-style changes -- tests/** is exempt from the #719 PR-citation rule. Ran each file individually under pytest and plain unittest (all three use subTest): 6/6, 7/7, 60/60 passed both ways.
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 defectDescription of your pull request and other information
Step 2 of #860 (PR 1 of 2;
AppTypeis PR 2). Brings the 8 non-AppTypebespoke registries ontoEnumRegistryand applies the owner's #775 mint/unmint ruling, extended to these registries'get()as well as_missing_.StatusCode,ReturnCode,ResponseKind,GroupingInformation,OptionType— 12 unambiguous placeholder branches (Unassigned,Unknown,opt_unknown) converted to_unregistered_member. Each of the three with a custom__new__(StatusCode,ReturnCode,OptionType) gets its own override reconstructing the attributes the base's generic helper would otherwise leave unset.StatusCode/ReturnCode's hand-writtenget()(still on the retireddefault == -1convention) is replaced by the base's — verified no caller in this tree relies on the old form.OptionTypekeeps its ownget()(genuine multi-namespace dispatch), but round 2 review foundget()itself still minted on both its int/namespace path and itsstrpath — the live pcapng parse path (PCAPNG._make_pcapng_options) calls it with wire bytes, so parsing an undeclared option code was still registering a permanent member. Both paths now build an unregistered member too, and_unregistered_memberstill never touches__members_ns__on any of the three paths.FEATCode,Command,Method— these mint the literal, unmodified wire value as its own name rather than any manufactured placeholder. The owner ruled: "I think we should not mint on get still actually... get will not have sufficient information to create new ones."Commandneedsfeat/desc/type/confandMethodneedssafe/idempotent, neither of which a bare wire string carries. Both_missing_and each class's ownget()(a second, independent mint site bypassing_missing_) now build an unregistered member instead.FEATCode's own fix: the crawler now declares all 15 realFEAT codevalues from the live IANA table (5 group markers + 10 per-command keywords) instead of minting the 10 as a side effect of evaluatingCommand's own rows at import time — the same import-time-mutation shape #861 removed fromFilterType. Pinned count-agnostically (every name in__members__must be a real declaration in the generated source), not with a hardcoded member count, since a future IANA table update would otherwise fail a correct regeneration.Untouched, per explicit rulings:
CommandTypestaysIntFlag(realA|Pcomposites in the generated data);TransportProtocol'sauto()change andAppTypeitself are PR 2's territory.All 5 crawlers regenerated via
python -m pcapkit.vendor <module>;git status --porcelain pcapkit/constis empty afterward, and a third regeneration produced byte-identical output. mypy/pylint findings theEnumRegistrymixin and the new overrides introduced are fixed or suppressed the way neighbouring code does; everything else remaining on the touched files is pre-existing and unrelated (verified againstorigin/main).Tests: 239 methods across the seven touched test files, plus
tests/protocols/misc/test_pcapng_unit.py(93 methods) — 332 total, all pass undercoverage run. Touched const modules land at 92–100%:status_code.py's one miss is an unreachable exhaustive-guard fallback;option_type.py's remaining misses are pre-existing comparison dunders and an already-declared-member lookup branch, neither touched by this diff.