mesh_watch over both paths returns a LAN member's fact twice: its mesh copy carries the bridge's publisher id #16

Open
opened 2026-12-02 15:00:45 +00:00 by mercurius · 0 comments
Member

Purpose (fix): mesh_watch with MACULA_LAN_ENTRY set returns a fact a LAN member published once, not twice, when it hears the fact on both the LAN and the mesh.

Refs macula-io/macula-mcp#11, macula-services/mcl-core#12 (mcl-core 1.1.0, PR 14). Found reviewing mcl-core 1.1.0 against Neptunus's payload-form question.

The gap

FirstCopy.keep (src/reach_the_lan/hear_both.ts) matches the two copies on publisher + topic + sha256(canonicalJson(payload)). In mcl-core 1.1.0, the two paths do not agree on two of these:

  1. publisher, certain from the code. A LAN member has no mesh pool. Its publish goes to the LAN with publisher => the member's own node id (mcl_core_lan:publish/3), and to the mesh by erpc to the bridge, which runs mcl_core_pubsub:mesh_publish/3 on its own pool (mcl_core_bridge:publish/3). The mesh copy's publisher is therefore the BRIDGE's node id. Every fact a member publishes never matches its other copy, so it is returned twice. Only a fact the bridge itself publishes carries the same publisher on both paths.
  2. payload form, likely, not yet proven. The LAN entry point writes a UTF-8 Erlang binary as a JSON string (mcl_core_lan_json:value/1). On the mesh, macula's CBOR keeps a binary() as a byte string (macula_record_cbor moduledoc), which this server's bytes: "tagged" subscription returns as {"$bytes": ...}. If so, any payload holding a string value hashes differently on the two paths, even from the bridge.
    Both fail open: the agent sees the fact twice. Nothing is lost.

Done when

  • A member's fact, heard with the member's id on the LAN and the bridge's id on the mesh, is returned once. For example: key the match without publisher, or map a cluster member to its bridge (the second needs a ruling first).
  • A payload with a string value matches across the paths: either a test with the real mesh-side decoded form shows it already hashes alike, or both forms are normalised before the hash.
  • A stand-in test for each of the two cases.
Purpose (fix): `mesh_watch` with `MACULA_LAN_ENTRY` set returns a fact a LAN member published once, not twice, when it hears the fact on both the LAN and the mesh. Refs macula-io/macula-mcp#11, macula-services/mcl-core#12 (mcl-core 1.1.0, PR 14). Found reviewing mcl-core 1.1.0 against Neptunus's payload-form question. ## The gap `FirstCopy.keep` (src/reach_the_lan/hear_both.ts) matches the two copies on `publisher + topic + sha256(canonicalJson(payload))`. In mcl-core 1.1.0, the two paths do not agree on two of these: 1. **publisher, certain from the code.** A LAN member has no mesh pool. Its publish goes to the LAN with `publisher => the member's own node id` (`mcl_core_lan:publish/3`), and to the mesh by erpc to the bridge, which runs `mcl_core_pubsub:mesh_publish/3` on its own pool (`mcl_core_bridge:publish/3`). The mesh copy's `publisher` is therefore the BRIDGE's node id. Every fact a member publishes never matches its other copy, so it is returned twice. Only a fact the bridge itself publishes carries the same publisher on both paths. 2. **payload form, likely, not yet proven.** The LAN entry point writes a UTF-8 Erlang binary as a JSON string (`mcl_core_lan_json:value/1`). On the mesh, macula's CBOR keeps a `binary()` as a byte string (`macula_record_cbor` moduledoc), which this server's `bytes: "tagged"` subscription returns as `{"$bytes": ...}`. If so, any payload holding a string value hashes differently on the two paths, even from the bridge. Both fail open: the agent sees the fact twice. Nothing is lost. ## Done when - [ ] A member's fact, heard with the member's id on the LAN and the bridge's id on the mesh, is returned once. For example: key the match without `publisher`, or map a cluster member to its bridge (the second needs a ruling first). - [ ] A payload with a string value matches across the paths: either a test with the real mesh-side decoded form shows it already hashes alike, or both forms are normalised before the hash. - [ ] A stand-in test for each of the two cases.
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-io/macula-mcp#16
No description provided.