Keep what discovery heard when a round hears nothing, and fetch only changed announcements (issue 554) #32

Merged
mesh-admin merged 1 commits from fix/554-empty-discovery-round into main 2026-10-12 12:25:48 +00:00
Contributor

Fixes issue 554 (every seat and module call fails for about a minute when no runtime's discovery answer reaches the console within 750 ms).

What

  1. A round with no PING is not an answer. announce.Gather no longer counts a round as complete while no PING has arrived: it waits on, up to Patience (5 s). A round that still heard nothing is Discovery.Empty().
  2. A call falls back to the last answer, with its age. The console keeps each runtime's last whole announcement. A round that does not hear a runtime (empty round, silent INFO, or simply missed) resolves against what that runtime announced last, within RuntimeForgotten (15 min), unless it restarted under a new instance. mesh_call and mesh_describe say "found from what node-tools on announced Ns ago: it did not answer the latest round of discovery"; if the runtime is really gone, the call fails with the bus's own refusal plus that sentence. An empty round is not kept for IndexKept: the next question asks again.
  3. A round that misses runtimes is logged once (when what it missed changes), with its wait, window, patience, PING and announcement counts and who was not heard; recovery is logged once too.
  4. Unchanged announcements are not pulled again. A runtime's PING metadata carries digest (sha256 of its info_response). Gather now broadcasts only PING and asks $SRV.INFO.<name>.<id> of each instance whose digest it does not hold (or that gave none, e.g. the controller). Already allowed by the console's grants ($SRV.INFO.>); every runtime already answers that subject. Steady state: a round moves PINGs only instead of ~880 kB to the laptop. mesh_runtimes says when an announcement was unchanged. bus.Collector (one inbox, many requests) added; Collect uses it.

Why

A round at 751 ms with an empty set of PING answers counted as complete and replaced the index wholesale, so every address resolved against nothing (announce.go Gather, console/address.go indexAsked, runtimes.go remember, resolve).

Tests (fail without the fix)

  • announce: TestARoundWaitsForAPingThatArrivesAfterTheWindow, TestARoundThatHearsNothingIsEmptyAfterThePatience, TestAnUnchangedAnnouncementIsNotFetchedAgain (counts INFO requests at the responder).
  • console: TestACallAfterARoundThatHeardNothingUsesWhatWasHeardBefore (end to end over the MCP surface: a runtime heard, its discovery goes quiet, module and seat calls still reach their handlers and say the age, a gone tool fails with the bus refusal, the empty round is logged once and not kept, recovery logged once), TestAnAddressKnownOnlyFromAnEarlierAnswerSaysHowOld.
  • The test runtimes in gather_test.go/runtimes_test.go now also answer the per-instance INFO subject, as real runtimes do. TestARuntimeHeardBeforeAndNotNowIsNamed gives its round a PING, as the case it models had.
  • merge-check.sh passes locally; its bundleless console list now includes the discovery tests (none launches a bundle). The console/runtime tests that launch bundles fail locally exactly as on main (no @novox/mesh-sdk here).

Replay

node-tools is core (the tool runner). Replay: after rollout, on g14 mesh_runtimes twice in a row shows announcements as unchanged (no INFO bytes re-pulled), and the next link dip on the laptop gives calls that answer with "found from what ... announced Ns ago" plus one journal line "discovery heard nothing at all" instead of refusals. The end-to-end test above replays the failing case on a test bus.

Design limits chosen

  • Fallback applies to every unheard runtime within RuntimeForgotten (15 min), not only to empty rounds.
  • An empty round is not cached, so during a long outage each question waits up to Patience (5 s) before answering from the earlier answer.
Fixes issue 554 (every seat and module call fails for about a minute when no runtime's discovery answer reaches the console within 750 ms). ## What 1. **A round with no PING is not an answer.** `announce.Gather` no longer counts a round as complete while no PING has arrived: it waits on, up to `Patience` (5 s). A round that still heard nothing is `Discovery.Empty()`. 2. **A call falls back to the last answer, with its age.** The console keeps each runtime's last whole announcement. A round that does not hear a runtime (empty round, silent INFO, or simply missed) resolves against what that runtime announced last, within `RuntimeForgotten` (15 min), unless it restarted under a new instance. `mesh_call` and `mesh_describe` say "found from what node-tools on <machine> announced Ns ago: it did not answer the latest round of discovery"; if the runtime is really gone, the call fails with the bus's own refusal plus that sentence. An empty round is not kept for `IndexKept`: the next question asks again. 3. **A round that misses runtimes is logged once** (when what it missed changes), with its wait, window, patience, PING and announcement counts and who was not heard; recovery is logged once too. 4. **Unchanged announcements are not pulled again.** A runtime's PING metadata carries `digest` (sha256 of its info_response). Gather now broadcasts only PING and asks `$SRV.INFO.<name>.<id>` of each instance whose digest it does not hold (or that gave none, e.g. the controller). Already allowed by the console's grants (`$SRV.INFO.>`); every runtime already answers that subject. Steady state: a round moves PINGs only instead of ~880 kB to the laptop. `mesh_runtimes` says when an announcement was unchanged. `bus.Collector` (one inbox, many requests) added; `Collect` uses it. ## Why A round at 751 ms with an empty set of PING answers counted as complete and replaced the index wholesale, so every address resolved against nothing (announce.go Gather, console/address.go indexAsked, runtimes.go remember, resolve). ## Tests (fail without the fix) - announce: `TestARoundWaitsForAPingThatArrivesAfterTheWindow`, `TestARoundThatHearsNothingIsEmptyAfterThePatience`, `TestAnUnchangedAnnouncementIsNotFetchedAgain` (counts INFO requests at the responder). - console: `TestACallAfterARoundThatHeardNothingUsesWhatWasHeardBefore` (end to end over the MCP surface: a runtime heard, its discovery goes quiet, module and seat calls still reach their handlers and say the age, a gone tool fails with the bus refusal, the empty round is logged once and not kept, recovery logged once), `TestAnAddressKnownOnlyFromAnEarlierAnswerSaysHowOld`. - The test runtimes in `gather_test.go`/`runtimes_test.go` now also answer the per-instance INFO subject, as real runtimes do. `TestARuntimeHeardBeforeAndNotNowIsNamed` gives its round a PING, as the case it models had. - `merge-check.sh` passes locally; its bundleless console list now includes the discovery tests (none launches a bundle). The console/runtime tests that launch bundles fail locally exactly as on main (no @novox/mesh-sdk here). ## Replay node-tools is core (the tool runner). Replay: after rollout, on g14 `mesh_runtimes` twice in a row shows announcements as unchanged (no INFO bytes re-pulled), and the next link dip on the laptop gives calls that answer with "found from what ... announced Ns ago" plus one journal line "discovery heard nothing at all" instead of refusals. The end-to-end test above replays the failing case on a test bus. ## Design limits chosen - Fallback applies to every unheard runtime within `RuntimeForgotten` (15 min), not only to empty rounds. - An empty round is not cached, so during a long outage each question waits up to `Patience` (5 s) before answering from the earlier answer.
mesh-admin added 1 commit 2026-10-12 11:57:10 +00:00
Keep what discovery heard when a round hears nothing, and fetch only changed announcements (issue 554)
mesh/merge-gate pass: builds mesh-tools, node-tools → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of …
mesh/repo-check pass: THE CHANGE ALTERS ITS OWN CHECK (merge-check.sh): main's version judged it; the change's judges the pull requests after it merges; it…
mesh/delivery delivered
424a7eec82
A round in which no PING reached the laptop's console within the 750 ms window
was taken as the mesh's answer that nothing is there, and replaced the index:
every seat and module call was refused for five seconds at a time. Discovery
now waits up to its patience for a first PING, a round that heard nothing is
not kept, a runtime not heard this round is resolved from what it announced
last (said with its age), and a round that misses runtimes is logged once.
A PING carries a digest of what the instance serves, so an unchanged
announcement is not pulled again every round (some 880 kB to the laptop).
Author
Contributor

Delivery novox/mesh-tools@424a7eec8235 — delivered since 2026-10-12T12:33:37Z

Delivery plan — builds mesh-tools, node-tools → ace, g14, novox, shanks; no bus step

  • tier 0: mesh-tools, node-tools
  • ace: receives node-tools
  • g14: receives node-tools
  • novox: receives node-tools
  • shanks: receives node-tools
  • node-tools provides mcp-endpoint: its consumers are sent again after it
  • grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before node-tools is judged on its first machine

Machines

  • node-tools on ace: passed — healthy 3 times over 2m38s
  • mesh-tools on every machine running it: sent
  • node-tools on the rest running it: sent

Transitions

  • 2026-10-12 11:57 (new) → proposed (announced): novox/mesh-tools#32's head announced
  • 2026-10-12 11:59 proposed → checked (checked): the verdict names this commit
  • 2026-10-12 11:59 checked → ready (accepted): the gate passed or warned, and the repository's own check did not fail
  • 2026-10-12 12:28 ready → published (merged): on the trunk its modules follow: merged there, and its walk opened — or nothing for a walk to move
  • 2026-10-12 12:28 published → delivering (go): its walk started: let go by this owner in its group's order, by a person, or on the controller's own path — not a failed walk that carried a later commit for it, after which it waits for a walk of its own commit
  • 2026-10-12 12:33 delivering → delivered (done): its walk is done, carrying its own commit: every machine of its deploy plan passed, or was left as its policy says

The commit's note under refs/notes/mesh-plan keeps every transition: git log --notes=mesh-plan.

<!-- mesh-delivery:view --> **Delivery** `novox/mesh-tools@424a7eec8235` — **delivered** since 2026-10-12T12:33:37Z **Delivery plan** — builds mesh-tools, node-tools → ace, g14, novox, shanks; no bus step - tier 0: mesh-tools, node-tools - ace: receives node-tools - g14: receives node-tools - novox: receives node-tools - shanks: receives node-tools - node-tools provides mcp-endpoint: its consumers are sent again after it - grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before node-tools is judged on its first machine **Machines** - node-tools on ace: passed — healthy 3 times over 2m38s - mesh-tools on every machine running it: sent - node-tools on the rest running it: sent **Transitions** - 2026-10-12 11:57 (new) → proposed (announced): novox/mesh-tools#32's head announced - 2026-10-12 11:59 proposed → checked (checked): the verdict names this commit - 2026-10-12 11:59 checked → ready (accepted): the gate passed or warned, and the repository's own check did not fail - 2026-10-12 12:28 ready → published (merged): on the trunk its modules follow: merged there, and its walk opened — or nothing for a walk to move - 2026-10-12 12:28 published → delivering (go): its walk started: let go by this owner in its group's order, by a person, or on the controller's own path — not a failed walk that carried a later commit for it, after which it waits for a walk of its own commit - 2026-10-12 12:33 delivering → delivered (done): its walk is done, carrying its own commit: every machine of its deploy plan passed, or was left as its policy says The commit's note under `refs/notes/mesh-plan` keeps every transition: `git log --notes=mesh-plan`.
Author
Contributor

Merge check at 424a7eec

  • mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-tools, node-tools)
  • mesh/repo-check: PASS — THE CHANGE ALTERS ITS OWN CHECK (merge-check.sh): main's version judged it; the change's judges the pull requests after it merges; its merge-check.sh passed

Delivery plan — builds mesh-tools, node-tools → ace, g14, novox, shanks; no bus step

  • tier 0: mesh-tools, node-tools
  • ace: receives node-tools
  • g14: receives node-tools
  • novox: receives node-tools
  • shanks: receives node-tools
  • node-tools provides mcp-endpoint: its consumers are sent again after it
  • grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before node-tools is judged on its first machine

Run by the build seat on ace as build-1791806257336466911 (builds --log build-1791806257336466911).

--- the gate: mesh-tools, node-tools
mesh-tools: ok
node-tools: ok, invokes every tool
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
2 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T11:52:38Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T11:52:38Z

machines:
  - a machine (f35): composes
  - holds mesh-dns-resolver (idt): composes
  - holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
  - a machine (yvbpsm): composes

a merge would rebuild 2 module(s) in 1 tier(s): mesh-tools, node-tools
--- THE CHANGE ALTERS ITS OWN CHECK (merge-check.sh): main's version judged it; the change's judges the pull requests after it merges
--- its merge-check.sh (go toolchain)
NOT TESTED HERE: internal/runtime and internal/console launch bundles that need node and @novox/mesh-sdk
?   	github.com/novox/mesh-tools/node-tools/cmd/node-tools	[no test files]
ok  	github.com/novox/mesh-tools/node-tools/internal/alive	1.193s
ok  	github.com/novox/mesh-tools/node-tools/internal/announce	9.270s
ok  	github.com/novox/mesh-tools/node-tools/internal/bus	12.457s
ok  	github.com/novox/mesh-tools/node-tools/internal/launch	1.070s
ok  	github.com/novox/mesh-tools/node-tools/internal/meshtest	1.127s
?   	github.com/novox/mesh-tools/node-tools/internal/wire	[no test files]
ok  	github.com/novox/mesh-tools/node-tools/internal/console	0.006s
ok  	github.com/novox/mesh-tools/node-tools/internal/runtime	1.976s
NOT TESTED HERE: node-tools/src (TypeScript) needs @novox/mesh-sdk from the package registry
**Merge check** at `424a7eec` - `mesh/merge-gate`: **PASS** — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-tools, node-tools) - `mesh/repo-check`: **PASS** — THE CHANGE ALTERS ITS OWN CHECK (merge-check.sh): main's version judged it; the change's judges the pull requests after it merges; its merge-check.sh passed **Delivery plan** — builds mesh-tools, node-tools → ace, g14, novox, shanks; no bus step - tier 0: mesh-tools, node-tools - ace: receives node-tools - g14: receives node-tools - novox: receives node-tools - shanks: receives node-tools - node-tools provides mcp-endpoint: its consumers are sent again after it - grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before node-tools is judged on its first machine Run by the build seat on ace as `build-1791806257336466911` (`builds --log build-1791806257336466911`). ``` --- the gate: mesh-tools, node-tools mesh-tools: ok node-tools: ok, invokes every tool long-running resources without health: 0 files asking for a setting without saying whether it is trusted: 0 2 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T11:52:38Z says they run composing every machine as the mesh is the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued composing every machine with the change the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose) judged by controller development build against the facts of 2026-10-12T11:52:38Z machines: - a machine (f35): composes - holds mesh-dns-resolver (idt): composes - holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes - a machine (yvbpsm): composes a merge would rebuild 2 module(s) in 1 tier(s): mesh-tools, node-tools --- THE CHANGE ALTERS ITS OWN CHECK (merge-check.sh): main's version judged it; the change's judges the pull requests after it merges --- its merge-check.sh (go toolchain) NOT TESTED HERE: internal/runtime and internal/console launch bundles that need node and @novox/mesh-sdk ? github.com/novox/mesh-tools/node-tools/cmd/node-tools [no test files] ok github.com/novox/mesh-tools/node-tools/internal/alive 1.193s ok github.com/novox/mesh-tools/node-tools/internal/announce 9.270s ok github.com/novox/mesh-tools/node-tools/internal/bus 12.457s ok github.com/novox/mesh-tools/node-tools/internal/launch 1.070s ok github.com/novox/mesh-tools/node-tools/internal/meshtest 1.127s ? github.com/novox/mesh-tools/node-tools/internal/wire [no test files] ok github.com/novox/mesh-tools/node-tools/internal/console 0.006s ok github.com/novox/mesh-tools/node-tools/internal/runtime 1.976s NOT TESTED HERE: node-tools/src (TypeScript) needs @novox/mesh-sdk from the package registry ```
mesh-admin left a comment
Author
Contributor

Verdict: approve at 424a7ee

Independent review for issue 554 (a discovery round that hears nothing refuses every seat and module call).

WHAT I CHECKED

  1. Gather: complete() is now false while no PING has arrived, so a round in which nothing answers within the 750 ms window waits until the 5 s patience and is marked Empty(). I proved the old behaviour fails: on main, a test that calls Gather on an empty bus with a 1.5 s patience returns after 750 ms ("an empty round returned after 750.142258ms"). On this head, TestARoundThatHearsNothingIsEmptyAfterThePatience and TestARoundWaitsForAPingThatArrivesAfterTheWindow pass.

  2. A stale or wrong runtime cannot be reached. Calls go to subjects taken from the announcements, mesh.mod..tool.[.] and mesh.seat..tool.[.]. None of these subjects carries an instance id. So a target resolved from an announcement up to 15 min old still reaches only the runtime that subscribes to that subject now. Three cases follow from that. A module that moved off a node gets the bus's no-responders refusal for /.. A removed tool is refused by the live runtime. A reassigned seat is answered by its current holder. The call result, or the failure, then carries the "found from what X announced Ns ago" sentence. Note that the instance id is the node name (runtime.go instanceOf), so a restart does not change the id. The "not since restarted under another instance" guard in before() therefore never fires for node-tools. The safety rests on routing by subject alone, and that routing is sound. I judge resolving from a 15-min-old announcement safe for side-effecting tools.

  3. Digest. The PING digest is sha256 (truncated to 96 bits) over the same micro.Info value that INFO serves: identity with version and metadata, description, and every endpoint with its subject, queue, kind, and a seat's schema. Any change to an announcement therefore changes the digest. endpointsOf and servedOn build their slices deterministically, and encoding/json sorts map keys, so an unchanged announcement keeps its digest. A PING without a digest (the controller's own service, old runtimes during the rollout) is never matched (heldAt) and is always fetched. If an announcement changes between a PING and its INFO, the console keeps the new Info under the old digest. The next PING's digest then differs, so the console fetches again. The race can cause one extra fetch, never a missed change. Two instances under one name and id undo a reused answer and are asked again.

  4. Grants. A runtime's account gets discovering() (mesh-controller internal/broker/nats.go: $SRV.PING, $SRV.PING.>, $SRV.INFO, $SRV.INFO.>), and so does a person's account. Every console may therefore publish $SRV.INFO... announcing() lets every server subscribe to $SRV.INFO..>. Serve on main already answers the 4-token subject, so old runtimes answer the new console. Old consoles still ask the bare $SRV.INFO, and new runtimes still answer it.

  5. go vet is clean for announce, console and bus. go test -race passes for announce and bus. For console, the bundleless set that this PR's merge-check.sh names, including the four new tests, passes under -race. The whole console package fails two tests here, TestTheMeshsToolsAreFoundByAddress and TestTheConsoleListsAndCallsOverHTTP, and fails them identically on main: they need node and the SDK. These failures are environmental and the PR did not cause them.

  6. Both required statuses on 424a7ee are success: mesh/merge-gate (node-tools to ace, g14, novox, shanks; every machine composes) and mesh/repo-check. repo-check ran main's merge-check.sh, because the change alters its own check. Main's bundleless filter excludes the four new console tests, so the gate did not run them. I ran them myself (point 5).

NON-BLOCKING, FOR A FOLLOW-UP

a. Memory. runtimeSeen.Last now holds a runtime's whole announcement, about 200 kB. An entry is deleted only when the same name@machine answers again. A runtime that disappears for good keeps its Last for the life of the process: a retired module runtime, or a silent entry with no machine. The growth is bounded by the distinct runtimes seen and is small in practice, but it has no bound in principle. Dropping Last, or the entry, once LastHeard is older than RuntimeForgotten would close it.

b. Bus down. While the connection reconnects, Gather returns an empty round after 5 s and the index serves every runtime's last answer for 15 min. A call then fails on the bus and carries the stale sentence. But mesh_search, mesh_overview and mesh_machine list those tools without any age, and a failed call does not say that nothing answered discovery at all. When Discovery.Empty() holds, I suggest that the listing answers and the call failures say "no runtime answered discovery at all within 5s; this console's bus link may be down".

c. An empty round is not cached, so while the link is starved every question waits the full 5 s patience. I accept this as the cost of not answering wrongly. It belongs in the issue's resolve note.

d. Each PING now builds and hashes the whole Info, about 250 kB, including the node-engine's witness PINGs. The cost is a few ms, but PING latency is what this issue was about. Caching the digest until current() changes would keep PING as cheap as before.

e. In indexOn, when several earlier runtimes announce the same endpoint, stale[k] takes the first in key order, not the most recent. The age it reports can then be the older of the two. This is cosmetic.

Verdict: approve at 424a7ee Independent review for issue 554 (a discovery round that hears nothing refuses every seat and module call). WHAT I CHECKED 1. Gather: complete() is now false while no PING has arrived, so a round in which nothing answers within the 750 ms window waits until the 5 s patience and is marked Empty(). I proved the old behaviour fails: on main, a test that calls Gather on an empty bus with a 1.5 s patience returns after 750 ms ("an empty round returned after 750.142258ms"). On this head, TestARoundThatHearsNothingIsEmptyAfterThePatience and TestARoundWaitsForAPingThatArrivesAfterTheWindow pass. 2. A stale or wrong runtime cannot be reached. Calls go to subjects taken from the announcements, mesh.mod.<module>.tool.<tool>[.<node>] and mesh.seat.<seat>.tool.<verb>[.<node>]. None of these subjects carries an instance id. So a target resolved from an announcement up to 15 min old still reaches only the runtime that subscribes to that subject now. Three cases follow from that. A module that moved off a node gets the bus's no-responders refusal for <node>/<module>.<tool>. A removed tool is refused by the live runtime. A reassigned seat is answered by its current holder. The call result, or the failure, then carries the "found from what X announced Ns ago" sentence. Note that the instance id is the node name (runtime.go instanceOf), so a restart does not change the id. The "not since restarted under another instance" guard in before() therefore never fires for node-tools. The safety rests on routing by subject alone, and that routing is sound. I judge resolving from a 15-min-old announcement safe for side-effecting tools. 3. Digest. The PING digest is sha256 (truncated to 96 bits) over the same micro.Info value that INFO serves: identity with version and metadata, description, and every endpoint with its subject, queue, kind, and a seat's schema. Any change to an announcement therefore changes the digest. endpointsOf and servedOn build their slices deterministically, and encoding/json sorts map keys, so an unchanged announcement keeps its digest. A PING without a digest (the controller's own service, old runtimes during the rollout) is never matched (heldAt) and is always fetched. If an announcement changes between a PING and its INFO, the console keeps the new Info under the old digest. The next PING's digest then differs, so the console fetches again. The race can cause one extra fetch, never a missed change. Two instances under one name and id undo a reused answer and are asked again. 4. Grants. A runtime's account gets discovering() (mesh-controller internal/broker/nats.go: $SRV.PING, $SRV.PING.>, $SRV.INFO, $SRV.INFO.>), and so does a person's account. Every console may therefore publish $SRV.INFO.<name>.<id>. announcing() lets every server subscribe to $SRV.INFO.<name>.>. Serve on main already answers the 4-token subject, so old runtimes answer the new console. Old consoles still ask the bare $SRV.INFO, and new runtimes still answer it. 5. go vet is clean for announce, console and bus. go test -race passes for announce and bus. For console, the bundleless set that this PR's merge-check.sh names, including the four new tests, passes under -race. The whole console package fails two tests here, TestTheMeshsToolsAreFoundByAddress and TestTheConsoleListsAndCallsOverHTTP, and fails them identically on main: they need node and the SDK. These failures are environmental and the PR did not cause them. 6. Both required statuses on 424a7ee are success: mesh/merge-gate (node-tools to ace, g14, novox, shanks; every machine composes) and mesh/repo-check. repo-check ran main's merge-check.sh, because the change alters its own check. Main's bundleless filter excludes the four new console tests, so the gate did not run them. I ran them myself (point 5). NON-BLOCKING, FOR A FOLLOW-UP a. Memory. runtimeSeen.Last now holds a runtime's whole announcement, about 200 kB. An entry is deleted only when the same name@machine answers again. A runtime that disappears for good keeps its Last for the life of the process: a retired module runtime, or a silent entry with no machine. The growth is bounded by the distinct runtimes seen and is small in practice, but it has no bound in principle. Dropping Last, or the entry, once LastHeard is older than RuntimeForgotten would close it. b. Bus down. While the connection reconnects, Gather returns an empty round after 5 s and the index serves every runtime's last answer for 15 min. A call then fails on the bus and carries the stale sentence. But mesh_search, mesh_overview and mesh_machine list those tools without any age, and a failed call does not say that nothing answered discovery at all. When Discovery.Empty() holds, I suggest that the listing answers and the call failures say "no runtime answered discovery at all within 5s; this console's bus link may be down". c. An empty round is not cached, so while the link is starved every question waits the full 5 s patience. I accept this as the cost of not answering wrongly. It belongs in the issue's resolve note. d. Each PING now builds and hashes the whole Info, about 250 kB, including the node-engine's witness PINGs. The cost is a few ms, but PING latency is what this issue was about. Caching the digest until current() changes would keep PING as cheap as before. e. In indexOn, when several earlier runtimes announce the same endpoint, stale[k] takes the first in key order, not the most recent. The age it reports can then be the older of the two. This is cosmetic.
mesh-admin merged commit 954e1a53ee into main 2026-10-12 12:25:48 +00:00
mesh-admin deleted branch fix/554-empty-discovery-round 2026-10-12 12:25:48 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: novox/mesh-tools#32