mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-10-31 10:02:38 +00:00
refactor: restore behavior the branch had changed (codex review)
A codex review of the branch found seven places where earlier refactor commits changed behavior. Each is restored here with a test: - base_service imported flood_scope relatively; the local-service loader also runs that file as local_services.base_service, where the import cannot resolve. Now absolute. - Radio-health fields were initialized after commands and services were built, so a plugin constructor reading is_radio_offline raised. They are now set before any plugin. - Removing the per-command can_execute overrides made 31 commands honor skip_channel_check, which their overrides had dropped. BaseCommand.honors_skip_channel_check (False on exactly those commands) keeps them enforcing their channel list. - CommandManager.get_plugin_metadata, WxCommand.get_weather_for_zipcode and PluginLoader.validate_plugin were public compatibility entry points; they are back. - feed_manager stopped exporting DEFAULT_MAX_FEED_RESPONSE_BYTES and DEFAULT_MAX_PARSED_FEED_ITEMS despite the commit saying it re-exported them; it does now. - wx and gwx logged companion-location lookup failures at WARNING; the shared helper logged at debug. It now takes the level. - The INFO 'MESSAGE ROUTING' / 'DIRECT MESSAGE' lines for pubkey-correlated DMs were removed with the dead path_info computation; they are logged again by a log-only helper.
This commit is contained in:
1 parent
adedfa6c9e
commit
efe074b151
47 files changed
+277
-17
No files matched your search
@@ -539,3 +539,28 @@ class PluginLoader:
|
||||
self.logger.error(f"Error reloading plugin {plugin_name}: {e}")
|
||||
return False
|
||||
|
||||
def validate_plugin(self, plugin_instance: BaseCommand) -> list[str]:
|
||||
"""Validate a plugin instance and return any issues"""
|
||||
issues = []
|
||||
metadata = plugin_instance.get_metadata()
|
||||
|
||||
# Check required metadata
|
||||
if not metadata.get('name'):
|
||||
issues.append("Plugin missing 'name' metadata")
|
||||
|
||||
if not metadata.get('description'):
|
||||
issues.append("Plugin missing 'description' metadata")
|
||||
|
||||
# Check if execute method is implemented
|
||||
if not hasattr(plugin_instance, 'execute'):
|
||||
issues.append("Plugin missing 'execute' method")
|
||||
|
||||
# Check for keyword conflicts
|
||||
for keyword in metadata.get('keywords', []):
|
||||
if keyword.lower() in self.keyword_mappings:
|
||||
existing_plugin = self.keyword_mappings[keyword.lower()]
|
||||
if existing_plugin != metadata['name']:
|
||||
issues.append(f"Keyword '{keyword}' conflicts with plugin '{existing_plugin}'")
|
||||
|
||||
return issues
|
||||
|
||||
Reference in new issue
Block a user