Skip to main content

Module dispatch_label

Module dispatch_label 

Source
Expand description

Strict $dispatchMac/$dispatchPublic grammar and the InitialLabelMap (v16 §6, WS-D / #1505).

This module is the ONE parser for the dispatch-label grammar, shared by the proc-macro codegen (hyprstream-rpc-derive, via the cgr re-export) and any build-time validation in this crate. A second implementation of this grammar is a refactor-plan §0.3 violation.

Grammar (v16 §6):

<level>:<assurance>[:<compartment>[,<compartment>...]]

Every failure mode below is a build error at code generation — an annotation failure can never produce an unlabeled runtime row:

  • unknown level or assurance;
  • empty components (internal:, :pq-hybrid, secret:pq-hybrid:);
  • duplicate compartments;
  • compartments not listed in canonical (bit-ascending) order;
  • compartment names not present in the checked-in InitialLabelMap;
  • trailing/leading whitespace anywhere (the annotation is not trimmed);
  • system low (public:unverified, no compartments) written through $dispatchMac — that label is exactly what $dispatchPublic expands to, so spelling it through the MAC annotation is the one form that would let a “labeled” row be indistinguishable from a public row; and
  • $dispatchPublic with an empty, whitespace-only, or surrounding-whitespace-padded reason (the reason is never trimmed — the recorded inventory text is the exact declared annotation text).

Structs§

DispatchLabel
A parsed $dispatchMac label: the axis values plus the resolved, canonical-ordered compartment bits.
InitialLabelMap
The parsed crate::schema::dispatch_label vocabulary.
InitialLabelMapError
The map file is malformed (not valid JSON against the schema above, a duplicate live or tombstoned name/bit, live/tombstone overlap, or a bit outside the SecurityLabel compartment width).

Constants§

ASSURANCES
LEVELS
The label axes the grammar accepts. These mirror the runtime Level/Assurance enums; the mapping to runtime values lives in the generated code, keyed on these strings.
MAX_COMPARTMENT_BITS
Maximum compartment bits — mirrors hyprstream_rpc::auth::mac::label::MAX_COMPARTMENTS (the fixed u64 bitset width of SecurityLabel). rpc-build cannot depend on the runtime crate (the runtime crate depends on this one’s consumers), so the constant is restated here and cross-checked by a drift test in hyprstream-rpc.
READ_CLASS_ACTIONS
The read-class authorization actions (S3 ScopeAction Block A). A leaf in this class may still declare a bounded application effect; every other action requires an explicit mutation policy. This is the CODEGEN-TIME copy; the runtime validator keeps its own copy in hyprstream_rpc::proof::policy, and the full-inventory validation test is the drift gate between them: a row generated under one list fails the other’s validation.
SYSTEM_LOW
The system-low label text — the exact expansion of $dispatchPublic.

Functions§

parse_dispatch_mac
Parse one $dispatchMac annotation value against the map.
parse_dispatch_public_reason
Validate one $dispatchPublic reason string: nonempty and already trimmed.
public_expansion
The label $dispatchPublic expands to — always exactly system low.