refactor!: drop the enclosure abstraction from PHALPlugin - #406
Conversation
The legacy Mark-1 enclosure.* protocol is no longer baked into the PHAL base. register_enclosure_namespace() and every enclosure command handler (on_eyes_*, on_system_*, _on_mouth_*, on_text/on_display/on_weather_display, on_reset/ on_no_internet, mouth-event gating) are removed. PHALPlugin now wires only the core lifecycle events (audio in/out, wake, sleep, speak). Hardware enclosure plugins mix in EnclosureProtocolListener from ovos-ui-enclosure-protocol instead; the EnclosureAPI producer lives in ovos-gui-api-client (self.gui + self.enclosure from one client).
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
Greetings! The CI pipeline has delivered its findings. 🏗️I've aggregated the results of the automated checks for this PR below. 📋 Repo HealthEnsuring the repo is ready for a marathon (aka long-term support). 🏁 ✅ All required files present. Latest Version: ✅ 🏷️ Release PreviewEnsuring the 'Thanks' section includes your name! 🤝 Caution Breaking change — this PR will bump the MAJOR version ( Current:
🚀 Release Channel Compatibility Predicted next version:
⚖️ License CheckThe license check is now finished. 🏁 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 🔍 LintEvaluating the overall impact of your changes. 📈 ❌ ruff: issues found — see job log 📊 CoverageEnsuring the logic is battle-tested. ⚔️ ✅ 84.8% total coverage Files below 80% coverage (21 files)
Full report: download the 🔨 Build TestsThe build pipeline has reached its destination. 📍 ✅ All versions pass
🔒 Security (pip-audit)Security check! Are we safe from vulnerabilities? 🛡️ ✅ No known vulnerabilities found (64 packages scanned). Code quality is our top priority ✨ |
The record/speak/wake/sleep lifecycle (recognizer_loop:record_begin/record_end/ sleep/audio_output_start/audio_output_end, mycroft.awoken, speak) drives the enclosure, so it moves to EnclosureProtocolListener.register_core_events() alongside the enclosure.* commands. PHALPlugin now wires no bus events at all: it is a background Thread with self.bus, runtime_requirements, emit, run and a shutdown that just stops. Hardware enclosure plugins mix in the listener.
Removes the legacy Mark-1
enclosure.*protocol from thePHALPluginbase as a breaking change.What changes
PHALPluginno longer wiresenclosure.*. Removed:register_enclosure_namespace()and its__init__callenclosure.*bus.remove(...)calls fromshutdown()on_eyes_*,on_system_*,_on_mouth_*,on_text/on_display/on_weather_display,on_reset/on_no_internet,on_talk/on_think/on_listen/on_smile/on_viseme/on_viseme_list/on_display_resetmouth_events_active,_activate_mouth_events,_deactivate_mouth_events,_mouth_events)PHALPluginkeeps the core lifecycle only:register_core_events()+ the audio in/out, wake, sleep and speak handlers.Where the protocol goes
EnclosureProtocolListenerfromovos-ui-enclosure-protocol(the same wiring + no-op handlers, extracted verbatim).EnclosureAPIlives inovos-gui-api-clientalongsideGUIInterface, soself.guiandself.enclosurecome from one client.Modern visual output is handled by
GUIInterface(OVOS-GUI-1) and its template system.Tests
test_phal_template_extended.pyreworked: drops the enclosure-handler/mouth-event tests, adds assertions that noenclosure.*subscriptions are wired and the abstraction's attributes are gone, and verifies the core-event register/shutdown wiring. Full suite green locally (965 passed; the one unrelatedlangcodesTTS-session failure is pre-existing and independent of this change).Part of the enclosure→GUI migration (mk1 modeled as a GUI; abstraction dropped from core).