Don't show messages from Ignored nodes - #11068
Conversation
⚡ Try this PR in the Web FlasherWarning This is an automated, unreviewed CI test build. Back up your device configuration Supported boards built by this PR (30)
Build artifacts expire on 2026-08-18. Updated for |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughChangesIgnored Message Filtering
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MeshService
participant MessageStore
participant MessageRenderer
MeshService->>MessageStore: tryAddFromPacket(packet)
MessageStore-->>MeshService: StoredMessage or nullptr
MeshService->>MessageRenderer: handleNewMessage(storedMessage)
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2dbd1ec923
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/mesh/NodeDB.cpp (1)
3267-3271: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPrevent unconditional data loss when an ignore request is rejected.
Because the
ifstatement lacks braces,eraseNodeSatellitesandmessageStore.deleteAllMessagesFromNodeexecute unconditionally. If the node cannot be ignored (e.g., due to protected-node limits),setProtectedFlagfails and logs a warning, but the node's entire message history and satellite data are still destructively erased.Please wrap the teardown operations in an
elseblock so they only execute when the node is successfully ignored, matching the safe behavior implemented inAdminModule.cpp.🐛 Proposed fix
- if (!setProtectedFlag(info, NODEINFO_BITFIELD_IS_IGNORED_MASK, true)) + if (!setProtectedFlag(info, NODEINFO_BITFIELD_IS_IGNORED_MASK, true)) { LOG_WARN(PROTECTED_CAP_WARN_FMT, "ignore", contact.node_num, MAX_NUM_NODES - 2); - nodeInfoLiteSetBit(info, NODEINFO_BITFIELD_IS_FAVORITE_MASK, false); - eraseNodeSatellites(contact.node_num); - messageStore.deleteAllMessagesFromNode(contact.node_num); + } else { + nodeInfoLiteSetBit(info, NODEINFO_BITFIELD_IS_FAVORITE_MASK, false); + eraseNodeSatellites(contact.node_num); + messageStore.deleteAllMessagesFromNode(contact.node_num); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/mesh/NodeDB.cpp` around lines 3267 - 3271, Update the ignore handling around setProtectedFlag so eraseNodeSatellites and messageStore.deleteAllMessagesFromNode execute only when the node is successfully marked ignored. Add an else block for the teardown operations, while preserving the warning path and favorite-bit update behavior.
🧹 Nitpick comments (1)
src/MessageStore.cpp (1)
520-521: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winOptimize flash writes by checking if any messages were actually deleted.
saveToFlash()is called unconditionally, which causes unnecessary flash wear if the ignored node had no associated messages in history. Please consider tracking the size of the deque to skip the save if no elements were erased, similar to the pattern used inpruneHiddenMessages().♻️ Proposed refactor
- eraseAllMatches(liveMessages, pred); - saveToFlash(); + const size_t before = liveMessages.size(); + eraseAllMatches(liveMessages, pred); + if (liveMessages.size() != before) { + saveToFlash(); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/MessageStore.cpp` around lines 520 - 521, Update the flow around eraseAllMatches in the relevant message-removal method to record the liveMessages size before deletion, then call saveToFlash() only when the deque size decreases. Follow the existing conditional-save pattern used by pruneHiddenMessages(), while preserving deletion behavior when messages were actually removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/modules/TextMessageModule.cpp`:
- Around line 28-35: Move the message-ignore check using
messageStore.shouldStorePacket(mp) to immediately after the textPacketList
update so it applies to all display modes before any screen wake or observer
notification. In the OLED-specific block, replace tryAddFromPacket and its null
check with messageStore.addFromPacket(mp), preserving the renderer call with the
returned StoredMessage reference.
---
Outside diff comments:
In `@src/mesh/NodeDB.cpp`:
- Around line 3267-3271: Update the ignore handling around setProtectedFlag so
eraseNodeSatellites and messageStore.deleteAllMessagesFromNode execute only when
the node is successfully marked ignored. Add an else block for the teardown
operations, while preserving the warning path and favorite-bit update behavior.
---
Nitpick comments:
In `@src/MessageStore.cpp`:
- Around line 520-521: Update the flow around eraseAllMatches in the relevant
message-removal method to record the liveMessages size before deletion, then
call saveToFlash() only when the deque size decreases. Follow the existing
conditional-save pattern used by pruneHiddenMessages(), while preserving
deletion behavior when messages were actually removed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 428f5c8e-b4c8-4627-a2e1-ca33c6583768
📒 Files selected for processing (16)
src/MessageStore.cppsrc/MessageStore.hsrc/graphics/Screen.cppsrc/graphics/draw/MenuHandler.cppsrc/graphics/draw/MessageRenderer.cppsrc/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cppsrc/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cppsrc/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cppsrc/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cppsrc/graphics/niche/InkHUD/Events.cppsrc/graphics/niche/InkHUD/Persistence.cppsrc/mesh/MeshService.cppsrc/mesh/NodeDB.cppsrc/modules/AdminModule.cppsrc/modules/TextMessageModule.cppsrc/mqtt/MQTT.cpp
This makes it so messages from ignored nodes do not show, including over MQTT, similar to how the phone apps behave.
Changes
Why
Before this change, messages from ignored nodes could still show, especially through MQTT or from saved message history.
Summary by CodeRabbit