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$dispatchPublicexpands 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 $dispatchPublicwith 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§
- Dispatch
Label - A parsed
$dispatchMaclabel: the axis values plus the resolved, canonical-ordered compartment bits. - Initial
Label Map - The parsed
crate::schema::dispatch_labelvocabulary. - Initial
Label MapError - 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
SecurityLabelcompartment width).
Constants§
- ASSURANCES
- LEVELS
- The label axes the grammar accepts. These mirror the runtime
Level/Assuranceenums; 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 fixedu64bitset width ofSecurityLabel). 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 inhyprstream-rpc. - READ_
CLASS_ ACTIONS - The read-class authorization actions (S3
ScopeActionBlock 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 inhyprstream_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
$dispatchMacannotation value against the map. - parse_
dispatch_ public_ reason - Validate one
$dispatchPublicreason string: nonempty and already trimmed. - public_
expansion - The label
$dispatchPublicexpands to — always exactly system low.