feat(cpn): refactor handling of erroneous models#7377
Conversation
📝 WalkthroughWalkthroughThe PR restructures error handling across Companion by aggregating model validation errors and shifting from disabling user actions to enabling them while validating before execution. Error details are now displayed interactively in the status bar and in contextual dialogs during simulation and write operations. ChangesModel error handling and interactive validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 `@companion/src/firmwares/modeldata.cpp`:
- Line 2131: The QStringList named "list" is being pre-seeded with an empty
string (QStringList list { "" }), which causes leading blank entries in error
dialogs; change the initialization to create an empty QStringList (e.g.,
QStringList list or QStringList list{}), and leave separator/blank insertion to
the caller or explicit push_back calls where needed so no implicit blank entry
appears in aggregated outputs.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3a7c8b1c-c90b-428e-acfe-f0abe58e67ec
📒 Files selected for processing (7)
companion/src/firmwares/modeldata.cppcompanion/src/firmwares/radiodata.cppcompanion/src/firmwares/radiodata.hcompanion/src/mainwindow.cppcompanion/src/mdichild.cppcompanion/src/mdichild.hcompanion/src/modeledit/modeledit.cpp
| QStringList ModelData::errorsList() | ||
| { | ||
| QStringList list; | ||
| QStringList list { "" }; |
There was a problem hiding this comment.
Remove the pre-seeded blank entry from error lists.
At Line 2131, initializing with "" causes leading blank lines in model error dialogs and extra spacing in aggregated output. Start with an empty list and let the caller add separators if needed.
Suggested patch
-QStringList ModelData::errorsList()
-{
- QStringList list { "" };
+QStringList ModelData::errorsList()
+{
+ QStringList list;📝 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.
| QStringList list { "" }; | |
| QStringList list; |
🤖 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 `@companion/src/firmwares/modeldata.cpp` at line 2131, The QStringList named
"list" is being pre-seeded with an empty string (QStringList list { "" }), which
causes leading blank entries in error dialogs; change the initialization to
create an empty QStringList (e.g., QStringList list or QStringList list{}), and
leave separator/blank insertion to the caller or explicit push_back calls where
needed so no implicit blank entry appears in aggregated outputs.
Fixes #6153
Summary of changes:
Summary by CodeRabbit
Bug Fixes
New Features