mesh_watch: events published during a LAN stream's reopen go unheard with nothing said #15

Open
opened 2026-12-02 14:40:58 +00:00 by neptunus · 0 comments
Member

Purpose (fix): a mesh_watch over the LAN says when its LAN stream had a gap, instead of losing the gap's events without a word.

Refs macula-io/macula-mcp#11 (Jupiter's r2 note, PR 12 at ca964f88). With MACULA_LAN_ENTRY set, the entry point ends a topic's event stream when its token expires, and keepHearing (src/reach_the_lan/hear_both.ts) opens it again with a fresh token. Events published on the LAN during that challenge+token round trip are not heard, and nothing says so. A fact also published on the mesh still arrives that way; a LAN-only fact is lost.

Done when

  • A watch whose LAN stream was reopened reports it, e.g. lan_gaps: [{from, to}] beside the events, so an agent knows when it heard nothing.
  • Or the gap is closed: the next token is earned before the stream ends, and the new stream opens before the old one closes, with a guard against events delivered twice in the overlap. If this option is taken, it is ruled first.
  • A stand-in test ends a stream, publishes during the reopen, and shows what the reply says.

Widened purpose (Supervisor, 2026-12-02, via Mars)

Losing events without a word is real harm, so the gap is in scope. In order:

  1. Avoid the gap first. Renew the token and reopen the LAN stream BEFORE the token expires, with the new stream open before the old one closes, so no event falls between them. The overlap is where duplicates come from: the path-aware dedup in src/reach_the_lan/hear_both.ts covers same-path copies delivered by the two streams as well as the two paths (this is what #16 keys: topic plus the hash of the payload in one normal form, no publisher).
  2. If a gap still happens (a node restart, the network), mesh_watch says so, with the gap's start and end times.

macula-io/macula-mcp#16 is folded into this package and closes with it. Tests use the 127.0.0.1 stand-in; nothing outside.

Added Done-when (Supervisor, 2026-12-02)

  • The next token is earned and the new stream is OPEN before the old stream closes; a stand-in test ends/publishes/reopens and shows no event lost.
  • A fact delivered by both streams in the overlap is returned once: the key is topic plus the hash of the payload in one normal form (no publisher), one test for a mesh {"$bytes"} payload and one for the LAN UTF-8 string, both hashing alike.
  • The one-for-one other-path rule keeps its tests green.
  • A gap that does happen (the new stream cannot open in time, or the node restarts) is reported beside the events as lan_gaps: [{from, to}] with the gap's start and end.

Refs macula-io/macula-mcp#16

Purpose (fix): a `mesh_watch` over the LAN says when its LAN stream had a gap, instead of losing the gap's events without a word. Refs macula-io/macula-mcp#11 (Jupiter's r2 note, PR 12 at ca964f88). With `MACULA_LAN_ENTRY` set, the entry point ends a topic's event stream when its token expires, and `keepHearing` (src/reach_the_lan/hear_both.ts) opens it again with a fresh token. Events published on the LAN during that challenge+token round trip are not heard, and nothing says so. A fact also published on the mesh still arrives that way; a LAN-only fact is lost. ## Done when - [ ] A watch whose LAN stream was reopened reports it, e.g. `lan_gaps: [{from, to}]` beside the events, so an agent knows when it heard nothing. - [ ] Or the gap is closed: the next token is earned before the stream ends, and the new stream opens before the old one closes, with a guard against events delivered twice in the overlap. If this option is taken, it is ruled first. - [ ] A stand-in test ends a stream, publishes during the reopen, and shows what the reply says. ## Widened purpose (Supervisor, 2026-12-02, via Mars) Losing events without a word is real harm, so the gap is in scope. In order: 1. **Avoid the gap first.** Renew the token and reopen the LAN stream BEFORE the token expires, with the new stream open before the old one closes, so no event falls between them. The overlap is where duplicates come from: the path-aware dedup in `src/reach_the_lan/hear_both.ts` covers same-path copies delivered by the two streams as well as the two paths (this is what #16 keys: topic plus the hash of the payload in one normal form, no publisher). 2. **If a gap still happens** (a node restart, the network), `mesh_watch` says so, with the gap's start and end times. `macula-io/macula-mcp#16` is folded into this package and closes with it. Tests use the 127.0.0.1 stand-in; nothing outside. ## Added Done-when (Supervisor, 2026-12-02) - [ ] The next token is earned and the new stream is OPEN before the old stream closes; a stand-in test ends/publishes/reopens and shows no event lost. - [ ] A fact delivered by both streams in the overlap is returned once: the key is topic plus the hash of the payload in one normal form (no publisher), one test for a mesh `{"$bytes"}` payload and one for the LAN UTF-8 string, both hashing alike. - [ ] The one-for-one other-path rule keeps its tests green. - [ ] A gap that does happen (the new stream cannot open in time, or the node restarts) is reported beside the events as `lan_gaps: [{from, to}]` with the gap's start and end. Refs macula-io/macula-mcp#16
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#15
No description provided.