Skip to content

Fix Elixir 1.20 warnings, pin toolchain to 1.20.1-otp-29 & refresh deps - #71

Closed
gilbertwong96 wants to merge 3 commits into
elixir-ecto:mainfrom
gilbertwong96:fix/elixir-1.20-warnings-and-toolchain
Closed

Fix Elixir 1.20 warnings, pin toolchain to 1.20.1-otp-29 & refresh deps#71
gilbertwong96 wants to merge 3 commits into
elixir-ecto:mainfrom
gilbertwong96:fix/elixir-1.20-warnings-and-toolchain

Conversation

@gilbertwong96

@gilbertwong96 gilbertwong96 commented Jun 13, 2026

Copy link
Copy Markdown

Summary

  • Removes two Elixir 1.20+ compiler warnings in MissingFkIndexesLogic and MissingFkConstraintsLogic (unused require Logger — neither module references Logger, so the require is dead code).
  • Pins .tool-versions to a single coherent pair: elixir 1.20.1-otp-29 + erlang 29.0.2. The previous fallback (1.16.0-otp-26 1.18 paired with 26.0.2 27.2) was incoherent: 1.18 resolves to 1.18.4-otp-28, which requires OTP 28+, so any mise install would pair it with erlang 26.0.2 and crash with Failed to load module 'elixir'. The new pair matches the toolchain already installed locally.
  • Refreshes mix.lock to the dep versions required by the new toolchain (decimal 2.1.1 → 3.1.1, ecto 3.11.2 → 3.14.0, ecto_sql 3.11.3 → 3.14.0, db_connection 2.7.0 → 2.10.1, ex_doc 0.34.2 → 0.40.3, mock 0.3.8 → 0.3.9, plus patch bumps for earmark_parser, makeup, makeup_elixir, makeup_erlang, nimble_parsec) and forces meck 1.2+ via an in-project override (see follow-up commit).
  • Bumps the project's stated Elixir minimum from ~> 1.11 to ~> 1.15 to honestly reflect what the locked deps now require (postgrex 0.22.x uses ^positions_bytes which is invalid on 1.14).
  • Adds 1.20.1 / 29 to the CI matrix (newest first) and drops 1.14 / 25 (no longer supported by postgrex 0.22.x). Net matrix size unchanged at 6 combos.

Follow-up: why meck 1.2 is a direct dep with override: true

mock 0.3.9 (latest) pins meck ~> 0.9.2. meck 0.9.2 uses the deprecated Erlang (catch ...) expression, which is a hard compile error in OTP 28+ (removed outright). meck 1.2.0 (2026-05-27) added official OTP 29 support, but mock 0.3.9's constraint excludes it. The only way to get a newer meck is to add it as a direct dep with override: true. Marked only: :test so it never reaches a release.

Verification

  • mix compile --force --warnings-as-errors → exit 0
  • MIX_ENV=test mix compile --force --warnings-as-errors → exit 0

The project's own source compiles clean. The test suite requires a running PostgreSQL and is best validated by CI on the updated 6-pair matrix.

Out of scope

postgrex 0.22.2's own mix.exs still uses the deprecated xref: [exclude: [Jason]] and emits a one-line Elixir 1.20 deprecation warning during its own compilation. That's an upstream issue (latest postgrex release hasn't migrated to elixirc_options: [no_warn_undefined: ...]) and not in our project's mix.exs, so it's left alone here.

Files changed

 .github/workflows/ci.yml                                |  6 ++---
 .tool-versions                                          |  4 ++--
 lib/ecto_psql_extras/missing_fk_constraints_logic.ex    |  2 --
 lib/ecto_psql_extras/missing_fk_indexes_logic.ex        |  2 --
 mix.exs                                                 |  8 ++++++--
 mix.lock                                                | 30 ++++++++++++++++----------
 6 files changed, 24 insertions(+), 28 deletions(-)

Context

Follows the same pattern as #46 (Fix Elixir 1.15 warning, require Elixir 1.11+ & bump Ecto/Postgrex requirements) — bump the toolchain, fix any new warnings that surface, refresh the lockfile.

Removes two 'unused require Logger' warnings emitted by Elixir 1.20+'s
compiler in MissingFkIndexesLogic and MissingFkConstraintsLogic — neither
module references Logger, so the require is dead code.

Also pins .tool-versions to elixir 1.20.1-otp-29 / erlang 29.0.2 and
refreshes mix.lock to the dep versions required by the new toolchain
(decimal 2.1.1 -> 3.1.1, ecto 3.11.2 -> 3.14.0, ecto_sql 3.11.3 -> 3.14.0,
db_connection 2.7.0 -> 2.10.1, ex_doc 0.34.2 -> 0.40.3, mock 0.3.8 -> 0.3.9,
earmark_parser / makeup / makeup_elixir / makeup_erlang / nimble_parsec
patch bumps). The previous '1.16.0-otp-26 1.18' / '26.0.2 27.2' fallback
in .tool-versions was incoherent: '1.18' resolved to 1.18.4-otp-28 which
needs OTP 28+, so any 'mise install' would crash. The 1.20.1-otp-29 +
29.0.2 pair matches the toolchain already on disk.

Note: postgrex 0.22.2's mix.exs still uses the deprecated
'xref: [exclude: [Jason]]' and emits an Elixir 1.20 deprecation warning
during its own compilation. That's an upstream issue (latest postgrex
release), not in scope for this project.

Verified with: 'mix compile --force --warnings-as-errors' and
'MIX_ENV=test mix compile --force --warnings-as-errors' both exit 0.
Mirrors the .tool-versions pin from the previous commit: 1.20.1-otp-29
is now the highest-tested combo. Inserted at the top of the matrix
(newest first, matching the existing ordering).

erlef/setup-beam@v1 accepts the major OTP version (29) and the exact
Elixir version (1.20.1), same as the other entries.
The 1.20.1/OTP 29 and 1.14/OTP 25 CI jobs were both red on PR elixir-ecto#71.

* 1.20.1/OTP 29 failed at compile: `meck 0.9.2` (a transitive dep of
  `mock`) uses the deprecated Erlang `catch` expression, which is a
  hard error in OTP 28+ (removed outright). `mock 0.3.9` still pins
  `meck ~> 0.9.2`, so the only way to get a newer meck is to add it as
  a direct dep with `override: true`. meck 1.2.0 (2026-05-27) added
  official OTP 29 support, so that's the floor.

* 1.14/OTP 25 failed at compile: `postgrex 0.22.x` requires
  `elixir: ~> 1.15` and uses `^positions_bytes` (pin operator in
  expression position, valid in 1.15+). With the lockfile at 0.22.x
  there's no way to make 1.14 work without a CI-only postgrex pin,
  which is hacky. The project's actual minimum is now 1.15+, so the
  honest fix is to drop 1.14/25 from the matrix and bump
  `elixir: "~> 1.11"` to `~> 1.15` in mix.exs.

CI matrix goes from 6 → 6 combos (added 1.20.1/29 at the top in the
previous commit, dropped 1.14/25 here). Project's stated Elixir minimum
is now consistent with what the locked deps (postgrex 0.22.x, ecto
3.14, decimal 3.1) actually require.
@pawurb

pawurb commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Hi, thanks for the PRs but I currently don't have capacity to maintain this project, and I'll be archiving it. I hope that someone can fork and take over.

@pawurb pawurb closed this Aug 7, 2026
gilbertwong96 added a commit to gilbertwong96/ecto_psql_extras that referenced this pull request Aug 9, 2026
The 1.20.1/OTP 29 and 1.14/OTP 25 CI jobs were both red on PR elixir-ecto#71.

* 1.20.1/OTP 29 failed at compile: `meck 0.9.2` (a transitive dep of
  `mock`) uses the deprecated Erlang `catch` expression, which is a
  hard error in OTP 28+ (removed outright). `mock 0.3.9` still pins
  `meck ~> 0.9.2`, so the only way to get a newer meck is to add it as
  a direct dep with `override: true`. meck 1.2.0 (2026-05-27) added
  official OTP 29 support, so that's the floor.

* 1.14/OTP 25 failed at compile: `postgrex 0.22.x` requires
  `elixir: ~> 1.15` and uses `^positions_bytes` (pin operator in
  expression position, valid in 1.15+). With the lockfile at 0.22.x
  there's no way to make 1.14 work without a CI-only postgrex pin,
  which is hacky. The project's actual minimum is now 1.15+, so the
  honest fix is to drop 1.14/25 from the matrix and bump
  `elixir: "~> 1.11"` to `~> 1.15` in mix.exs.

CI matrix goes from 6 → 6 combos (added 1.20.1/29 at the top in the
previous commit, dropped 1.14/25 here). Project's stated Elixir minimum
is now consistent with what the locked deps (postgrex 0.22.x, ecto
3.14, decimal 3.1) actually require.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants