docs: add architecture and best-practices reference guides#20
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds two new reference guides under docs/ to describe the seedwork’s intended service architecture and DDD/hexagonal best practices, including diagrams and decision guides for events vs tasks.
Changes:
- Added a DDD & Hexagonal Architecture best-practices guide with component definitions and recommended flows.
- Added a service architecture building-blocks guide covering outbox/UoW/idempotency/retry/DLQ/observability, with Mermaid diagrams.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| docs/best-practices.md | New reference guide for DDD/hexagonal rules, domain/application components, and event/task decisioning. |
| docs/architecture.md | New reference guide describing standard service building blocks and infrastructure mechanisms (outbox, UoW, idempotency, retry/DLQ, observability). |
Comments suppressed due to low confidence (1)
docs/best-practices.md:345
- This section documents a
Maybetype withjust(...)/nothing()helpers, but no such type/helpers exist in the repository; queries returnNonewhen absent. Please align this section with the actual API (or add the missingMaybeimplementation), otherwise readers will look for APIs that aren't there.
### 3.6 Maybe
`Maybe` is the **value-based absence contract for queries**.
#### Key points
- Two states: `just(value)` (found) and `nothing()` (absent).
- Replaces `null`/`None` returns with an explicit type that forces the caller to handle absence.
- Use `nothing()` for both not-found and unauthorized — identical response, no information leak.
#### Do
- Check `isNothing()` at the entry point before accessing the value.
#### Don't
- Use `Maybe` for command results — that is `Result`'s responsibility.
- Use `just(null)` — if the value is absent, return `nothing()`.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Replace Maybe<TResult>/just/nothing with TResult | None to match QueryBus.ask and QueryHandler.handle signatures - Remove non-existent validate() hook and ValidationErrors; Commands and Queries are plain frozen dataclasses, domain validation lives in __post_init__ of ValueObject and Entity - Fix Result.fail → Result.failed throughout - Remove validation step from bus sequence diagrams and update CommandBus stack label accordingly - Fix camelCase identifiers (findById, correlationId, causationId, occurredAt) to snake_case matching the Python API - Fix rollback wording: "handlers did not execute" → "their effects are not persisted" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Command and Query domain-value validation happens in __post_init__ when the object is constructed by the API, before dispatch()/ask() is called. Moved the validation note from the bus to the API participant in both the write and read operation diagrams. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
docs/architecture.md: describes the standard service building blocks (API, Database, Subscriber, DLQ Subscriber, Publisher, Scheduler, Worker) with Mermaid diagrams and infrastructure mechanisms (outbox pattern, unit of work, idempotency, retry/DLQ, observability).docs/best-practices.md: concise DDD & Hexagonal Architecture reference covering domain components (Entity, Value Object, Aggregate, Domain Event, Domain Service, Repository, Ports), application components (Command/Query/Handler, UoW, Result, Maybe), and the domain event vs integration event vs background task decision guide.Test plan
make pre-commit)🤖 Generated with Claude Code