aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/harness/search_fanout_harness.mjs
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-17 18:51:35 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-17 18:51:35 +0200
commit7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf (patch)
tree9b5d0aae04e226e1f3c7187a4866ee421544f7a4 /packages/meshbay-hub/tests/harness/search_fanout_harness.mjs
parent8125df6d8149368ed8a84c9db6c5e37bfccb5a15 (diff)
downloadmeshbay-7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf.tar.gz
fix(spa): search names the groups refused the local network
Search gives up before ICE does, so the refusal is read from the connection then; the walk moves on to the group's other nodes, and the page lists the refused groups with a link to each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/harness/search_fanout_harness.mjs')
-rw-r--r--packages/meshbay-hub/tests/harness/search_fanout_harness.mjs17
1 files changed, 14 insertions, 3 deletions
diff --git a/packages/meshbay-hub/tests/harness/search_fanout_harness.mjs b/packages/meshbay-hub/tests/harness/search_fanout_harness.mjs
index f84d90bc..27ad8757 100644
--- a/packages/meshbay-hub/tests/harness/search_fanout_harness.mjs
+++ b/packages/meshbay-hub/tests/harness/search_fanout_harness.mjs
@@ -23,6 +23,8 @@ const {
// Indexes (0-based, in the hub's listing order) of the groups whose node is
// down. They take `deadMs`; every other group answers in `liveMs`.
dead = [],
+ // Of those, the ones whose node this device refused on the local network.
+ lanRefused = [],
liveMs = 200,
deadMs = 10000,
// Group indexes the browser remembers as silent from a previous sweep.
@@ -87,8 +89,12 @@ const fetchGroupIndex = (_pool, groupId) => new Promise((resolve, reject) => {
const n = Number(String(groupId).split('-')[1]);
const isDead = dead.includes(n);
setTimeout(
- () => (isDead ? reject(new Error('Connection timeout'))
- : resolve({ entries: [{ id: `e${n}` }], roots: {} })),
+ () => {
+ if (!isDead) return resolve({ entries: [{ id: `e${n}` }], roots: {} });
+ const err = new Error('Connection timeout');
+ if (lanRefused.includes(n)) err.reason = 'local_network_blocked';
+ return reject(err);
+ },
isDead ? deadMs : liveMs,
);
});
@@ -125,11 +131,15 @@ const fetchAllIndexes = make(
const list = Array.from({ length: groups }, (_, i) => ({ id: `g-${i}`, name: `G${i}` }));
let finishedAt = null;
+let outcome = null;
fetchAllIndexes(
null, list, 'tok', 'alice', 'u1',
() => {}, // progress counters only
(results) => { shown.push({ at: now, groups: results.size }); },
-).then(() => { finishedAt = now; });
+).then((out) => {
+ finishedAt = now;
+ outcome = { unreachable: out.unreachable, lanBlocked: out.lanBlocked.map((g) => g.name) };
+});
await run(runUntil);
@@ -140,6 +150,7 @@ console.log(JSON.stringify({
// Every render, so a test can see whether live groups waited on dead ones.
renders: shown,
finishedAt,
+ outcome,
inFlight: Number(ceiling[1]),
// What the browser will remember for next time.
remembered: written === null ? null : JSON.parse(written),