Skip to content

Commit 372115f

Browse files
committed
1
1 parent 48170d2 commit 372115f

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/public/parts/shells/chat/test/live/scripts/federation/control_plane.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
FedA,
66
FedB,
77
InitializeOpenGroupJoin,
8+
TestFedHasMessage,
89
testCase,
910
WaitFedConverged,
1011
WaitFedMembers,
@@ -93,10 +94,7 @@ await testCase('B applies signed event from A via POST /events/signed', async ()
9394
const response = await Api(FedB, 'POST', `/groups/${groupId}/events/signed`, { events: [row] })
9495
if (response.status !== 200) throw new Error(`ingest ${response.status}: ${response.raw}`)
9596

96-
return WaitFedConverged(FedB, groupId, async () => {
97-
const onB = await Api(FedB, 'GET', `/groups/${groupId}/events?limit=50`)
98-
return (onB.json.events?.filter(e => e.id === eventId).length ?? 0) === 1
99-
})
97+
return WaitFedConverged(FedB, groupId, async () => TestFedHasMessage(FedB, groupId, channelId, eventId))
10098
})
10199

102100
await ClearFedGroup(groupId)

src/scripts/test/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Manifest id = domain (`server`, `testkit`, `p2p`, `shells/chat`, …).
6363
- Native-addon / WebRTC: one `.test.mjs` per Deno child when the addon panics under reuse (common on Windows). **`p2p:live`** needs `node-datachannel` native build; because every test child now passes `--allow-scripts`, Deno builds it (and self-heals a prior `.scripts-warned`) on first run — no manual `deno install --allow-scripts` after clone. **Symptom if the flag is ever dropped**: the addon dir under `node_modules/.deno/node-datachannel@*/` carries `.scripts-warned` (no `.scripts-run`) and `build/Release` is empty, nodes still boot fine, but every federation suite fails with `peers: 0` / `members>=2` gate never satisfied. Verify with `deno test --no-check --allow-scripts --allow-all -c ./deno.json ./src/scripts/p2p/test/live/link_smoke.test.mjs`.
6464
- Single-node: `{ p2p: false, minP2pNode: true }`. P2P signaling: [p2p/docs/signaling.md](../p2p/docs/signaling.md).
6565
- Federation live probes: reuse `InitializeOpenGroupJoin` / `InitializeOpenGroupJoinMulti` from `live/federation/common.mjs` (they bundle `WarmupFedNodeLinks``rebind` → members gate → re-invite fallback). A hand-rolled bare join (create → invite → join) with no warmup/rebind will hang at `members>=2`. A `members>=2` hang is usually a real link/handshake or ICE bug, not flakiness — inspect handshake/ICE logs before rerunning (signaling traps: [p2p/docs/signaling.md](../p2p/docs/signaling.md)).
66+
- Federation convergence assertions should prefer semantic helpers (`TestFedHasMessage`, `TestFedHasReaction`, etc.) over raw `GET /events?limit=...` scans: event streams are paged/windowed and can miss the target row even when ingestion succeeded, causing false negatives.
6667

6768
## Operator tools
6869

0 commit comments

Comments
 (0)