Repository navigation
fix(projects): retain source-only FC parameters in template imports - #2186
amilcarlucas wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
FC residual-export failures can leave incomplete projects, and retention failures receive a misleading copy-error title.
2 open findings
What changed in this PR
Preserves source-only flight-controller parameters during template imports and expands acceptance coverage.
Changes:
- Exports unrepresented parameters to a final numbered step.
- Avoids duplicate residual exports in dedicated import workflows.
- Adds comprehensive import, inference, persistence, and cleanup tests.
| File | Description |
|---|---|
.gitignore |
Ignores node_modules. |
backend_filesystem.py |
Adds residual parameter export. |
data_model_vehicle_project.py |
Delegates dedicated residual imports. |
data_model_vehicle_project_creator.py |
Integrates retention and cleanup. |
tests/test_data_model_vehicle_project.py |
Updates workflow expectations. |
tests/test_data_model_vehicle_project_creator.py |
Tests retention and cleanup. |
tests/template_import_helpers.py |
Adds independent acceptance-test helpers. |
tests/acceptance_template_import_from_params.py |
Strengthens end-to-end import coverage. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| settings, | ||
| fc_connected=True, | ||
| fc_parameters=fc_parameters, | ||
| retain_source_parameters=False, |
| if not error_msg and settings.use_fc_params and fc_parameters and retain_source_parameters: | ||
| self.local_filesystem.retain_unrepresented_fc_parameters( | ||
| new_vehicle_dir, fc_parameters, self.next_import_filename | ||
| ) | ||
| except Exception as exc: | ||
| shutil_rmtree(new_vehicle_dir, ignore_errors=True) | ||
| raise VehicleProjectCreationError(_("Copying template files"), str(exc)) from exc |
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Test Results 3 files 3 suites 37m 25s ⏱️ For more details on these failures and errors, see this check. Results for commit e3adb17. ♻️ This comment has been updated with latest results. |
9ea2d39 to
a4cfaa8
Compare
Previous review (2026-10-08)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for this. Retaining source-only FC values is a good change, but CI will not pass as it stands. The reworked acceptance tests require apm.pdef.xml inside each template (acceptance_template_import_from_params.py:386, template_import_helpers.py:143). That file is gitignored and not tracked for most templates, including empty_4.6.x and ArduPlane/empty_4.7.x, and the new autouse fixture blocks the download that used to provide it. On this head I get 4 failed and 131 errors, the same as CI showed for 9ea2d39. Could you commit or seed the XML the tests need, or skip clearly when it is absent? In the generic template path, retain_unrepresented_fc_parameters (backend_filesystem.py:837) exports every FC value not in a template step, including values still at their default. With a full FC download into empty_4.6.x the final step had 732 entries, 731 of them defaults, including INS_ACCOFFS_* and INS_GYROFFS_*. Because the editor preselects differing values for upload, a calibration made at an earlier step could be offered for reset to 0. Filtering against the FC defaults, as _complete_imported_vehicle_project_creation already does, would avoid this. Minor: a retention failure is reported as 'Copying template files' instead of 'Parameter import' (data_model_vehicle_project_creator.py:550), as Copilot also noted. Cleanup itself works. Copilot's point about missing cleanup in the FC workflow is real, but it predates this PR; it would be good to fix separately. |
Preserve flight-controller settings that are absent from the selected template instead of silently dropping them during project creation. - Export unrepresented source parameters to a final numbered import step - Scan copied parameter files without loading or mutating the source project - Leave template defaults unchanged and omit imported change reasons - Allow dedicated FC and bin-log imports to manage their own residual export - Remove newly created projects when residual retention fails Strengthen template-import acceptance coverage: - Discover nested templates while pruning migration directories - Isolate workflow inputs and require local parameter metadata - Assert complete parameter membership, values, comments, and precedence - Verify component inference from deliberately incorrect initial values - Preserve non-inferable component context - Validate regeneration against independent configuration expectations - Exercise real manager, component-editor, and parameter-editor workflows - Verify preview-only startup and persistence requiring user permission - Detect missing inference, saving, rules, context, and source parameters - Copy templates before tests that can invalidate cached metadata Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
a4cfaa8 to
e3adb17
Compare
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Follow-up after the rebase: this is for head e3adb17, the previous note was for a4cfaa8. The rebase only dropped the .gitignore hunk, so the earlier points still stand and I have re-checked each of them on the new head. The pytest jobs still cannot pass. The reworked acceptance tests read apm.pdef.xml from the installed templates (tests/acceptance_template_import_from_params.py:386, tests/template_import_helpers.py:143). That file is gitignored and tracked for only 8 of the 29 templates, not for ArduCopter/empty_4.6.x or ArduPlane/empty_4.7.x, and the autouse fixture at tests/acceptance_template_import_from_params.py:166 blocks the download. In a clean checkout of e3adb17 I get 4 failed, 86 passed, 131 errors; with the XML present in every template the same file gives 221 passed, so the tests themselves look fine. CI for this head was still queued when I checked; CI for a4cfaa8, which has identical test files, failed with the same 4 failures and 131 errors. Could you commit or seed the XML the tests need, or skip clearly when it is absent? Not blocking: in the generic template path, retain_unrepresented_fc_parameters (ardupilot_methodic_configurator/backend_filesystem.py:837) keeps every FC value that is not in a template step, including values still at their default. With a full 1020-parameter FC and empty_4.6.x the new final step has 732 entries, 731 of them defaults, where 'create from flight controller' writes 1 for the same input. That includes INS_ACCOFFS_* and INS_GYROFFS_* saved as 0, so after an accelerometer calibration the last step shows them as different from the FC, and the table's checkbox logic would select them for upload on a live link (I ran the editor's data model and read the checkbox code; I did not upload to a real FC). The calibration plugin does warn about stale values in other steps, so this is a stale snapshot to review, not a silent reset. Filtering against the FC defaults when they are available, as _complete_imported_vehicle_project_creation does, would avoid it. Minor: a retention failure is still reported as 'Copying template files' instead of 'Parameter import' (ardupilot_methodic_configurator/data_model_vehicle_project_creator.py:550), as Copilot also noted. The cleanup itself works. Copilot's other point, the missing cleanup when the residual export fails in the 'create from flight controller' workflow, behaves the same on master and on this branch, so it is not from this PR; it would be good to fix separately. |

Description
Preserve flight-controller settings that are absent from the selected template instead of silently dropping them during project creation.
Strengthen template-import acceptance coverage:
Checklist
git commit --signoff)Testing
Describe how you tested these changes: