A publish goes to the LAN and the mesh, deduplicated at the bridge #12

Closed
opened 2026-12-02 14:05:33 +00:00 by venus · 1 comment
Member

Purpose (capability): a fact a LAN member publishes reaches the mesh as well as the LAN, so other realms keep hearing the cluster whoever subscribes on the LAN, and each subscriber hears it once.

The gap

mcl_core_transport:publish/3 sends to the LAN's subscribers and goes to the bridge only when the LAN has none ({error, no_lan_subscriber}). A topic with one LAN subscriber is then never published on the mesh: a service in another realm, or mcl-graph's mesh learner, stops hearing the cluster's facts the day a cluster node subscribes. DECIDED 2026-12-02 (Raf): "we won't loose the mesh! I just don't want to pitch Martha as "mesh-only"": the LAN sits beside the mesh, never in place of it.

What

  • A publish goes to the LAN's subscribers AND through the bridge to the mesh. The answer is the mesh's, except ok when the LAN took the fact and the mesh answers mesh_unavailable (a cluster with no mesh keeps publishing on its LAN).
  • Dedup (Supervisor ruling, option 1): on the bridge, a subscription the LAN carries (no sealed group) runs behind mcl_core_cluster_echo, which drops a mesh event whose publisher is a node of this cluster (mcl_core_lan:cluster_node/1). Sealed-group subscriptions stay mesh-only and hear the cluster there. A standalone node is unchanged. No wire change.
  • The wrapper reads back as the service's own declaration, so the reconcile does not restart it.
  • In-flight edge, written in DESIGN §9: a node that leaves the cluster with its fact in flight gives at worst one duplicate; a node joining in that moment at worst misses one local copy.

Threat model

  • A spoofed publisher: in lenient mode a mesh event's publisher is a claim. An outsider naming a cluster node's id has its event dropped at the bridge, which loses that outsider's own event and nothing else. No event is accepted that was not before.
  • More mesh traffic: every cluster publish now reaches the station, as it did with mcl_om 1.9.0 before the LAN existed. No new listener, no new route.

Done when

  • A publish the LAN took is also sent on the mesh, once; LAN ok + mesh_unavailable → ok; any other mesh error is the answer (eunit).
  • A member's publish reaches the bridge's LAN subscriber and the bridge's mesh path, each once (peer case).
  • The echo wrapper drops a cluster node's event, passes a foreign one, and passes every optional callback through as macula_subscriber would (eunit).
  • Wrapped only on the bridge and only for a LAN-carried subscription; read back unwrapped (eunit).
  • Mutants (no mesh on a LAN publish; no echo drop; wrap a group sub; wrap off the bridge; no unwrap) each fail a test.
  • Whole local gate green; CHANGELOG 1.1.0, the LAN guide and DESIGN say a publish goes to both.

Refs macula-services/mcl-graph#19, macula-services/mcl-core#10

Purpose (capability): a fact a LAN member publishes reaches the mesh as well as the LAN, so other realms keep hearing the cluster whoever subscribes on the LAN, and each subscriber hears it once. ## The gap `mcl_core_transport:publish/3` sends to the LAN's subscribers and goes to the bridge only when the LAN has none (`{error, no_lan_subscriber}`). A topic with one LAN subscriber is then never published on the mesh: a service in another realm, or mcl-graph's mesh learner, stops hearing the cluster's facts the day a cluster node subscribes. DECIDED 2026-12-02 (Raf): "we won't loose the mesh! I just don't want to pitch Martha as "mesh-only"": the LAN sits beside the mesh, never in place of it. ## What - A publish goes to the LAN's subscribers AND through the bridge to the mesh. The answer is the mesh's, except `ok` when the LAN took the fact and the mesh answers `mesh_unavailable` (a cluster with no mesh keeps publishing on its LAN). - Dedup (Supervisor ruling, option 1): on the bridge, a subscription the LAN carries (no sealed `group`) runs behind `mcl_core_cluster_echo`, which drops a mesh event whose `publisher` is a node of this cluster (`mcl_core_lan:cluster_node/1`). Sealed-group subscriptions stay mesh-only and hear the cluster there. A standalone node is unchanged. No wire change. - The wrapper reads back as the service's own declaration, so the reconcile does not restart it. - In-flight edge, written in DESIGN §9: a node that leaves the cluster with its fact in flight gives at worst one duplicate; a node joining in that moment at worst misses one local copy. ## Threat model - **A spoofed publisher:** in lenient mode a mesh event's `publisher` is a claim. An outsider naming a cluster node's id has its event dropped at the bridge, which loses that outsider's own event and nothing else. No event is accepted that was not before. - **More mesh traffic:** every cluster publish now reaches the station, as it did with mcl_om 1.9.0 before the LAN existed. No new listener, no new route. ## Done when - [ ] A publish the LAN took is also sent on the mesh, once; LAN ok + `mesh_unavailable` → `ok`; any other mesh error is the answer (eunit). - [ ] A member's publish reaches the bridge's LAN subscriber and the bridge's mesh path, each once (peer case). - [ ] The echo wrapper drops a cluster node's event, passes a foreign one, and passes every optional callback through as macula_subscriber would (eunit). - [ ] Wrapped only on the bridge and only for a LAN-carried subscription; read back unwrapped (eunit). - [ ] Mutants (no mesh on a LAN publish; no echo drop; wrap a group sub; wrap off the bridge; no unwrap) each fail a test. - [ ] Whole local gate green; CHANGELOG 1.1.0, the LAN guide and DESIGN say a publish goes to both. Refs macula-services/mcl-graph#19, macula-services/mcl-core#10
Author
Member

Amendment to the Done-when, as built in PR 14 (391fe14, Mercurius PASS): the line "any other mesh error is the answer" now excludes a member's {error, {bridge_unreachable, _}} as well as {error, mesh_unavailable}. When the LAN took the fact, both answer ok.

Why: a member cut off from its bridge is a node with no mesh, just like mesh_unavailable. mcl_core 1.0 answered ok there, because the LAN took the fact and nothing went to the bridge. If the caller retried on the error, it would deliver to the LAN twice. Any other mesh error is still the answer. Pinned by a_lan_publish_with_no_bridge_reached_is_ok in test/mcl_core_transport_tests.erl; a mutant that drops the clause fails it.

Amendment to the Done-when, as built in PR 14 (391fe14, Mercurius PASS): the line "any other mesh error is the answer" now excludes a member's `{error, {bridge_unreachable, _}}` as well as `{error, mesh_unavailable}`. When the LAN took the fact, both answer `ok`. Why: a member cut off from its bridge is a node with no mesh, just like `mesh_unavailable`. mcl_core 1.0 answered `ok` there, because the LAN took the fact and nothing went to the bridge. If the caller retried on the error, it would deliver to the LAN twice. Any other mesh error is still the answer. Pinned by `a_lan_publish_with_no_bridge_reached_is_ok` in `test/mcl_core_transport_tests.erl`; a mutant that drops the clause fails it.
venus closed this issue 2026-12-02 15:02:37 +00:00
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-core#12
No description provided.