Mutare.Oban.Enqueue (mutare_oban v0.2.1)

Copy Markdown View Source

Mutates the enqueue options of an Oban job — the keyword options passed when a job is built (MyWorker.new(args, max_attempts: 3, unique: [...], schedule_in: 60)). These options encode the job's retry / dedup / scheduling policy. Changing or removing an option tests whether the suite detects the corresponding change in behaviour.

The mutations

max_attempts: n  (n ≠ 1)  ->  max_attempts: 1   no retries — is the retry asserted?
unique: [...]             ->  (dropped)          dedup removed — is the dupe caught?
schedule_in: _            ->  (dropped)          runs now, not later — is the delay asserted?
scheduled_at: _           ->  (dropped)          runs now, not later

Each is a single mutant, delivered in place by Mutare's selector, and compile-safe by construction (dropping a keyword pair or substituting the literal 1 always yields a legal keyword list — even the empty [], a valid second argument to new/2).

Each mutant is a Mutare.Mutator.Mutation tagged with the option it changes as its ignore variant — so # mutare:ignore[oban_enqueue:unique] suppresses just the dedup drop on that line (see Mutare.Ignore) — and includes a report note describing an assertion that could detect the change.

How it matches

It matches the new/N call (not the keyword list — Mutare traverses trailing keyword options as individual call arguments, never passing the list as a single node), resolving it through Mutare.Calls.resolved_call/1 so the direct, aliased, and piped (args |> MyWorker.new(opts)) forms all match, and rebuilds the call with the mutated options in the form used in the source. It applies to any module's new whose options include one of the keys it mutates (max_attempts, unique, schedule_in, scheduled_at) — Oban-distinctive enough that a false positive is unlikely, and would at worst rebuild an equivalent call elsewhere, never miscompile.

This intentionally covers only the dynamic new/2 options. Static config in the use Oban.Worker line is compile-time and unreachable — see Mutare.Oban.

Summary

Functions

The option labels for # mutare:ignore[oban_enqueue:<label>] — each mutant is tagged with the key of the option changed or removed.

Functions

variants()

The option labels for # mutare:ignore[oban_enqueue:<label>] — each mutant is tagged with the key of the option changed or removed.