doctrine: enforce handler service pattern (ADR 003)#115
Merged
Conversation
7 tasks
c9549b4 to
42c7ead
Compare
Doctrine tests now prevent the superseded next_action() orchestration pattern from re-entering use cases, and enforce that handler protocol methods return Acknowledgement — the uniform handoff signal introduced by ADR 003. The parser previously looked for service protocols in a services/ directory that does not exist in any bounded context. Services live under domain/services/ per ADR 001, so the fix also makes handler discovery possible for the first time.
57ee3df to
b77faae
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 #112
ADR 003 established handler services as the canonical pattern for cross-BC orchestration: use cases recognise domain conditions and hand off to injected handlers, rather than computing next actions themselves. Without doctrine enforcement, nothing prevented
next_action()from creeping back into use cases, and nothing guaranteed that handler protocols held up their end of the contract by returningAcknowledgement.The parser also had a latent bug: service protocol discovery pointed at a
services/directory that does not exist in any bounded context — per ADR 001 they live underdomain/services/. Fixing this was a prerequisite for handler discovery to work at all, since handlers also live indomain/services/.The "handler methods must accept an entity-typed argument" criterion from the issue is omitted. Cross-BC handlers legitimately use primitives (e.g.
endpoint_id: str) because the entity being handed off may belong to a different bounded context; forcing an entity parameter type would encode an unworkable coupling assumption.Fixes #92