Skip to content

calternal_notes_core::tasks::status

Project status rollup — rollup_status (spec §7, contract §5–§6).

A project file’s displayed status is NOT stored directly; it is derived from its children on every extractTaskIndex call. This keeps the vault self-consistent: editing a child line automatically propagates upward without any separate “sync” step.

Ownership: only the projector (extractTaskIndex, T4/T6) calls this. Plans 2 & 3 surface the pre-rolled value from TaskIndexEntry; they NEVER recompute it. A manual frontmatter status: bypasses rollup entirely (statusOverridden = true), and that value wins as-is.

Source: crates/calternal-notes-core/src/tasks/status.rs

pub fn rollup_status(children: &[TaskStatus]) -> TaskStatus

Derive a project’s status from its child task statuses (spec §7).

Precedence among OPEN children (highest→lowest): Blocked > Waiting > Doing > Todo. One open child at that level is sufficient to return that status.

Terminal branch (no open children remain):

  • If at least one child is Done → Done (project reached completion even if others were cancelled along the way).
  • If ALL children are Cancelled → Cancelled (entire project was dropped).

Empty slice → Todo (a freshly created project with no child lines yet is “not started”, matching the contract §5 sentinel for “open, undecided”).

The single-scan implementation avoids multiple passes: each variant flips a boolean as we walk the slice, then priority ordering picks the winner.

Source: crates/calternal-notes-core/src/tasks/status.rs:35