Is this a bug or a feature request? A design question, raised by the maintainer.
The question, verbatim:
one question tho, should we maintain full transport list in each AppType's enum? like for TCP.http on port 80, the current enum still carries the other transport info like UDP/TSCP/etc. is that necessary? if so, then we dont care. if not, we should then bring back the TransportProtocol retyping.
What it decides. #732's ruling was conditional — "proceed with retyping on TransportProtocol - if we no longer need it to be a Flag. But, if in any case we still prefer using a Flag, then we discard the retyping." This issue is that condition. It exists as its own issue so the reasoning is tracked rather than buried in #732, whose subject is the str-valued/port=-1 shape.
State today. AppType is split into four per-transport registries — TCP 6,147 / UDP 6,143 / SCTP 91 / DCCP 10 = 12,391 members — reached via AppType.__registries__. A member also carries a proto attribute holding a TransportProtocol Flag, which for a service IANA registers on several transports is multi-bit: TCP.http.proto names UDP too. 10,625 of 12,391 rows (85.7%) are multi-bit, so this is most of the enum, not an edge.
Two arguments that the list is redundant:
- The split already encodes it. "Which transports bind port 80" is answerable by asking which of the four registries contain it. The multi-bit
proto is then a second copy of a fact the structure already carries — and a second copy can drift from the first.
_dispatch already rejects multi-bit. AppType.get(80, TCP|UDP) raises, telling the caller to look one transport up at a time. So the entry point insists on a single transport while the members it returns advertise four.
The one site that decides it is pcapkit/foundation/registry/protocols.py:846, if test not in proto: — the only read known to treat proto as a set rather than a label. Load-bearing if it needs the other bits; decoration if it is only reachable once a registry has been selected.
Being measured now, before any answer — a wrong one costs a 12,391-member migration:
- Every read of
proto across pcapkit/, tests/, docs/: is multi-bit ever the only source of a fact?
- Derivability: for every port present in more than one registry, does "the set of registries containing it" equal "its
proto bit set"? Any disagreement means the two copies have already drifted — a defect independent of this design question.
Findings get appended here as they land. Related: #732, #775, #783.
Is this a bug or a feature request? A design question, raised by the maintainer.
The question, verbatim:
What it decides. #732's ruling was conditional — "proceed with retyping on TransportProtocol - if we no longer need it to be a Flag. But, if in any case we still prefer using a Flag, then we discard the retyping." This issue is that condition. It exists as its own issue so the reasoning is tracked rather than buried in #732, whose subject is the
str-valued/port=-1shape.State today.
AppTypeis split into four per-transport registries — TCP 6,147 / UDP 6,143 / SCTP 91 / DCCP 10 = 12,391 members — reached viaAppType.__registries__. A member also carries aprotoattribute holding aTransportProtocolFlag, which for a service IANA registers on several transports is multi-bit:TCP.http.protonames UDP too. 10,625 of 12,391 rows (85.7%) are multi-bit, so this is most of the enum, not an edge.Two arguments that the list is redundant:
protois then a second copy of a fact the structure already carries — and a second copy can drift from the first._dispatchalready rejects multi-bit.AppType.get(80, TCP|UDP)raises, telling the caller to look one transport up at a time. So the entry point insists on a single transport while the members it returns advertise four.The one site that decides it is
pcapkit/foundation/registry/protocols.py:846,if test not in proto:— the only read known to treatprotoas a set rather than a label. Load-bearing if it needs the other bits; decoration if it is only reachable once a registry has been selected.Being measured now, before any answer — a wrong one costs a 12,391-member migration:
protoacrosspcapkit/,tests/,docs/: is multi-bit ever the only source of a fact?protobit set"? Any disagreement means the two copies have already drifted — a defect independent of this design question.Findings get appended here as they land. Related: #732, #775, #783.