fix: Correct handling of dependencies between subtasks
This commit fixes an issue with the dependency management system where dependencies between subtasks of the same parent task were not being handled correctly. Previously, when trying to add a dependency between subtasks (e.g., making 23.8 depend on 23.13), the system incorrectly interpreted it as a circular dependency of the parent task depending on itself. Changes: - Modified add-dependency and remove-dependency commands to preserve string format for subtask IDs containing dots instead of converting them to integers - Updated dependency detection logic to properly handle string-based subtask IDs - Added specific tests verifying both successful dependency chains and circular dependency detection between subtasks of the same parent The fix ensures proper task ordering for development workflows where related subtasks must be completed in sequence (like establishing tests before implementing a feature). It maintains backward compatibility with existing task structures while correctly enforcing dependency chains within subtask groups. Tests: - Added tests for valid dependency chains between subtasks of the same parent - Added tests for circular dependency detection in subtask relationships - Added specific test for the 23.8->23.13->23.10 subtask dependency chain Resolves the issue where the suggested task development workflow couldn't be properly enforced through the dependency management system.
This commit is contained in:
@@ -471,7 +471,12 @@ function registerCommands(programInstance) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await addDependency(tasksPath, parseInt(taskId, 10), parseInt(dependencyId, 10));
|
||||
// Handle subtask IDs correctly by preserving the string format for IDs containing dots
|
||||
// Only use parseInt for simple numeric IDs
|
||||
const formattedTaskId = taskId.includes('.') ? taskId : parseInt(taskId, 10);
|
||||
const formattedDependencyId = dependencyId.includes('.') ? dependencyId : parseInt(dependencyId, 10);
|
||||
|
||||
await addDependency(tasksPath, formattedTaskId, formattedDependencyId);
|
||||
});
|
||||
|
||||
// remove-dependency command
|
||||
@@ -491,7 +496,12 @@ function registerCommands(programInstance) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await removeDependency(tasksPath, parseInt(taskId, 10), parseInt(dependencyId, 10));
|
||||
// Handle subtask IDs correctly by preserving the string format for IDs containing dots
|
||||
// Only use parseInt for simple numeric IDs
|
||||
const formattedTaskId = taskId.includes('.') ? taskId : parseInt(taskId, 10);
|
||||
const formattedDependencyId = dependencyId.includes('.') ? dependencyId : parseInt(dependencyId, 10);
|
||||
|
||||
await removeDependency(tasksPath, formattedTaskId, formattedDependencyId);
|
||||
});
|
||||
|
||||
// validate-dependencies command
|
||||
|
||||
Reference in New Issue
Block a user