Skip to main content

Module operations

Module operations 

Source
Expand description

Task queue task-level operations.

Responsibilities:

  • Mutate or query tasks within queue files (complete tasks, set statuses/fields, find tasks, delete tasks, sort by priority).
  • Provide typed domain errors for queue query operations to enable stable test assertions.

Does not handle:

  • Persisting queue data or managing locks (load/save/locks/repair live in crate::queue).
  • Task-level validation beyond runnability checks (see validate module for schema-level validation).

Invariants/assumptions:

  • Queue operations are called with fully loaded QueueFile values.
  • Queue query errors are returned as anyhow::Result but wrap typed QueueQueryError for downcasting in tests.
  • Message text in QueueQueryError variants must match user-facing expectations (single source of truth).

Structs§

ArchiveReport
BatchOperationResult
Overall result of a batch operation.
BatchTaskFilters
Filters for batch task selection.
BatchTaskResult
Result of a batch operation on a single task.
CloneTaskOptions
Options for cloning a task.
QueueRunnabilityReport
A structured report of queue runnability.
QueueRunnabilitySelection
Selection context for the report.
QueueRunnabilitySummary
Summary counts of runnability states.
RunnableSelectionOptions
SplitTaskOptions
Options for splitting a task.
TaskEditPreview
Preview of what would change in a task edit operation.
TaskFieldEdit
TaskFieldPreview
Preview of what would change in a custom field set operation.
TaskMutationReport
TaskMutationRequest
TaskMutationSpec
TaskMutationTaskReport
TaskRunnabilityRow
Per-task runnability row.

Enums§

DependencyIssue
Specific dependency issue.
NotRunnableReason
Reason a task is not runnable.
QueueQueryError
TaskEditKey
TaskMutationError

Constants§

RUNNABILITY_REPORT_VERSION
Report version for JSON stability.

Functions§

added_tasks
apply_status_policy
Apply the shared status-transition policy to a task.
apply_task_edit
apply_task_mutation_request
archive_terminal_tasks
Archive terminal tasks (Done/Rejected) from queue to done file.
archive_terminal_tasks_in_memory
Archive terminal tasks (Done/Rejected) in-memory and stamp timestamps.
archive_terminal_tasks_older_than_days
Archive terminal tasks that are at least after_days old (disk-based).
archive_terminal_tasks_older_than_days_in_memory
Archive terminal tasks (Done/Rejected) that are at least after_days old.
are_dependencies_met
Check if a task’s dependencies are met.
backfill_missing_fields
backfill_terminal_completed_at
Ensure terminal tasks have a completed_at timestamp.
batch_apply_edit
Batch edit field for multiple tasks.
batch_archive_tasks
Batch archive terminal tasks (Done/Rejected) from active queue to done.
batch_clone_tasks
Batch clone multiple tasks.
batch_delete_tasks
Batch delete multiple tasks from the queue.
batch_plan_append
Batch append plan items to multiple tasks.
batch_plan_prepend
Batch prepend plan items to multiple tasks.
batch_set_field
Batch set custom field for multiple tasks.
batch_set_status
Batch set status for multiple tasks.
batch_split_tasks
Batch split multiple tasks into child tasks.
clone_task
Clone an existing task to create a new task with the same fields.
collect_task_ids
Collect unique task IDs from a list of tasks.
complete_task
Complete a single task and move it to the done archive.
filter_tasks_by_tags
Filter tasks by tags (case-insensitive, OR-based).
find_task
find_task_across
is_task_runnable
Check if a task is runnable (dependencies met and scheduling satisfied).
is_task_runnable_detailed
Check if a specific task is runnable (convenience wrapper).
is_task_scheduled_for_future
Check if a task’s scheduled_start is in the future.
maybe_archive_terminal_tasks_in_memory
Conditionally archive terminal tasks based on optional days config.
next_runnable_task
Return the first runnable task (Todo and dependencies met).
next_todo_task
Return the first todo task by file order (top-of-file wins).
parse_older_than_cutoff
Parse an “older than” specification into an RFC3339 cutoff.
preview_set_field
Preview custom field changes without applying them.
preview_task_edit
Preview task edit changes without applying them.
print_batch_results
Print batch operation results in a user-friendly format.
promote_draft_to_todo
queue_runnability_report
Build a runnability report with the current time.
queue_runnability_report_at
Build a runnability report with a specific timestamp (deterministic for tests).
reposition_new_tasks
Repositions newly added tasks to the specified insertion index in the queue.
resolve_task_ids
Resolve task IDs from either explicit list or tag filter (legacy, without additional filters).
resolve_task_ids_filtered
Resolve task IDs from explicit list or tag filter, then apply additional filters.
select_runnable_task_index
Select the next runnable task index according to the provided options.
select_runnable_task_index_with_target
Select a runnable task index by target task id, with validation.
set_field
set_status
sort_tasks_by_priority
split_task
Split an existing task into multiple child tasks.
suggest_new_task_insert_index
Suggests the insertion index for new tasks based on the first task’s status.
task_id_set