Skip to content

clear app db of channel messages on delete#196

Merged
zjs81 merged 2 commits into
mainfrom
fix-channel-del
Feb 22, 2026
Merged

clear app db of channel messages on delete#196
zjs81 merged 2 commits into
mainfrom
fix-channel-del

Conversation

@446564

@446564 446564 commented Feb 19, 2026

Copy link
Copy Markdown
Collaborator

we were only deleting channels and messages on device and the in app db would persist this caused weird messages to later show up in other channels as they were deleted and added due to the fact we store messages by channel index(slot #)

closes #189

we were only deleting channels and messages on device and the in app db would persist
this caused weird messages to later show up in other channels as they were deleted and
added due to the fact we store messages by channel index(slot #)
@zjs81

zjs81 commented Feb 22, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: 4bf2519559

ℹ️ 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".

onPressed: () {
Navigator.pop(dialogContext);
connector.deleteChannel(channel.index);
channelMessageStore.clearChannelMessages(channel.index);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove unconditional local purge on channel delete

clearChannelMessages now runs immediately after kicking off connector.deleteChannel, so local history is deleted even when the device-side delete fails (for example, a transient BLE disconnect causes sendFrame in MeshCoreConnector.deleteChannel to throw before the channel is actually removed). In that case the channel still exists on-device after reconnect, but its app-side message history has already been erased, which is user-visible data loss.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We don't check for failure as it is

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Fair enough

@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: 6e1cb0482f

ℹ️ 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".

onPressed: () {
Navigator.pop(dialogContext);
connector.deleteChannel(channel.index);
channelMessageStore.clearChannelMessages(channel.index);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clear channel history only after delete succeeds

Calling channelMessageStore.clearChannelMessages(channel.index) immediately after firing connector.deleteChannel(...) deletes local history even when the device-side delete fails (for example, a BLE disconnect before sendFrame completes). Fresh evidence: MeshCoreConnector.deleteChannel already clears stored messages after a successful delete frame, so this new call bypasses that success gate and can erase chats for channels that still exist on-device.

Useful? React with 👍 / 👎.

@zjs81 zjs81 merged commit 9a27953 into main Feb 22, 2026
6 checks passed
@446564 446564 deleted the fix-channel-del branch April 8, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public messages (pings) leaking into private channel

2 participants