towerops/.dialyzer_ignore.exs
Graham McIntire 9cb4c59638 dialyzer: replace suppressions with real fixes where possible
Changes to eliminate @dialyzer suppressions by fixing underlying causes:

NIF stubs (towerops_native.ex, mib_translator.ex):
- Change stubs to :erlang.nif_error(:nif_not_loaded) (no_return type).
  Real NIF replaces stubs at load time; calls to unloaded stubs now fail
  loudly instead of returning fake data. Lets dialyzer trust @spec.
- Remove @dialyzer :nowarn_function on three NIFs and on translate/1.

Discovery sync_* functions (snmp/discovery.ex, channels/agent_channel.ex):
- agent_channel passes %{device_id: _, interfaces: _} and %{id: _} maps
  into Discovery.sync_ip_addresses/sync_processors/sync_storage, which
  @spec'd only %Device{}. Add narrow map-type unions (ip_sync_device,
  snmp_device_ref) reflecting what the functions actually access.
- Remove @dialyzer :nowarn_function on three agent_channel helpers.

remote_ip.ex — real bug caught and fixed:
- `:ranch.get_addr(socket.transport_pid)` was always raising since
  Bandit uses ThousandIsland, not Ranch; the rescue _ -> nil silently
  returned nil every time. Switched to Phoenix's documented
  :peer_data connect_info (already enabled in endpoint.ex) via
  socket.assigns; remote IP now actually works.
- Remove remote_ip.ex entry from .dialyzer_ignore.exs.

Accounts / Organizations (Ecto.Multi opacity):
- Add @specs to Multi-building helpers, refactor into pipe chains.
- 6 @dialyzer :nowarn_function → 0, but 7 :no_opaque remain. Root
  cause is upstream: Ecto.Multi.new/0 returns a struct with a literal
  %MapSet{} whose @opaque internal representation trips dialyzer on
  every subsequent Multi.* call. Unfixable without an Ecto patch or
  bypassing Multi entirely. Comments document the specific upstream
  issue rather than a vague "Ecto.Multi opacity" claim.

Devices.ex:
- Adding @specs made it worse (call_without_opaque → contract_with_
  opaque); inlining the Multi didn't help either — same MapSet root
  cause. Suppression kept with a sharper comment.
2026-04-21 11:01:30 -05:00

40 lines
1.4 KiB
Elixir

# Dialyzer warnings to ignore.
#
# Dependency PLT gaps should be handled via `plt_add_apps` in mix.exs.
# Only suppress genuine false positives here — fix real warnings instead.
[
# Ecto.Type behaviour — callbacks aren't always exported
{"deps/ecto/lib/ecto/type.ex", :callback_info_missing},
# Oban.Worker behaviour — PLT gap
{"deps/oban/lib/oban/worker.ex", :callback_info_missing},
{"deps/oban/lib/oban/worker.ex", :unknown_function},
# Phoenix behaviours
{"deps/phoenix/lib/phoenix/endpoint.ex", :callback_info_missing},
{"deps/phoenix/lib/phoenix/router.ex", :callback_info_missing},
# Plug behaviours
{"deps/plug/lib/plug/debugger.ex", :unknown_function},
{"deps/plug/lib/plug/error_handler.ex", :unknown_function},
# Honeybadger
{"deps/honeybadger/lib/honeybadger/plug.ex", :unknown_function},
# Cloak
{"deps/cloak/lib/cloak/vault.ex", :unknown_function},
{"deps/cloak_ecto/lib/cloak_ecto/type.ex", :callback_info_missing},
{"deps/cloak_ecto/lib/cloak_ecto/types/binary.ex", :unknown_function},
# Cloak.Vault uses GenServer, whose callback info isn't in the PLT because the
# containing gen_server.ex path is a CI build artifact, not a local dep path.
~r/gen_server\.ex/,
# Vendored SnmpKit — out of scope for typing cleanup
~r/lib\/snmpkit/,
~r/lib\/snmp_lib/,
~r/src\/snmpkit/,
~r/src\/snmp_lib/,
# Gleam type system doesn't map 1:1 to Erlang's — artifacts, not bugs.
~r/src\/towerops\/.*\.gleam/
]