Skip to content

Breaking rc pair: drop Aggregate::revision, consolidate EventStoreError (0.3.0-rc.7) - #8

Merged
codeitlikemiley merged 1 commit into
mainfrom
rc-breaking-pair
Aug 23, 2026
Merged

Breaking rc pair: drop Aggregate::revision, consolidate EventStoreError (0.3.0-rc.7)#8
codeitlikemiley merged 1 commit into
mainfrom
rc-breaking-pair

Conversation

@codeitlikemiley

Copy link
Copy Markdown
Owner

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() removed

The 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 shadow revision field 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 read loaded.revision), and the three docs pages that taught the pattern.

EventStoreError consolidated + machine-readable codes

  • 10 variants → 5: each X(String) / XWithSource { .. } pair merges into one struct variant X { message, code, source }.
  • Construction via per-kind constructor fns (backend(..), backend_with_source(..), …) so all ~290 call sites stayed one-expression; with_code / with_source builders compose.
  • New code: Option<String> + EventStoreError::code(): SQLSTATE (Postgres), server errno (MySQL), extended result code (SQLite) — transport-vs-domain classification no longer requires string matching.
  • Display strings unchanged; PartialEq compares kind + message + code, ignoring sources (as before).

Verification

  • Full suite green offline and against fresh disposable Postgres 17 + MySQL 8 containers (validates the code-populating mappers live)
  • clippy --all-targets --all-features -D warnings, rustfmt, 28 doc tests
  • CLI suite (26) + fullstack drift check + docs checks (nav + version snippets aligned at rc.7)
  • counter-app example compiled against the changed library via CI's exact patch-config invocation
  • New test coverage: code() accessor, code-aware equality, source-ignoring equality

Migration (also in CHANGELOG)

  • Delete fn revision() (and the shadow field, if unused) from aggregates; read revisions from LoadedAggregate.
  • Replace EventStoreError::Backend(msg) constructions with EventStoreError::backend(msg); match with EventStoreError::Backend { .. }.

https://claude.ai/code/session_01Wq5AdnNWVKWRTS34g6A3Bu

…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
@codeitlikemiley
codeitlikemiley merged commit 16062c9 into main Aug 23, 2026
2 checks passed
@codeitlikemiley
codeitlikemiley deleted the rc-breaking-pair branch August 23, 2026 07:19
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