Skip to content

fix!: remove upcast - #26

Merged
yordis merged 1 commit into
mainfrom
yordis/remove-upcasting
Oct 28, 2025
Merged

yordis merged 1 commit into
mainfrom
yordis/remove-upcasting

Conversation

@yordis

@yordis yordis commented Oct 28, 2025

Copy link
Copy Markdown
Member

No description provided.

@yordis
yordis marked this pull request as ready for review October 28, 2025 17:54
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the yordis/remove-upcasting branch from 0c82af6 to af830a0 Compare October 28, 2025 17:54
@coderabbitai

coderabbitai Bot commented Oct 28, 2025 •

Copy link
Copy Markdown

Walkthrough

This PR removes the Upcasting feature from Commanded by deleting the Upcast and Upcaster modules, removing upcasting logic from core event handlers and aggregates, eliminating related test support code, and updating documentation to reflect the removal.

Changes

Cohort / File(s) Summary
Documentation updates
guides/explanations/events.md, guides/explanations/fork-differences.md, guides/howtos/migrating-from-v1-to-v2.md
Removed "Upcasting events" explanatory sections and examples from events guide; added "Removed Upcasting Support" section to fork-differences documenting the removal and introducing EnrichedMetadata struct; deleted upcasting migration guidance.
Core upcasting modules deleted
lib/commanded/event/upcast.ex, lib/commanded/event/upcaster.ex
Deleted entire Upcast module with upcast_event_stream/2 and upcast_event/2 functions; deleted Upcaster protocol with upcast/2 callback and Any implementation.
Upcasting logic removal
lib/commanded/aggregates/aggregate.ex, lib/commanded/event/handler.ex, lib/commanded/event_store.ex
Removed Upcast alias and replaced upcasting pipeline with direct event processing; stream_forward no longer upcasts events; removed application extraction tied to upcasting.
Project configuration
mix.exs
Removed Commanded.Event.Upcaster from public API documentation exports.
Test support deletion
test/event/support/upcast/*, test/event/upcaster_test.exs
Deleted all upcasting test modules including BatchEventHandler, EventHandler, UpcastAggregate, and Events with their Upcaster implementations; removed entire UpcasterTest suite.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify removal completeness: Ensure no lingering references to Upcast/Upcaster modules remain in codebase or imports.
  • Handler and aggregate logic: Confirm event processing pipelines function correctly after replacing Upcast.upcast_event_stream with direct processor invocation.
  • Documentation consistency: Check that fork-differences accurately reflects all API changes and new EnrichedMetadata struct is properly documented elsewhere.

Possibly related PRs

  • feat: add batch support #18: Extends event handler batch processing with an Upcast.BatchEventHandler test helper that is being deleted in this PR.
  • chore: add fork diff explanation #25: Previously added the fork-differences documentation section that this PR directly modifies with the "Removed Upcasting Support" subsection.

Poem

🐰 Upcasting fades to history's past,
Simpler streams shall hold more fast,
No more transformations, clean and lean,
Commanded's now more keen, I've seen! ✨

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 pull request description was provided by the author. The check instructions state this should be a lenient check that passes as long as the description is not completely off-topic, but they assume a description exists. An absent description provides no information to evaluate whether it is related to the changeset, making it impossible to conclusively determine if it meets the pass criterion (description related to changeset) or the fail criterion (completely unrelated). This falls into the inconclusive category where insufficient information is available to make a determination.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "fix!: remove upcast" directly and accurately summarizes the main change in the pull request. The changeset comprehensively removes upcasting functionality throughout the codebase, including the removal of Commanded.Event.Upcast and Commanded.Event.Upcaster modules, elimination of upcasting logic from handlers and aggregates, removal of related documentation sections, and deletion of all test support code for upcasting. The title is concise, clear, and specific enough that teammates scanning history would immediately understand the primary change.
✨ 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-upcasting

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ad1e98 and af830a0.

📒 Files selected for processing (14)
  • guides/explanations/events.md (0 hunks)
  • guides/explanations/fork-differences.md (7 hunks)
  • guides/howtos/migrating-from-v1-to-v2.md (0 hunks)
  • lib/commanded/aggregates/aggregate.ex (0 hunks)
  • lib/commanded/event/handler.ex (3 hunks)
  • lib/commanded/event/upcast.ex (0 hunks)
  • lib/commanded/event/upcaster.ex (0 hunks)
  • lib/commanded/event_store.ex (1 hunks)
  • mix.exs (0 hunks)
  • test/event/support/upcast/batch_event_handler.ex (0 hunks)
  • test/event/support/upcast/event_handler.ex (0 hunks)
  • test/event/support/upcast/events.ex (0 hunks)
  • test/event/support/upcast/upcast_aggregate.ex (0 hunks)
  • test/event/upcaster_test.exs (0 hunks)
💤 Files with no reviewable changes (11)
  • test/event/support/upcast/upcast_aggregate.ex
  • test/event/support/upcast/batch_event_handler.ex
  • guides/explanations/events.md
  • guides/howtos/migrating-from-v1-to-v2.md
  • lib/commanded/event/upcast.ex
  • test/event/support/upcast/event_handler.ex
  • mix.exs
  • lib/commanded/event/upcaster.ex
  • lib/commanded/aggregates/aggregate.ex
  • test/event/upcaster_test.exs
  • test/event/support/upcast/events.ex
🔇 Additional comments (4)
lib/commanded/event/handler.ex (2)

953-973: LGTM: Event processing now bypasses upcasting.

The changes correctly remove the upcasting pipeline:

  • Events are passed directly to the processor function
  • The processor signature now explicitly receives events as the first argument
  • Both :event and :batch callback paths work correctly with raw events

1416-1436: LGTM: Partition logic correctly accesses raw event data.

The partition_event function now directly accesses the event's data field, which is the correct approach after removing upcasting. The metadata enrichment and error handling remain intact.

guides/explanations/fork-differences.md (1)

29-36: LGTM: Breaking change properly documented.

The documentation clearly describes:

  • What was removed (Upcast and Upcaster modules, integration with handlers/aggregates)
  • The rationale (schema transformations can be handled explicitly in handlers)
  • The breaking nature of this change

This provides users with clear information about the impact of upgrading to this version.

lib/commanded/event_store.ex (1)

82-82: LGTM: Upcasting removed from stream processing.

Verification confirms the stream is now returned directly without transformation, and all Upcast references have been successfully removed from the codebase. The change is correct and aligns with the PR's goal.


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 merged commit 0aa511b into main Oct 28, 2025
4 checks passed
@yordis
yordis deleted the yordis/remove-upcasting branch October 28, 2025 18:05
yordis added a commit that referenced this pull request Oct 28, 2025
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
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