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
validatemodule for schema-level validation).
Invariants/assumptions:
- Queue operations are called with fully loaded
QueueFilevalues. - Queue query errors are returned as
anyhow::Resultbut wrap typedQueueQueryErrorfor downcasting in tests. - Message text in
QueueQueryErrorvariants must match user-facing expectations (single source of truth).
Structs§
- Archive
Report - Batch
Operation Result - Overall result of a batch operation.
- Batch
Task Filters - Filters for batch task selection.
- Batch
Task Result - Result of a batch operation on a single task.
- Clone
Task Options - Options for cloning a task.
- Queue
Runnability Report - A structured report of queue runnability.
- Queue
Runnability Selection - Selection context for the report.
- Queue
Runnability Summary - Summary counts of runnability states.
- Runnable
Selection Options - Split
Task Options - Options for splitting a task.
- Task
Edit Preview - Preview of what would change in a task edit operation.
- Task
Field Edit - Task
Field Preview - Preview of what would change in a custom field set operation.
- Task
Mutation Report - Task
Mutation Request - Task
Mutation Spec - Task
Mutation Task Report - Task
Runnability Row - Per-task runnability row.
Enums§
- Dependency
Issue - Specific dependency issue.
- NotRunnable
Reason - Reason a task is not runnable.
- Queue
Query Error - Task
Edit Key - Task
Mutation Error
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_daysold (disk-based). - archive_
terminal_ tasks_ older_ than_ days_ in_ memory - Archive terminal tasks (Done/Rejected) that are at least
after_daysold. - 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