Recurrence: re-running done spawns duplicate instances (no status guard) #9

Closed
opened 2026-06-05 10:26:04 +00:00 by victor · 0 comments
Owner

complete_task (src/core/service.rs:258-278) unconditionally marks the task done and calls spawn_next, with no check that the task is currently active.

Impact: running next done <id> twice on the same recurring task — or on an already-Done/Cancelled task — marks it done again and spawns a second next instance each time. Also spawns even when the task is blocked or has open children.

Fix: guard complete_task so it is a no-op (or a clear error) when the task is not in an active (Open/Started) state; only spawn on a genuine open→done transition. Add tests for: re-done does not spawn a duplicate; done on already-done/cancelled.

Found in review. Spec ambiguity to resolve: should done on a resolved task error or no-op? (REQUIREMENTS §7 silent.)

`complete_task` (src/core/service.rs:258-278) unconditionally marks the task done and calls `spawn_next`, with no check that the task is currently active. **Impact:** running `next done <id>` twice on the same recurring task — or on an already-Done/Cancelled task — marks it done again and spawns a **second** next instance each time. Also spawns even when the task is blocked or has open children. **Fix:** guard `complete_task` so it is a no-op (or a clear error) when the task is not in an active (`Open`/`Started`) state; only spawn on a genuine open→done transition. Add tests for: re-`done` does not spawn a duplicate; `done` on already-done/cancelled. Found in review. Spec ambiguity to resolve: should `done` on a resolved task error or no-op? (REQUIREMENTS §7 silent.)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
victor/task-manager#9
No description provided.