Skip to content

chore!: remove deprecated project macros in Ecto projections - #31

Merged
yordis merged 1 commit into
mainfrom
yordis/remove-reprecated
Nov 19, 2025
Merged

yordis merged 1 commit into
mainfrom
yordis/remove-reprecated

Conversation

@yordis

@yordis yordis commented Nov 19, 2025 •

Copy link
Copy Markdown
Member

Note

Removes deprecated do-end Ecto projection macros, standardizes on function-based project macros, deletes related tests, and updates docs.

  • Breaking change (Ecto Projections):
    • Removed deprecated block macros: project(event, do: ...) and project(event, metadata, do: ...).
    • Only function syntax is supported: project(event, fn multi -> ... end) and project(event, metadata, fn multi -> ... end).
  • Code:
    • Deleted deprecated macro implementations in lib/commanded/projections/ecto.ex; retained function-based project/2 and project/3 and batch APIs.
  • Tests:
    • Removed test/projections/deprecated_projection_test.exs.
  • Docs:
    • Updated guides/explanations/fork-differences.md to document the breaking change and migration guidance.

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

@coderabbitai

coderabbitai Bot commented Nov 19, 2025 •

Copy link
Copy Markdown

Walkthrough

This change removes deprecated projection macro syntax in favor of lambda-based functions, deletes an entire test module validating the old syntax, and updates documentation to reflect breaking changes in the API. The refactoring consolidates projection handling and removes obsolete code patterns.

Changes

Cohort / File(s) Summary
Documentation updates
guides/explanations/fork-differences.md
Adds breaking-change sections documenting removal of deprecated Ecto Projections do-end block syntax, ProcessManager support, Upcasting support, and various architectural consolidations; notes new features including UUIDv7 support, EnrichedMetadata struct, aggregate telemetry, custom event IDs, and EventStore adapter integration.
Projection macro changes
lib/commanded/projections/ecto.ex
Removes deprecated project/2 and project/3 macros accepting do-end blocks; adds new project/1 macro accepting lambda-based function syntax.
Test removal
test/projections/deprecated_projection_test.exs
Deletes entire test module that validated deprecated do-end block projection syntax and deprecation warnings for project/2 and project/3 macros.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Breaking API change: The removal of project/2 and project/3 macros requires verification that all callers have migrated to lambda-based syntax.
  • Test coverage: Ensure new macro implementation (referenced implicitly) has corresponding test coverage to replace the deleted test module.
  • Documentation accuracy: Verify that the fork-differences documentation accurately reflects all consolidations and feature changes mentioned.

Possibly related PRs

  • PR #25: Modifies the same documentation file (guides/explanations/fork-differences.md), likely coordinating breaking-change documentation updates.
  • PR #27: Directly touches the same macros in lib/commanded/projections/ecto.ex and includes the deleted test module; potential conflict or related refactoring effort.

Poem

🐰 Do-blocks deprecated, lambda's the way—
Projections streamlined for a brighter day.
Old tests fade away, new syntax takes flight,
Commanded evolves, the future is bright! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore!: remove deprecated project macros in Ecto projections' accurately and specifically describes the main change: removing deprecated do-block macros from Ecto projections and retaining function-based syntax.
Description check ✅ Passed The description clearly documents the breaking change, lists removed macros, retained function-based APIs, files modified, and migration guidance, directly corresponding to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yordis/remove-reprecated

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.

@yordis
yordis force-pushed the yordis/remove-reprecated branch from 5b42e22 to 0bc7032 Compare November 19, 2025 05:17
@yordis
yordis marked this pull request as ready for review November 19, 2025 05:17
@yordis
yordis force-pushed the yordis/remove-reprecated branch 2 times, most recently from 1cd6d39 to e8deb86 Compare November 19, 2025 05:19
@yordis yordis changed the title refactor!: remove deprecated project macros in Ecto projections chore!: remove deprecated project macros in Ecto projections Nov 19, 2025
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the yordis/remove-reprecated branch from e8deb86 to 9cbd2fa Compare November 19, 2025 05:23

@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

🧹 Nitpick comments (1)
guides/explanations/fork-differences.md (1)

16-22: Consider adding PR reference and rationale for consistency.

Other breaking change entries in this document (ProcessManager, Upcasting, EnrichedMetadata) include both a PR reference and a "Reason:" subsection explaining the motivation. Adding these would improve consistency and help maintainers and users understand the context behind the change.

~### **Removed Deprecated Ecto Projections "do end" Block Syntax**
+### **Removed Deprecated Ecto Projections "do end" Block Syntax**
+[PR #31](https://github.com/straw-hat-team/commanded/pull/31)
 
 **Changes:**
 - Removed deprecated `project(event, do: block)` macro variant
 - Removed deprecated `project(event, metadata, do: block)` macro variant
 - Only function-based syntax is now supported: `project(event, fn multi -> ... end)`
+
+**Reason:** Consolidating on a single, function-based API reduces cognitive load and aligns with Elixir idioms, eliminating the need to maintain and document multiple syntax variants.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fb29d6 and 9cbd2fa.

📒 Files selected for processing (3)
  • guides/explanations/fork-differences.md (1 hunks)
  • lib/commanded/projections/ecto.ex (0 hunks)
  • test/projections/deprecated_projection_test.exs (0 hunks)
💤 Files with no reviewable changes (2)
  • test/projections/deprecated_projection_test.exs
  • lib/commanded/projections/ecto.ex
⏰ 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). (1)
  • GitHub Check: Quality Assurance (1.18.x, 27)
🔇 Additional comments (1)
guides/explanations/fork-differences.md (1)

16-22: Breaking change documentation is clear and accurate. ✅

The removal of deprecated do-block syntax is well-documented with clear before/after guidance on the supported function-based approach. This will help users migrating from the old API.

@yordis
yordis merged commit 2c552e8 into main Nov 19, 2025
6 of 7 checks passed
@yordis
yordis deleted the yordis/remove-reprecated branch November 19, 2025 05:29
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