fix(HAI-002): handle undefined title and dependencies to prevent crashes

- Guard against undefined dependencies with fallback to empty array in worktreeGrouping
- Handle missing task title in InlineCreateCard by falling back to description or id
- Update package-lock.json
This commit is contained in:
Dustin Byrne
2026-03-25 19:59:05 -04:00
3 changed files with 575 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ export function InlineCreateCard({ tasks, onSubmit, onCancel, addToast }: Inline
onClick={() => toggleDep(t.id)}
>
<span className="dep-dropdown-id">{t.id}</span>
<span className="dep-dropdown-title">{truncate(t.title, 30)}</span>
<span className="dep-dropdown-title">{truncate(t.title || t.description || t.id, 30)}</span>
</div>
))
)}

View File

@@ -33,7 +33,7 @@ function resolveDependencyOrder(tasks: Task[]): string[] {
visiting.add(id);
const task = taskMap.get(id);
if (task) {
for (const depId of task.dependencies) {
for (const depId of task.dependencies || []) {
if (taskMap.has(depId)) visit(depId);
}
}
@@ -72,7 +72,7 @@ export function groupByWorktree(
const taskById = new Map(allTasks.map((t) => [t.id, t]));
const todoTasks = allTasks.filter((t) => t.column === "todo");
const eligible = todoTasks.filter((t) =>
t.dependencies.every((depId) => {
(t.dependencies || []).every((depId) => {
const dep = taskById.get(depId);
return dep && (dep.column === "done" || dep.column === "in-review");
}),