feat(meshcore): scope all originated flood traffic — phase 2 (#3667)#3673
Conversation
Phase 1 scoped channel/DM messages. Phase 2 extends the same per-source scope mutex to every other flood-originating send so MeshMonitor is fully usable in a `region denyf *` mesh (which drops un-scoped flood traffic): - Add `runSerialized` + `sendWithDefaultScope` helpers; refactor `sendMessage` to use `runSerialized`. - Assert the source default scope (serialized) before: companion adverts (`sendAdvert`), remote logins (`loginToNode`), telemetry requests (`requestRemoteTelemetry`), and remote CLI commands (`sendCliCommand`). Auto-announce / timer advert bursts and auto-ack/announce messages are covered transitively (they call `sendAdvert`/`sendMessage`). - Node discovery is intentionally exempt — it is zero-hop and never repeater-forwarded, so scope is irrelevant. - If the scope can't be asserted the send does not go out un-scoped. Tests: advert/login/telemetry assert default scope before the command; unscoped fallback; advert-concurrent-with-channel-send serialization; scope-failure aborts the advert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4
|
Claude finished @Yeraze's task —— View job PR Review: feat(meshcore): scope all originated flood traffic — phase 2Tasks:
Overall AssessmentThis is a well-structured, incremental PR. The core abstraction ( Code Quality
Potential Bug / Concern
In the current implementation this is safe because This isn't a bug today, but the Test CoverageGood coverage for the happy paths:
Missing test:
Serialization test ( Correctness / DesignRepeater exemption in
Error propagation from SummaryApprove with one suggestion: Add a test for The |
…on test (#3667) Address Claude review feedback on PR #3673: - Add tests that sendCliCommand asserts the default scope before send_cli, and that a failed scope assertion rejects the command without sending. - Strengthen the advert/channel serialization test: set_flood_scope now awaits a real macrotask (floodScopeDelayMs) so the lock is exercised under genuine interleaving, not just synchronous mock resolution. - Comment that the CLI send is intentionally fire-and-forget to avoid nesting the per-prefix cliCommandLocks with the global sendScopeLock. - Trivial: resolveScopeForSend() instead of resolveScopeForSend(undefined). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4
|
Thanks! Addressed in 0a0d342:
|
|
Claude finished @Yeraze's task —— View job PR Review: feat(meshcore): scope all originated flood traffic — phase 2Tasks:
Overall AssessmentThis is a clean, well-considered follow-up commit (0a0d342) that directly addresses all four concerns raised in the previous review. The implementation is correct, the added tests are meaningful, and the explanatory comments are thorough. Ready to merge. Changes in the Follow-Up Commit (0a0d342)
The test at line 231 uses Concurrent serialization test strengthened (
Trivial: One Minor Observation
Nothing new raised — the lock-nesting concern, synchronous-mock weakness, and missing CLI test are all resolved. No new concerns from reviewing the current state of the files. SummaryAll four items from the previous review are addressed. The implementation is correct, the comment on the Approve. |
Summary
Phase 2 of MeshCore region/scope support (#3667), building on the merged Phase 1 (#3669). Phase 1 scoped channel/DM messages; this extends the same per-source scope mutex to every other flood-originating send, so MeshMonitor is fully usable in a
region denyf *mesh (which drops un-scoped flood traffic).Changes
MeshCoreManager:runSerialized(fn)— serialize a send on the per-source scope lock (extracted from Phase 1's inline chain;sendMessagenow uses it).sendWithDefaultScope(fn)— assert the source default scope (serialized) then runfn; if the scope can't be asserted,fndoes not run (nothing leaves un-scoped).sendWithDefaultScopeto the originated-flood sends:sendAdvert(companion branch) — repeaters scope via their ownregionconfig, so the repeater branch is untouched.loginToNode(remote admin login)requestRemoteTelemetrysendCliCommand(remote CLI)sendAdvert/sendMessage.Why these and not others
Config/local-only commands (
set_channel, radio params,get_*, reboot, etc.) don't transmit a packet onto the mesh, and direct-routed traffic (trace along a known path) isn't flood-forwarded — neither needs a scope assertion.Testing
tscserver typecheck cleanFollow-up
Part of #3667.
🤖 Generated with Claude Code