Skip to main content

deactivate

Function deactivate 

Source
pub async fn deactivate(
    store: &SharedWorkstreamStore,
    id: WorkstreamId,
) -> Result<Option<WorkstreamId>, ActivationError>
Expand description

Deactivate id under DOC-48 §4.3’s idempotent rule.

Why: the single entry point for both workstream.deactivate (RPC) and its REST twin. What: clears the pointer (persisting None) and returns Some(id) ONLY when id is the CURRENTLY active workstream; otherwise a no-op success returning None — deactivating an idle, closed, or even nonexistent id is idempotent by design (§4.3), so this never looks the id up in workstreams[] at all. Test: activation_tests::deactivate_active_clears_pointer, activation_tests::deactivate_non_active_is_idempotent_noop, activation_tests::deactivate_active_publishes_state_inferred_idle.