Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
Fresh off the press! I've got some check results for you. 🗞️I've aggregated the results of the automated checks for this PR below. 🔍 LintA detailed summary of the latest automation run. 📝 ❌ ruff: issues found in 76 file(s) — see job log 📊 CoverageHow much of the logic is under the microscope? 🔬 Files below 80% coverage (17 files)
Full report: download the ⚖️ License CheckScanning for any non-commercial-only restrictions. 💰 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 📋 Repo HealthScanning for any signs of code rot or decay. 🍄 ✅ All required files present. Latest Version: ✅ 🔒 Security (pip-audit)I've checked the security of our API endpoints. 🌐 ✅ No known vulnerabilities found (133 packages scanned). 🏷️ Release PreviewEvaluating the overall quality of the next release. ✨ Current:
✅ PR title follows conventional commit format. 🚀 Release Channel Compatibility Predicted next version:
🔨 Build TestsThe build bots have finished their assembly. 🤖 ✅ All versions pass
Powered by OVOS scripts and a bit of magic. ✨ |
cf5ef23 to
39f2275
Compare
39f2275 to
eb6b48b
Compare
eb6b48b to
15d0dba
Compare
15d0dba to
bc03bcf
Compare
MediaBackendHarness drives one MediaBackend v2 plugin in isolation, without a daemon: it binds a spy reporter, calls each v2 verb, and asserts the physical playback events the plugin reported. OCPPlayerHarness gains backend injection, so a test can drive the real ovos-media player over a backend it controls. The v2 names (PlaybackEvent, bind_event_reporter, report) exist only on ovos-plugin-manager's feat/media-backend-v2 branch, so the import is guarded and every v2 cell skips with a reason against a released OPM. The cells therefore run in CI only once ovos-plugin-manager 3.0.0a1 publishes. Three review findings are answered. C1, the branch did not merge into dev. Dev #188 set the release workflow's install_extras to "test"; this branch set an explicit five-extra list. The hunk is dropped rather than re-resolved, because dev's "test" extra is a strict superset of it: it carries ovos-audio, ovos-media, ovos-dinkum-listener, ovos-pydantic-models and numpy, which are exactly the five, plus more. The coverage-pages workflow keeps its own widening, which the body now discloses instead of calling the release workflow "the whole CI change". C2, the v2 cells failed against the branches the PR names. Re-measured against the CURRENT heads rather than the ones the review read: ovos-plugin-manager 0b4d806 (was dfcb7fab) and ovos-media 32c8582 (was 997fc82a). Most of the failures were the dependencies' and are gone. What remained was ours: five assertions read a backend attribute on the line after a bus emit, so they raced the daemon's own thread. Each now uses this class's existing bounded settle (assert_backend_playing, assert_backend_paused, _eventually at 2s). The two assertions on a directly driven backend are left alone, because that path is synchronous and has no race. Result: 68 passed, six runs out of six, where the review measured 6 to 8 failures. The cells have teeth in both directions, proven by mutation rather than claimed: making report() drop its event data reds 4 cells, and making bind_event_reporter never bind reds 17. The tree restores to 68 green after each. C3, __exit__ deleted a reporter bound before the harness. A daemon binds its own handler before a test ever sees the backend, and clearing it left the daemon deaf for the rest of the process with nothing raised. __enter__ now remembers what it displaces and __exit__ puts it back; an unbound backend still ends unbound, which is asserted as the control. The v2 availability probe import in test_media.py carries an explicit noqa: F401. It exists to make the try/except detect the template, so ruff's unused-import finding on it is intentional rather than a defect; the marker states that instead of leaving CI to report it. T-7216, from T-0260. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
bc03bcf to
b59e45e
Compare
ovos-media's
feat/media-backend-v2-portbranch replaces the v1MediaBackendcontract with areport()/bind_event_reporter()one: plugins report physicalPlaybackEvents (TRACK_START,PAUSED,RESUMED,STOPPED,END_OF_MEDIA,ERROR) instead of emitting bus messages themselves,load_trackreturns a bool instead of aNone, andstop()becomes a concrete template method that delegates to a plugin's_stop(). The daemon (ovos-media'sBaseMediaService) is now the sole translator from those events toovos.common_play.*wire messages, via_handle_backend_event— and it has droppedhandle_media_state_changeentirely. ovoscope's media harnesses predate this port and needed updating to keep exercising the real daemon shape.This adds
MediaBackendHarness(ovoscope/media_backend.py), a harness for a plugin author testing their ownMediaBackendv2 class in isolation: it binds a capturing spy reporter onto a backend instance and asserts the event sequence and per-event data it reports, without any daemon involved. The v2 template it targets (ovos_plugin_manager.templates.media) only exists on the unreleased OPM branch, so both the module import and theovoscope/__init__.pyre-export are guarded:import ovoscopeis always safe against a releasedovos-plugin-manager, andMediaBackendHarness()raises a clearImportErroronly when actually constructed without the v2 template installed. Its own test module carries the equivalent guard at collection time, since its plugin stand-in subclasses the v2 template directly.It also adds
MockOCPBackendV2(ovoscope/media.py), the v2 counterpart to the existingMockOCPBackend(kept unmodified, still importable, for plugin repos that haven't ported yet), and makes itOCPPlayerHarness's default injected backend.OCPPlayerHarness.__enter__now binds each injected backend's event reporter, and guards the v1-onlyset_track_start_callbackcall on whether the service it readstrack_startfrom actually has that attribute — not on the backend, which a v1 backend always has regardless of whichovos-mediabuild is installed; guarding on the backend alone still crashed withAttributeErroragainst a v2 build. In the default (nobackend_factory) mode,audio_serviceis aMagicMockwith no real_handle_backend_eventbehind it, so the backend's reporter is bound to a small shim reproducing the daemon'sEND_OF_MEDIA/ERRORwire translation — the only two events that mode's own control methods can actually drive — with its docstring naming the two daemon guards (currency, staleness) it deliberately skips, so a test needing those knows to go through the real daemon (backend_factory) instead.MockOCPBackendV2.load_tracknow clearscurrent_urion a failed load, so a failed load doesn't leave a stale, previous track's uri behind for a followingsimulate_invalid_stream()/report_track_end()to report against.Every v2-only test class and cell is now gated on whether the v2 template actually imported, not merely on
ovos-mediabeing installed, and thebackend_factorystand-in several pre-existing cells share (_RecordingBackend) now has a v1 variant selected the same way — including fixing that variant to emitLOADED_MEDIAon the topic a real v1BaseMediaServiceactually subscribes to (ovos.common_play.media.state), not the per-namespace oneMockOCPBackendemits, which no realBaseMediaServiceinstance has ever listened on. The full suite now collects and runs clean against both a releasedovos-plugin-manager(v2 cells skip) and the unreleased branches (v2 cells run) — collection used to abort entirely against released deps because a test module imported the v2 template unguarded at collection time.Fail-before (source reverted with the test kept, run foreground, then restored): the
set_track_start_callbackguard turned 16 of 42test_media.pytests failing withAttributeErroracross everyOCPPlayerHarness-based class; the default-mode event-reporter shim's two new cells failed with no wire message emitted at all when reverted to binding straight into theMagicMock's_handle_backend_event;test_failed_load_clears_current_urifailed with thecurrent_uriclear removed.Full suite against released PyPI deps on python 3.10, foreground: 655 passed, 55 skipped, 0 failed. The 55 skips are exactly the v2-only cells gated off without the v2 template.
No workflow installs from git.
coverage-pages.ymlandrelease-workflow.yml'sbuild_testsjob gain themedia,listenerandbenchextras, which they lacked, and that is the whole CI change. The releasedovos-plugin-manageris 2.12.1a1 (latest alpha; itstemplates/media.pyis still the v1 one, noPlaybackEvent, nobind_event_reporter) and releasedovos-mediais 2.2.5a1, so neither carries the v2 backend template. The[media]floor therefore stays atovos-media>=2.0.0a9and the v2 cells skip on the template guard they already carry; they start running onceovos-plugin-managerpublishes the v2 template and the floor can be raised to it.That also settles the
build_tests (3.10)failure onTestOCPHarnessWithoutHandlePlay::test_enter_and_play_succeed_when_handle_play_is_absent: it was specific to the git-branchovos-mediathosepre_install_piplines installed, not todev. Against released deps that cell passes, as does the rest of the suite.