Wave 2: mail names its own store, org and data root, and boots only when it is not bundled (mcl-martha#1) #31
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 (feature): mcl-mail stands in one mcl-martha bundle beside the other services without fighting them. It names its own store on its read-model replay, carries its own org, takes its data root from its own app env, and leaves the mcl_om boot to the bundle when it is bundled. Its own standalone release keeps working exactly as it does today.
Raf, 2026-12-02: "Run the whole path (Recommended)"
Raf, 2026-12-02: "trust on sight. mcl-martha services should auto-cluster over LAN, no mcl-station required. Distributed Erlang offers us all we need."
Refs martha-ai/mcl-martha#1, macula-services/mcl-om#8
Conflict table: consolidation analysis §2.1 C2, C6, C7, C8, C9; §2.3 "mail: C2 (the replay reads evoq.store_id) and C8"; A3 package 4.
What changes here
C2, the replay names its own store.
mailboxes_read_model_replay:store_id/0readapplication:get_env(evoq, store_id), which is one app env per VM and is set differently by every service in the bundle. It now callsmcl_mail_store:id/0, the one place this service's store id is written. The nine CMD desks already passstore_idon every dispatch and are left as they are.C6, its own org.
mcl_mail_service:info/0carriesorg => <<"mcl-mail">>, which mcl-om#8's boot reads in place ofmcl_om.org. The{org, ...}line stays inconfig/sys.config.srcwhile the pinned mcl_om release is 1.8.0, whose boot reads only that env; a test holds the two equal so they cannot drift before the pin moves.C6 is NOT done by this package. The pinned hex release, mcl_om 1.8.0, ignores
info/0'sorgand reads only themcl_omapp env; only mcl_om main (a2aa62e3,service_org/1) reads the key. So the key sits inert here, the config line must NOT be dropped until the pin is~> 1.9, and C6 completes with that pin move, not with this change.C7, the bundled switch.
{bundled, true}in mcl_mail's app env makesmcl_mail_app:start/2open the store and start the service supervisor without callingmcl_om:boot/1; the bundle's own app calls it with the list. Unset, which is every standalone release, keeps today's single call. For that to hold,mcl_mail_service:start/1answers the running supervisor's pid when the app already started it, so the bundle's boot registers the service instead of failingalready_started.C8, its data root from its own app env.
event_store/0no longer reads theMCL_DATA_DIROS variable. The root comes from{mcl_mail, data_root}, whose laptop default is in the module and whichconfig/sys.config.srcsets to${MCL_DATA_DIR}; the store keeps its own subdirectorymcl_mail_storeunder it, so/data/mcl_mail_storeis unchanged.C9, the release default in the app. The
{mcl_mail, data_root}entry inconfig/sys.config.srcis the only release-level setting this change moves; the rest is already in the app module or the.app.src.A3 package 4, side effects: none to wrap. Mail publishes to and subscribes to no mesh topic (its seven procedures are CALLs), and its read model is a local ETS table rebuilt from store events. Nothing here sends or publishes per node, so a second copy of the service on another node runs no doubled side effect and no singleton is added.
Done when
mcl_mail_store:id/0, and a test fails ifmailboxes_read_model_replay.erlreadsev oq'sstore_idapp env again.mcl_mail_service:info/0carriesorg, and a test holds it equal to the org inconfig/sys.config.src. The key is inert on the pinned mcl_om 1.8.0 (see item 2); the test is what keeps the two from drifting before~> 1.9makes it live.bundledtrue calls nomcl_om:boot/1andbundledfalse calls it once, with the store opened before either.{mcl_mail, data_root}and reads it back throughevent_store/0, and noos:getenvis left in the service module.mcl_mail_service:start/1answers the running supervisor's pid when one is already up (the bundle's boot path), asserted by a test.MCL_DATA_DIR=/dataas before.Landed. PR 34 merged into
mainatcb5f83359f(fast-forward, read back on the origin), on top of the wave-2 change already on main at26ef0a8.Done-when, checked on
mainatcb5f833:mcl_mail_store:id/0, and the test that fails if it reads evoq'sstore_idapp env again is in place (landed at26ef0a8).info/0carriesorg => <<"mcl-mail">>. The second half of this line is superseded by the 1.9 pin: while mcl_om 1.8 was pinned, a config org had to be held equal to the key because boot read only the env. With~> 1.9boot readsinfo/0(service_org/1), the{org, ...}line is out ofconfig/sys.config.src, and the test is now its mirror:the_config_names_no_org_testfails if a config org returns, andthe_org_mcl_om_boots_with_comes_from_info_testclears themcl_omenv and requires this service's org from mcl_om's own decision function.26ef0a8):bundledtrue calls nomcl_om:boot/1, false calls it once, the store opened before either.{mcl_mail, data_root}is read back throughevent_store/0, and noos:getenvis left in the service module (landed at26ef0a8).mcl_mail_service:start/1answers the running supervisor's pid, asserted by a test (landed at26ef0a8).The release:
rebar3 as prod releaseassembles with mcl_om-1.9.0 and macula-18.3.0 in it. Not booted here: the shipped config is{mesh, required}, so a boot would reach the live realm's stations and file a claim, which a package check must not do. The org path that this commit changed is proven by mcl_om'sservice_org/1with the env cleared, pluschecked_orgon the answer.A3 package 4, for the record: mail wraps nothing in
mcl_om_singleton; it publishes and subscribes to no mesh topic, and its read model is one ETS table per node that every node must fill. The split note about what a double run would do is inmcl_mail_sup, and Jupiter corrected its opening to cite mcl-graph#15's ruling that a per-node learner is not a singleton case.