Skip to content

Ensure "Notes" is always the last field#1495

Merged
amilcarlucas merged 2 commits into
masterfrom
Notes
Apr 13, 2026
Merged

Ensure "Notes" is always the last field#1495
amilcarlucas merged 2 commits into
masterfrom
Notes

Conversation

@amilcarlucas
Copy link
Copy Markdown
Collaborator

Make sure "Notes" is always the last field of a component in the component editor

Copilot AI review requested due to automatic review settings April 13, 2026 19:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Ensures the "Notes" field is always displayed last within each component in the component editor by updating component field reordering logic and adding regression tests to lock in the behavior.

Changes:

  • Add multiple tests verifying "Notes" is moved to the end (and stays there) across varied component shapes and during update_json_structure().
  • Update _reorder_components() to move "Notes" to the end of each component after other field reordering (e.g., Product subfields).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_data_model_vehicle_components_base.py Adds test coverage to ensure "Notes" is always the final field across scenarios, including migration via update_json_structure().
ardupilot_methodic_configurator/data_model_vehicle_components_base.py Updates _reorder_components() to pop/reinsert "Notes" so it becomes the last key in each component dict.

Comment on lines +452 to +454
if "Notes" in component_data:
notes_value = component_data.pop("Notes")
component_data["Notes"] = notes_value
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

component_data.pop("Notes") will raise at runtime if component_data is not a dict (e.g., a list or other non-mapping). Since this method iterates over arbitrary loaded component data, add an isinstance(component_data, dict) guard (similar to the existing "Product" dict guard) before calling pop, or otherwise ensure component_data is treated as a mapping consistently.

Copilot uses AI. Check for mistakes.
Comment thread tests/test_data_model_vehicle_components_base.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Amilcar Lucas <amilcar.lucas@iav.de>
@amilcarlucas amilcarlucas merged commit 28e3447 into master Apr 13, 2026
24 of 25 checks passed
@amilcarlucas amilcarlucas deleted the Notes branch April 13, 2026 20:33
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 14, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
12055 11342 94% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 02ed305 by action🐍

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 14, 2026

Coverage Report for CI Build 24364119634

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.001%) to 94.169%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12057
Covered Lines: 11354
Line Coverage: 94.17%
Relevant Branches: 1785
Covered Branches: 1723
Branch Coverage: 96.53%
Branches in Coverage %: No
Coverage Strength: 3.75 hits per line

💛 - Coveralls

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.

3 participants