Dialyzer warning on Oban.Pro.Workflow.new()

Getting this ElixirLS Dialyzer warning when using Oban.Pro.Workflow as described in the docs. The workflow itself works as intended.

  Workflow.new() (<-- warning appears here under .new)
  |> Workflow.add(:to, [new_insert_job_here])
  |> Oban.insert_all()
The call 'Elixir.Oban.Pro.Workflow':add
         (#{'__struct__' := 'Elixir.Oban.Pro.Workflow',
          (with opaque subterms) as 1st argument

Heya :waving_hand:,

Which version are you using?

^^ This is fixed and we recommend you upgrade to v1.6.3

:waving_hand: Upgraded to 1.6.4, nuked /_build and /.elixir_ls but still getting the same warning

Are you adding a list of jobs rather than one job? That’s what it shows in your original question:

|> Workflow.add(:to, [new_insert_job_here])

We run a dialyzer pass in our test suite, and this trivial function passes without issue:

def check_workflow do
  Workflow.new()
  |> Workflow.add(:a, job())
  |> Workflow.add(:b, job(), deps: :a)
  |> Workflow.add(:c, job(), deps: [:b])
end

Here’s an example:

    Workflow.new()
    |> Workflow.add(:worker, Worker.new(%{person_id: person.id}))
    |> Oban.insert_all()

shows this warning under “.new()”

The call 'Elixir.Oban.Pro.Workflow':add
         (#{'__struct__' := 'Elixir.Oban.Pro.Workflow',
            'changesets' := [],
            'check_deps' := 'true',
            'grafts' := #{},
            'id' := _,
            'names' := #{'__struct__' := 'Elixir.MapSet', 'map' := #{}},
            'opts' := map(),
            'subs' := #{}},
          'worker',
          #{'__struct__' := 'Elixir.Ecto.Changeset',
            'action' := atom(),
            'changes' := #{atom() => _},
            'constraints' :=
                [#{'constraint' := binary() | map(),
                   'error_message' := binary(),
                   'error_type' := atom(),
                   'field' := atom(),
                   'match' := 'exact' | 'prefix' | 'suffix',
                   'type' :=
                       'check' | 'exclusion' | 'foreign_key' | 'unique'}],
            'data' := 'nil' | map(),
            'empty_values' := _,
            'errors' := [{atom(), {_, _}}],
            'filters' := #{atom() => _},
            'params' := 'nil' | #{binary() => _},
            'prepare' := [fun((_) -> any())],
            'repo' := atom(),
            'repo_opts' := [{atom(), _}],
            'required' := [atom()],
            'types' :=
                #{atom() =>
                      atom() |
                      {'array' | 'assoc' | 'embed' | 'in' | 'map' |
                       'parameterized' | 'supertype' | 'try',
                       _}},
            'valid?' := boolean(),
            'validations' := [{atom(), _}]}) does not have a term of type 
          #{'__struct__' := 'Elixir.Oban.Pro.Workflow',
            'changesets' :=
                [#{'__struct__' := 'Elixir.Ecto.Changeset',
                   'action' := atom(),
                   'changes' := map(),
                   'constraints' := [any()],
                   'data' := map(),
                   'empty_values' := _,
                   'errors' := [any()],
                   'filters' := map(),
                   'params' := 'nil' | map(),
                   'prepare' := [any()],
                   'repo' := atom(),
                   'repo_opts' := [any()],
                   'required' := [any()],
                   'types' := map(),
                   'valid?' := boolean(),
                   'validations' := [any()]}],
            'check_deps' := boolean(),
            'grafts' := _,
            'id' := binary(),
            'names' :=
                #{'__struct__' := 'Elixir.MapSet',
                  'map' := 'Elixir.MapSet':internal(_)},
            'opts' := map(),
            'subs' := map()} (with opaque subterms) as 1st argument

Identifier

elixir-lsp.elixir-ls

Version

0.29.3

Which Elixir and Erlang versions are you on? This looks similar to https://github.com/elixir-lang/elixir/issues/14750

Elixir 1.18.4, Erlang/OTP 28

I disabled opaque checks from dialyzer for now as recommended by Jose :+1: