Skip to content

doctrine: enforce handler service pattern (ADR 003)#115

Merged
absoludity merged 3 commits into
masterfrom
doctrine-test-handlers
Mar 19, 2026
Merged

doctrine: enforce handler service pattern (ADR 003)#115
absoludity merged 3 commits into
masterfrom
doctrine-test-handlers

Conversation

@absoludity

@absoludity absoludity commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

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 returning Acknowledgement.

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 under domain/services/. Fixing this was a prerequisite for handler discovery to work at all, since handlers also live in domain/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

@absoludity absoludity self-assigned this Mar 19, 2026
@absoludity absoludity marked this pull request as ready for review March 19, 2026 00:19
@absoludity absoludity requested a review from monkeypants March 19, 2026 00:20
@absoludity absoludity force-pushed the doctrine-test-repository branch from c9549b4 to 42c7ead Compare March 19, 2026 22:22
@absoludity absoludity changed the base branch from doctrine-test-repository to master March 19, 2026 22:22
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.
@absoludity absoludity force-pushed the doctrine-test-handlers branch from 57ee3df to b77faae Compare March 19, 2026 22:23
@absoludity absoludity merged commit e48c55f into master Mar 19, 2026
6 checks passed
@absoludity absoludity deleted the doctrine-test-handlers branch March 19, 2026 22:24
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 handler service doctrine tests (ADR 003)

1 participant