Skip to content

Obey inline component editor connection renames#1676

Merged
amilcarlucas merged 2 commits into
masterfrom
inline_component_editor_connection_renames
Jun 7, 2026
Merged

Obey inline component editor connection renames#1676
amilcarlucas merged 2 commits into
masterfrom
inline_component_editor_connection_renames

Conversation

@amilcarlucas
Copy link
Copy Markdown
Collaborator

Description

Obey inline component editor connection renames

Checklist

  • Run pre-commit checks locally
  • Verified by a human programmer
  • All commits are signed off (use git commit --signoff)
  • Code follows our coding standards
  • Documentation updated if needed
  • No breaking changes or properly documented

Testing

Describe how you tested these changes:

  • Unit tests pass
  • Integration tests pass
  • Manual testing performed
  • Tested on flight controller hardware

Copilot AI review requested due to automatic review settings June 7, 2026 14:21
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

This PR updates the configuration-step connection-renaming logic to respect inline component editor “connection type” changes, including the ability to re-evaluate rename_connection renames in-place (without rebuilding the full parameter set). It also renames the underlying rename-calculation helper to a public calculate_connection_rename_operations method and updates tests accordingly.

Changes:

  • Rename _calculate_connection_rename_operationscalculate_connection_rename_operations and update call sites/tests.
  • Track and re-apply/undo connection renames in ParameterEditor.refresh_current_step_computed_parameters() when component data changes.
  • Add a GNSS-specific special case to force a MAVLink protocol value when applicable.

Reviewed changes

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

File Description
tests/test_data_model_configuration_step.py Updates unit tests to use the new public calculate_connection_rename_operations name.
ardupilot_methodic_configurator/data_model_parameter_editor.py Adds connection-rename tracking and in-place refresh logic when inline component edits change the evaluated connection type.
ardupilot_methodic_configurator/data_model_configuration_step.py Renames the static helper to calculate_connection_rename_operations and updates internal usage.

Comment on lines +2369 to +2376
# Target changed — move the parameter to the new name
if current_target in self.current_step_parameters:
self._added_parameters.discard(current_target)
del self.current_step_parameters[current_target]
if orig_name in original_params:
self.current_step_parameters[new_target] = self._config_step_processor.create_ardupilot_parameter(
new_target, original_params[orig_name], self.current_file, self.fc_parameters
)
Comment on lines +2358 to +2367
# Rename no longer applicable — restore original name
if current_target in self.current_step_parameters:
self._added_parameters.discard(current_target)
del self.current_step_parameters[current_target]
if orig_name in original_params:
self.current_step_parameters[orig_name] = self._config_step_processor.create_ardupilot_parameter(
orig_name, original_params[orig_name], self.current_file, self.fc_parameters
)
self._deleted_parameters.discard(orig_name)
del self._connection_renames[orig_name]
Comment on lines +2386 to +2397
for orig_name, new_target in new_rename_map.items():
if orig_name in self._connection_renames:
continue # already handled above
if orig_name in original_params:
# Remove the original (un-renamed) parameter if it is still present
if orig_name in self.current_step_parameters:
del self.current_step_parameters[orig_name]
self._deleted_parameters.add(orig_name)
self.current_step_parameters[new_target] = self._config_step_processor.create_ardupilot_parameter(
new_target, original_params[orig_name], self.current_file, self.fc_parameters
)
if is_gnss and new_target.endswith("_PROTOCOL"):
Comment on lines +2322 to +2324
if "rename_connection" in step_info:
self._refresh_current_step_connection_renames(step_info, variables)

@amilcarlucas amilcarlucas force-pushed the inline_component_editor_connection_renames branch from 240ee5f to 426735c Compare June 7, 2026 14:31
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
13153 12412 94% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 2da8a2a by action🐍

…e refresh

Add conflict checks in `_refresh_current_step_connection_renames()` so that
a rename is skipped (with a warning) when `new_target` already exists in
`current_step_parameters` as an unrelated parameter, preventing silent data
loss on both the "target changed" and "new rename" branches.

Add six BDD-style unit tests in `TestRefreshConnectionRenames` covering:
- eval failure leaves state unchanged
- normal new rename applies correctly
- new rename skipped when target already exists (fix)
- rename undone when expression no longer applies
- rename retargeted when destination changes
- retarget skipped when new target already exists (fix)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

Test Results

     4 files       4 suites   40m 29s ⏱️
 4 042 tests  4 035 ✅  7 💤 0 ❌
15 960 runs  15 914 ✅ 46 💤 0 ❌

Results for commit 2da8a2a.

♻️ This comment has been updated with latest results.

@amilcarlucas amilcarlucas merged commit 596d2a8 into master Jun 7, 2026
29 of 31 checks passed
@amilcarlucas amilcarlucas deleted the inline_component_editor_connection_renames branch June 7, 2026 15:08
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