wave 2: mcl-stations as a bundle member — org from info/0, a bundled switch, and no double boot #16
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-stations can be hosted inside the one clustered mcl-martha release beside the other services — it reads its own org from its own service module instead of another app's env, and it does not boot mcl_om a second time when the bundle already did — while its own standalone release keeps working exactly as it does today.
Raf DECIDED 2026-12-02 "Run the whole path (Recommended)", and DECIDED 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.
This is the wave-2 per-service package for this repository (BRIEF 2026-12-02_wave2_common.md, analysis
ANALYSIS_2026-12-01_mcl-martha-consolidation.md§2.3 "Every service" and A1/A3).Done when
Each line below is one item of the common list, checked against THIS repository.
store_idpassed explicitly on every dispatch (C2) — not applicable here, and here is why. The service is storeless:rebar.configtakes no evoq dependency ("No event store: the service exports no store_id/0"),mcl_stations_serviceexports none of the store callbacks, and the read model is an ETS table owned bystation_store(CHANGELOG 0.7.0). There is no dispatch and no store to name. Nothing changes for this item.mcl_stations_service:info/0carriesorg => <<"mcl-stations">>, which is the keymcl_om:service_org/1reads first (mcl-om#8), so in the bundle the service advertises under its own org rather than whatever the one sharedmcl_om.orgenv says. The service keeps its own keys nowhere else: it has no crew keys and no other per-service setting that today comes from another app's env. Done when: a test asserts theorgkey's presence and that it equalsinfo/0'sname.mcl_om:bootwhen bundled (C7), in the one shape Mars ruled for the wave (mail#31's).mcl_stations_app:start/2ALWAYS starts this service's supervisor, in both shapes, and the application's own process is that supervisor;{mcl_stations, [{bundled, true}]}in app env skips one thing only, this application's ownmcl_om:boot(mcl_stations_service). Bundled, the hosting release's onemcl_om:boot([...])list callsmcl_stations_service:start/1, which is now idempotent and answers{ok, Pid}with the running supervisor instead of{error, {already_started, _}}. Absent or false (the standalone release, and every existing deployment), this application boots exactly as today. Done when: tests prove both shapes without booting mcl_om — bundled starts the supervisor and does not call the boot, standalone starts it and calls the boot withmcl_stations_service, andstart/1answers with the running supervisor on a second call.MCL_DATA_DIRand the on-disk store, and the model refills from the DHT snapshot at every boot.config/sys.config.src'smcl_omblock and intoinfo/0, so a dependency carries it. What stays insys.config.srcis not this service's:identity_key_path,health_socket,realm,realm_keyand the macula crypto profile are mcl_om's settings, set once by the bundle (C5). Themcl_om.orgenv line stays for the 1.8.0 window, where mcl_om still reads only the env, with a comment naming that.ingest_node_recordssingleton wrap: NOT DONE, by Mars's ruling (option a, 2026-12-02), because this service's code shows the wrap would break serving. What a double run does was recorded above and is harmless — but the harm here is the other direction, in the singleton itself:list_stationsanswers from this node's own read model:station_read_model:fold/2(station_read_model.erl:117) foldsstation_store's ETS table, which isprotectedand written only by its owner process (station_store.erl:57).ingest_node_recordsis the only writer of that table, from the DHT snapshot and its subscriptions.mcl_om_singletonruns the work on one node. Every other node would then keep an EMPTY table while still advertisingOrg/list_stations, so a caller routed there gets an empty directory — and its health is permanently{degraded, not_subscribed_to_records}, becauseingest_node_records:subscribed/0andlinks_up/0catchnoprocand answerfalse, whichmcl_stations_service:health_of/3reports under that name.So, unlike the other services' side effects, this one is per node by design. The reasoning lives in
mcl_stations_sup's module doc so the next reader does not "fix" it back.rebar3 eunitis green, and the whole suite that runs today still runs.Out of scope
mode(A3 package 2): waits for reckon-db#2, a separate package.Sequencing (Mars, 2026-12-02), and where the work stands.
This branch (PR 17) carries C7 only — the bundled switch:
mcl_stations_app:start/2reads{mcl_stations, [{bundled, true}]}, starts nothing when set, and callsmcl_om:boot(mcl_stations_service)exactly as before when absent. Three mutants each turn the matching test red.Held for the last commit, because all four need mcl_om 1.9 and hex tops out at 1.8.0:
orgininfo/0(C6);mcl_om.orgliteral leavingconfig/sys.config.src(C9);dependency_floors_tests' mcl_om floor moved to 1.9.0, with the pin at~> 1.9andrebar.lockregenerated;ingest_node_recordssingleton wrap (A3 package 4).Meanwhile the env literal stays where it is, which is what keeps the standalone release booting with an org on 1.8: 1.8 reads the org only from
mcl_om's env, andinfo/0's key is inert there.Correction to the last commit's contents, found while holding:
rebar.lockis not part of it. The file is gitignored in this repository (.gitignore:2), and the tested resolve is filed by CI, not committed — so there is nothing for the branch to regenerate or carry. The last commit is:orgininfo/0(C6); themcl_om.orgliteral leavingconfig/sys.config.src(C9); the pin to~> 1.9withdependency_floors_tests' floor moved to 1.9.0; and theingest_node_recordssingleton wrap.Also checked while holding: mcl-om main (
a8e35a1) leavesmcl_om_singleton's API as the wrap expects —child_spec/2,whereis/1— and mcl-om#13 was CI only (publish-hex on the forge), so the v1.9.0 tag Venus is cutting carries the helper this package needs.Ruling recorded: (a) —
ingest_node_recordsis NOT wrapped inmcl_om_singleton(Mars, 2026-12-02, after the finding below came from this package's code).The common list's package 4 assumes a side effect that is merely doubled. This one is the opposite: it is the per-node feeder of the read model that
list_stationsand health answer from, so making it one copy across a cluster is what breaks it.list_stationsanswers from this node's read model:station_read_model:fold/2(station_read_model.erl:117) foldsstation_store's ETS table,protected, written only by its owner process (station_store.erl:57).ingest_node_recordsis the only writer of that table (DHT snapshot plus subscriptions).mcl_om_singletonruns the work on the holder only. Every other node would keep an empty table while still advertisingOrg/list_stations, so callers routed there get an empty directory, and health there would be permanently{degraded, not_subscribed_to_records}:subscribed/0andlinks_up/0catchnoprocand answerfalse, andmcl_stations_service:health_of/3reports exactly that.The reasoning is now in
mcl_stations_sup's module doc, beside the feeder, so a later reader does not "fix" it back; and the double run the common list asked about stays recorded as harmless.Landed and closed: the package's three commits are on
mainas520a811(12b164dthe C7 switch in the one ruled shape,23a8d56the org from info/0 with the 1.9 pin,520a811the comment corrections), and the main push run is fully green —6781test.yml and6780c4-model, with job27683(the signer filing) finishing green after its runner picked it up.Every item of the common list is either done or recorded as not applicable/not done with its evidence:
start/1.orgininfo/0; C9 — the sharedmcl_om.orgliteral gone, kept out by a test.~> 1.9with the floor test at 1.9.0.ingest_node_recordsstays per node, with the code references and the health path recorded above and inmcl_stations_sup.Standalone release unchanged: the same boot path, the same configuration,
as prod releaseassembles.