Repository navigation
fix: Semver traits crash on Elixir 1.12 and 1.13 - #81
Conversation
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Replaces the Elixir 1.14-only Version.to_string/1 with the universally available to_string/1 in three semver trait paths and adds a CI job compiling on Elixir 1.12 with warnings-as-errors. The fix is small, behavior-preserving, and directly addresses the declared minimum-version crash.
Turn on auto-fix | Re-trigger cubic
8b9d3de to
3f28f73
Compare
There was a problem hiding this comment.
0 issues found across 7 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Replaces Version.to_string/1 with to_string/1 in semver trait paths and adds CI coverage on Elixir 1.12, plus Logger.warn swaps. The fix is small, behavior-preserving, and covers the declared minimum-version crash.
Turn on auto-fix | Re-trigger cubic
🤖 I have created a release *beep* *boop* --- ## [2.7.2](v2.7.1...v2.7.2) (2026-11-23) ### Bug Fixes * Semver traits crash on Elixir 1.12 and 1.13 ([#81](#81)) ([e1890e8](e1890e8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Version.to_string/1was added in Elixir 1.14, but the package declareselixir: "~> 1.12". On 1.12 and 1.13, three code paths raiseUndefinedFunctionErrorwhen they meet a semver trait value:Flagsmith.Engine.Evaluator.to_str/1, during local evaluationFlagsmith.Engine.Mappers.map_trait_value/1Flagsmith.Schemas.Traits.Trait.Value%Version{}implementsString.Charson every supported Elixir, so this usesto_string/1instead. 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:--warnings-as-errors).tool-versions(Elixir 1.15.2, OTP 26)ubuntu-latestubuntu-24.04, the newest runner with OTP 24 buildsFormat 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/1is deprecated from Elixir 1.15 and breaks--warnings-as-errors, so it's replaced withLogger.warning/2, which has existed since 1.11.ExUnit.CaptureLog.with_log/1(1.13+) is replaced withcapture_log/2.assert_requestcompares JSON request bodies as decoded data, not raw strings, because key order differs between OTP versions.level: :warnwith:warning.Verified locally in containers for both entries:
mix compile --warnings-as-errorspasses.mix testpasses, 433 tests and 0 failures.mix format --check-formattedandmix dialyzerpass.Before the fix, the 1.12 entry fails, both at compile time (
Version.to_string/1 is undefined or private) and in tests (UndefinedFunctionError).