All jobs

Fix "warning: Logger.warn/1 is deprecated. Use Logger.warning/2 instead" in an Elixir Library

Yes. An agent compiles the project on a current Elixir, renames every Logger.warn call, and shows the warning gone with the test suite unchanged.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads the project definition first, because the warning only appears on a compiler the project may never have run. In a library like BlakeWilliams/Elixir-Slack, mix.exs declares elixir: "~> 1.7" and version 0.23.6, with httpoison ~> 1.2, websocket_client ~> 1.2.4 and jason ~> 1.1 as runtime dependencies. The CI workflow in .github/workflows/elixir.yml tests Elixir 1.10 to 1.13 on OTP 22 to 24, so its logs have never shown this warning: the Elixir 1.15 changelog is where Logger.warn/2 is deprecated in favor of Logger.warning/2.

It then compiles on Elixir 1.18 with OTP 25 and reads the output rather than grepping for the call. mix deps.get and mix compile print the warning three times, each with its location: lib/slack/lookups.ex:20:12 in Slack.Lookups.lookup_user_id/2, lib/slack/lookups.ex:84:12 in lookup_user_name/2 and lib/slack/lookups.ex:105:12 in find_username_by_id/2. All three pass the same module attribute, @username_warning, a multi-line string about @USER_NAME references being deprecated by Slack.

The same compile prints other warnings that the agent keeps out of this change and lists in the pull request: this clause of defp params/3 is never used several times in lib/slack/web/web.ex, a ~R sigil deprecation inside the earmark_parser dependency, and _.._ inside match is deprecated range warnings. Because of those, mix compile --warnings-as-errors fails before and after, so the agent does not propose turning it on in CI as part of this fix.

The change is three identical edits, Logger.warn( to Logger.warning(, with the argument untouched. A fresh mix compile --force on the branch prints no Logger.warn line. mix test runs 54 tests with one failure on both sides: test/integration/bot_test.exs:23 fails with UndefinedFunctionError: function :http_uri.parse/2 is undefined or private, raised inside websocket_client 1.2.4 on this OTP, which has nothing to do with logging and is reported as pre-existing.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Compiling this Elixir project on a current Elixir prints \"warning: Logger.warn/1 is deprecated. Use Logger.warning/2 instead\". Read mix.exs and the CI workflow, install an Elixir release that prints the warning, run mix deps.get and mix compile, and list every location the compiler reports. Rename each call to Logger.warning with the arguments unchanged, recompile with --force to show the warning is gone, and run mix test before and after. Open a pull request that quotes the compiler output on both sides and lists every other warning or test failure that already existed as separate work.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request that changes three lines in lib/slack/lookups.ex and nothing else. Its description quotes the three warning blocks from the compiler, the clean mix compile --force on the branch, and the mix test summary from both sides, with the one pre-existing integration failure and the dependency that raises it.

A reviewer checks that each call still passes @username_warning and that no require Logger was added or removed. The list of unrelated warnings in the description tells them what a later cleanup would cover, and that --warnings-as-errors is not yet achievable.

Because the CI matrix stops at Elixir 1.13, the description notes that the workflow would not have caught this and names the matrix and the action versions it uses, without changing them in this pull request.

Run it on every new Elixir release

Deprecations arrive with each Elixir minor, so the natural trigger is a release. A schedule trigger with a monthly cron and your timezone runs this prompt against each Elixir project in a Project, and a run that finds no deprecation warning ends with an answer saying so and no pull request.

To run it across many repositories at once, your server sends this request once per repository, each with its own UUID as request_id, and reads each run.completed webhook; a key starts at most max_concurrent runs at a time and queues the rest.

The use case this job follows, with its automation and trigger: Fix a bug from an alert.

Why run it on Rush?

The warning needs a newer compiler than the project's own CI uses, and reading a changelog is not the same as seeing the output. In a Rush sandbox the agent installs Erlang and an Elixir release, compiles the real dependency tree and keeps every line, so the pull request quotes the compiler and the test runner rather than paraphrasing them.

A library last touched years ago carries other noise, and a reviewer wants to know which warnings belong to this change. Running the full compile and test suite on both sides lets the agent draw that line precisely: three edits, zero new warnings, one failure that was already there, with its cause named.

Frequently asked questions

Why does our CI not show this warning?

Because the workflow's matrix runs Elixir 1.10 to 1.13, and the deprecation of Logger.warn/2 arrives in Elixir 1.15. The agent compiles on a release that prints it and reports the matrix as it found it.

Is Logger.warning a drop-in replacement?

For these calls, yes. Each passes a single string, and the agent changes only the function name. The compiler's own message names Logger.warning/2 as the replacement, and the recompiled module prints no warning.

What about the other warnings in the compile output?

They are listed in the pull request with their locations: unused params/3 clauses in the Slack web module, a sigil deprecation inside a dependency, and range-match deprecations. None is touched here, so the diff is the three renamed calls.

Why does one test fail before and after?

The integration test that starts a bot calls websocket_client 1.2.4, which uses the removed :http_uri.parse/2 on this OTP release. That is a dependency upgrade question, so the pull request names it and leaves it alone.

More Elixir jobs

More jobs like this: Fix a bug from an alert

Keep reading