host_bookclub parity with mcl-bookclub, and an evoq behaviour for command handlers #4
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 (parity): mcl-bookclub-phoenix (Elixir) carries the same domain, slices and evoq use as mcl-bookclub (Erlang, the leading implementation), so either repo shows the method in full; and every command handler in both implements the fitting evoq behaviour.
Raf, 2026-12-01: "In mcl-bookclub, i see that the implementation is A LOT more complete than in mcl-bookclub-phoenix (e.g. host_bookclub)" and "shouldn't command handlers (e.g. maybe_procure_book) implement some kind of evoq behaviour? (maybe evoq_command_handler?)". mcl-bookclub (Erlang) leads; mcl-bookclub-phoenix is just as important; mcl-bookclub-gleam is postponed.
Done when:
maybe_<command>handler should implement (an existing one, or none exists and what that would mean), and what mcl-bookclub does today.Gap table: mcl-bookclub (Erlang, leading) vs mcl-bookclub-phoenix (Elixir)
What was compared:
mcl-bookclubmain0ce055a47e96d9c51328ee7dd8e47f6d20f322ca(E) andmcl-bookclub-phoenixmaina93a8b7836e9745ed5bc422317b87dbf8110c64e(P). I read every module, test and repository-level file on both sides.file:lineis relative to these prefixes:host/apps/host_bookclub/src/apps/host_bookclub/lib/host_bookclub/prj/apps/project_bookclub/src/apps/project_bookclub/lib/project_bookclub/qry/apps/query_bookclub/src/apps/query_bookclub/lib/query_bookclub/fac/apps/mcl_bookclub/src/apps/mcl_bookclub_phoenix/lib/mcl_bookclub_phoenix/web/apps/mcl_bookclub_phoenix_web/lib/mcl_bookclub_phoenix_web/Status values: same (same behaviour, idiom aside), thinner (P exists but lacks something E has), missing (no P counterpart), moved (P puts it in another app, on purpose and with a written reason).
Summary
The two repos have the same domain: the same 4 aggregates, the same 8 command slices, the same events and fields, the same policy, emitters, facts, projections and queries. Every event struct has exactly the fields of its Erlang record (checked field by field). Where P falls short of E is in the following areas:
{command}_apimodules. P has none. P's LiveView mints ids and enriches the club name inline (web/admin_live.ex:210-334).evoq_stateand have noto_map/from_map. P's aggregates have nosnapshot/from_snapshot. evoq only snapshots whensnapshot/1is exported (reckon-db-org/evoq src/evoq_aggregate.erl:757), so a P aggregate never snapshots: every load replays its whole stream.from_map/1or typed fields (@type t :: %__MODULE__{}).dispatch. E dispatches a built command (dispatch(Cmd)) and stamps a timestamp on the evoq command (evoq_command:new/5). P'sdispatch/1takes a raw params map and builds the command inside. It also usesevoq_command:new/4, so there is no timestamp metadata.store_test_, withhost/test/host_bookclub_test_store.erl). It also tests the policy firing on the 5th registration, emitters publishing (meck on macula), the admin HTTP API, projection replay idempotence, the PRJ/QRY schema contract, the department boundaries, and 23 service/image/runtime contract tests. P's host tests are pure only: none dispatches a command through a store. P has 0 tests for the policy's dispatch, for an emitter's publish, or for the admin over HTTP.@moduledoc falseand carry their documentation as#comments, somix docsrenders nothing. P has 2@specs in total, against 286-specs in E.fac/mcl_bookclub_admin.erl,POST /api/{plural}/{verb},GET /api/{plural}/:id) does not exist in P. P has a LiveView instead.mcl_om ~> 1.6,macula ~> 18.0(rebar.config:42,48). P usesmcl_om ~> 1.4,macula ~> 16.0(apps/mcl_bookclub_phoenix/mix.exs:37-38): two macula majors behind, older wire.config/sys.config.src:15,scripts/health.sh)scripts/start.sh:13-24)deploy/docker-compose.ymlguides/(admin_ui, event_delivery)wall.json(the event-storming wall) and itswall-treeworkflow.github/workflows/ci.yml, which runs on GitHub and pulls a ghcr.io image. There is no.forgejo/workflow. Forge Actions are held on moved repos (forge-actions-off-until-ported), so P has no running CI today.A. Aggregates, state, status (host)
host/bookclub_aggregate.erl:15host/bookclub_aggregate.ex:1snapshot/1/from_snapshot/1(E :50-54). P also has an extrastream_id/1(:61) that nothing callshost/book_aggregate.erl:7host/book_aggregate.ex:1stream_id/1:44host/member_aggregate.erl:8host/member_aggregate.ex:1host/reading_aggregate.erl:8host/reading_aggregate.ex:1host/bookclub_state.erl:11host/bookclub_state.ex:1evoq_state(E :13). It has noto_map/from_map(E :61-84), no getters (E :86-104), no typespecs. Pevent_data/1returns the raw event unstripped (P :51 vs E :114-117)host/book_state.erl:6host/book_state.ex:1host/member_state.erl:7host/member_state.ex:1host/reading_state.erl:8host/reading_state.ex:1host/bookclub_status.erl:1,host/bookclub_status.hrl:9host/bookclub_status.ex:1labels/0in P,flag_map/0in E)host/book_status.erl:8host/book_status.ex:1host/member_status.erl:1host/member_status.ex:1host/reading_status.erl:1host/reading_status.ex:1B. Command slices (host), 8 desks × command / event / handler / API
In every row, the P command and event modules declare
@behaviour :evoq_command/:evoq_eventwith@impl, as E's do.host/initiate_bookclub/initiate_bookclub_v1.erl:8host/initiate_bookclub/initiate_bookclub_v1.ex:1from_map/1passes a strayclub_namekey intonew/1(:55); it is ignored, but it is a copy-paste warthost/initiate_bookclub/bookclub_initiated_v1.erl:7host/initiate_bookclub/bookclub_initiated_v1.ex:1from_map/1(E :51-58) and no getters (E :61-74); the type is untypedhost/initiate_bookclub/maybe_initiate_bookclub.erl:9host/initiate_bookclub/maybe_initiate_bookclub.ex:1dispatch(params)builds the command inside (:47); Edispatch(Cmd)(:57). P has no timestamp metadata (evoq_command:new/4:51 vs E/5:66-69)host/initiate_bookclub/initiate_bookclub_api.erl:8club_idwhen absent (E :15-17). In P this lives inweb/admin_live.ex:210-220host/archive_bookclub/archive_bookclub_v1.erl:6host/archive_bookclub/archive_bookclub_v1.ex:1host/archive_bookclub/bookclub_archived_v1.erl:10host/archive_bookclub/bookclub_archived_v1.ex:1from_map/getters (E :65-98)host/archive_bookclub/maybe_archive_bookclub.erl:11host/archive_bookclub/maybe_archive_bookclub.ex:1state.club_idetc. directly (:48-51), where E goes through state getters (:48-51)host/archive_bookclub/archive_bookclub_api.erl:5host/plan_party/plan_party_v1.erl:6host/plan_party/plan_party_v1.ex:1host/plan_party/party_planned_v1.erl:7host/plan_party/party_planned_v1.ex:1from_map/getters (E :45-63)host/plan_party/maybe_plan_party.erl:7host/plan_party/maybe_plan_party.ex:1state.parties_planneddirectly (:43)host/plan_party/plan_party_api.erl:4host/register_member/register_member_v1.erl:8host/register_member/register_member_v1.ex:1host/register_member/member_registered_v1.erl:8host/register_member/member_registered_v1.ex:1from_map/getters (E :52-76)host/register_member/maybe_register_member.erl:8host/register_member/maybe_register_member.ex:1host/register_member/register_member_api.erl:1member_id. The club-name enrichment is in E's admin (fac/mcl_bookclub_admin.erl:100-108) and in P's LiveView (web/admin_live.ex:325-334)host/unregister_member/unregister_member_v1.erl:8host/unregister_member/unregister_member_v1.ex:1host/unregister_member/member_unregistered_v1.erl:9host/unregister_member/member_unregistered_v1.ex:1from_map/getters (E :60-93)host/unregister_member/maybe_unregister_member.erl:9host/unregister_member/maybe_unregister_member.ex:1host/unregister_member/unregister_member_api.erl:1host/procure_book/procure_book_v1.erl:6host/procure_book/procure_book_v1.ex:1host/procure_book/book_procured_v1.erl:5host/procure_book/book_procured_v1.ex:1from_map/getters (E :55-85)host/procure_book/maybe_procure_book.erl:6host/procure_book/maybe_procure_book.ex:1host/procure_book/procure_book_api.erl:5book_id(E :10-12)host/retire_book/retire_book_v1.erl:8host/retire_book/retire_book_v1.ex:1host/retire_book/book_retired_v1.erl:9host/retire_book/book_retired_v1.ex:1from_map/getters (E :68-107)host/retire_book/maybe_retire_book.erl:9host/retire_book/maybe_retire_book.ex:1host/retire_book/retire_book_api.erl:1host/start_reading/start_reading_v1.erl:9host/start_reading/start_reading_v1.ex:1host/start_reading/reading_started_v1.erl:7host/start_reading/reading_started_v1.ex:1from_map/getters (E :47-70)host/start_reading/maybe_start_reading.erl:8host/start_reading/maybe_start_reading.ex:1host/start_reading/start_reading_api.erl:1reading_idhost/finish_reading/finish_reading_v1.erl:8host/finish_reading/finish_reading_v1.ex:1host/finish_reading/reading_finished_v1.erl:10host/finish_reading/reading_finished_v1.ex:1from_map/getters (E :61-94)host/finish_reading/maybe_finish_reading.erl:9host/finish_reading/maybe_finish_reading.ex:1host/finish_reading/finish_reading_api.erl:1C. Policy, emitters, facts, supervision
host/on_member_registered_v1_maybe_plan_party/on_member_registered_v1_maybe_plan_party.erl:21host/on_member_registered_v1_maybe_plan_party.ex:1MaybePlanParty.dispatch(%{club_id: ...}):59), where E buildsplan_party_v1:new/1first (:52-62). P logs a string, E a structured map (:65-67)host/emit_member_registered_v1_to_mesh/emit_member_registered_v1_to_mesh.erl:19fac/emit_member_registered_v1_to_mesh.ex:1fac/supervisor.ex:6-12). The logic is the samehost/emit_book_procured_v1_to_mesh/emit_book_procured_v1_to_mesh.erl:1fac/emit_book_procured_v1_to_mesh.ex:1host/emit_book_retired_v1_to_mesh/emit_book_retired_v1_to_mesh.erl:1fac/emit_book_retired_v1_to_mesh.ex:1host/mcl_bookclub_facts.erl:18fac/facts.ex:1host/host_bookclub_sup.erl:16-46(policy + 3 emitters)host/application.ex:14-27(policy) +fac/supervisor.ex:28-36(emitters)host/host_bookclub_app.erl:1host/application.ex:1D. Facade (service)
fac/mcl_bookclub_service.erl:14fac/service.ex:1infoversion is"0.1.0"(:17), while the umbrella is0.2.0(mix.exs:7). E pins info = app vsn by test (mcl_bookclub_service_tests.erl:52)fac/mcl_bookclub_store.erl:13fac/event_store.ex:1ensure/2for tests (E :34-36)fac/mcl_bookclub_app.erl:18-20fac/application.ex:15-18fac/mcl_bookclub_get_bookclub_by_id.erl:9fac/get_bookclub_by_id_handler.ex:1fac/mcl_bookclub_sup.erl:16-24(admin listener)fac/supervisor.ex:28-36(emitters)web/application.ex)POST /api/{plural}/{verb},GET /api/{plural}/:id)fac/mcl_bookclub_admin.erl:30-34, 63-93live "/"(web/router.ex:19)apps/mcl_bookclub/priv/admin/index.html:1,app.js:6-55web/admin_live.ex:46-107,admin_live.html.heex:1prj/bookclub_changed.ex:1)fac/mcl_bookclub_admin.erl:137-147web/endpoint.ex:1+config/runtime.exsE. Projections (PRJ) and queries (QRY)
All 8 projections are
evoq_event_handlerwithreplay_policy() -> deliveron both sides, and both use idempotentINSERT OR REPLACEwithevent_idandversionon the row.prj/bookclub_read_model_store.erl:27-60prj/bookclub_read_model_store.ex:19-52prj/bookclub_initiated/bookclub_initiated_v1_to_sqlite_clubs.erl:22prj/bookclub_initiated/bookclub_initiated_v1_to_sqlite_clubs.ex:14BookclubChanged)prj/bookclub_archived/bookclub_archived_v1_to_sqlite_clubs.erl:12prj/bookclub_archived/bookclub_archived_v1_to_sqlite_clubs.ex:14prj/member_registered/member_registered_v1_to_sqlite_members.erl:9prj/member_registered/member_registered_v1_to_sqlite_members.ex:11prj/member_unregistered/member_unregistered_v1_to_sqlite_members.erl:9prj/member_unregistered/member_unregistered_v1_to_sqlite_members.ex:11prj/book_procured/book_procured_v1_to_sqlite_books.erl:9prj/book_procured/book_procured_v1_to_sqlite_books.ex:11prj/book_retired/book_retired_v1_to_sqlite_books.erl:9prj/book_retired/book_retired_v1_to_sqlite_books.ex:11prj/reading_started/reading_started_v1_to_sqlite_readings.erl:10prj/reading_started/reading_started_v1_to_sqlite_readings.ex:11prj/reading_finished/reading_finished_v1_to_sqlite_readings.erl:10prj/reading_finished/reading_finished_v1_to_sqlite_readings.ex:12prj/project_bookclub_sup.erl:1prj/application.ex:1qry/bookclub_query_store.erl:1qry/bookclub_query_store.ex:1qry/get_bookclub_by_id/get_bookclub_by_id.erl:11qry/get_bookclub_by_id/get_bookclub_by_id.ex:10qry/get_member_by_id/get_member_by_id.erl:8qry/get_member_by_id/get_member_by_id.ex:11qry/get_book_by_id/get_book_by_id.erl:8qry/get_book_by_id/get_book_by_id.ex:11qry/get_reading_by_id/get_reading_by_id.erl:7qry/get_reading_by_id/get_reading_by_id.ex:10qry/get_readings_by_member/get_readings_by_member.erl:9qry/get_readings_by_member/get_readings_by_member.ex:12F. Tests
E test paths are
apps/<app>/test/<x>_tests.erl; P test paths areapps/<app>/test/<x>_test.exs. "store" means the case dispatches through a real reckon-db store; "pure" means it callshandle/2or the module directly.host_bookclub/test/initiate_bookclub_tests.erl:12(store),:20(pure),:112(CMD mesh boundary)host_bookclub/test/initiate_bookclub_test.exs:9-44(pure)host_bookclub/test/archive_bookclub_tests.erl:11(store),:21host_bookclub/test/archive_bookclub_test.exs:20-75(pure)host_bookclub/test/plan_party_tests.erl:11(store),:19host_bookclub/test/plan_party_test.exs:19-69(pure)host_bookclub/test/register_member_tests.erl:11(store),:22host_bookclub/test/register_member_test.exs:14-103,unregister_member_test.exs:26-66(pure)host_bookclub/test/procure_book_tests.erl:11(store),:22host_bookclub/test/procure_book_test.exs:14-111,retire_book_test.exs:23-63(pure)host_bookclub/test/start_reading_tests.erl:13(store),:24host_bookclub/test/start_reading_test.exs:15-85,finish_reading_test.exs:22-71(pure)host_bookclub/test/status_tests.erl:12host_bookclub/test/statuses_test.exs:13-29host_bookclub/test/on_member_registered_v1_maybe_plan_party_tests.erl:13(store: the 5th registration plans a party, 4 plan none)host_bookclub/test/on_member_registered_v1_maybe_plan_party_test.exs:10-20(callbacks only)host_bookclub/test/emit_member_registered_v1_to_mesh_tests.erl:12(store + meck: each of the 3 emitters publishes its fact),:20mcl_bookclub_phoenix/test/facts_contract_test.exs:52-62(callbacks only)host_bookclub/test/admin_api_tests.erl:9(store),:19_apimoduleshost_bookclub/test/host_bookclub_test_store.erl:1mcl_bookclub/test/mcl_bookclub_admin_tests.erl:12mcl_bookclub_phoenix_web/test/admin_live_test.exs:11-65(task table + run_task refusals; no LiveView render or event test)Phoenix.LiveViewTestmount/click testmcl_bookclub/test/mcl_bookclub_service_tests.erl:27-379(23 cases)mcl_bookclub_phoenix/test/service_test.exs:8-75(6) +event_store_test.exs:17-75(5)project_bookclub/test/bookclub_initiated_v1_to_sqlite_clubs_tests.erl:14(store),:23(schema contract)project_bookclub/test/projections_test.exs:52-85project_bookclub/test/book_procured_v1_to_sqlite_books_tests.erl:13,member_registered_…_tests.erl:13,reading_started_…_tests.erl:13(store)project_bookclub/test/projections_test.exs:116, 176, 228(handler called directly)project_bookclub/test/bookclub_initiated_v1_to_sqlite_clubs_tests.erl(the_prj_department_writes_no_status_literal)project_bookclub/test/division_boundary_test.exs:22query_bookclub/test/get_bookclub_by_id_tests.erl:10,:19(QRY imports no framework/mesh)query_bookclub/test/get_bookclub_by_id_test.exs:30-47query_bookclub/test/get_member_by_id_tests.erl:10,get_book_by_id_tests.erl:10query_bookclub/test/get_member_by_id_test.exs:27-47,get_book_by_id_test.exs:27-48query_bookclub/test/get_reading_by_id_tests.erl:11query_bookclub/test/get_reading_by_id_test.exs:27-65,get_readings_by_member_test.exs:27-59G. Repository, release, ops
rebar.config:42mcl_om ~> 1.6,:48macula ~> 18.0,:54evoq >= 1.26.1apps/mcl_bookclub_phoenix/mix.exs:37mcl_om ~> 1.4,:38macula ~> 16.0,:46evoq ~> 1.27;apps/host_bookclub/mix.exs:30evoq ~> 1.24config/sys.config.src:13-15,scripts/health.sh:1scripts/start.sh:13-24rel/env.sh.eexrefuses to start withoutMCL_COOKIEdeploy/docker-compose.ymlguides/admin_ui.md,guides/event_delivery.mdwall.json+.github/workflows/wall-tree.ymlarchitecture/README.md,c4_diagrams.py.github/workflows/*(GitHub).github/workflows/ci.yml(GitHub only, ghcr image); no.forgejo/rebar.config(xref, dialyzer).credo.exs,.formatter.exs,.dialyzer_ignore.exsH. Proposed build order for step 3 (one PR per few slices)
HostBookclub.TestStorefixture (port ofhost_bookclub_test_store.erl), with the initiate, archive and plan_party store cases and the CMD-mesh boundary test. Every later PR uses the fixture.@behaviour :evoq_state,to_map/from_mapand@specs on the 4 state modules.snapshot/from_snapshoton the 4 aggregates, with a round-trip test each.from_map/1, typed@type tand@specs on the 9 events.*_apientry points in their slices; the LiveView calls them instead of minting and enriching inline. The handlers'dispatch/1takes the built command (%XxxV1{}) and stamps the timestamp, as in E. The policy gets its own slice folder and builds the command first. Store cases for member, book and reading.:macula), projection replay idempotence, the schema contract, the QRY boundary and non-binary ids.@moduledoctext instead of@moduledoc falseacross the code. The mcl_om/macula bump to E's line. Health on a Unix socket and the cookie, if the dependency bump makes them free.Not built without a ruling: a
.forgejo/CI port (the package does it only if the Supervisor rules it), theguides/,deploy/andwall.jsoncopies, and anything step 2 leaves to a design change.Which evoq behaviour should a
maybe_<command>handler implement?Short answer: none of evoq's existing behaviours fits, and evoq has no command-handler behaviour.
git log --all -S evoq_command_handlerover reckon-db-org/evoq is empty, so there never was one. evoq's own guides list the handler as the one desk file with no behaviour. A handler contract would be a new evoq behaviour, which is a design change for Raf. I stop step 2 here; nothing has been built.Base: reckon-db-org/evoq main
bb1be23(1.30.8).1. What mcl-bookclub does today
Each
maybe_<command>module is a plain module with three exports and no-behaviour. Example:mcl-bookclub apps/host_bookclub/src/procure_book/maybe_procure_book.erl.handle_from_map/2(:12-16). The aggregate calls it.book_aggregate:execute/2routes oncommand_typeand callsguarded(State, Payload, fun maybe_procure_book:handle_from_map/2)(book_aggregate.erl:22-33). evoq calls the aggregate atevoq src/evoq_aggregate.erl:298(Module:execute(AggState, Command#evoq_command.payload)).handle/2(:24-46). This is the business rule: given the aggregate state and the typed command, it returns{ok, [EventMap]} | {error, Reason}. It is pure.dispatch/1(:56-71). It validates, buildsevoq_command:new/5forbook_aggregateand the book's stream id, and callsevoq_command_router:dispatch/2with the store, adapter and consistency. It is the write entry point.The same three-part shape is copied in all 8 desks of both repos. mcl-bookclub-phoenix has the same three functions, again with no behaviour (
host_bookclub/lib/host_bookclub/procure_book/maybe_procure_book.ex:15-72).2. evoq's behaviours, checked one by one
maybe_handler?evoq_commandcommand_type/0, new/1, to_map/1, optionalvalidate/1, from_map/1(src/evoq_command.erl:26-34)*_v1command modules already implement it. A handler is not a commandevoq_aggregateinit/1, execute/2, apply/2, optionalstate_module/0, snapshot/1, from_snapshot/1(src/evoq_aggregate.erl:34-46)handle/2is one clause of whatexecute/2does, and the aggregate delegates to it. A handler declaringevoq_aggregatewould become its own aggregate, with its own state and stream. The aggregate is the consistency boundary that 2-3 desks share (bookclub_aggregate.erl:32-37routes three desks)evoq_decisioncontext/1, decide/2, optionalretry_budget/0, boundary_key/1, init_decision_model/0, apply_context_event/2(src/evoq_decision.erl:94-128)decide(ContextEvents, Command)has the same shape ashandle(State, Command), but a decision runs throughevoq_decision_runtime:dispatch/3(src/evoq_decision_runtime.erl:63). It locks on a tag-filter context and appends to the DCB pseudo-stream<<"_dcb">>(:53), not to the aggregate's stream. evoq says so itself: "Mixed-mode use cases (aggregate streams + DCB sharing tags) are not supported" (src/evoq_decision.erl:39-44). Moving the desks there would take their events off the club, book, member and reading streams. It fits cross-cutting checks such as uniqueness and allocation, not these desksevoq_event_handler,evoq_process_manager,evoq_projectionsrc/evoq_event_handler.erl:48-64,src/evoq_process_manager.erl:90-105,src/evoq_projection.erl:67-89evoq_emitter,evoq_listener,evoq_responder,evoq_requestersrc/evoq_emitter.erl:25-37,src/evoq_listener.erl:25-34,src/evoq_responder.erl:24-37,src/evoq_requester.erl:23-29maybe_X:dispatch/1(guides/integration_actors.md:93)evoq's own documentation leaves the handler without a contract:
evoq_command, eventevoq_event, factevoq_fact, emitterevoq_emitter, responderevoq_responder). It listsmaybe_initiate_venture.erl # Handlerwith none, like the API entry point (guides/integration_actors.md:243-251).guides/event_envelope.md:304,guides/bit_flags.md:328-331.mcl-corpus GLOSSARY.md:150-155. Its stated return,{ok, Event} | {error, Reason}, has drifted from the{ok, [Event]}that the code returns.3. Why the missing contract matters
Without a behaviour, every service has grown its own handler shape:
handle_from_map/2+handle(State, Cmd)+dispatch(Cmd)(mcl-chess apps/play_games/src/archive_game/maybe_archive_game.erl:18-35)handle_payload/2+handle(State, Cmd)+dispatch(Cmd)(apps/guide_card_lifecycle/lib/guide_card_lifecycle/claim_card/maybe_claim_card.ex:16-50)handle_from_map/1+handle(Cmd), with no state (apps/guide_realm_lifecycle/lib/guide_realm_lifecycle/admit_realm_member/maybe_admit_realm_member.ex:24-81)handle_from_map/1+handle(Cmd)+dispatch(params)(apps/guide_board_lifecycle/lib/guide_board_lifecycle/place_text/maybe_place_text.ex:10-31)The forge clones hold about 90 Erlang and about 110 Elixir
maybe_*modules (realm 48, kanban 42, whiteboard 12, ...). Each one copies the samedo_dispatchblock:evoq_command:new+evoq_command_router:dispatchwith the store, adapter and consistency. Nothing checks at compile time that a desk exports what its aggregate calls: a typo infun maybe_x:handle_from_map/2shows up only when that command first runs.4. What a new behaviour would be (a design to rule on; not built)
Alongside it, an optional
evoq_aggregatecallbackcommand_handlers() -> #{CommandType :: atom() => module()}would let an aggregate routeexecute/2without per-command clauses. The bookclub aggregates keep their lifecycle guard (archived, retired, unregistered, finished) and call the handler only after it.What it would cost:
evoq_emitter's compile-time-only contract, which nothing in evoq calls:src/evoq_emitter.erl:25-37, no caller offact_module/0insrc/)guides/integration_actors.mdandguides/aggregates.mdFor mcl-bookclub (E) and mcl-bookclub-phoenix (P) it means:
handle_from_map/2,handled/2anddo_dispatch/1The ruling needed from Raf:
evoq_command_handlerto evoq (name and callbacks as above, or his own), and have both bookclubs adopt it (step 4 of #4).5. Side findings on "the fitting evoq behaviour" (both repos)
evoq_state(src/evoq_state.erl:36-54). P's do not. That one fits, and it is in the parity build (gap table §A).evoq_event_handler, which is right: it is the behaviour evoq's runtime subscribes. They could also declare the compile-timeevoq_emitter, but that needs oneevoq_factmodule per fact, where todaymcl_bookclub_factsis one module for three. I am not proposing it without a ruling.evoq_event_handlerwith their own sqlite rows, carryingevent_idandversionand written idempotently.evoq_projectiontargetsevoq_read_modelwith checkpoints. The event handler is the honest fit for an external sqlite store, so they stay as they are.mercurius referenced this issue2026-12-01 04:18:12 +00:00
Raf, 2026-12-01: "move them into host_bookclub...mcl-bookclub-phoenix should be as much aligned with mcl-bookclub as possible!"
Ruling for this issue: the three
emit_*_to_meshemitters move frommcl_bookclub_phoenixintohost_bookclubslice folders, named as in mcl-bookclub;host_bookclubtakes the macula SDK dependency and the emitters supervision, as in Erlang. Every gap-table row marked "moved" or "thinner" is a gap to close: where Phoenix differs from mcl-bookclub in layout, slice names, app boundaries, supervision or tests, the Erlang shape wins, in idiomatic Elixir."moved" rows, and where they land (DECIDED 2026-12-01 "move them into host_bookclub...mcl-bookclub-phoenix should be as much aligned with mcl-bookclub as possible!")
These are every gap-table row marked moved (gap-table.md lines 100-104 and 115). Each now follows mcl-bookclub's shape:
host/emit_member_registered_v1_to_mesh/…erl:19fac/emit_member_registered_v1_to_mesh.exhost_bookclub/lib/host_bookclub/emit_member_registered_v1_to_mesh/host/emit_book_procured_v1_to_mesh/…erl:1fac/…exhost/emit_book_retired_v1_to_mesh/…erl:1fac/…exmcl_bookclub_facts)host/mcl_bookclub_facts.erl:18fac/facts.exHostBookclub.MclBookclubFactsin host_bookclubhost/host_bookclub_sup.erl:16-46(policy + 3 emitters)host/application.ex(policy) +fac/supervisor.ex(emitters)fac/mcl_bookclub_sup.erl:16-24(admin listener)fac/supervisor.ex(emitters)What goes with them in PR 4:
host_bookclub/mix.exsdivision_boundary_test.exs(PR 1) gets E's exemptions: theemit_*_to_meshmodules and the facts module may name macula, and nothing else in host_bookclub/lib may (as in E'sinitiate_bookclub_tests.erl:112):macula) then test them in their new homeThe 42 "thinner" rows are closed in the PR that owns their area:
Each PR body names the gap rows it closes.
Deferred to #1, recorded here as ruled: the Erlang twin also asserts that the image builder IS the CI image, digest for digest (mcl_bookclub_service_tests.erl:274, second half). Here ci.yml tests on the forge build of macula-ci-pq ex118, and the Containerfile builder is the ghcr build of the same toolchain. That half holds only once #1 moves the pins to the forge. PR 9 tests everything else in row B: runtime agreement, the digest-pinned builder/runtime pair, and the revision label.
Closed: every Done-when line is on main at
63d4a71162. Jupiter checked the Done-when lines against that tip and called #4 closable. Mars gave the GO.Landed shas:
3964d7226bee0640c6edff2d26eccd2a8c86a55e63d4a711Accepted exceptions:
Found while closing, and left unplaced: #28 (a busy sqlite read crashes the QRY store), with its twin macula-services/mcl-bookclub#15.
Supervisor's ruling D, given to Mercurius on 2026-12-01 (original wording, for the record): no get_* getters on states and events; Elixir reads struct fields directly; recorded in the gap table as an accepted idiom difference. Raf may overrule.