Skip to content

feat(component editor): Re-oder component data#1026

Merged
amilcarlucas merged 1 commit into
masterfrom
re-order-components
Nov 10, 2025
Merged

feat(component editor): Re-oder component data#1026
amilcarlucas merged 1 commit into
masterfrom
re-order-components

Conversation

@amilcarlucas

Copy link
Copy Markdown
Collaborator

More important components first, less important and/or optional components last
Product's Manufacturer, Model and version are now on consecutive fields

Copilot AI review requested due to automatic review settings November 10, 2025 02:08
@github-actions

github-actions Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
9131 7614 83% 80% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
ardupilot_methodic_configurator/backend_filesystem.py 90% 🟢
ardupilot_methodic_configurator/data_model_par_dict.py 90% 🟢
ardupilot_methodic_configurator/data_model_vehicle_components_base.py 95% 🟢
TOTAL 91% 🟢

updated for commit: 46fe140 by action🐍

Copilot AI 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.

Pull Request Overview

This pull request implements automatic component reordering and field standardization for vehicle template JSON files. The changes extract firmware versions from vehicle components instead of using the package version, standardize Product field ordering (Version before URL), and reorder components into a logical workflow sequence.

Key Changes

  • Firmware version extraction from vehicle_components.json Flight Controller component
  • Component reordering following workflow logic (Flight Controller → Frame → Battery Monitor → ... → Telemetry)
  • Product field ordering standardization (Manufacturer → Model → Version → URL)
  • Line ending standardization to Unix format (\n)

Reviewed Changes

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

Show a summary per file
File Description
update_vehicle_templates.py Extracts firmware version from vehicle components; removes dependency on package version
data_model_vehicle_components_base.py Adds component and field reordering logic in _reorder_components() method
data_model_par_dict.py Forces Unix line endings in parameter exports
tests/test_data_model_vehicle_components_base.py Adds comprehensive tests for reordering functionality
vehicle_templates/*/vehicle_components.json Updates all templates with reordered components and standardized field order

vehicle_components_data = json.load(f)

# Extract firmware version from Flight Controller component
fw_version = "4.6.3" # default fallback

Copilot AI Nov 10, 2025

Copy link

Choose a reason for hiding this comment

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

The hardcoded default firmware version '4.6.3' should be extracted to a constant at the module level or configuration file to improve maintainability and make it easier to update across the codebase.

Copilot uses AI. Check for mistakes.
Comment thread update_vehicle_templates.py Outdated
firmware = flight_controller.get("Firmware", {})
if isinstance(firmware, dict) and "Version" in firmware:
fw_version = firmware["Version"]
if " " in fw_version:

Copilot AI Nov 10, 2025

Copy link

Choose a reason for hiding this comment

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

This string manipulation logic lacks documentation explaining why spaces need to be removed from firmware versions. Add a comment explaining the expected format transformation (e.g., '4.5.x stable' → '4.5.x').

Suggested change
if " " in fw_version:
if " " in fw_version:
# Remove any suffix (e.g., 'stable', 'beta') from the firmware version string.
# Expected transformation: '4.5.x stable' → '4.5.x'

Copilot uses AI. Check for mistakes.
"Firmware": {
"Type": "ArduCopter",
"Version": "4.6.x"
"Version": "4.6.3"

Copilot AI Nov 10, 2025

Copy link

Choose a reason for hiding this comment

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

The firmware version changed from '4.6.x' to '4.6.3'. This hardcodes a specific patch version instead of allowing flexibility for any 4.6.x version. Consider if this is the intended behavior or if the wildcard 'x' format should be preserved.

Suggested change
"Version": "4.6.3"
"Version": "4.6.x"

Copilot uses AI. Check for mistakes.
"Firmware": {
"Type": "ArduCopter",
"Version": "4.5.x"
"Version": "4.5.7"

Copilot AI Nov 10, 2025

Copy link

Choose a reason for hiding this comment

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

The firmware version changed from '4.5.x' to '4.5.7'. Similar to the 4.6.x template, this replaces a wildcard with a specific version. This change may require updating whenever new patch versions are released.

Suggested change
"Version": "4.5.7"
"Version": "4.5.x"

Copilot uses AI. Check for mistakes.
@github-actions

github-actions Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Test Results

    3 files      3 suites   2m 45s ⏱️
2 036 tests 2 034 ✅ 2 💤 0 ❌
6 108 runs  6 102 ✅ 6 💤 0 ❌

Results for commit 46fe140.

♻️ This comment has been updated with latest results.

More important components first, less important and/or optional components last
Product's Manufacturer, Model and version are now on consecutive fields
@amilcarlucas amilcarlucas merged commit 58f57f7 into master Nov 10, 2025
33 checks passed
@amilcarlucas amilcarlucas deleted the re-order-components branch November 10, 2025 22:31
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