Skip to content

fix: Compile on Elixir 1.12 so releases publish to Hex - #79

Merged
khvn26 merged 1 commit into
mainfrom
fix/hex-publish-elixir-1.12
Nov 23, 2026
Merged

khvn26 merged 1 commit into
mainfrom
fix/hex-publish-elixir-1.12

Conversation

@khvn26

@khvn26 khvn26 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Restore Elixir 1.12 compat. ** broke 2 last releases.

@khvn26
khvn26 requested a review from a team as a code owner November 23, 2026 15:18
@khvn26
khvn26 requested review from emyller and removed request for a team November 23, 2026 15:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Replaces the Elixir 1.13+ ** operator with Integer.pow/2 in the retry backoff calculation, restoring Elixir 1.12 compilation so Hex publishes can proceed. Behavior is preserved for the integer exponent.

Turn on auto-fix | Re-trigger cubic

@codspeed

codspeed Bot commented Nov 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing fix/hex-publish-elixir-1.12 (f7c58ea) with main (fc6b7e8)

Open in CodSpeed

@khvn26
khvn26 merged commit bbabe3e into main Nov 23, 2026
5 of 6 checks passed
@khvn26
khvn26 deleted the fix/hex-publish-elixir-1.12 branch November 23, 2026 15:45
khvn26 pushed a commit that referenced this pull request Nov 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.7.1](v2.7.0...v2.7.1)
(2026-11-23)


### Bug Fixes

* Compile on Elixir 1.12 so releases publish to Hex
([#79](#79))
([bbabe3e](bbabe3e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
khvn26 added a commit that referenced this pull request Nov 23, 2026
`Version.to_string/1` was added in Elixir 1.14, but the package declares
`elixir: "~> 1.12"`. On 1.12 and 1.13, three code paths raise
`UndefinedFunctionError` when they meet a semver trait value:

- `Flagsmith.Engine.Evaluator.to_str/1`, during local evaluation
- `Flagsmith.Engine.Mappers.map_trait_value/1`
- JSON encoding of `Flagsmith.Schemas.Traits.Trait.Value`

`%Version{}` implements `String.Chars` on every supported Elixir, so
this uses `to_string/1` instead. The output is the same.

Nothing in CI tests the minimum version, which is how this and the `**`
operator from #79 got through (that one also stopped 2.6.0 and 2.7.0
from publishing to Hex). To close that gap, the build job now runs on a
matrix:

| Entry | Runner | Compile (`--warnings-as-errors`) | Tests | Format and
dialyzer |
| --- | --- | --- | --- | --- |
| `.tool-versions` (Elixir 1.15.2, OTP 26) | `ubuntu-latest` | ✅ | ✅ | ✅
|
| Elixir 1.12, OTP 24 (the minimum, and what the Hex publish uses) |
`ubuntu-24.04`, the newest runner with OTP 24 builds | ✅ | ✅ | — |

Format and dialyzer only run on `.tool-versions`, since their output
differs between versions. Each entry has its own cache keys.

To make that pass:

- `Logger.warn/1` is deprecated from Elixir 1.15 and breaks
`--warnings-as-errors`, so it's replaced with `Logger.warning/2`, which
has existed since 1.11.
- Two fixes to make the tests work on 1.12:
- `ExUnit.CaptureLog.with_log/1` (1.13+) is replaced with
`capture_log/2`.
- `assert_request` compares JSON request bodies as decoded data, not raw
strings, because key order differs between OTP versions.
  - Also replaced a deprecated `level: :warn` with `:warning`.

Verified locally in containers for both entries:

- `mix compile --warnings-as-errors` passes.
- `mix test` passes, 433 tests and 0 failures.
- On 1.15.2, `mix format --check-formatted` and `mix dialyzer` pass.

Before the fix, the 1.12 entry fails, both at compile time
(`Version.to_string/1 is undefined or private`) and in tests
(`UndefinedFunctionError`).
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.

1 participant