pub fn insert_finished_task(&mut self, task: Task<Finished>) -> usize {
        let index = match task.result() {
            TaskResult::Failure => self
                .finished
                .iter()
                .enumerate()
                .skip_while(|(_, task)| task.result() == TaskResult::Failure)
                .map(|(idx, _)| idx)
                .next(),
            TaskResult::Success => self
                .finished
                .iter()
                .enumerate()
                .skip_while(|(_, task)| {
                    task.result() == TaskResult::Failure || task.result() == TaskResult::Success
                })
                .map(|(idx, _)| idx)
                .next(),
            TaskResult::CacheHit => None,
        }
        .unwrap_or(self.finished.len());
        self.finished.insert(index, task);
        index
    }
Insert a finished task into the correct place in the finished section.
The order of `finished` is expected to be: failure, success, cached
with each subsection being sorted by finish time.
Returns the index task was inserted at
crates/turborepo-ui/src/tui/task.rs