-
Notifications
You must be signed in to change notification settings - Fork 426
tasks: allow running multi-level sub-tasks #2018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For example, for 3 level tasks, you can now run the second level: ``` devenv tasks run ci:lint ```
Claude finished @sandydoo's task —— View job Code Review Tasks
Code Review FeedbackI've reviewed the changes for multi-level sub-task support. The implementation looks solid overall, but here are some areas for improvement: devenv-tasks/src/tasks.rsIssue 1: Potential Performance Impact ( let matching_tasks: Vec<_> = task_indices
.iter()
.filter(|(task_name, _)| task_name.starts_with(&*search_prefix))
.map(|(_, &index)| index)
.collect(); For large task sets, this linear scan could be slow. Consider:
Issue 2: String Allocation in Hot Path ( let search_prefix: Cow<str> = if trimmed_name.ends_with(':') {
Cow::Borrowed(trimmed_name)
} else {
Cow::Owned(format!("{}:", trimmed_name))
}; Good use of Issue 3: Input Validation Logic ( if trimmed_name == ":" || trimmed_name.starts_with(':') || trimmed_name.contains("::") {
return Err(Error::TaskNotFound(name.clone()));
} The validation logic mixes syntax errors with "not found" errors. Consider:
Issue 4: Inconsistent Error Handling ( if trimmed_name.is_empty() {
return Err(Error::TaskNotFound(name.clone()));
}
// vs
return Err(Error::TaskNotFound(name.clone())); Both cases use the same error type but represent different failure modes (empty vs not found). devenv-tasks/src/tests/mod.rsIssue 5: Test Flakiness Concerns ( if let TaskStatus::Completed(TaskCompleted::Skipped(Skipped::Cached(_))) =
&tasks2.graph[tasks2.tasks_order[0]].read().await.status
{
println!("Task was correctly skipped on second run");
} else {
println!("Warning: Task was not skipped on second run");
} Several tests have relaxed assertions "for CI stability". This suggests:
Issue 6: Resource Management ( let cache = crate::task_cache::TaskCache::with_db_path(db_path.clone()).await?; Database connections are created but not explicitly closed. While Rust's RAII handles this, consider:
Issue 7: Hardcoded Sleep Values ( "#!/bin/sh\necho 'Task {tag} is running' && sleep 0.1 && echo 'Task {tag} completed'" Hardcoded sleeps can cause test flakiness. Consider:
Positive Aspects
Security Considerations
Recommendations
The implementation correctly handles the core requirement of allowing multi-level sub-task execution like |
Deploying devenv with
|
Latest commit: |
4966727
|
Status: | ✅ Deploy successful! |
Preview URL: | https://8e0797c4.devenv.pages.dev |
Branch Preview URL: | https://sub-tasks.devenv.pages.dev |
For example, for 3 level tasks, you can now run the second level:
Fixes #2017.