Skip to content

Commit 99e9eed

Browse files
committed
feat(051-implement-real-task-function-dispatch-in-wfexec-cu): Implement real task function dispatch in wf_exec. Currently lookup_task_function/2 is a hardcoded mock that ignores the task name and returns fun(Ctx) -> {ok, maps:put(task_result, ok, Ctx)} end. Fix this so the executor actually calls the task function from the wf_term metadata. The compiler must propagate task metadata (the function field from task_metadata map) into the bytecode or a side-table accessible by the executor. The executor must call the real function when it encounters a task_exec opcode. ACCEPTANCE TEST: Create an escript that compiles wf_term:seq(wf_term:task(a, #{function => fun(Ctx) -> {ok, Ctx#{a_ran => true}} end}), wf_term:task(b, #{function => fun(Ctx) -> {ok, Ctx#{b_ran => true}} end})), executes it, and asserts the final context contains both a_ran and b_ran keys set to true. The test must fail with the current mock and pass after the fix. Do NOT use mocks or stubs. Write a real eunit test in test/wf_acceptance_tests.erl that verifies this.
2 parents 738a54d + 3b8b116 commit 99e9eed

14 files changed

Lines changed: 1703 additions & 263 deletions

File tree

.wreckit/items/050-fix-8-failing-tests-in-testwftracetestserl-and-the/item.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
"schema_version": 1,
33
"id": "050-fix-8-failing-tests-in-testwftracetestserl-and-the",
44
"title": "Fix 8 failing tests in test/wf_trace_tests.erl and the 5 cancelled tests. The root cause is wf_trace:new/1 creates a named ETS table wf_trace_events — when multiple tests call new/1, the second call crashes with badarg (table already exists). Fix wf_trace:new/1 to delete existing table first or use ets:whereis to check. Also fix assertion mismatches in trace_level_full_test, sink_ets_test, snapshot_serialization_test, restore_bytecode_mismatch_test, restore_invalid_binary_test, filter_scope_test, filter_predicate_test, integration_wf_exec_emits_events_test. Target: rebar3 eunit 0 failures 0 cancelled.",
5-
"state": "critique",
5+
"state": "done",
66
"overview": "",
7-
"branch": null,
7+
"branch": "wreckit/050-fix-8-failing-tests-in-testwftracetestserl-and-the",
88
"pr_url": null,
99
"pr_number": null,
1010
"last_error": null,
1111
"created_at": "2026-02-11T21:49:41.537Z",
12-
"updated_at": "2026-02-11T21:58:10.666Z"
12+
"updated_at": "2026-02-11T21:58:13.020Z",
13+
"rollback_sha": "a735c8296e7380b6ceb3392604089bbd7528a15c",
14+
"completed_at": "2026-02-11T21:58:13.020Z"
1315
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"schema_version": 1,
3+
"id": "051-implement-real-task-function-dispatch-in-wfexec-cu",
4+
"title": "Implement real task function dispatch in wf_exec. Currently lookup_task_function/2 is a hardcoded mock that ignores the task name and returns fun(Ctx) -> {ok, maps:put(task_result, ok, Ctx)} end. Fix this so the executor actually calls the task function from the wf_term metadata. The compiler must propagate task metadata (the function field from task_metadata map) into the bytecode or a side-table accessible by the executor. The executor must call the real function when it encounters a task_exec opcode. ACCEPTANCE TEST: Create an escript that compiles wf_term:seq(wf_term:task(a, #{function => fun(Ctx) -> {ok, Ctx#{a_ran => true}} end}), wf_term:task(b, #{function => fun(Ctx) -> {ok, Ctx#{b_ran => true}} end})), executes it, and asserts the final context contains both a_ran and b_ran keys set to true. The test must fail with the current mock and pass after the fix. Do NOT use mocks or stubs. Write a real eunit test in test/wf_acceptance_tests.erl that verifies this.",
5+
"state": "critique",
6+
"overview": "",
7+
"branch": null,
8+
"pr_url": null,
9+
"pr_number": null,
10+
"last_error": null,
11+
"created_at": "2026-02-11T23:59:37.615Z",
12+
"updated_at": "2026-02-12T00:09:25.850Z"
13+
}

0 commit comments

Comments
 (0)