Repository navigation
protocol: Hide unimplemented channel commands - #104
Merged
jodal merged 2 commits intoOct 30, 2026
Merged
Conversation
jodal
requested changes
Oct 29, 2026
|
|
||
|
|
||
| @protocol.commands.add("subscribe") | ||
| @protocol.commands.add("subscribe", list_command=False) |
Member
There was a problem hiding this comment.
Can we make all of these formatted like this, so we have a chance of remembering to start listing the commands again when/if we implement them?
Suggested change
| @protocol.commands.add("subscribe", list_command=False) | |
| @protocol.commands.add( | |
| "subscribe", | |
| list_command=False, # Remove when implementing command | |
| ) |
Comment on lines
+94
to
+127
| def test_unimplemented_channels_are_not_advertised_before_or_after_login(self): | ||
| for authenticated in (False, True): | ||
| if authenticated: | ||
| self.send_request('password "topsecret"') | ||
| self.assertEqualResponse("OK") | ||
| for request in ("commands", "notcommands"): | ||
| self.send_request(request) | ||
| for name in CHANNEL_REQUESTS: | ||
| with self.subTest( | ||
| authenticated=authenticated, request=request, command=name | ||
| ): | ||
| self.assertNotInResponse(f"command: {name}") | ||
| self.assertInResponse("OK") | ||
| if (request == "commands") == authenticated: | ||
| self.assertInResponse("command: play") | ||
| self.assertInResponse("command: status") | ||
|
|
||
| def test_unlisted_channels_keep_their_authentication_and_error_responses(self): | ||
| for authenticated in (False, True): | ||
| if authenticated: | ||
| self.send_request('password "topsecret"') | ||
| self.assertEqualResponse("OK") | ||
| for name, request in CHANNEL_REQUESTS.items(): | ||
| with self.subTest(authenticated=authenticated, command=name): | ||
| self.send_request(request) | ||
| if authenticated: | ||
| self.assertEqualResponse( | ||
| f"ACK [0@0] {{{name}}} Not implemented" | ||
| ) | ||
| else: | ||
| self.assertEqualResponse( | ||
| f"ACK [4@0] {{{name}}} " | ||
| f'you don\'t have permission for "{name}"' | ||
| ) |
Member
There was a problem hiding this comment.
I feel these tests are a bit too much. Tests needs to be maintained too. With these gone, CHANNEL_REQUESTS can be inlined as a list of five commands.
Contributor
Author
|
Updated in
From the repository root, |
jodal
approved these changes
Oct 30, 2026
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The channel commands are advertised even though their handlers always return
Not implemented. Clients such as MPD_sima can interpret this as support for messaging.Set
list_command=Falseon the five channel handlers, with a reminder to remove that flag when each command is implemented. This hides them from bothcommandsandnotcommands, while retaining their registration and direct-call behavior.Keep one focused regression for capability discovery. The extra authentication/direct-call tests were removed as requested in review.
Validation from the repository root, with Python 3.13.5 and Mopidy 4.0.2:
pytest tests -q --cov: 808 passed, 1 skipped (10 subtests passed).ruff check .,ruff format --check .,pyright src, andpython -m build --no-isolationpass.MpdFrontendconfirms the discovery change and unchanged direct-call ACK responses with and without a password. Native dummy backends supply the core fixtures; audio playback was not exercised.Fixes #19