Skip to content

chore: upgrade elixir and otp - #40

Merged
yordis merged 1 commit into
mainfrom
chore/upgrade-elixir-1-19
Jan 1, 2026
Merged

yordis merged 1 commit into
mainfrom
chore/upgrade-elixir-1-19

Conversation

@yordis

@yordis yordis commented Jan 1, 2026

Copy link
Copy Markdown
Member

No description provided.

@cursor

cursor Bot commented Jan 1, 2026 •

Copy link
Copy Markdown

PR Summary

  • Upgrade toolchain/CI: Bump CI matrix to elixir 1.19.x (OTP 27) and add .tool-versions (elixir 1.19-otp-27, erlang 27.3.2).
  • Mix config refactor: Move preferred CLI envs to new project/cli (preferred_envs) and keep application/ focused on runtime apps; remove old preferred_cli_env entry.
  • Aggregate internals: Use map update syntax when mutating aggregate state (e.g., Aggregate state updates in aggregate.ex and aggregate_state_builder.ex).
  • Tests/handlers: Update tests to pattern-match on %EventStore.RecordedEvent{} and use map updates for RecordedEvent/FailureContext fields; minor type spec refinements.

Written by Cursor Bugbot for commit b49f0ab. This will update automatically on new commits. Configure here.

@coderabbitai

coderabbitai Bot commented Jan 1, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@yordis has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 440a70a and b49f0ab.

📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • .tool-versions
  • lib/commanded/aggregates/aggregate.ex
  • lib/commanded/aggregates/aggregate_state_builder.ex
  • mix.exs
  • test/aggregates/aggregate_subscription_test.exs
  • test/event/support/error/error_event_handler.ex

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The pull request updates the project toolchain to Elixir 1.19 and Erlang 27.3.2, updates CI configuration accordingly, and refactors internal state representation in aggregate modules from struct updates to map operations. The mix.exs configuration is reorganized with a new cli/0 function and restored application wiring.

Changes

Cohort / File(s) Change Summary
Toolchain & Build Configuration
.github/workflows/ci.yml, .tool-versions, mix.exs
CI matrix upgraded to Elixir 1.19.x; tool-versions set to elixir 1.19-otp-27 and erlang 27.3.2; mix.exs reorganized with new cli/0 function, removed preferred_cli_env/0, and restored application/0 and mod/0 configuration.
Aggregate State Handling
lib/commanded/aggregates/aggregate.ex, lib/commanded/aggregates/aggregate_state_builder.ex
Changed state updates from Aggregate struct (%Aggregate{}) to plain map (%{}) representation in handle_call and event-replay paths. ⚠️ May impact downstream code expecting struct types and pattern matching (e.g., telemetry_metadata).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • fix: make take snapshot sync call #20 — Modifies aggregate.ex command/snapshot handling and state-update logic with similar struct-vs-map representation changes; potential conflict in same functions.

Poem

🐰 Elixir hops to version new,
Erlang twenty-seven shines so true,
Maps now replace the struct's embrace,
State flows swift with lighter grace,
Toolchains aligned, our systems refined! 🔧✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No description was provided, which makes this check inconclusive as there is no content to evaluate for relevance to the changeset. Add a description explaining the rationale and scope of the Elixir and OTP upgrade, including any breaking changes or compatibility notes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: upgrading Elixir to 1.19.x and OTP to 27, which are reflected in the CI matrix and .tool-versions updates.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread .tool-versions
@yordis
yordis force-pushed the chore/upgrade-elixir-1-19 branch 2 times, most recently from e95f4f1 to 440a70a Compare January 1, 2026 05:00
@yordis
yordis marked this pull request as ready for review January 1, 2026 05:00

@coderabbitai coderabbitai 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.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.tool-versions (1)

1-2: Elixir version missing patch number.

The Elixir version 1.19-otp-27 is missing the patch number. The correct format is 1.19.0-otp-27 (or whichever patch version is intended). This will likely cause asdf install to fail.

🧹 Nitpick comments (2)
lib/commanded/aggregates/aggregate.ex (1)

364-364: Inconsistent struct update syntax.

This line uses %{state | ...} (map syntax) while other similar updates in the same file use %Aggregate{state | ...} (struct syntax) — see lines 415, 462-466, and 572-576. The map syntax loses compile-time key validation. If this change is intentional for Elixir 1.19 compatibility, consider applying it consistently throughout the file; otherwise, revert to the struct syntax for consistency and type safety.

Option 1: Revert to struct syntax for consistency
-        state = %{state | lifespan_timeout: lifespan_timeout}
+        state = %Aggregate{state | lifespan_timeout: lifespan_timeout}
lib/commanded/aggregates/aggregate_state_builder.ex (1)

99-103: Map syntax loses compile-time key validation.

Using %{state | ...} instead of %Aggregate{state | ...} is functionally equivalent (the struct type is preserved at runtime), but loses compile-time validation that the keys :aggregate_version and :aggregate_state exist in the struct. This is also inconsistent with the populate/1 function above (lines 50-54, 58) which uses struct syntax.

If this change is intentional for a specific reason, consider applying it consistently; otherwise, prefer the struct syntax for better compile-time guarantees.

Revert to struct syntax for consistency
-        state = %{
+        state = %Aggregate{
           state
           | aggregate_version: stream_version,
             aggregate_state: aggregate_module.apply(aggregate_state, data)
         }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6c3e0b and 440a70a.

📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • .tool-versions
  • lib/commanded/aggregates/aggregate.ex
  • lib/commanded/aggregates/aggregate_state_builder.ex
  • mix.exs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Quality Assurance (1.19.x, 27)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (3)
mix.exs (2)

12-12: Verify Elixir version constraint compatibility with cli/0 callback.

The cli/0 callback was introduced in Elixir 1.15, but the project declares elixir: "~> 1.12" on line 12. If supporting older Elixir versions is intended, this will cause issues. Consider updating the constraint to "~> 1.15" or higher to match the new toolchain.

Also applies to: 27-35


37-42: LGTM!

The application/0 function is correctly restored with proper extra_applications/1 and mod configuration. This aligns with standard OTP application setup.

.github/workflows/ci.yml (1)

46-48: LGTM!

The CI matrix update to Elixir 1.19.x with OTP 27 aligns with the toolchain upgrade. The 1.19.x format is valid for erlef/setup-beam and will resolve to the latest 1.19 patch release.

Comment thread mix.exs
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the chore/upgrade-elixir-1-19 branch from 440a70a to b49f0ab Compare January 1, 2026 05:05
@yordis
yordis merged commit f44dcf1 into main Jan 1, 2026
5 checks passed
@yordis
yordis deleted the chore/upgrade-elixir-1-19 branch January 1, 2026 05:14
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