EnumRegistry.get's docstring says "It never mints. Registering a member is register's job and nobody else's, which is the ruling #775 exists to carry out" (pcapkit/corekit/enum.py:267-270). It does mint, today, on a shipped registry — both the str branch (:297) and the value branch (:303) end in return cls(default), which reaches _missing_.
Measured on main (6b333d7e4), throwaway process, pcapkit.__file__ asserted inside a clean worktree:
len before : 160
get(0x1234, 0x0888) -> <EtherType.Xyplex_0x0888: 2184>
len after : 161
MINTED : ['Xyplex_0x0888']
0x1234 is in no _missing_ range, so the lookup falls to the default; 0x0888 is in the Xyplex range, which mints by the #775 ruling. So a failed lookup permanently grows the registry. This survives #861 for the three registries that still mint — EtherType (52 branches), Socket (1), CGAType (1).
Needs a ruling, because both readings are defensible. Either (a) a caller who names 0x0888 as a fallback has "explicitly" asked for that member, so minting is correct and the docstring is simply wrong; or (b) a fallback is a value to resolve, not a request to register, so get should resolve the default through the non-minting path (_value2member_map_, then _unregistered_member) and cls(default) is the defect.
My lean is (b): #775's wording is "so that we dont create registered enums out of unrecognised/unregistered values, unless user/caller explicitly created them", and passing a fallback is not creating one. But (b) changes behaviour on a shipped path, so it is not mine to decide.
Found by the #863 cross-review, which scoped it to str-valued registries; the int path above is the live case and is wider than that. Pre-existing — cls(default) is identical on main before #863.
EnumRegistry.get's docstring says "It never mints. Registering a member isregister's job and nobody else's, which is the ruling #775 exists to carry out" (pcapkit/corekit/enum.py:267-270). It does mint, today, on a shipped registry — both thestrbranch (:297) and the value branch (:303) end inreturn cls(default), which reaches_missing_.Measured on
main(6b333d7e4), throwaway process,pcapkit.__file__asserted inside a clean worktree:0x1234is in no_missing_range, so the lookup falls to the default;0x0888is in theXyplexrange, which mints by the #775 ruling. So a failed lookup permanently grows the registry. This survives #861 for the three registries that still mint —EtherType(52 branches),Socket(1),CGAType(1).Needs a ruling, because both readings are defensible. Either (a) a caller who names
0x0888as a fallback has "explicitly" asked for that member, so minting is correct and the docstring is simply wrong; or (b) a fallback is a value to resolve, not a request to register, sogetshould resolve the default through the non-minting path (_value2member_map_, then_unregistered_member) andcls(default)is the defect.My lean is (b): #775's wording is "so that we dont create registered enums out of unrecognised/unregistered values, unless user/caller explicitly created them", and passing a fallback is not creating one. But (b) changes behaviour on a shipped path, so it is not mine to decide.
Found by the #863 cross-review, which scoped it to
str-valued registries; the int path above is the live case and is wider than that. Pre-existing —cls(default)is identical onmainbefore #863.