Desks implement evoq_command_handler (evoq 1.31.1) #4
Loading…
Reference in a new issue
No description provided.
Delete branch "mercurius/4-evoq-command-handler"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (alignment): every mcl-bookclub desk declares evoq's
evoq_command_handlerbehaviour, so the rule, the wiring and the dispatch read the same in every slice and a miswired desk fails a test instead of its first command.Refs reckon-db-org/evoq#3, macula-services/mcl-bookclub-phoenix#4 (step 4 of that package).
What changes
rebar.config:{evoq, ">= 1.31.1 and < 2.0.0"}. 1.31.1 is the first release on hex.pm that carries the behaviour. The repo's existing constraint style is kept.maybe_*desks:-behaviour(evoq_command_handler), withcommand_module/0.handle/2is unchanged.handle_from_map/2andhandled/2glue is gone, becauseevoq_command_handler:execute/3builds the typed command.dispatch/1is one call toevoq_command_handler:dispatch/3. It still validates before dispatch: the library runsvalidate/1and returns its refusal without reaching the router. It still stamps the timestamp metadata and keeps the same store options.command_handlers/0, keyed by each command module'scommand_type/0.execute/2keeps the lifecycle guard, then callsevoq_command_handler:route/3.test/command_handlers_tests.erl:evoq_command_handler:check_handlers/1, one test per aggregate.Behaviour notes
unknown_command. The guard runs first, as in the evoq#3 design.from_map/1, because evoq prefers it when the command module exports it. All 9from_map/1only pass their fields tonew/1, so behaviour is unchanged.Proof (msi00, CI image
macula-ci-otp@sha256:dd2ba6eb…, OTP 28.4.3)b745505, evoq 1.31.1 from hex.pm ({vsn,"1.31.1"}in_build):rebar3 lintrc 0,rebar3 eunitrc 0 (all 125 tests passed),rebar3 dialyzerrc 0.maybe_plan_party:command_module/0returns the wrong module: killed bycommand_handlers_tests.retire_book_v1entry is dropped frombook_aggregate:command_handlers/0: killed by 3procure_book_testscases.member_aggregate: killed byregister_member_tests:an_unregistered_member_refuses_every_command.