LAN backend beside the mesh: MACULA_LAN_ENTRY, a member's token, mesh_call and mesh_watch on the entry point (mcl-lan P6) #11
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): with
MACULA_LAN_ENTRYset, macula-mcp reaches a LAN cluster's entry point. The member gets a token with its own key,mesh_callruns there, andmesh_watchhears the LAN's events. The mesh backend stays beside it, unchanged. With the variable unset, nothing changes.DECIDED 2026-12-02 "we won't loose the mesh! I just don't want to pitch Martha as "mesh-only"" (Raf): the LAN is added beside the mesh, never in place of it.
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 §4.2 and §4.3 (P6). The entry point is macula-services/mcl-core#4 (main 914650ae):
POST /lan/v1/challenge,/token,/call,GET /lan/v1/events.Threat model (before code)
Assets: the member's identity key (ML-DSA, pq_hybrid), the token it earns (15 min, HMAC under the cluster's key), and what the member's calls can do.
"mcl-lan token request v1" 0x00 ‖ node_id ‖ nonceis signed. That label is mcl-core'ssigned_message/2, so the signature means nothing elsewhere. A nonce that is not exactly 32 bytes is refused before signing.MACULA_LAN_ENTRYnames a public host (a typo or a hostile config), or a redirect sends the request elsewherelan_members. The challenge is single-use. This package adds nothing, and the tool says the call went in the clear.MACULA_LAN_ENTRYunset, no LAN code runs and every tool behaves exactly as on main. A test holds this.mesh_call.no_lan_providerfalls through to the mesh, and every other tool stays on the mesh.Out of scope: TLS on the LAN, a browser sign-in, and the owner's
lan_membersstep (P7).Design
src/reach_the_lan/:MACULA_LAN_ENTRYparsed and checked (http, no user info, private address);call(org, procedure, args, timeout);mesh_call: a plain call goes to the LAN first. Plain means norealm,provider,ucan,prove_ownershiporconfidential: "required", all of which are mesh concepts. The procedureorg/nameis split into{org, procedure}.no_lan_providerit goes to the mesh as today.via: "lan"or"mesh". A LAN result carries no seal report: it went in the clear on the LAN, and the result says so.mesh_watch: with the variable set and norealm, it hears the LAN stream and the mesh subscription together. Each event names itsvia. If the mesh side cannot connect, it still returns the LAN events and says why the mesh was not heard.mesh_recallchecks the corpus against the node that answered, and the entry point does not report which node served a call. A follow-up is filed on mcl-core for that.Done when
MACULA_LAN_ENTRYunset, no LAN code runs (a test that would see any entry-point request).NodeKey.verifyover the same message) issues a token to the right key. It refuses a node id that is not listed, so nothing more is signed or sent. A replayed challenge is refused. No test reaches an outside host.mesh_callgoes to the LAN withAuthorization: Bearer, and its result saysvia: "lan". Onno_lan_providerit reaches the mesh path. A call withrealm,provider,ucan,prove_ownershiporconfidential: "required"never touches the LAN.mesh_watchreturns LAN events taggedvia: "lan"beside the mesh's.vitest run), with mutants on the guards.Supervisor rulings 2026-12-02 (relayed by Mars), folded into PR 12 at
3ce2e4f:mesh_recall's corpus check needs that. Follow-up: macula-services/mcl-core#13.MACULA_LAN_ENTRYset,mesh_watchkeeps the first copy of (publisher, topic, payload hash) withinDEDUP_WINDOW_MS(10 s, defined once in src/reach_the_lan/hear_both.ts) and drops the second. The kept event carries itsvia. Test: "a fact heard over the LAN and the mesh is delivered once…". Mutantsno_dedup,no_window,publisher_caseandkey_orderare killed.LAN-first call with fall-through, and the mesh-only cases: as written.
Landed: PR 12, main
ca964f88(Terra, fast-forward). Review: Jupiter, r1 FAIL (3 fixes), then r2 PASS. CI onca964f88: run 6970 green. Run 6971: structural floor, typecheck, build, test and shellcheck green; Dependency advisories red, accepted under #13 (minimatch in the lock, no package file changed).Done when:
NodeKey.verifyand issues the token to the right key. An unlisted node id: nothing is signed or sent past the challenge. A replayed challenge is refused ("cannot be earned twice from one challenge"). Nothing reaches outside, and DNS is a seam.via: "lan". no_lan_provider goes to the mesh (via: "mesh"). Any other LAN failure does not fall through. realm, realm-prefixed procedure, ucan, prove_ownership, confidential "required" and bytes never touch the LAN.viabeside the mesh's. A fact over both paths is delivered once, one for one, and real repeats over one path are all kept (ruling + r1 fix 1). An ended stream is reopened with a fresh token, and a failed reopen is reported undernot_heard.lan. The open is bounded.Follow-ups: macula-services/mcl-core#13 (the reply names the serving member, so memory can move to the LAN), #13 (minimatch), #14 (descriptions test load timeout), #15 (reopen gap).