Commit graph

2 commits

Author SHA1 Message Date
63a9417287
fix(admin_task_worker): unknown feature now returns error instead of falling through
Backtest branch's unknown-feature guard was dead code: the if block's
{:error, _} return was discarded and execution fell through, running the
backtest with a just-created atom and writing a report for nonsense
features. Two compounding issues:

- function_exported?/3 returns false for modules not yet loaded in the
  BEAM, so even valid feature names triggered the warning path on a
  cold VM.
- String.to_atom/1 on caller-supplied strings created unbounded atoms.

Fix: Code.ensure_loaded?(Features) before the check, String.to_existing_atom/1
with rescue (Features exports __info__(:functions) so every valid function
atom already exists), and an explicit early return via a with pipeline so
the error tuple actually leaves the worker.
2026-04-16 14:58:55 -05:00
a6a670aee7
test: cover admin_task_worker dispatcher
18 characterization tests, one per task branch: backtest, backtest_all,
climatology (aggregation math + min_samples + is_grid_point + empty),
native_derive (filters + limit), recalibrate, scorer_diff, unknown-task
handling, and Oban worker metadata. Tests redirect priv/backtest_reports
writes to a tmp cwd to avoid clobbering checked-in baselines.
2026-04-16 14:58:54 -05:00