mud_server.services.policy.utils

Shared utility helpers for policy services.

These helpers are intentionally storage-agnostic primitives used across multiple policy modules. They hold common parsing and guard-rail behavior that should remain consistent across validation, activation, and publish.

Functions

now_iso()

Return canonical UTC ISO-8601 timestamp string with Z suffix.

ensure_world_exists(world_id)

Raise a typed 404 when the target world id does not exist.

parse_scope(scope_text)

Parse world_id[:client_profile] text into ActivationScope.

resolve_positive_int_version(*, value, default, context)

Resolve a positive integer value with strict type and range checks.

activation_map_from_rows(rows)

Return policy_id -> variant map from activation row payloads.

Module Contents

mud_server.services.policy.utils.now_iso()[source]

Return canonical UTC ISO-8601 timestamp string with Z suffix.

mud_server.services.policy.utils.ensure_world_exists(world_id)[source]

Raise a typed 404 when the target world id does not exist.

mud_server.services.policy.utils.parse_scope(scope_text)[source]

Parse world_id[:client_profile] text into ActivationScope.

Empty client_profile always maps to world-level scope.

mud_server.services.policy.utils.resolve_positive_int_version(*, value, default, context)[source]

Resolve a positive integer value with strict type and range checks.

mud_server.services.policy.utils.activation_map_from_rows(rows)[source]

Return policy_id -> variant map from activation row payloads.