fix(prod-build): silence Nx.* undefined warnings in dev/test-only modules

Recalibrator and FrontalAnalysis use Nx for tensor math, but Nx is
declared `only: [:dev, :test]` in mix.exs because neither module has a
prod entry point — Recalibrator is invoked by hand from IEx and
FrontalAnalysis is research scaffolding. The prod compile would emit
"Nx.to_number/1 is undefined" warnings on every Nx call. Add a
`@compile {:no_warn_undefined, Nx}` directive to both modules so the
prod build is clean without dragging Nx/Axon/EXLA (~hundreds of MB) into
the runtime image.
This commit is contained in:
Graham McIntire 2026-04-30 12:19:16 -05:00
parent ac3a2517d9
commit fdadba52b8
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 12 additions and 0 deletions

View file

@ -29,6 +29,13 @@ defmodule Microwaveprop.Propagation.Recalibrator do
require Logger
# Nx is `only: [:dev, :test]` in mix.exs because the recalibrator is a
# research / weight-fitting tool that never runs in prod (no scheduled
# job, no cron, no LiveView entry point). Silence the prod-compile
# warnings about Nx.* being undefined — this module wouldn't be called
# without a developer explicitly invoking it.
@compile {:no_warn_undefined, Nx}
@factor_keys ~w(humidity time_of_day td_depression refractivity sky season wind rain pwat pressure)a
@doc """

View file

@ -21,6 +21,11 @@ defmodule Microwaveprop.Weather.FrontalAnalysis do
All grid math uses Nx for vectorized 2D operations.
"""
# Nx is `only: [:dev, :test]` in mix.exs. This module is a research
# tool — no prod code path invokes it — so silence the prod-compile
# warnings about Nx.* being undefined.
@compile {:no_warn_undefined, Nx}
@doc """
Detect fronts from a 2D grid of surface temperature and pressure.