Skip to content

added command diagnostic#33854

Open
igorkorsukov wants to merge 2 commits into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step5
Open

added command diagnostic#33854
igorkorsukov wants to merge 2 commits into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step5

Conversation

@igorkorsukov

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request refactors the playback command infrastructure by splitting the monolithic PlaybackCommands class into two focused classes: PlaybackCommandsRegister (provides command metadata) and PlaybackCommandsState (tracks per-command enabled/disabled state reactively). playbackcommands.h is simplified to expose three inline Command URI constants (PLAY_COMMAND, PAUSE_COMMAND, STOP_COMMAND). PlaybackController and PlaybackModule are updated to use these constants and register both new classes. A diagnostic-show-rcommands entry is added to the developer Diagnostics menu. The muse_framework submodule URL is changed from the musescore HTTPS origin to a personal fork via SSH, and the submodule commit pointer is advanced.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty, lacking all required sections including issue reference, motivation, CLA confirmation, and the developer checklist. Add a complete pull request description following the template, including issue reference, motivation for changes, signed CLA confirmation, and completion of the developer checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'added command diagnostic' is vague and generic, using non-descriptive phrasing that doesn't convey meaningful information about the substantial changes made to the playback command architecture. Clarify the title to better reflect the main change, such as 'Refactor playback commands to use IModuleCommandsRegister and IModuleCommandsState pattern' or 'Add command state tracking for playback controls'.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped musescore/muse_framework.git.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitmodules:
- Line 3: The muse_framework submodule URL in the .gitmodules file has been
changed from the official musescore repository to a personal fork, which
violates the CI contract enforced by check_submodules.yml. Revert the url
configuration for the muse_framework submodule from
git@github.com:igorkorsukov/muse_framework.git back to the official repository
URL https://github.com/musescore/muse_framework.git to restore CI compliance.

In `@muse`:
- Line 1: The submodule URL in `.gitmodules` pointing to a personal fork
conflicts with the hardcoded EXPECTED_URL in the
`.github/workflows/check_submodules.yml` workflow file which is set to the
official repository URL. To resolve this CI failure, either revert the submodule
URL in `.gitmodules` back to the official repository
(https://github.com/musescore/muse_framework.git), or alternatively update the
EXPECTED_URL variable in the workflow file to match the personal fork URL and
provide explicit justification for this supply-chain decision in the PR
description.

In `@src/playback/internal/playbackcommandsstate.cpp`:
- Around line 40-50: The state invalidation is incomplete because
updateCommandStates() is not triggered when playback status changes or when the
interactive/project closes. Add two additional signal connections after the
existing ones: connect to playbackController()->isPlayingChanged() to catch
playback state transitions, and connect to interactive()->closed() to catch page
close events. Both connections should follow the same pattern as the existing
signal handlers and invoke updateCommandStates() to ensure command states remain
synchronized with the actual playback and project state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7651528c-8cf1-4f28-abd5-60dcf207f5dc

📥 Commits

Reviewing files that changed from the base of the PR and between 683e084 and fee9a17.

📒 Files selected for processing (11)
  • .gitmodules
  • muse
  • src/appshell/qml/MuseScore/AppShell/appmenumodel.cpp
  • src/playback/CMakeLists.txt
  • src/playback/internal/playbackcommandsregister.cpp
  • src/playback/internal/playbackcommandsregister.h
  • src/playback/internal/playbackcommandsstate.cpp
  • src/playback/internal/playbackcommandsstate.h
  • src/playback/internal/playbackcontroller.cpp
  • src/playback/playbackcommands.h
  • src/playback/playbackmodule.cpp

Comment thread .gitmodules
[submodule "muse_framework"]
path = muse
url = https://github.com/musescore/muse_framework.git
url = git@github.com:igorkorsukov/muse_framework.git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

⛔ Critical: Submodule URL points to personal fork and breaks CI contract.

Line 3 changes the muse_framework submodule URL from the official https://github.com/musescore/muse_framework.git to a personal fork git@github.com:igorkorsukov/muse_framework.git. This violates the CI contract enforced by .github/workflows/check_submodules.yml, which explicitly validates that the URL must match the musescore official repository. The check_muse_framework CI checks are already failing with the error: "muse_framework submodule URL must be https://github.com/musescore/muse_framework.git, found git@github.com:igorkorsukov/muse_framework.git. Did you accidentally leave it pointing at a fork?"

This change will block the PR from merging. Given that the PR's primary objective is refactoring playback commands (unrelated to submodule configuration), this appears to be an accidental development artifact.

🔧 Proposed fix: Revert to official repository URL
 [submodule "muse_framework"]
 	path = muse
-	url = git@github.com:igorkorsukov/muse_framework.git
+	url = https://github.com/musescore/muse_framework.git
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
url = git@github.com:igorkorsukov/muse_framework.git
[submodule "muse_framework"]
path = muse
url = https://github.com/musescore/muse_framework.git
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitmodules at line 3, The muse_framework submodule URL in the .gitmodules
file has been changed from the official musescore repository to a personal fork,
which violates the CI contract enforced by check_submodules.yml. Revert the url
configuration for the muse_framework submodule from
git@github.com:igorkorsukov/muse_framework.git back to the official repository
URL https://github.com/musescore/muse_framework.git to restore CI compliance.

Comment thread muse
@@ -1 +1 @@
Subproject commit e573f8bc57ab1373d0a80b013e3d3fed932fb7f4
Subproject commit e04ff5e0c16e475009cf0ec6daa182d201bcf513

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify that the pinned muse commit exists in the personal fork.

# Test: Check if the commit is reachable from the personal fork's default branch.
# Expect: The commit should be listed; if not found, the clone will fail.
COMMIT="e04ff5e0c16e475009cf0ec6daa182d201bcf513"
FORK_URL="git@github.com:igorkorsukov/muse_framework.git"

echo "Checking if commit ${COMMIT} exists in personal fork..."
git ls-remote "${FORK_URL}" | grep -q "^${COMMIT}" && echo "✓ Commit found in personal fork" || echo "✗ Commit NOT found in personal fork"

# Also check if it's reachable from main/master
for branch in main master develop; do
  echo "Checking ${branch} branch..."
  git ls-remote "${FORK_URL}" "refs/heads/${branch}" | awk '{print $1}' | xargs -I {} bash -c "git merge-base --is-ancestor ${COMMIT} {} 2>/dev/null && echo '  ✓ Commit is an ancestor of ${branch}' || echo '  ✗ Commit is NOT an ancestor of ${branch}'"
done

Repository: musescore/MuseScore

Length of output: 909


🏁 Script executed:

# First, find and examine the .gitmodules file to confirm the submodule configuration
find . -name ".gitmodules" -type f -exec cat {} \;

Repository: musescore/MuseScore

Length of output: 159


🏁 Script executed:

# Check the CI workflow file mentioned in the review
cat .github/workflows/check_submodules.yml 2>/dev/null || echo "File not found"

Repository: musescore/MuseScore

Length of output: 2495


🏁 Script executed:

# Try to verify the commit using HTTPS instead of SSH, and check the official upstream
COMMIT="e04ff5e0c16e475009cf0ec6daa182d201bcf513"
echo "Attempting to verify commit in official upstream via HTTPS..."
git ls-remote "https://github.com/musescore/muse_framework.git" | grep "^${COMMIT}" && echo "✓ Commit found in official upstream" || echo "✗ Commit NOT found in official upstream"

echo -e "\nTrying personal fork via HTTPS..."
git ls-remote "https://github.com/igorkorsukov/muse_framework.git" | head -20

Repository: musescore/MuseScore

Length of output: 1641


The CI workflow will fail: .github/workflows/check_submodules.yml explicitly rejects fork URLs.

The .gitmodules file has been changed to point to the personal fork (git@github.com:igorkorsukov/muse_framework.git), but the workflow step "Verify muse_framework submodule URL" in .github/workflows/check_submodules.yml is hardcoded with EXPECTED_URL: https://github.com/musescore/muse_framework.git (the official repository). The workflow explicitly rejects mismatches with the error:

muse_framework submodule URL must be ${EXPECTED_URL}, found ${ACTUAL_URL}. Did you accidentally leave it pointing at a fork?

The commit e04ff5e0c16e475009cf0ec6daa182d201bcf513 does exist in both the official upstream (refs/pull/89/head) and the personal fork (refs/heads/w/rcmd/rcmd_step4), so commit availability is not the issue.

To merge this PR, either:

  1. Revert the .gitmodules URL to the official repository, or
  2. Update the EXPECTED_URL in the workflow and explicitly justify this supply-chain decision in the PR description
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@muse` at line 1, The submodule URL in `.gitmodules` pointing to a personal
fork conflicts with the hardcoded EXPECTED_URL in the
`.github/workflows/check_submodules.yml` workflow file which is set to the
official repository URL. To resolve this CI failure, either revert the submodule
URL in `.gitmodules` back to the official repository
(https://github.com/musescore/muse_framework.git), or alternatively update the
EXPECTED_URL variable in the workflow file to match the personal fork URL and
provide explicit justification for this supply-chain decision in the PR
description.

Comment on lines +40 to +50
globalContext()->currentProjectChanged().onNotify(this, [this]() {
updateCommandStates();
});

interactive()->opened().onReceive(this, [this](const muse::Uri&) {
updateCommandStates();
});

playbackController()->isPlayAllowedChanged().onNotify(this, [this]() {
updateCommandStates();
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

State invalidation misses playback and page-close transitions.

commandState() derives values from isPlaying() and isProjectOpened(), but updateCommandStates() is never triggered on playback status changes or page close events. That leaves PLAY/PAUSE/STOP state notifications stale until another unrelated event fires.

Proposed fix
 void PlaybackCommandsState::init()
 {
     globalContext()->currentProjectChanged().onNotify(this, [this]() {
         updateCommandStates();
     });

     interactive()->opened().onReceive(this, [this](const muse::Uri&) {
         updateCommandStates();
     });
+    interactive()->closed().onReceive(this, [this](const muse::Uri&) {
+        updateCommandStates();
+    });

     playbackController()->isPlayAllowedChanged().onNotify(this, [this]() {
         updateCommandStates();
     });

-    // playbackController()->isPlayingChanged().onNotify(this, [this]() {
-    //     updateCommandStates();
-    // });
+    playbackController()->isPlayingChanged().onNotify(this, [this]() {
+        updateCommandStates();
+    });

     m_moduleRegister = commandsRegister()->moduleRegister(moduleName());
     IF_ASSERT_FAILED(m_moduleRegister) {
         return;
     }

@@
 void PlaybackCommandsState::deinit()
 {
     globalContext()->currentProjectChanged().disconnect(this);
     interactive()->opened().disconnect(this);
+    interactive()->closed().disconnect(this);
     playbackController()->isPlayAllowedChanged().disconnect(this);
-    //playbackController()->isPlayingChanged().disconnect(this);
+    playbackController()->isPlayingChanged().disconnect(this);
 }

Also applies to: 52-54, 66-69

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/playback/internal/playbackcommandsstate.cpp` around lines 40 - 50, The
state invalidation is incomplete because updateCommandStates() is not triggered
when playback status changes or when the interactive/project closes. Add two
additional signal connections after the existing ones: connect to
playbackController()->isPlayingChanged() to catch playback state transitions,
and connect to interactive()->closed() to catch page close events. Both
connections should follow the same pattern as the existing signal handlers and
invoke updateCommandStates() to ensure command states remain synchronized with
the actual playback and project state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants