LAN entry point: a call's reply names the member that served it #13
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): a LAN entry-point client can tell which member served its call, so macula-mcp's memory tools can move to the LAN as well.
Refs macula-io/macula-mcp#11 (mcl-lan P6). Supervisor ruling 2026-12-02 (relayed by Mars): in P6 the memory tools stay on the mesh, and this follow-up is filed on mcl-core.
Why
mesh_recallin macula-mcp checks each answer's corpus against the node that served the call (src/mesh_memory.ts, src/rag_corpus.ts). Today the entry point'sPOST /lan/v1/callanswers{ok: Reply}only (mcl_core_lan_entry_handlerreplied/1), so a client cannot say which LAN member answered. That leaves the memory tools on the mesh, a departure from mcl-lan docs/DESIGN.md §4.3.Done when
/lan/v1/callcarries the serving member's node id as 64 hex characters besideok(e.g.served_by), taken from whatmcl_core_lan:call_as/6actually reached, never from the request.Plan (Neptunus, placed by the Supervisor through Mars, 2026-12-02)
Code waits for mcl-core 1.1.0 (#10 + #12, PR 14) to land, because both touch the call path. This plan is read against main
db68d82. It will be rebased onto 1.1.0 before any code is written.Threat model
This adds no listener, no route and no new trust.
/lan/v1/callalready needs a sealed token from a listed member.served_bytells a client: the node id of a cluster member. Those ids are public-key hashes, not secrets. A token holder is already a listed member, and member ids are already onlan_members. Nothing is shown that an outsider could not get before.pggroup{node, NodeId}that the serving node joined (mcl_core_lan_node). That is a cluster member's own claim, the same claimadvertiserpinning already trusts (design §2.4, trust on sight). A member that lies about its id could already run code anywhere in the cluster over distribution. So this is not a new insider gap, and an outside attacker never gets to write it.argsnever becomeserved_by. A mutant checks this.pgread per call, with no network hop.Design
mcl_core_lan:call_members/5returns the answering pid's node id with anok. The lookup is one function,served_by(node(Pid)). It reads the{node, Id}groups in?LAN_SCOPEand keeps the one whose member runs on that node. The lookup runs just BEFORE the call to that pid. A pid whose node has no id at that moment is a node on its way out, since the LAN supervisor startsmcl_core_lan_nodebefore any capability. It is treated asgone, so the next candidate is tried.call_served_as/6 -> {ok, Reply, ServedBy} | {error, Reason}, takes the same arguments ascall_as/6.call_as/6andcall_capability/5keep their{ok, Reply}shape by dropping the id, so the bridge andmcl_core_transportdo not change. Nothing changes between nodes either: no message changes shape, so a mixed-version cluster keeps working during a rolling upgrade.mcl_core_lan_entry_handler:called/5usescall_served_as/6. A 200 becomes{ok: Reply, served_by: <64 hex>}, and error answers stay as they are. The/lan/v1/callline inmcl_core_lan_entry's module doc names the field.served_by.Tests
served_bymust equal the second peer'smcl_core_lan:node_id/0while differing from the caller's. The control is a capability served on the entry peer itself, which must answer with the entry peer's id.served_by/1returns the id for a node in a{node, _}group, andnonefor a node in no such group. That case is treated asgone.served_byset to the caller; tonode_id()(this node); dropped from the 200; the no-id pid called instead of skipped. Each one must fail a test.Out of scope
macula-mcp moving
mesh_recallto the LAN. That is the follow-up in macula-io/macula-mcp, once this is on hex.