Skip to main content

classify_server_runtime_state

Function classify_server_runtime_state 

Source
pub fn classify_server_runtime_state(
    has_tokens: bool,
    has_policy: bool,
    allow_unauthenticated: bool,
) -> Result<ServerRuntimeState>
Expand description

Compute the ServerRuntimeState from the configured inputs. Pulled out as a pure function so the matrix is unit-testable without standing up the full server.

The classifier is the single source of truth for “should we start?” — both serve()’s single-mode and multi-mode branches call this before constructing their AppState. Adding a startup invariant here means both modes enforce it automatically; the alternative (per-constructor bail!) drifts the moment a third mode is added.