Skip to main content

activate

Function activate 

Source
pub async fn activate(
    store: &SharedWorkstreamStore,
    id: WorkstreamId,
    force: bool,
) -> Result<ActivateOutcome, ActivationError>
Expand description

Activate id under DOC-48 §6.1’s exclusivity rules.

Why: the single entry point for both workstream.activate (RPC) and its REST twin — see the module docs for the exact rule table. What: rejects an unknown id with ActivationError::NotFound BEFORE looking at the active pointer (activating a nonexistent workstream is never valid, force or not). Otherwise: no workstream active -> activate and persist, prior_id: None; id already active -> idempotent success, prior_id: None (no pointer write); a DIFFERENT workstream active and force: false -> ActivationError::ActiveConflict; a DIFFERENT workstream active and force: true -> persist the switch, prior_id: Some(previous). Test: activation_tests::activate_with_no_prior_active_succeeds, activation_tests::activate_already_active_is_idempotent, activation_tests::activate_without_force_returns_active_conflict, activation_tests::activate_with_force_switches_and_reports_prior, activation_tests::activate_unknown_id_returns_not_found, activation_tests::activate_with_no_prior_active_publishes_state_inferred, activation_tests::activate_with_force_publishes_state_inferred_for_both.