doctrine: repository protocols SHOULD bind to at most one entity type#112
Merged
Conversation
Collaborator
Author
|
I've put this one in draft after realising that it really needs the migration of ADR 001 to be complete first (since it's currently treating julee.domain as a bounded context, which is wrong). |
071520a to
00de80b
Compare
Collaborator
Author
|
Fixed the ceap migration separately and rebased this one on that. |
262ef46 to
772c428
Compare
Switch the repository protocol binding test back to the directory-scanning approach now that CEAP has migrated to contrib/ceap/domain/models/ — the structure that prevented this approach from working before was the CEAP content being at julee/domain/ without a proper domain/models/ subdirectory. Also update parse_bounded_context to use domain/models/ and domain/repositories/ (the canonical ADR 001 structure) rather than the flat entities/ and repositories/ paths, so that both the doctrine test and any tooling using parse_bounded_context see the correct entity and repository lists for each bounded context.
…julee.domain BaseRepository is generic framework infrastructure — nothing CEAP-specific about it. With the CEAP content now in contrib/ceap, julee/domain/ was left holding only base.py and empty __init__ files. Move it to julee.repositories.base alongside the concrete implementations that depend on it, and remove the now-empty domain package entirely.
c9549b4 to
42c7ead
Compare
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.
Follows #114.
The doctrine has no enforcement of aggregate boundary separation at the repository level. A repository that references multiple domain entity types is taking on multiple responsibilities — it's a "god repository" — but nothing was catching this.
The primary entity type is structurally declared via
BaseRepository[T], which makes the check reliable without heuristics. Incidental references to Enums, Status classes, and primitives are excluded automatically by intersecting against the bounded context's actual entity list, so only genuine foreign-aggregate references are flagged.Repositories that don't inherit from
BaseRepository[T]are skipped — their primary type can't be determined structurally and they may have legitimate reasons for broader signatures.Fixes #99