Skip to main content

complete_task

Function complete_task 

Source
pub fn complete_task(
    queue_path: &Path,
    done_path: &Path,
    task_id: &str,
    status: TaskStatus,
    now_rfc3339: &str,
    notes: &[String],
    id_prefix: &str,
    id_width: usize,
    max_dependency_depth: u8,
    custom_fields_patch: Option<&HashMap<String, String>>,
) -> Result<()>
Expand description

Complete a single task and move it to the done archive.

Validates that the task exists in the active queue, is in a valid starting state (todo or doing), updates its status and timestamps, appends any provided notes, applies optional custom_fields patch, and atomically moves it from the active queue file to the end of the done archive file.

§Arguments

  • queue_path - Path to the active queue file
  • done_path - Path to the done archive file (created if missing)
  • task_id - ID of the task to complete
  • status - Terminal status (Done or Rejected)
  • now_rfc3339 - Current UTC timestamp as RFC3339 string
  • notes - Optional notes to append to the task
  • id_prefix - Expected task ID prefix (e.g., “RQ”)
  • id_width - Expected numeric width for task IDs (e.g., 4)
  • max_dependency_depth - Maximum dependency depth for validation
  • custom_fields_patch - Optional custom fields to apply to the task (observational data)