Skip to content

test(taskctl): add edge case tests for Pulse tick concurrency and crash recovery #225

@randomm

Description

@randomm

Context

Code review of feature/taskctl-pipeline noted that Pulse tests cover basic scheduling and staging but are missing edge cases for the more complex failure scenarios.

Missing test coverage

Tick concurrency

  • What happens if a tick takes > 10 seconds (the overlap guard)? Verify the tick is skipped, not queued
  • What if processAdversarialVerdicts throws mid-loop? Does the lock clean up?

Lock file corruption

  • Lock file exists with non-numeric content → readLockPid returns null correctly
  • Lock file exists with PID of dead process → treated as zombie correctly in resume

Session resurrection edge cases

  • Task in in_progress with worktree that no longer exists → resurrection handles missing worktree gracefully
  • Task in adversarial-running with dead session → 60-min timeout transitions to reviewing

Completion edge cases

  • Job with mix of closed + failed tasks → completion check correctly waits (not all closed)
  • Job with zero tasks → completion fires immediately

Acceptance criteria

  • At least 6 new meaningful tests covering the above scenarios
  • bun test test/tasks/pulse.test.ts passes with 0 failures
  • bun run typecheck passes with 0 errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions