Breaking rc pair: drop Aggregate::revision, consolidate EventStoreError (0.3.0-rc.7) - #8
Merged
Merged
Conversation
…3.0-rc.7
Two breaking API cleanups while 0.3.0 is still in release candidates,
shipped with the rc.7 version bump and changelog entry:
Aggregate::revision() is removed. The framework always derived stream
revisions from persisted envelopes (LoadedAggregate::revision) and
never called the method, so every aggregate carried and bumped a shadow
revision field that did nothing. Aggregates, doc examples, test
fixtures, the counter-app example, and the CLI aggregate template no
longer track it; read the revision from LoadedAggregate.
EventStoreError's doubled variants (X(String) plus XWithSource) merge
into single struct variants { message, code, source }, halving the enum
and the hand-written PartialEq. Construction goes through per-kind
constructor fns (backend, backend_with_source, ...), so call sites stay
one expression. The new code field carries the backend's
machine-readable error code - SQLSTATE for Postgres, server errno for
MySQL, extended result code for SQLite - via EventStoreError::code(),
ending string-matching as the only classification option. Display
output is unchanged; equality compares kind, message, and code and
ignores preserved sources.
Version references in docs, README install snippets, and the fullstack
template/example stay pinned in lockstep at 0.3.0-rc.7.
Claude-Session: https://claude.ai/code/session_01Wq5AdnNWVKWRTS34g6A3Bu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two breaking API cleanups from the repo review, landed together while 0.3.0 is still in rc, with the version bumped to 0.3.0-rc.7.
Aggregate::revision()removedThe framework always derived stream revisions from persisted envelopes (
LoadedAggregate::revision) and never called the trait method — grep shows zero framework call sites. Every aggregate carried and manually bumped a shadowrevisionfield that did nothing (forgetting the bump changed nothing, proving it decorative). Removed from the trait, all doc examples, test fixtures,examples/bank_account, the counter-app example, the CLI aggregate template (generated DTOs now readloaded.revision), and the three docs pages that taught the pattern.EventStoreErrorconsolidated + machine-readable codesX(String)/XWithSource { .. }pair merges into one struct variantX { message, code, source }.backend(..),backend_with_source(..), …) so all ~290 call sites stayed one-expression;with_code/with_sourcebuilders compose.code: Option<String>+EventStoreError::code(): SQLSTATE (Postgres), server errno (MySQL), extended result code (SQLite) — transport-vs-domain classification no longer requires string matching.PartialEqcompares kind + message + code, ignoring sources (as before).Verification
--all-targets --all-features -D warnings, rustfmt, 28 doc testscode()accessor, code-aware equality, source-ignoring equalityMigration (also in CHANGELOG)
fn revision()(and the shadow field, if unused) from aggregates; read revisions fromLoadedAggregate.EventStoreError::Backend(msg)constructions withEventStoreError::backend(msg); match withEventStoreError::Backend { .. }.https://claude.ai/code/session_01Wq5AdnNWVKWRTS34g6A3Bu