feat(db_migrations, message_handler, repeater_manager): enhance purging log functionality

- Added a new migration to include a 'details' column in the 'purging_log' table for improved logging of actions.
- Refactored the `log_purging_action` method in `RepeaterManager` to handle both new and legacy schemas, ensuring compatibility with the updated database structure.
- Updated `MessageHandler` to utilize the new logging method, replacing direct database updates with a unified logging approach.
- Added tests to verify the presence of the new column and the correct functionality of the logging mechanism across different scenarios.
This commit is contained in:
agessaman committed 2026-04-21 17:04:51 -07:00
1 parent 8e71a11bd1
commit 23cdce03e8
6 files changed
+132 -28

No files matched your search

+2 -1
View File
@@ -1910,6 +1910,7 @@ def new_contact_env(mock_logger):
)
rm.manage_contact_list = AsyncMock(return_value={"success": True})
rm.add_companion_from_contact_data = AsyncMock(return_value=True)
rm.log_purging_action = Mock()
rm.db_manager = Mock()
rm.db_manager.execute_update = Mock()
rm._is_repeater_device = Mock(return_value=False)
@@ -1933,7 +1934,7 @@ class TestHandleNewContactAutoManage:
rm.track_contact_advertisement.assert_awaited_once()
mesh.commands.add_contact.assert_not_called()
rm.add_companion_from_contact_data.assert_not_called()
rm.db_manager.execute_update.assert_called()
rm.log_purging_action.assert_called_once()
async def test_device_mode_no_bot_add_contact(self, new_contact_env):
bot, handler, rm, mesh = new_contact_env