Repository navigation
feat(parameter-editor): filter parameters absent from connected firmware - #2086
amilcarlucas wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Resolve concurrent parameter I/O, preserve confirmed absences, invalidate stale requests, and cancel stale table renders.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds firmware parameter-presence probing before rendering configuration-step tables, omitting only definitively absent parameters while preserving hidden and timed-out ones.
Changes:
- Added direct parameter reads and
PARAM_ERRORhandling. - Rebuilds models after firmware cache updates and performs follow-up checks.
- Added regression tests for filtering and render ordering.
File summaries
| File | Summary |
|---|---|
tests/test_frontend_tkinter_parameter_editor.py |
Tests probing and model rebuild ordering. |
tests/test_frontend_tkinter_parameter_editor_table.py |
Tests filtering and rendering behavior. |
tests/test_data_model_parameter_editor.py |
Tests model refresh delegation. |
tests/test_backend_flightcontroller_params.py |
Tests presence detection and response decoding. |
ardupilot_methodic_configurator/frontend_tkinter_parameter_editor.py |
Coordinates asynchronous probing and model rebuilding. |
ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py |
Filters confirmed-absent rows and displays progress. |
ardupilot_methodic_configurator/data_model_parameter_editor.py |
Exposes presence checks and model rebuilding. |
ardupilot_methodic_configurator/backend_flightcontroller.py |
Delegates presence checks. |
ardupilot_methodic_configurator/backend_flightcontroller_protocols.py |
Extends the flight-controller protocol. |
ardupilot_methodic_configurator/backend_flightcontroller_params.py |
Implements direct reads and PARAM_ERROR decoding. |
Review details
Suppressed comments (2)
ardupilot_methodic_configurator/frontend_tkinter_parameter_editor.py:1428
- Resetting the presence state does not invalidate an active request. If the user leaves and returns to the same file before the old worker finishes, and the return does not queue a new batch (for example, no N/A rows remain), the old result still matches the unchanged request ID and filename at line 1486 and can hide rows using stale data. Increment the request generation whenever
resetstarts, or explicitly discard/cancel the active request.
if reset:
self._confirmed_absent_fc_parameter_names.clear()
self._checked_parameter_presence_names.clear()
ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py:313
- This clears the viewport but does not invalidate an already scheduled
_update_table_in_batchescallback. If the user changes steps while a large table is rendering, that callback can still add rows from the previous step into the “Checking...” view, and those stale widgets remain until a later render. Invalidate the current render generation before destroying the widgets (and reset any reserved-row state) so pending batches cannot repopulate this loading screen.
def show_parameter_presence_check_in_progress(self) -> None:
"""Replace stale rows while direct parameter reads are in progress."""
for widget in self.view_port.winfo_children():
widget.destroy()
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| nonexistent = self.parameter_editor.get_nonexistent_fc_parameters(list(param_names)) | ||
| except Exception as error: # pylint: disable=broad-exception-caught | ||
| logging_warning("Could not check flight-controller parameter presence: %s", error) | ||
| nonexistent = set() | ||
| self._parameter_presence_results.put((request_id, filename, nonexistent)) | ||
|
|
||
| threading.Thread(target=check_parameter_presence, daemon=True).start() |
| completed_request = self._active_parameter_presence_request | ||
| self._active_parameter_presence_request = None | ||
| if request_id == self._parameter_presence_request_id and filename == self.parameter_editor.current_file: | ||
| self._confirmed_absent_fc_parameter_names = nonexistent |
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Test Results 4 files ± 0 4 suites ±0 50m 29s ⏱️ -29s For more details on these failures, see this check. Results for commit 4fd9cc6. ± Comparison against base commit e802f3f. ♻️ This comment has been updated with latest results. |
Coverage Report for CI Build 37789509885Coverage decreased (-0.08%) to 91.058%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions204 previously-covered lines in 5 files lost coverage.
Coverage Stats💛 - Coveralls |
b6cad22 to
833ce5b
Compare
833ce5b to
3cdb805
Compare
Previous review (2026-10-06)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for this. Distinguishing hidden parameters from ones that are truly absent is a useful improvement, and treating only an explicit DOES_NOT_EXIST as absence is the right conservative choice. A few things need fixing before merge. The presence check runs on a background thread (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-66416537a8c3d05fc24b29ee4b158b15e4bade6fe86f9229e780081570a279b5R1599) and reads the same MAVLink connection as fetch_param, the post-upload re-download and plugin polling, with no shared lock. Because recv_match throws away messages it does not match, either side can lose the other's replies. I reproduced both directions with the real fetch_param and get_nonexistent_parameters. This is the concern in Copilot's first inline comment, and it is still open. Please route all connection reads through one serialised path, disable upload/skip while the check runs, and stop the worker when the window closes. The follow-up probe replaces the confirmed-absent set instead of extending it (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-66416537a8c3d05fc24b29ee4b158b15e4bade6fe86f9229e780081570a279b5R1618), so a parameter hidden by the first batch reappears after the second. Changing the assignment to With the pinned pylint 4.0.9, the changed files now report 11 messages, where the base is a clean 10.00/10: too-many-return-statements and too-many-branches at https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-59979ba0868d9bd6c7a9e3b955e1fe59cdffdfde2ccff2ae57fd53098c102762R400 and 441, seven attribute-defined-outside-init for the presence state (initialising those attributes in Smaller suggestions: In simple mode, rows hidden as absent are still uploaded (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-a1fc77b2f824d73d73195abb5559fad566982d510708937a5c52ba2c86de71acR293), so a verification failure is reported for a parameter the user cannot see. Filtering the upload set the same way would keep the two consistent. The loading view (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-a1fc77b2f824d73d73195abb5559fad566982d510708937a5c52ba2c86de71acR323) leaves the previous step's upload checkboxes in place, so Upload during the check can send values for rows that are not shown. Clearing the checkboxes when the loading view appears would fix it. Firmware before 4.7 never answers unknown names, so each visit to such a step waits the full 2 s (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-66416537a8c3d05fc24b29ee4b158b15e4bade6fe86f9229e780081570a279b5R1477). Caching inconclusive names for the session would help. Bumping the request id on every reset (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-66416537a8c3d05fc24b29ee4b158b15e4bade6fe86f9229e780081570a279b5R1557) would make stale results impossible to accept. Checking the reply's source system/component (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-59979ba0868d9bd6c7a9e3b955e1fe59cdffdfde2ccff2ae57fd53098c102762R486) would stop another node's PARAM_ERROR from hiding a row. The test docstring at https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-01a2ce165f9d32eff9b69d3a8ec04e5817ad31de84ad2ad5eb635369ed3b028cR338 says the pinned dialect exposes UNKNOWN_345, but pymavlink 2.4.50 decodes PARAM_ERROR natively. It would be worth rewording the docstring and adding a native-decode test. |
3cdb805 to
e853df9
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 the rebase. The patch is identical to the one reviewed before (now at e853df9), so the earlier points still apply. There is also one new problem. New: when a calibration step asks to copy FC values into the file and the user answers YES, the copy is held in memory only. The presence result then rebuilds the step from the saved file (https://github.com/ArduPilot/MethodicConfigurator/pull/2086/files#diff-66416537a8c3d05fc24b29ee4b158b15e4bade6fe86f9229e780081570a279b5R1640), even when the result is inconclusive. That silently reverts the copied values and clears their dirty flags. I reproduced a copied value going from 9 back to the file's 1 with the real model code. A later upload would then write the old value back over the calibration on the FC. Please preserve staged edits across the rebuild, or run the copy workflow after presence processing. Still blocking from the previous review:
Smaller suggestions:
|
e853df9 to
c36c38d
Compare
Previous review (2026-10-13)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for the rebase. The feature commit is the same patch as before (now c36c38d, plus the pre-commit import fix), so the earlier points still apply. This time I also ran the backend against ArduCopter 4.7.2 and 4.6.3 SITL with the AirCar_v1 template. On 4.7.2 the feature does its job: 82 names were reported absent, 113 hidden names came back with values, and most checks took 0.1 to 0.3 s. Blocking:
Smaller suggestions:
Not tested: the GUI end to end against a live FC, real hardware, and firmware other than ArduCopter SITL. |
2ae0c22 to
f7c25ae
Compare
Previous review (2026-10-14)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for the rebase. Since the last review the branch moved from 2ae0c22 to f7c25ae; Blocking:
Smaller suggestions:
Not tested: the full Tk window against a live FC, real hardware, Windows and macOS, and firmware other than ArduCopter 4.7.2 and 4.6.3 SITL. The SITL figures above are from the first pass of this review; the later passes re-checked the behaviour with a simulated FC, not SITL. |
f7c25ae to
b55494f
Compare
Previous review (2026-11-08)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Changes requested: one existing test file now fails at this head. Since the last review (at f7c25ae; the head is now b55494f), the three earlier blockers and the smaller suggestions are fixed. Copied FC values stay dirty across the rebuild, the check holds the navigation lock and recovery lease and close waits for it, and pylint is clean. Blocking
Should fix
Minor (1)
The removed property list in the |
ced6652 to
1d78a1f
Compare
Previous review (2026-11-09)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Changes requested: one new test leaks a Tk grab and turns CI red. Since the last review (at b55494f; the head is now 1d78a1f), the inspector-test break, the stale absent-set after recovery and the untyped host attribute are all fixed. Blocking
|
1d78a1f to
d6f4bbb
Compare
Previous review (2026-11-09)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Looks good to merge: no open findings remain at d6f4bbb. Since the last review (at 1d78a1f, the head is now d6f4bbb), the Tk grab leak in |
d6f4bbb to
c9aa8f8
Compare
Previous review (2026-11-10)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Nearly ready: one low-priority model edge case is open and nothing blocks. Nothing was open after the last review at d6f4bbb. Since then the head has moved to c9aa8f8: the presence check now uses BackgroundTaskRunner (with a Thread.start failure fix), and the earlier grab-leak test fix (tests/test_frontend_tkinter_parameter_editor.py:5707) is still in place. Minor (2)
|
…t failure When Thread.start() raised, the runner kept the dead thread and the completion callback, so every later start() was refused as "active". Clear both before re-raising so the user can retry. Co-authored-by: Copilot <[email protected]> Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
…ameter names fetch_param raised IndexError for names that fail MAVLink validation, which is unrelated to indexing and indistinguishable from real index bugs. Introduce InvalidParamNameError(ValueError) so callers can handle the validation failure specifically. Co-authored-by: Copilot <[email protected]> Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
c9aa8f8 to
4fd9cc6
Compare
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Not ready yet: the parameter-presence probe ignores every reply on a real link, and once that is fixed it would delete parameters from the quick-tune step's file. Since the last review at c9aa8f8, the head moved to 4fd9cc6. The bitmask edit-restore issue is fixed and tested. The BackgroundTaskRunner fix is now its own commit, and the feature now deletes absent rows instead of hiding them. Blocking
Minor (2)
|
…(ArduPilot >= 4.7) ArduPilot 4.7 answers PARAM_REQUEST_READ for a missing parameter with an explicit PARAM_ERROR/DOES_NOT_EXIST. Probe step parameters that lack a cached flight-controller value in batches of ten with one retry. Hold the navigation lock and connection-recovery lease during the probe. Address requests to the system and component identified by the connection handshake, and only accept replies from that controller. pymavlink can leave the target component at broadcast after a heartbeat. Cache PARAM_VALUE replies from hidden parameters and keep rows when a timeout or an inconclusive error leaves their availability unknown. Remove confirmed-absent parameters from the step and omit them on the next confirmed save. When the step changes an existing enable parameter that can require a reboot, retain the absent rows and their file values. Send dependent parameters in the upload pass after reboot so Quick Tune keeps its QUIK_* settings when SCR_ENABLE changes. Forget absences when the step changes or the controller supplies a value. Preserve unsaved additions, deletions, values, reasons and manual overrides when reconnect or readback rebuilds the step. Wait for the probes before offering to copy live values. Complete the step's file transfers before activating its plugin so the plugin cannot consume MAVFTP replies. Show the step instructions after activation. Co-authored-by: Copilot <[email protected]> Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
The project's firmware version in vehicle_components.json is updated to the connected FC's version before the parameter-file upgrade runs. Files the user never opened stayed un-migrated on disk and the upgrade was not triggered again, so their legacy parameters would later be removed as absent from the firmware. upgrade_parameters_for_firmware_version now returns the names of the files it changed, and main() saves exactly those files right after the upgrade. Co-authored-by: Copilot <[email protected]> Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
The connected firmware version is still set in memory early, because derived parameters need it, but vehicle_components.json is now written only after the upgraded parameter files were saved. An interrupted start therefore retries the upgrade instead of skipping it. Every save of vehicle_components.json, including the project-format migration, now also refreshes the 'Program version' with the running AMC version. Co-authored-by: Copilot <[email protected]> Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
4fd9cc6 to
6441f03
Compare
Description
Probe N/A configuration-step parameters with PARAM_REQUEST_READ before rendering the parameter table.
Treat PARAM_ERROR/DOES_NOT_EXIST as a definitive absence and omit only those rows. Retain parameters that respond with PARAM_VALUE, including parameters hidden by firmware gating, and leave timeouts as N/A.
Rebuild the configuration-step data model after direct reads update the FC cache so conditional, derived, and auto-imported rows use current FC state. Re-probe any new N/A rows produced by that rebuild before rendering.
Add regression coverage for model-before-render ordering and follow-up presence checks.
Checklist
git commit --signoff)Testing
Describe how you tested these changes: