fixed nav shorcuts (added compat map)#143
Conversation
|
/build |
|
Build dispatched: https://github.com/musescore/muse_framework/actions/runs/29080100576 |
|
/build |
|
Build dispatched: https://github.com/musescore/muse_framework/actions/runs/29080206702 |
📝 WalkthroughWalkthroughNavigationApi now uses 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) 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 |
There was a problem hiding this comment.
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/shortcuts/internal/shortcutscontroller.cpp`:
- Line 43: Mark the file-scope compatActionToCommand lookup table as const,
preserving its existing initialization and type while preventing later mutation.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 1991debd-a668-49e4-8278-01b899516161
📒 Files selected for processing (3)
framework/shortcuts/internal/shortcutscontroller.cppframework/ui/api/navigationapi.cppframework/ui/api/navigationapi.h
8984f9e to
09d43ae
Compare
|
/build |
|
Build dispatched: https://github.com/musescore/muse_framework/actions/runs/29080608239 |
09d43ae to
6e2330a
Compare
|
/build |
|
Build dispatched: https://github.com/musescore/muse_framework/actions/runs/29081403895 |
3854b0f to
4b86d99
Compare
There was a problem hiding this comment.
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/diagnostics/qml/Muse/Diagnostics/DiagnosticActionsPanel.qml`:
- Around line 72-73: Update the button label associated with
actionsModel.print() from “Print this” to “Print” or “Print all” so it
accurately reflects that all current actions are printed.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: a0d012d1-e40c-41ea-b024-8146943413da
📒 Files selected for processing (5)
framework/diagnostics/qml/Muse/Diagnostics/DiagnosticActionsPanel.qmlframework/shortcuts/internal/shortcutscontroller.cppframework/shortcuts/internal/shortcutsregister.cppframework/ui/api/navigationapi.cppframework/ui/api/navigationapi.h
| text: "Print this" | ||
| onClicked: actionsModel.print() |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align the label with the print scope.
actionsModel.print() prints all current actions, so “Print this” misleadingly suggests that only the selected item is printed. Use “Print” or “Print all” instead.
🤖 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/diagnostics/qml/Muse/Diagnostics/DiagnosticActionsPanel.qml` around
lines 72 - 73, Update the button label associated with actionsModel.print() from
“Print this” to “Print” or “Print all” so it accurately reflects that all
current actions are printed.
56856be to
7e013a5
Compare
7e013a5 to
16fdb3c
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/actions/internal/actionsdispatcher.cpp`:
- Line 81: Replace the startsWith check in the action dispatch logic with an
exact equality comparison between actionQuery.uri().scheme() and
rcommand::COMMAND_SCHEME, ensuring only the intended command scheme is routed to
the command dispatcher.
In `@framework/rcommand/commandtypes.h`:
- Line 36: Prevent command dispatch from matching unrelated action codes
beginning with “command”. In ActionsDispatcher::dispatch(const ActionCode&), use
a delimited URI prefix for the raw startsWith check, such as a new
COMMAND_URI_PREFIX constant set to “command://”, while retaining COMMAND_SCHEME
as “command” for parsed scheme comparisons; update the relevant references in
commandtypes.h and actionsdispatcher.cpp consistently.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 039dbd6b-1f09-458d-8b13-2990acc137a7
📒 Files selected for processing (7)
framework/actions/internal/actionsdispatcher.cppframework/diagnostics/qml/Muse/Diagnostics/DiagnosticActionsPanel.qmlframework/rcommand/commandtypes.hframework/shortcuts/internal/shortcutscontroller.cppframework/shortcuts/internal/shortcutsregister.cppframework/ui/api/navigationapi.cppframework/ui/api/navigationapi.h
| void ActionsDispatcher::dispatch(const ActionQuery& actionQuery) | ||
| { | ||
| if (actionQuery.uri().scheme() == rcommand::COMMAND_SCHEME) { | ||
| if (muse::strings::startsWith(actionQuery.uri().scheme(), rcommand::COMMAND_SCHEME)) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Prefer == over startsWith for exact scheme comparison.
actionQuery.uri().scheme() returns the parsed scheme component (e.g., "command"). Using startsWith instead of equality means URIs with schemes like "commander" or "commands" would also match and be routed to the command dispatcher. An exact equality check is more precise and prevents unintended scheme matches.
🔧 Proposed fix
- if (muse::strings::startsWith(actionQuery.uri().scheme(), rcommand::COMMAND_SCHEME)) {
+ if (actionQuery.uri().scheme() == rcommand::COMMAND_SCHEME) {📝 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.
| if (muse::strings::startsWith(actionQuery.uri().scheme(), rcommand::COMMAND_SCHEME)) { | |
| if (actionQuery.uri().scheme() == rcommand::COMMAND_SCHEME) { |
🤖 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/actions/internal/actionsdispatcher.cpp` at line 81, Replace the
startsWith check in the action dispatch logic with an exact equality comparison
between actionQuery.uri().scheme() and rcommand::COMMAND_SCHEME, ensuring only
the intended command scheme is routed to the command dispatcher.
|
|
||
| namespace muse::rcommand { | ||
| constexpr std::string_view COMMAND_SCHEME = "command://"; | ||
| constexpr std::string_view COMMAND_SCHEME = "command"; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
COMMAND_SCHEME change from "command://" to "command" broadens startsWith matching in ActionsDispatcher::dispatch(const ActionCode&).
In actionsdispatcher.cpp line 64, startsWith(actionCode, rcommand::COMMAND_SCHEME) is applied to the raw action code. With the old value "command://", only action codes beginning with "command://" matched. With the new value "command", any action code starting with the substring "command" (e.g., "commando-action", "command-edit") will be incorrectly routed to commandDispatcher() instead of being looked up among registered action clients.
This is a cross-file contract break: the constant value change in commandtypes.h silently broadens the dispatch routing in actionsdispatcher.cpp line 64, potentially hijacking action codes that were previously handled by registered clients.
Consider either:
- Using
==on line 81 (scheme comparison) and restoring a delimited prefix (e.g.,"command://"or"command:") for thestartsWithcheck on line 64. - Or introducing a separate constant (e.g.,
COMMAND_URI_PREFIX = "command://") for the raw-stringstartsWithcheck on line 64, keepingCOMMAND_SCHEME = "command"for scheme comparisons.
🔧 Proposed fix: separate scheme and URI prefix constants
constexpr std::string_view COMMAND_SCHEME = "command";
+constexpr std::string_view COMMAND_URI_PREFIX = "command://";
using Command = Uri;Then in actionsdispatcher.cpp line 64:
- if (muse::strings::startsWith(actionCode, rcommand::COMMAND_SCHEME)) {
+ if (muse::strings::startsWith(actionCode, rcommand::COMMAND_URI_PREFIX)) {And line 81:
- if (muse::strings::startsWith(actionQuery.uri().scheme(), rcommand::COMMAND_SCHEME)) {
+ if (actionQuery.uri().scheme() == rcommand::COMMAND_SCHEME) {🤖 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/rcommand/commandtypes.h` at line 36, Prevent command dispatch from
matching unrelated action codes beginning with “command”. In
ActionsDispatcher::dispatch(const ActionCode&), use a delimited URI prefix for
the raw startsWith check, such as a new COMMAND_URI_PREFIX constant set to
“command://”, while retaining COMMAND_SCHEME as “command” for parsed scheme
comparisons; update the relevant references in commandtypes.h and
actionsdispatcher.cpp consistently.
Resolves: audacity/audacity#11393
Build configuration
audacity: audacity/audacity/master
audacity platforms: linux_x64
musescore: musescore/MuseScore/main
musescore platforms: linux_x64