A3 package 2: the store mode comes from config, nothing appends before the join, and the crew reconcile runs once per cluster #15

Manually merged
terra merged 4 commits from juno/14-a3-cluster-store into main 2026-12-02 14:00:42 +00:00
Member

The board runs on a clustered event store (mcl-kanban#14, A3 package 2): the store's mode comes from config, nothing is appended before the store has joined, and in cluster mode the 60 s crew reconcile runs on one node of the cluster.

Refs #14
Refs reckon-db-org/reckon-db#2
Refs reckon-db-org/reckon-db#14

What changes

  1. The mode comes from config. GuideCardLifecycle.Store.mode/0 reads :guide_card_lifecycle, :store_mode (default :single, refused by name when it is neither :single nor :cluster), and MclKanban.Service.event_store/0 opens the store in it. MCL_STORE_MODE names it for the standalone release; a release that hosts several services sets it per service. The README has the variable and a "Cluster mode" section.
  2. Nothing is appended before the store has joined. GuideCardLifecycle.Store.dispatch/1 is the board's one dispatch funnel (C2), so the gate lives there: in :single mode it dispatches as today and never asks the cluster module; in :cluster mode it answers {:error, :store_not_joined} — the caller's named error, not a crash — until reckon_db_cluster.local_healthy/1 is true (a live leader, more than one member, and a local Raft server that answers). reckon-db's join guard counts the store and then resets the joiner's tree, so an append to an empty joining node inside that window would be acknowledged and then wiped (reckon-db/guides/cluster_consistency.md, "Do not append before the store has joined"). Subscribing before the join is fine: live subscriptions are carried across it.
  3. In cluster mode the reconcile runs on one node (A3 package 4, moved here from #11). MclKanban.Supervisor.children/0 picks the child by GuideCardLifecycle.Store.mode/0: in :cluster it lists CrewStandingReconciler through mcl_om_singleton.child_spec/2; in :single, the default, it lists the plain child. That is #11's own rule: in single mode each node holds its own store, so a singleton would reconcile one node's roster and leave every other node's unreconciled — a crew on another node's board would never be discharged. A node without distribution (the standalone release) runs the cluster shape exactly as before.

The operator rule (a)

A store that holds data refuses every join, including a join to a cluster that already exists, because a join resets the joiner's tree (reckon-db#2). So start the node whose store holds the data first; it is elected coordinator and the empty nodes join it. Empty nodes that cluster first serve an empty store; two nodes that each hold events stay apart rather than merge. This is stated where the mode is read, in the README, and in #14.

A netsplit (c)

mcl_om_singleton runs one copy per connected partition — that is how global behaves in a split. Each copy keeps its own counts, so a side counts only the realm answers it received, and a crew is discharged only after the realm told that side unknown_crew unknown_limit times 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. No new check is added for this.

Build and land

Built against reckon_db 5.12.1, the pin floor now in both apps: 5.12 carries the join guard this rests on, and 5.12.1's leader answers is_active while it activates (reckon-db#14), which the land waited for. The floor was raised in a diff-only round on its own green run. The same round sets the evoq floor to ~> 1.32 in all three apps (guide_card_lifecycle, mcl_kanban, project_boards), which carries the one-node-per-aggregate routing a clustered store needs.

Proof

Same tree, locally: mix format --check-formatted clean, mix compile --warnings-as-errors clean, credo no issues, dialyzer passed, full suite 242/28/22/70/37 tests with 0 failures — re-run unchanged on 5.12.1. A standalone release was built and booted on 5.12.1: it migrated, /health answered ok with "org":"mcl-kanban", and its data stayed at the root in :single mode; it booted again with MCL_STORE_MODE=cluster on a lone node, so both shapes start. Mutants, each caught: the gate never refusing; :single asking the cluster module; no mode validation; the tree fixed to :cluster (the single-mode case fails); the tree never wrapping the reconciler (the cluster-shape case fails).

The board runs on a clustered event store (mcl-kanban#14, A3 package 2): the store's mode comes from config, nothing is appended before the store has joined, and in cluster mode the 60 s crew reconcile runs on one node of the cluster. Refs #14 Refs reckon-db-org/reckon-db#2 Refs reckon-db-org/reckon-db#14 ## What changes 1. **The mode comes from config.** `GuideCardLifecycle.Store.mode/0` reads `:guide_card_lifecycle, :store_mode` (default `:single`, refused by name when it is neither `:single` nor `:cluster`), and `MclKanban.Service.event_store/0` opens the store in it. `MCL_STORE_MODE` names it for the standalone release; a release that hosts several services sets it per service. The README has the variable and a "Cluster mode" section. 2. **Nothing is appended before the store has joined.** `GuideCardLifecycle.Store.dispatch/1` is the board's one dispatch funnel (C2), so the gate lives there: in `:single` mode it dispatches as today and never asks the cluster module; in `:cluster` mode it answers `{:error, :store_not_joined}` — the caller's named error, not a crash — until `reckon_db_cluster.local_healthy/1` is `true` (a live leader, more than one member, and a local Raft server that answers). reckon-db's join guard counts the store and then resets the joiner's tree, so an append to an empty joining node inside that window would be acknowledged and then wiped (`reckon-db/guides/cluster_consistency.md`, "Do not append before the store has joined"). Subscribing before the join is fine: live subscriptions are carried across it. 3. **In cluster mode the reconcile runs on one node (A3 package 4, moved here from #11).** `MclKanban.Supervisor.children/0` picks the child by `GuideCardLifecycle.Store.mode/0`: in `:cluster` it lists `CrewStandingReconciler` through `mcl_om_singleton.child_spec/2`; in `:single`, the default, it lists the plain child. That is #11's own rule: in single mode each node holds its own store, so a singleton would reconcile one node's roster and leave every other node's unreconciled — a crew on another node's board would never be discharged. A node without distribution (the standalone release) runs the cluster shape exactly as before. ## The operator rule (a) A store that holds data refuses **every** join, including a join to a cluster that already exists, because a join resets the joiner's tree (reckon-db#2). So **start the node whose store holds the data first**; it is elected coordinator and the empty nodes join it. Empty nodes that cluster first serve an empty store; two nodes that each hold events stay apart rather than merge. This is stated where the mode is read, in the README, and in #14. ## A netsplit (c) `mcl_om_singleton` runs one copy per connected partition — that is how `global` behaves in a split. Each copy keeps its own `counts`, so a side counts only the realm answers it received, and a crew is discharged only after the realm told that side `unknown_crew` `unknown_limit` times 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. No new check is added for this. ## Build and land Built against **reckon_db 5.12.1**, the pin floor now in both apps: 5.12 carries the join guard this rests on, and 5.12.1's leader answers `is_active` while it activates (reckon-db#14), which the land waited for. The floor was raised in a diff-only round on its own green run. The same round sets the **evoq floor to `~> 1.32`** in all three apps (guide_card_lifecycle, mcl_kanban, project_boards), which carries the one-node-per-aggregate routing a clustered store needs. ## Proof Same tree, locally: `mix format --check-formatted` clean, `mix compile --warnings-as-errors` clean, credo no issues, dialyzer passed, full suite 242/28/22/70/37 tests with 0 failures — re-run unchanged on 5.12.1. A standalone release was built and booted on 5.12.1: it migrated, `/health` answered `ok` with `"org":"mcl-kanban"`, and its data stayed at the root in `:single` mode; it booted again with `MCL_STORE_MODE=cluster` on a lone node, so both shapes start. Mutants, each caught: the gate never refusing; `:single` asking the cluster module; no mode validation; the tree fixed to `:cluster` (the single-mode case fails); the tree never wrapping the reconciler (the cluster-shape case fails).
store: the mode comes from config, and nothing appends before the join (#14)
All checks were successful
ci / guard (pull_request) Has been skipped
ci / guard-1 (pull_request) Has been skipped
ci / elixir in . (pull_request) Has been skipped
c4 model / c4-model-1 (pull_request) Successful in 2s
c4 model / c4-model (pull_request) Successful in 0s
ci / elixir in . (container) (pull_request) Successful in 9s
ci / Dependency advisories (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Successful in 7m28s
ci / image (amd64) (pull_request) Has been skipped
ci / attest (pull_request) Has been skipped
7275b1da9a
A3 package 2. GuideCardLifecycle.Store reads the mode from
:guide_card_lifecycle, :store_mode (default :single, refused by name when
it is neither :single nor :cluster), and MclKanban.Service.event_store/0
opens the store in it; MCL_STORE_MODE names it for the standalone release.

The board appends nothing until a cluster-mode store has joined:
Store.dispatch/1 is the one dispatch funnel since C2, and in :cluster mode
it answers {:error, :store_not_joined} until
reckon_db_cluster:local_healthy/1 does -- reckon-db's join guard counts the
store and then resets the joiner's tree, so an append to an empty joining
node inside that window would be acknowledged and wiped. :single mode is
always yes and never asks the cluster module.

The crew reconcile is wrapped in mcl_om_singleton again, which mcl-kanban#11
left out while every node had its own store: with one store per node a
singleton would have reconciled one node's roster only. It runs one copy per
connected partition, which the README and the issue state.

reckon_db moves to ~> 5.12 for the join guard; the floor is raised to
~> 5.12.1 before the HANDOFF (reckon-db#14), so this does not land on 5.12.0.

Refs macula-services/mcl-kanban#14
Refs reckon-db-org/reckon-db#2
store: the reconcile is a singleton only in cluster mode (#14)
All checks were successful
ci / elixir in . (container) (pull_request) Successful in 8s
ci / guard (pull_request) Has been skipped
ci / guard-1 (pull_request) Has been skipped
ci / elixir in . (pull_request) Has been skipped
c4 model / c4-model-1 (pull_request) Successful in 2s
c4 model / c4-model (pull_request) Successful in 0s
ci / Dependency advisories (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Successful in 6m21s
ci / image (amd64) (pull_request) Has been skipped
ci / attest (pull_request) Has been skipped
1f30193962
In single mode each node holds its own store (mcl-kanban#11), so wrapping
the crew reconcile in mcl_om_singleton there left every node but the guard
holder's unreconciled. children/0 now picks the shape from
GuideCardLifecycle.Store.mode/0: the plain child in single mode, the
singleton in cluster mode. singleton_test pins both shapes, and the
lone-node takeover test runs under cluster mode.
kanban: raise the reckon_db floor to ~> 5.12.1 (#14)
All checks were successful
ci / guard (pull_request) Has been skipped
ci / guard-1 (pull_request) Has been skipped
ci / elixir in . (pull_request) Has been skipped
c4 model / c4-model-1 (pull_request) Successful in 4s
c4 model / c4-model (pull_request) Successful in 0s
ci / elixir in . (container) (pull_request) Successful in 12s
ci / Dependency advisories (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Successful in 7m21s
ci / image (amd64) (pull_request) Has been skipped
ci / attest (pull_request) Has been skipped
abc625c7df
5.12.1 is on hex, so the land's last condition is met: its leader answers
is_active while it activates (reckon-db#14). Both apps' pins move from
~> 5.12 to ~> 5.12.1, and the comments say what the floor buys on top of
5.12's join guard.
deps: raise the evoq floor to ~> 1.32 in all three apps (#14)
All checks were successful
ci / guard (pull_request) Has been skipped
ci / guard-1 (pull_request) Has been skipped
ci / elixir in . (pull_request) Has been skipped
c4 model / c4-model-1 (pull_request) Successful in 5s
c4 model / c4-model (pull_request) Successful in 0s
ci / elixir in . (container) (pull_request) Successful in 20s
ci / Dependency advisories (pull_request) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (pull_request) Successful in 7m48s
ci / image (amd64) (pull_request) Has been skipped
ci / attest (pull_request) Has been skipped
c4 model / c4-model-1 (push) Successful in 10s
c4 model / c4-model (push) Successful in 0s
ci / guard-1 (push) Has been skipped
ci / elixir in . (push) Has been skipped
ci / guard (push) Has been skipped
ci / elixir in . (container) (push) Successful in 9s
ci / Dependency advisories (push) Successful in 0s
ci / gates (OTP 28.4.3 / Elixir 1.18.4) (push) Successful in 8m32s
ci / image (amd64) (push) Has been skipped
ci / attest (push) Has been skipped
7687787b72
evoq 1.32 carries the one-node-per-aggregate routing, which the board's
clustered store needs. guide_card_lifecycle, mcl_kanban and project_boards
each move from ~> 1.26 to ~> 1.32; the resolved version was already
1.32.0, so this fixes the floor rather than the build.
terra manually merged commit 7687787b72 into main 2026-12-02 14:00:42 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
macula-services/mcl-kanban!15
No description provided.