orchestrata_ultimate.core.packet.enums
Reference › orchestrata_ultimate › core › packet › enums
The enumerations and state-machine tables of the CXP packet (Spec 004), a leaf module extracted from the earlier packet implementation. PacketType names the packet kinds: message, query, command, response, ack, error, heartbeat and notification. DeliveryStatus has QUEUED, DELIVERED, ACKNOWLEDGED and FAILED (with PENDING as an alias for QUEUED). WorkStatus has PENDING, IN_PROGRESS, RESOLVED and ARCHIVED. Priority is an integer enum from BACKGROUND (0) through LOW (3), NORMAL (5) and HIGH (7) to URGENT (10), with alias names such as LOWEST, MEDIUM, HIGHEST and CRITICAL.
The two transition tables drive the state machines in packet. DELIVERY_TRANSITIONS allows queued to delivered or failed, delivered to acknowledged or failed, and nothing out of acknowledged or failed. WORK_TRANSITIONS allows pending to in progress, in progress to resolved or back to pending (a re-queue), resolved to archived, and nothing out of archived.
At a glance
| Source | src/orchestrata_ultimate/core/packet/enums.py |
| Lines of code | 136 |
| Classes | 4 |
| Functions | 0 |
| Imports (internal) | orchestrata_ultimate.core.base.traces |
| Imported by | orchestrata_ultimate.core.packet, orchestrata_ultimate.core.packet.compat, orchestrata_ultimate.core.packet.packet |
| Tests that import it | none |
Class diagram
Dependency diagram
API
Constants
| Name | Type | Value |
|---|---|---|
DELIVERY_TRANSITIONS |
dict[str, frozenset] |
{'queued': frozenset({'delivered', 'failed'}), 'delivered': frozenset({'acknowl… |
WORK_TRANSITIONS |
dict[str, frozenset] |
{'pending': frozenset({'in_progress'}), 'in_progress': frozenset({'resolved', '… |
Classes
PacketType (enum)
Bases: StrEnum · Line 20
Types of CXP packets.
| Member | Value |
|---|---|
MESSAGE |
'message' |
QUERY |
'query' |
COMMAND |
'command' |
RESPONSE |
'response' |
ACKNOWLEDGEMENT |
'ack' |
ERROR |
'error' |
HEARTBEAT |
'heartbeat' |
NOTIFICATION |
'notification' |
DeliveryStatus (enum)
Bases: StrEnum · Decorators: traces(spec='004', story='US-004', reqs=['REQ-004-US-001-010', 'REQ-004-US-004-001', 'REQ-004-US-004-002', 'REQ-004-US-… · Line 45
Packet delivery status.
| Member | Value |
|---|---|
QUEUED |
'queued' |
DELIVERED |
'delivered' |
ACKNOWLEDGED |
'acknowledged' |
FAILED |
'failed' |
PENDING |
'queued' |
WorkStatus (enum)
Bases: StrEnum · Decorators: traces(spec='004', story='US-005', reqs=['REQ-004-US-001-011', 'REQ-004-US-005-001', 'REQ-004-US-005-002', 'REQ-004-US-… · Line 85
Work item status.
| Member | Value |
|---|---|
PENDING |
'pending' |
IN_PROGRESS |
'in_progress' |
RESOLVED |
'resolved' |
ARCHIVED |
'archived' |
Priority (enum)
Bases: int, Enum · Decorators: traces(spec='004', story='US-009', reqs=['REQ-004-US-001-009', 'REQ-004-US-009-001', 'REQ-004-US-009-002']) · Line 119
Packet delivery priority (0-10 range).
| Member | Value |
|---|---|
BACKGROUND |
0 |
LOW |
3 |
NORMAL |
5 |
HIGH |
7 |
URGENT |
10 |
LOWEST |
0 |
MEDIUM |
5 |
HIGHEST |
10 |
CRITICAL |
10 |
Source
# mypy: ignore-errors
"""CXP packet enums and state-machine transition tables.
Leaf, cycle-free cluster extracted from ``_packet_impl``: the four packet
enums (PacketType, DeliveryStatus, WorkStatus, Priority) and the two
module-level transition dicts that drive the delivery/work state machines.
Spec: 004-cxp
"""
from enum import Enum, StrEnum
from orchestrata_ultimate.core.base.traces import traces
# ============================================================================
# Enums
# ============================================================================
class PacketType(StrEnum):
"""Types of CXP packets."""
MESSAGE = "message"
QUERY = "query"
COMMAND = "command"
RESPONSE = "response"
ACKNOWLEDGEMENT = "ack"
ERROR = "error"
HEARTBEAT = "heartbeat"
NOTIFICATION = "notification"
@traces(
spec="004",
story="US-004",
reqs=[
"REQ-004-US-001-010",
"REQ-004-US-004-001",
"REQ-004-US-004-002",
"REQ-004-US-004-003",
"REQ-004-US-004-004",
"REQ-004-US-004-005",
],
)
class DeliveryStatus(StrEnum):
"""Packet delivery status.
State machine (Spec 004):
QUEUED -> DELIVERED, FAILED
DELIVERED -> ACKNOWLEDGED, FAILED
ACKNOWLEDGED -> (terminal)
FAILED -> (terminal)
"""
QUEUED = "queued"
DELIVERED = "delivered"
ACKNOWLEDGED = "acknowledged"
FAILED = "failed"
# Backward compat alias (Python enum: same value = alias)
PENDING = "queued"
# Valid transitions for delivery status state machine
DELIVERY_TRANSITIONS: dict[str, frozenset] = {
"queued": frozenset({"delivered", "failed"}),
"delivered": frozenset({"acknowledged", "failed"}),
"acknowledged": frozenset(),
"failed": frozenset(),
}
@traces(
spec="004",
story="US-005",
reqs=[
"REQ-004-US-001-011",
"REQ-004-US-005-001",
"REQ-004-US-005-002",
"REQ-004-US-005-003",
"REQ-004-US-005-004",
"REQ-004-US-005-005",
],
)
class WorkStatus(StrEnum):
"""Work item status.
State machine (Spec 004):
PENDING -> IN_PROGRESS
IN_PROGRESS -> RESOLVED, PENDING (re-queue)
RESOLVED -> ARCHIVED
ARCHIVED -> (terminal)
"""
PENDING = "pending"
IN_PROGRESS = "in_progress"
RESOLVED = "resolved"
ARCHIVED = "archived"
# Valid transitions for work status state machine
WORK_TRANSITIONS: dict[str, frozenset] = {
"pending": frozenset({"in_progress"}),
"in_progress": frozenset({"resolved", "pending"}),
"resolved": frozenset({"archived"}),
"archived": frozenset(),
}
@traces(
spec="004",
story="US-009",
reqs=[
"REQ-004-US-001-009",
"REQ-004-US-009-001",
"REQ-004-US-009-002",
],
)
class Priority(int, Enum):
"""Packet delivery priority (0-10 range).
Spec 004 values:
BACKGROUND=0, LOW=3, NORMAL=5, HIGH=7, URGENT=10
"""
BACKGROUND = 0
LOW = 3
NORMAL = 5
HIGH = 7
URGENT = 10
# Backward compat aliases (deprecated, same-value = Python enum alias)
LOWEST = 0 # alias for BACKGROUND
MEDIUM = 5 # alias for NORMAL
HIGHEST = 10 # alias for URGENT
CRITICAL = 10 # alias for URGENT