Skip to content

transform dock actions to commands - #212

Merged
igorkorsukov merged 1 commit into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step36
Aug 11, 2026
Merged

transform dock actions to commands#212
igorkorsukov merged 1 commit into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step36

Conversation

@igorkorsukov

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@igorkorsukov, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b0feadcf-dfc4-46f8-b47d-c0f7d482b4b6

📥 Commits

Reviewing files that changed from the base of the PR and between 3d19fa4 and 09f3c6d.

📒 Files selected for processing (3)
  • CMakeLists.txt
  • framework/dockwindow/internal/dockcommandsregister.cpp
  • framework/dockwindow_v2/internal/dockcommandsregister.cpp
📝 Walkthrough

Walkthrough

Both dock window variants now define four dock commands and provide command metadata and state services. Module and context import resolution registers these services with the command registries. DockWindowActionsController now dispatches CommandQuery requests, preserves mappings from legacy actions, validates command parameters, and returns muse::Ret results. Build targets include the new command headers and implementations.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description, so it omits the issue reference, change summary, checklist, testing details, and build configuration. Add the required description sections, including the issue reference, motivation, completed checklist items, testing results, and build configuration.
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.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating dock actions to command dispatching.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@framework/dockwindow/internal/dockwindowactionscontroller.cpp`:
- Around line 77-109: Validate CommandQuery parameter types before conversion in
both DockWindowActionsController implementations:
framework/dockwindow/internal/dockwindowactionscontroller.cpp lines 77-109 and
framework/dockwindow_v2/internal/dockwindowactionscontroller.cpp lines 77-109.
In setDockOpen, require dock_name to have Val::String type and open to have
Val::Bool type; in toggleOpened and toggleFloating, require dock_name to be
Val::String. Return BadArgs for missing or non-conforming parameters before
calling QString conversion or window actions.
🪄 Autofix

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: ASSERTIVE

Plan: Pro Plus

Run ID: bb7babc3-62fe-452f-abfe-3cc195fb513a

📥 Commits

Reviewing files that changed from the base of the PR and between d605d80 and 3d19fa4.

📒 Files selected for processing (20)
  • framework/dockwindow/CMakeLists.txt
  • framework/dockwindow/dockcommands.h
  • framework/dockwindow/dockmodule.cpp
  • framework/dockwindow/dockmodule.h
  • framework/dockwindow/internal/dockcommandsregister.cpp
  • framework/dockwindow/internal/dockcommandsregister.h
  • framework/dockwindow/internal/dockcommandsstate.cpp
  • framework/dockwindow/internal/dockcommandsstate.h
  • framework/dockwindow/internal/dockwindowactionscontroller.cpp
  • framework/dockwindow/internal/dockwindowactionscontroller.h
  • framework/dockwindow_v2/CMakeLists.txt
  • framework/dockwindow_v2/dockcommands.h
  • framework/dockwindow_v2/dockmodule.cpp
  • framework/dockwindow_v2/dockmodule.h
  • framework/dockwindow_v2/internal/dockcommandsregister.cpp
  • framework/dockwindow_v2/internal/dockcommandsregister.h
  • framework/dockwindow_v2/internal/dockcommandsstate.cpp
  • framework/dockwindow_v2/internal/dockcommandsstate.h
  • framework/dockwindow_v2/internal/dockwindowactionscontroller.cpp
  • framework/dockwindow_v2/internal/dockwindowactionscontroller.h

Comment on lines +77 to +109
muse::Ret DockWindowActionsController::setDockOpen(const CommandQuery& query)
{
if (args.count() < 2) {
return;
if (!(query.contains("dock_name") && query.contains("open"))) {
return muse::make_ret(Ret::Code::BadArgs);
}

QString dockName = args.arg<QString>(0);
bool open = args.arg<bool>(1);
QString dockName = QString::fromStdString(query.param("dock_name").toString());
bool open = query.param("open").toBool();

window()->setDockOpen(dockName, open);
return muse::make_ok();
}

void DockWindowActionsController::toggleOpened(const ActionData& args)
muse::Ret DockWindowActionsController::toggleOpened(const CommandQuery& query)
{
QString dockName = dockNameFromArgs(args);
if (!query.contains("dock_name")) {
return muse::make_ret(Ret::Code::BadArgs);
}

QString dockName = QString::fromStdString(query.param("dock_name").toString());
window()->toggleDock(dockName);
return muse::make_ok();
}

void DockWindowActionsController::toggleFloating(const ActionData& args)
muse::Ret DockWindowActionsController::toggleFloating(const CommandQuery& query)
{
QString dockName = dockNameFromArgs(args);
if (!query.contains("dock_name")) {
return muse::make_ret(Ret::Code::BadArgs);
}

QString dockName = QString::fromStdString(query.param("dock_name").toString());
window()->toggleDockFloating(dockName);
return muse::make_ok();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the CommandQuery and Val conversion contracts.
rg -n -C 5 \
  'class CommandQuery|struct CommandQuery|CommandQuery::param|class Val|struct Val|Val::toBool|Val::toString|toBool\(\) const|toString\(\) const' \
  .

# Locate command-dispatch tests and direct dock command requests.
rg -n -C 4 \
  'DOCK_SET_OPEN_COMMAND|DOCK_TOGGLE_COMMAND|DOCK_TOGGLE_FLOATING_COMMAND|CommandQuery' \
  framework

Repository: musescore/muse_framework

Length of output: 46609


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Val implementation ---'
sed -n '1,240p' framework/global/types/val.cpp
printf '%s\n' '--- Val type API and UriQuery API ---'
sed -n '44,125p' framework/global/types/val.h
sed -n '80,140p' framework/global/types/uri.h
printf '%s\n' '--- UriQuery implementation ---'
rg -n -C 8 'UriQuery::(param|addParam|contains)|Val&|const Val&' framework/global/types/uri.cpp framework/global/types/uri.h
printf '%s\n' '--- Command schema and dispatch validation ---'
rg -n -C 8 'InputSchema|DataType|validate|schema|Arg' framework/rcommand framework/global | head -n 400

Repository: musescore/muse_framework

Length of output: 43478


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Val conversions ---'
sed -n '90,225p' framework/global/types/val.cpp
printf '%s\n' '--- UriQuery declarations and implementation ---'
sed -n '95,125p' framework/global/types/uri.h
rg -n -C 12 'UriQuery::(param|addParam|contains)' framework/global/types/uri.cpp
printf '%s\n' '--- InputSchema and dispatcher paths ---'
rg -n -C 10 'InputSchema|validate|DataType|schema' framework/rcommand framework/global/types

Repository: musescore/muse_framework

Length of output: 13073


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Command dispatch ---'
sed -n '50,95p' framework/rcommand/internal/commanddispatcher.cpp
printf '%s\n' '--- InputSchema consumers ---'
rg -n -C 8 'inputSchema|InputSchema|DataType::Boolean|DataType::String' framework --glob '*.{cpp,h}'
printf '%s\n' '--- UriQuery parsing ---'
sed -n '140,265p' framework/global/types/uri.cpp

Repository: musescore/muse_framework

Length of output: 35626


Reject non-conforming CommandQuery parameter types.

InputSchema is not enforced by CommandDispatcher. Val::toString() converts numeric and boolean values, while Val::toBool() converts numeric, string, list, and map values. Validate Val::type() before dispatch and return BadArgs unless dock_name is String and open is Bool in both controllers.

🧰 Tools
🪛 Clang (14.0.6)

[warning] 77-77: use a trailing return type for this function

(modernize-use-trailing-return-type)


[warning] 90-90: use a trailing return type for this function

(modernize-use-trailing-return-type)


[warning] 101-101: use a trailing return type for this function

(modernize-use-trailing-return-type)

🪛 Cppcheck (2.21.0)

[error] 107-107: failed to evaluate #if condition, undefined function-like macro invocation

(syntaxError)

📍 Affects 2 files
  • framework/dockwindow/internal/dockwindowactionscontroller.cpp#L77-L109 (this comment)
  • framework/dockwindow_v2/internal/dockwindowactionscontroller.cpp#L77-L109
🤖 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 `@framework/dockwindow/internal/dockwindowactionscontroller.cpp` around lines
77 - 109, Validate CommandQuery parameter types before conversion in both
DockWindowActionsController implementations:
framework/dockwindow/internal/dockwindowactionscontroller.cpp lines 77-109 and
framework/dockwindow_v2/internal/dockwindowactionscontroller.cpp lines 77-109.
In setDockOpen, require dock_name to have Val::String type and open to have
Val::Bool type; in toggleOpened and toggleFloating, require dock_name to be
Val::String. Return BadArgs for missing or non-conforming parameters before
calling QString conversion or window actions.

@igorkorsukov
igorkorsukov merged commit 4f86705 into musescore:main Aug 11, 2026
3 checks passed
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