A3 package 2: the store mode comes from config, nothing appends before the join, and the crew reconcile runs once per cluster #14
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-kanban runs on a clustered event store — the store's
modecomes from config instead of a hardcodedsingle, the board appends nothing until the store has joined, and the 60 s crew reconcile runs on one node of the cluster.DECIDED 2026-12-02 "Run the whole path (Recommended)" (Raf: the crew runs the whole path to one clustered mcl-martha release, in order, without coming back to him).
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."
This is A3 package 2 (
ANALYSIS_2026-12-01_mcl-martha-consolidation.md, §A3: "reckon-db storemoderead from config, not hardcodedsingle"), plus A3 package 4 — themcl_om_singletonwrap that mcl-kanban#11 deliberately left out, because with one store per node a singleton would reconcile only the elected node's roster.What changes
MclKanban.Service.event_store/0takesmodefrom:mcl_kanban, :store_mode(default:single, validated to:single | :clusterat boot, refused by name otherwise), andconfig/runtime.exsreads it fromMCL_STORE_MODEfor the standalone release. A release that hosts several services sets it per service; a dependency'sruntime.exsnever runs (C9).GuideCardLifecycle.Store.dispatch/1is the board's one dispatch funnel (C2), so the gate lives there: in:singlemode it dispatches as today; in:clustermode it refuses with{:error, :store_not_joined}untilreckon_db_cluster:local_healthy(store_id)istrue— a live leader, more than one member, and a local Raft server that answers (reckon-db/guides/cluster_consistency.md, "Do not append before the store has joined"). reckon-db's own guard counts the store and then joins, so an append inside that window to an empty joining node would be acknowledged and then wiped by the join. Subscribing before the join is fine: live subscriptions are carried across it.MclKanban.SupervisorlistsCrewStandingReconcilerthroughmcl_om_singleton:child_spec/2: the node whose guard holds the global name runs the pass, and a standby takes over when that node goes. A NODE WITHOUT DISTRIBUTION — the standalone release — runs it exactly as today.The operator rule this makes real
A store that holds data refuses every join, including a join to a cluster that already exists (reckon-db#2): the persisted-membership guard cannot tell a new cluster from an existing one, and a join resets the joiner's tree. So the node whose store holds data must be up and connected before the empty nodes join it — then it is elected coordinator (the election ranks data-holders first) and the others join it. If the empty nodes clustered first, that cluster serves an empty store forever. If both sides hold events, neither joins and both keep their history; merging two histories is an operator's decision. This is stated where the mode is read, and in the README the deploy is pointed at.
A netsplit runs the reconcile on every connected partition
mcl_om_singletonruns one copy per connected partition (that is howglobalbehaves in a split). Each copy keeps its owncounts: a side counts only the realm answers it received, so a crew is discharged only after the realm told that sideunknown_crewunknown_limittimes in a row. Both sides discharge on the same evidence, never on twice the evidence; the two discharges are the same evoq command, and reckon-db's version check settles the duplicate append (whether evoq retries the loser is unconfirmed, analysis A1). Neither copy can end a crew the realm still answers for, so the split needs no further guard; the PR states this and names no new check.Build and land
is_activeduring activation, so a leadership transfer times out). The pin floor is raised to~> 5.12.1in a diff-only round once it is on hex, before the land. Supervisor: no service moves to cluster mode before 5.12.1.Done when
MclKanban.Service.event_store/0answers the mode from:mcl_kanban, :store_mode: a test sets:clusterand reads it back, and an invalid value is refused by name at boot.:singlemode every dispatch lands as today (the existing suite).:clustermode with the store not joined, a dispatch is refused with{:error, :store_not_joined}and writes nothing; with the join answered, the same dispatch lands. The health answer is the seam a test takes; the real one isreckon_db_cluster:local_healthy/1.mcl_om_singletonchild of the service's supervisor: a test reads the child shape, and on a node without distribution one copy runs, a second guard starts no second copy, and it takes over when the holder goes.:singlemode and migrates then starts.mix format --check-formatted, credo, dialyzer and the full suite green; a mutant on each new guard is caught.Refs martha-ai/mcl-martha#1
Refs macula-services/mcl-kanban#11
Refs reckon-db-org/reckon-db#2
Refs reckon-db-org/reckon-db#14
One correction to Done-when 1, accepted at review (r=2): the single source of the mode is
:guide_card_lifecycle, :store_mode, not:mcl_kanban, :store_mode.GuideCardLifecycle.Store.mode/0reads it (default:single, refused by name when it is neither:singlenor:cluster), and bothMclKanban.Service.event_store/0andMclKanban.Supervisor.children/0read that one function, so the store's mode and the tree's shape cannot disagree. The behaviour Done-when 1 asks for is unchanged; only the key it names is.Landed on main at
7687787b; PR 15 merged. Main-push runs 6942 (c4-model) and 6943 (gates + advisories) green — 6943 after one rerun of the gates job on a flake since filed as #17; the retry passed.Done-when, line by line:
GuideCardLifecycle.Store.mode/0reads:guide_card_lifecycle, :store_mode(the single source; this line named:mcl_kanbanand the correction was accepted at review), default:single, refused by name when it is neither:singlenor:cluster;MclKanban.Service.event_store/0andMclKanban.Supervisor.children/0both read it.store_gate_test.exssets:clusterand reads it back, and pins the named refusal.:singledispatches as today. The existing suite is the proof; the gate never asks the cluster module in:single.:clusterbefore the join. A dispatch answers{:error, :store_not_joined}and writes nothing (the test reads its own stream and finds nothing); withjoined?answered the same dispatch lands.MCL_STORE_MODEcarries the mode for the standalone release.children/0gives themcl_om_singletonchild in:clusterand the plain child in:single(the default, where each node holds its own store — #11's reason);singleton_test.exspins both shapes, and on a node without distribution one copy runs, a second guard starts no second copy, and it takes over when the holder goes.:single(and again withMCL_STORE_MODE=clusteron a lone node); data stays at the root with no subdir.mix format --check-formatted, credo, dialyzer and the full suite (242/28/22/70/37) green on the landed tip; mutants caught on each new guard: the gate never refusing;:singleasking the cluster module; no mode validation; the tree fixed to:cluster; the tree never wrapping the reconciler.Floor as landed:
reckon_db ~> 5.12.1andevoq ~> 1.32in both/all three apps.