Skip to content

Fix map enumeration bug in DAG task filters + expand test coverage#8

Merged
badubizzle merged 1 commit intocopilot/update-test-coveragefrom
copilot/rebase-on-master
Mar 4, 2026
Merged

Fix map enumeration bug in DAG task filters + expand test coverage#8
badubizzle merged 1 commit intocopilot/update-test-coveragefrom
copilot/rebase-on-master

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 4, 2026

dag.tasks is a %{task_id => %DAGTask{}} map, but get_completed_tasks/1, get_pending_tasks/1, and get_running_tasks/1 were passing raw {key, value} tuples into DAGTask.is_completed/1 etc., causing FunctionClauseError at runtime on any non-empty DAG.

Bug Fix

# Before — crashes when tasks exist
Enum.filter(dag.tasks, fn task -> DAGTask.is_completed(task) end)

# After — correctly destructures map entries
Enum.filter(dag.tasks, fn {_task_id, task} -> DAGTask.is_completed(task) end)

New Test Files

  • test/dag_task_test.exsDAGTask.new/1, validate/1, status predicates, set_handler/2
  • test/dag_run_test.exsDAGRun.new/1, generate_id/0, random_string/1, uniqueness invariants
  • test/dag_task_run_test.exsDAGTaskRun.new/3, field initialization, payload storage, timestamps

Expanded ex_dag_test.exs

Covers the previously untested surface: get_completed_tasks/1, get_pending_tasks/1, get_running_tasks/1, get_tasks/1, set_handler/2, set_tasks_handler/2, validate_for_run/1, get_deps/2, get_deps_map/1, sorted_tasks/1, should_run_task/2, clear_failed_tasks_runs/1, completed?/1, String.Chars impl, and add_task!/2 throw behavior.

Original prompt

Pull Request: #5

Rebase on master


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Rebase current branch on master Fix map enumeration bug in DAG task filters + expand test coverage Mar 4, 2026
@badubizzle badubizzle marked this pull request as ready for review March 4, 2026 04:58
@badubizzle badubizzle merged commit 0ecef15 into copilot/update-test-coverage Mar 4, 2026
1 check passed
@badubizzle badubizzle deleted the copilot/rebase-on-master branch March 4, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants