Repository navigation
reg: expose AppType aliases as a public property and in repr/str, and allow registering them per transport #807
Description
Activity
- addedenhancementIssues requesting a new capability (set by the feature request template)Issues requesting a new capability (set by the feature request template)blockedDeferred pending another issue or decision; see the last comment for what unblocks itDeferred pending another issue or decision; see the last comment for what unblocks it
on Sep 25, 2026 Checkable blocker: #806 merged.
gh issue view 806 -R JarryShaw/PyPCAPKit --json state#806 rewrites the three format strings this issue then has to extend —
pcapkit/vendor/reg/apptype/apptype.py:250(__new__, which sets_value_),:270(__repr__),:273(__str__) — because the retyping drops the compositeproto.namefrom all three. Adding aliases torepr/strfirst means writing against strings that are about to change, then re-deriving. Doing it after means extending strings that have already reached their final shape.Chain: #803 → #806 → this issue, with #808 also waiting on #806.
- removedblockedDeferred pending another issue or decision; see the last comment for what unblocks itDeferred pending another issue or decision; see the last comment for what unblocks it
on Sep 26, 2026 Checkable blocker: #808 merged.
gh pr view 808 -R JarryShaw/PyPCAPKit --json state 2>/dev/null || gh issue view 808 -R JarryShaw/PyPCAPKit --json stateUnblocked from #806 by #815 merging (
3118ed796), but sequenced behind #808 rather than dispatched now, because both changepcapkit/const/reg/apptype/apptype.pyand its generatorpcapkit/vendor/reg/apptype/apptype.py— and #808 may replaceTransportProtocol's base class, which changes the ground this work stands on. Two agents in one generated file is how a regeneration silently clobbers the other's work.Ordering, not scope. Dispatching as soon as #808 lands.
- addedblockedDeferred pending another issue or decision; see the last comment for what unblocks itDeferred pending another issue or decision; see the last comment for what unblocks itwipWork in flight - a covering PR is open or an agent is actively on itWork in flight - a covering PR is open or an agent is actively on itand removedblockedDeferred pending another issue or decision; see the last comment for what unblocks itDeferred pending another issue or decision; see the last comment for what unblocks it
on Sep 26, 2026 Unblocked — #808 is closed. Its PR #836 merged as
14d3d3dc7, so the file-collision reason for sequencing this behind it is gone.gh issue view 808 -R JarryShaw/PyPCAPKit --json state -> CLOSED git log --oneline -1 origin/main -> 14d3d3dc7 fix(reg)!: drop TransportProtocol's IntFlag base … (#836)Dispatching a worker now. One thing #836 changed that this issue's design has to account for:
TransportProtocolis a plainaenum.IntEnumand no longer extensible —TransportProtocol.get()refuses an unrecognised name rather than minting. So per-transport alias registration must resolve its transport against the five declared members and refuse anything else, not create one.wip.- added 5 commits that reference this issue
on Sep 26, 2026 Closing — delivered. PR #837 merged as
add2a8255onmain, which now carries the publicaliasesproperty, alias-awarerepr/str, and the per-transportregister_aliasclassmethod in both the generator template and the generated const file.Verified on the merged head:
52.65% → 53.59%coverage ofpcapkit/const/reg/apptype/apptype.py(1624/769 → 1657/769 statements, all 33 new ones covered),tests/const/87 run / OK, and CI 27✅ / 0❌ / 3 skipped / 0 incomplete. Cross-reviewed GOOD TO GO on the merged sha by a model other than the author.- removedwipWork in flight - a covering PR is open or an agent is actively on itWork in flight - a covering PR is open or an agent is actively on it
on Sep 26, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Is this a bug or a feature request? A feature, ruled on in #801.
Step 2 of #801's three. The maintainer's rulings, verbatim:
(He also noted his signature sketches are "just POC not how it should actually look like", so treat the shape as the requirement and the parameter list as illustrative.)
What changes
.aliasesproperty on eachAppTypemember.__repr__and__str__expose the aliases when there are any.Expected behavior
TCP['http'].aliasesgives the other services IANA registers on TCP/80 — andSCTP['http'].aliasesis empty, becausewwwis not registered on SCTP. Aliases are a property of(port, transport), never of the port alone.Additional context
Most of this already exists — check before building. Reading
tests/const/test_const_apptype_split_unit.py(415 lines, 15 methods) shows the canonical/alias split is already implemented and tested:__canonical__is a per-registryport → canonical servicemap curated from/etc/services, because IANA names no precedence and registry row order matches/etc/serviceson 28 of the 44 colliding pairs and differs on 16 (test_a_port_lookup_returns_the_canonical_serviceat:114records the reasoning;test_get_all_reaches_the_aliasesat:143is the existing reader).So
.aliasesneeds no new storage. It derives as__registry__.getlist(self.port)minusself— verified:Return an empty tuple rather than
Nonewhen there are none, so callers need no guard, and a tuple rather than a list because members are otherwise immutable.Hard constraint, measured: the aliases must NOT reach
_value_.AppTypeis aStrEnumand_value_is the live lookup key in_value2member_map_, built once at class creation. Mutating it afterwards leaves the map stale:Since aliases are registerable at runtime, an alias list inside
_value_goes stale the moment one is registered. So__repr__/__str__grow them and_value_does not.Two consequences to handle rather than discover:
str(m) == m.valueisTruetoday and becomesFalse. 0 tests or docs pin the bracketed value form — verified with a self-tested pattern (grep -rnE "\[[0-9]+ - (tcp|udp|sctp|dccp)" tests/ docs/source/ examples/→ 0, and the same pattern matches the real string, so the zero is real).repr/stroutput becomes mutable at runtime, since registering an alias changes it. Note that in the docstring so nobody pins a fixed alias list in a doctest.Related: #801, #806, #732.