Skip to content

doctrine: repository protocols SHOULD bind to at most one entity type#112

Merged
absoludity merged 5 commits into
masterfrom
doctrine-test-repository
Mar 19, 2026
Merged

doctrine: repository protocols SHOULD bind to at most one entity type#112
absoludity merged 5 commits into
masterfrom
doctrine-test-repository

Conversation

@absoludity

@absoludity absoludity commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

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

@absoludity absoludity self-assigned this Mar 18, 2026
@absoludity absoludity requested a review from monkeypants March 18, 2026 03:41
@absoludity absoludity marked this pull request as draft March 18, 2026 03:41
@absoludity

Copy link
Copy Markdown
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).

@absoludity absoludity changed the base branch from doctrine-test-5 to ceap-migration March 18, 2026 05:28
@absoludity absoludity force-pushed the doctrine-test-repository branch from 071520a to 00de80b Compare March 18, 2026 05:39
@absoludity

Copy link
Copy Markdown
Collaborator Author

Fixed the ceap migration separately and rebased this one on that.

@absoludity absoludity marked this pull request as ready for review March 18, 2026 05:41
@absoludity absoludity changed the base branch from ceap-migration to master March 19, 2026 22:22
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.
@absoludity absoludity force-pushed the doctrine-test-repository branch from c9549b4 to 42c7ead Compare March 19, 2026 22:22
@absoludity absoludity merged commit a927951 into master Mar 19, 2026
6 checks passed
@absoludity absoludity deleted the doctrine-test-repository branch March 19, 2026 22:23
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.

Add one-repository-per-entity doctrine test

1 participant