LAN-first on mcl_core: the truth learner as a declared subscription, a boot without a realm (mcl-lan P5) #19

Open
opened 2026-12-02 13:13:13 +00:00 by neptunus · 1 comment
Member

Purpose (feature): mcl-graph runs on a LAN cluster through mcl_core. It hears truth_asserted facts from its cluster peers over the LAN and boots on a node that has no realm. Nothing changes for callers.

DECIDED 2026-12-02 "I have created and cloned macula-services/mcl-core. Let's build this properly. In the end I hope we keep a single repo: mcl-core that will replace both mcl-om and mcl-lan" (Raf)
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." (Raf)

Refs macula-services/mcl-lan docs/DESIGN.md §5 (the mcl-graph row, "graph 1 + 2") and §7 P5, folded into graph's §2.3 package (martha-ai/mcl-martha#1). Builds on macula-services/mcl-core main 914650ae.

What changes

  1. mcl_om → mcl_core. The dependency becomes mcl_core: a git pin on 914650ae until 1.0.0 is on hex, then ~> 1.0. The mcl_om* calls (wire, caller, ownership proof, publish, boot, health) move to their mcl_core* names, and so do the config keys.
  2. Graph 1: the learner becomes a declared subscription. learn_truths_from_mesh subscribes by itself today: mesh_handles, then macula:subscribe(..., #{sources => members}) at learn_truths_from_mesh.erl:65, 102. Instead it becomes a macula_subscriber module named in mcl_graph_service:subscriptions/0 with sources => members. mcl_core wires it on the LAN (a pg group) and, on a bridge node, also on the mesh. The learning itself stays the same: verified publisher, confidence 0.7, a non-map refused. Its /health input changes from "subscription held" to the subscriber process being alive.
  3. Graph 2: the two realm reads.
    • mcl_graph_facts:check_realm_name/0 (:83) refuses a boot whose realm name does not hash to the configured realm. It stays for a node with a realm. A node without one (a LAN member, {error, no_realm}) boots.
    • learn_link (:64) checks an asserted_by proof against the realm. Without a realm it still refuses with realm_unknown, since an unchecked claim is never learned. So on the LAN a proof is checked only where a realm is configured, which is the bridge path. A plain LAN call is learned under the caller that mcl_core writes.

Threat model (short)

  • A LAN peer publishes a false truth. Under "trust on sight", any cluster node is a member (sources => members takes every cluster node). That is as strong as distributed Erlang itself, since any member can already run code here (DESIGN §2.1). Provenance is still recorded: the publisher's node id is linked asserted at 0.7.
  • A forged asserted_by on a node without a realm. Refused with realm_unknown, never learned under the claimed identity. A test holds this.
  • A non-map payload crashing the learner. Still refused, and the test is kept.
  • Truths from realm members outside the LAN: mcl_core delivers mesh events only to subscribers on a node that is on the mesh, so by the Supervisor's ruling the graph holder runs on the bridge node (or standalone), and a holder on a LAN member is refused at boot.

Done when

  • rebar.config depends on mcl_core (the 914650ae pin, or ~> 1.0 once 1.0.0 is on hex), with no mcl_om left in src, tests, config or CI.
  • mcl_graph_service:subscriptions/0 declares truth_asserted with sources => members, and learn_truths_from_mesh no longer calls macula:subscribe or mesh_handles.
  • A two-node LAN test (peer nodes, as in mcl-core's LAN suites): a fact published on member node A is learned by graph on the bridge node B, which holds it, with node A's id as provenance.
  • Graph boots on a LAN member that holds no graph and has no realm configured; the holder without a realm, and any node whose realm name does not match, are still refused (unit tests).
  • Placement (Supervisor ruling, comment below): a graph holder on a LAN member (not on the mesh) is refused at boot with {mcl_graph_holder_off_mesh, member}; on a standalone node or the bridge it boots (unit tests).
  • On a node without a realm, learn_link with an asserted_by is refused realm_unknown and learns nothing. Without one, it is learned under the written caller.
  • /health reads the subscriber's state, and its tests are updated.
  • Whole eunit, plus the repo's CI jobs, green on OTP 28.
Purpose (feature): mcl-graph runs on a LAN cluster through mcl_core. It hears `truth_asserted` facts from its cluster peers over the LAN and boots on a node that has no realm. Nothing changes for callers. DECIDED 2026-12-02 "I have created and cloned macula-services/mcl-core. Let's build this properly. In the end I hope we keep a single repo: mcl-core that will replace both mcl-om and mcl-lan" (Raf) 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." (Raf) Refs macula-services/mcl-lan docs/DESIGN.md §5 (the mcl-graph row, "graph 1 + 2") and §7 P5, folded into graph's §2.3 package (martha-ai/mcl-martha#1). Builds on macula-services/mcl-core main 914650ae. ## What changes 1. **mcl_om → mcl_core.** The dependency becomes mcl_core: a git pin on 914650ae until 1.0.0 is on hex, then `~> 1.0`. The `mcl_om*` calls (wire, caller, ownership proof, publish, boot, health) move to their `mcl_core*` names, and so do the config keys. 2. **Graph 1: the learner becomes a declared subscription.** `learn_truths_from_mesh` subscribes by itself today: `mesh_handles`, then `macula:subscribe(..., #{sources => members})` at `learn_truths_from_mesh.erl:65, 102`. Instead it becomes a `macula_subscriber` module named in `mcl_graph_service:subscriptions/0` with `sources => members`. mcl_core wires it on the LAN (a `pg` group) and, on a bridge node, also on the mesh. The learning itself stays the same: verified publisher, confidence 0.7, a non-map refused. Its `/health` input changes from "subscription held" to the subscriber process being alive. 3. **Graph 2: the two realm reads.** - `mcl_graph_facts:check_realm_name/0` (`:83`) refuses a boot whose realm name does not hash to the configured realm. It stays for a node with a realm. A node without one (a LAN member, `{error, no_realm}`) boots. - `learn_link` (`:64`) checks an `asserted_by` proof against the realm. Without a realm it still refuses with `realm_unknown`, since an unchecked claim is never learned. So on the LAN a proof is checked only where a realm is configured, which is the bridge path. A plain LAN call is learned under the `caller` that mcl_core writes. ## Threat model (short) - **A LAN peer publishes a false truth.** Under "trust on sight", any cluster node is a member (`sources => members` takes every cluster node). That is as strong as distributed Erlang itself, since any member can already run code here (DESIGN §2.1). Provenance is still recorded: the publisher's node id is linked `asserted` at 0.7. - **A forged `asserted_by` on a node without a realm.** Refused with `realm_unknown`, never learned under the claimed identity. A test holds this. - **A non-map payload crashing the learner.** Still refused, and the test is kept. - **Truths from realm members outside the LAN:** mcl_core delivers mesh events only to subscribers on a node that is on the mesh, so by the Supervisor's ruling the graph holder runs on the bridge node (or standalone), and a holder on a LAN member is refused at boot. ## Done when - [ ] rebar.config depends on mcl_core (the 914650ae pin, or `~> 1.0` once 1.0.0 is on hex), with no mcl_om left in src, tests, config or CI. - [ ] `mcl_graph_service:subscriptions/0` declares `truth_asserted` with `sources => members`, and `learn_truths_from_mesh` no longer calls `macula:subscribe` or `mesh_handles`. - [ ] A two-node LAN test (`peer` nodes, as in mcl-core's LAN suites): a fact published on member node A is learned by graph on the bridge node B, which holds it, with node A's id as provenance. - [ ] Graph boots on a LAN member that holds no graph and has no realm configured; the holder without a realm, and any node whose realm name does not match, are still refused (unit tests). - [ ] Placement (Supervisor ruling, comment below): a graph holder on a LAN member (not on the mesh) is refused at boot with `{mcl_graph_holder_off_mesh, member}`; on a standalone node or the bridge it boots (unit tests). - [ ] On a node without a realm, `learn_link` with an `asserted_by` is refused `realm_unknown` and learns nothing. Without one, it is learned under the written `caller`. - [ ] /health reads the subscriber's state, and its tests are updated. - [ ] Whole eunit, plus the repo's CI jobs, green on OTP 28.
Author
Member

Supervisor's ruling, relayed by Mars on 2026-12-02 (Raf may overrule): "place graph on the bridge node, like rag, so mesh-wide truth_asserted facts keep reaching it. The general rule: a service that consumes facts from off the LAN, or federates, runs on the bridge node."

How it is folded in:

  • Behaviour: the node that holds the graph (store_holder) must talk to the mesh itself: a standalone release, or the cluster's bridge. mcl_graph_service:start/1 refuses a holder on a LAN member with {mcl_graph_holder_off_mesh, member}. A member without the graph boots, with or without a realm.
  • The realm check: the holder needs a realm, and its name must match. A member without the graph may have no realm, and if it has one it must still match.
  • Done when: two lines are added in the body (the placement refusal, and the two-node test with the holder as the bridge).
Supervisor's ruling, relayed by Mars on 2026-12-02 (Raf may overrule): "place graph on the bridge node, like rag, so mesh-wide truth_asserted facts keep reaching it. The general rule: a service that consumes facts from off the LAN, or federates, runs on the bridge node." How it is folded in: - **Behaviour:** the node that holds the graph (`store_holder`) must talk to the mesh itself: a standalone release, or the cluster's bridge. `mcl_graph_service:start/1` refuses a holder on a LAN member with `{mcl_graph_holder_off_mesh, member}`. A member without the graph boots, with or without a realm. - **The realm check:** the holder needs a realm, and its name must match. A member without the graph may have no realm, and if it has one it must still match. - **Done when:** two lines are added in the body (the placement refusal, and the two-node test with the holder as the bridge).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
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-graph#19
No description provided.