Skip to content

Don't show messages from Ignored nodes - #11068

Merged
thebentern merged 2 commits into
developfrom
Honor-Node-Ignore
Jul 19, 2026
Merged

Don't show messages from Ignored nodes #11068
thebentern merged 2 commits into
developfrom
Honor-Node-Ignore

Conversation

@HarukiToreda

@HarukiToreda HarukiToreda commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

This makes it so messages from ignored nodes do not show, including over MQTT, similar to how the phone apps behave.

Changes

  • block messages from ignored nodes when they arrive over MQTT
  • stop saving messages from ignored nodes into local message history
  • hide saved messages from ignored nodes in message views and related screens
  • remove saved messages for a node when that node becomes ignored

Why

Before this change, messages from ignored nodes could still show, especially through MQTT or from saved message history.

Summary by CodeRabbit

  • New Features
    • Added node-ignore-aware message filtering throughout storage, thread/message selection, notifications, and the text message UI.
    • Ignoring a node now clears its saved message history.
    • MQTT downlink packets from ignored/banned sources can be discarded early.
  • Bug Fixes
    • Message screens, threads, InkHUD notifications, and “latest message” caches now skip non-visible or invalid messages.
    • Incoming messages that can’t be stored no longer trigger incorrect UI, latest-message updates, or notifications.
    • Hidden messages are pruned from persisted storage and the latest-message cache is rebuilt accordingly.

@HarukiToreda HarukiToreda self-assigned this Jul 19, 2026
@HarukiToreda HarukiToreda added baseui Issues directly related to BaseUI bugfix Pull request that fixes bugs InkHUD Issues directly related to InkHUD UI labels Jul 19, 2026
@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Flash this PR in the Web Flasher

firmware commit boards expires

Warning

This is an automated, unreviewed CI test build. Back up your device configuration
before flashing, and only flash devices you are able to recover.

Supported boards built by this PR (30)
Device Board Platform
Crowpanel Adv 3.5 TFT elecrow-adv-35-tft esp32-s3
Heltec HT62 heltec-ht62-esp32c3-sx1262 esp32-c3
Heltec Mesh Node 096 heltec-mesh-node-t096 nrf52840
Heltec Mesh Node T1 heltec-mesh-node-t1 nrf52840
Heltec Mesh Node T114 heltec-mesh-node-t114 nrf52840
Heltec V3 heltec-v3 esp32-s3
Heltec V4 heltec-v4 esp32-s3
Meshnology W10 meshnology_w10 esp32-s3
Raspberry Pi Pico pico rp2040
Raspberry Pi Pico W picow rp2040
RAK WisMesh Pocket V3 rak_wismesh_pocket nrf52840
RAK WisMesh Pod rak_wismesh_pod nrf52840
RAK WisMesh Repeater Mini V2 rak_wismesh_repeater_mini nrf52840
RAK WisMesh Tag rak_wismeshtag nrf52840
RAK WisBlock 11200 rak11200 esp32
RAK WisBlock 11310 rak11310 rp2040
RAK3312 rak3312 esp32-s3
RAK WisBlock 4631 rak4631 nrf52840
Seeed SenseCAP Mesh-Tracker-X1 seeed_mesh_tracker_X1 nrf52840
Seeed Wio Tracker L1 seeed_wio_tracker_L1 nrf52840
Seeed Xiao NRF52840 Kit seeed_xiao_nrf52840_kit nrf52840
Seeed Xiao ESP32-S3 seeed-xiao-s3 esp32-s3
Station G2 station-g2 esp32-s3
Station G3 station-g3 esp32-s3
LILYGO T-Deck t-deck-tft esp32-s3
LILYGO T-Echo t-echo nrf52840
LILYGO T-Echo Plus t-echo-plus nrf52840
LILYGO T-Impulse Plus t-impulse-plus nrf52840
LilyGo T3-C6 tlora-c6 esp32-c6
Seeed SenseCAP T1000-E tracker-t1000-e nrf52840

Build artifacts expire on 2026-08-18. Updated for 3c73c05.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aa79f8b8-03f1-4f3c-9855-ff72b7cacca2

📥 Commits

Reviewing files that changed from the base of the PR and between 2dbd1ec and 3c73c05.

📒 Files selected for processing (2)
  • src/mesh/NodeDB.cpp
  • src/modules/AdminModule.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/mesh/NodeDB.cpp
  • src/modules/AdminModule.cpp

📝 Walkthrough

Walkthrough

Changes

Ignored Message Filtering

Layer / File(s) Summary
MessageStore filtering and storage contract
src/MessageStore.*
Adds ignored-node packet filtering, visibility predicates, nullable insertion, visibility-aware accessors, and node-scoped deletion.
Persistence cleanup and node purging
src/MessageStore.cpp, src/mesh/NodeDB.cpp, src/modules/AdminModule.cpp
Prunes invisible messages after flash loading and deletes message history when nodes are ignored.
Inbound packet ingestion gates
src/graphics/niche/InkHUD/Events.cpp, src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp, src/mesh/MeshService.cpp, src/modules/TextMessageModule.cpp, src/mqtt/MQTT.cpp
Uses fallible message insertion and drops MQTT downlinks matching ignored-node or MQTT ignore rules.
Visibility-aware UI presentation
src/graphics/Screen.cpp, src/graphics/draw/*, src/graphics/niche/InkHUD/*
Prevents invisible messages from affecting navigation, rendering, latest-message caches, notifications, and applet output.

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)
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the change, but it omits the required attestations checklist and doesn't follow the repository template. Add the template's attestations section with testing details and any checked devices, and format the PR body to match the repository template.
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: hiding messages from ignored nodes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Honor-Node-Ignore

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/mesh/NodeDB.cpp

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Prevent unconditional data loss when an ignore request is rejected.

Because the if statement lacks braces, eraseNodeSatellites and messageStore.deleteAllMessagesFromNode execute unconditionally. If the node cannot be ignored (e.g., due to protected-node limits), setProtectedFlag fails 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 else block so they only execute when the node is successfully ignored, matching the safe behavior implemented in AdminModule.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 win

Optimize 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 in pruneHiddenMessages().

♻️ 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

📥 Commits

Reviewing files that changed from the base of the PR and between a4ea55f and 2dbd1ec.

📒 Files selected for processing (16)
  • src/MessageStore.cpp
  • src/MessageStore.h
  • src/graphics/Screen.cpp
  • src/graphics/draw/MenuHandler.cpp
  • src/graphics/draw/MessageRenderer.cpp
  • src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp
  • src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp
  • src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp
  • src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp
  • src/graphics/niche/InkHUD/Events.cpp
  • src/graphics/niche/InkHUD/Persistence.cpp
  • src/mesh/MeshService.cpp
  • src/mesh/NodeDB.cpp
  • src/modules/AdminModule.cpp
  • src/modules/TextMessageModule.cpp
  • src/mqtt/MQTT.cpp

Comment thread src/modules/TextMessageModule.cpp
@thebentern
thebentern merged commit 8c6cc5d into develop Jul 19, 2026
103 checks passed
@thebentern
thebentern deleted the Honor-Node-Ignore branch July 19, 2026 11:32
@coderabbitai coderabbitai Bot mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

baseui Issues directly related to BaseUI bugfix Pull request that fixes bugs InkHUD Issues directly related to InkHUD UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants