Skip to content

fix: reconcile inline derived parameters after component edits - #2289

Open
nflyernz wants to merge 18 commits into
ArduPilot:masterfrom
nflyernz:fix/inline-derived-parameter-refresh
Open

nflyernz wants to merge 18 commits into
ArduPilot:masterfrom
nflyernz:fix/inline-derived-parameter-refresh

Conversation

@nflyernz

Copy link
Copy Markdown
Contributor

Summary

  • Reconcile conditional derived rows in place after inline component edits, including new rows and retirement of obsolete automatic rows.
  • Preserve saved parameters, manual overrides, user additions, deleted rows, and connection rename destinations.
  • Add model regression tests for port changes, None selection, idempotent refresh, FC availability, export, and parameter provenance.

Validation

  • pytest -q tests/test_data_model_parameter_editor.py tests/test_data_model_configuration_step.py (430 passed)
  • Ruff check and format, targeted ty, focused Pylint, and git diff --check passed. Pylint's existing argument-count findings were excluded from the focused run.

Related inline-edit reports: #2284, #2287, #2288. GNSS forced/derived behavior from #2288 remains deferred.

@nflyernz
nflyernz marked this pull request as ready for review October 28, 2026 11:23
@amilcarlucas amilcarlucas added the AIReview Request an automated AI review; picked up by the reviewprs sweep label Oct 30, 2026
@AP-Review

AP-Review commented Oct 30, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-10-30)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head c3da9d8371.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/1.html#prMethodicConfigurator-2289

The reconciliation fix works for port moves, saved renames and FC availability, but it can bring back a derived row the user has just deleted.

Should fix

  • data_model_parameter_editor.py:2834: an automatically added derived row that the user deletes (e.g. SERIAL2_PROTOCOL) comes back on the next inline component edit and gets saved or uploaded, because delete_parameter_from_current_file only tombstones rows that exist in the saved file. Record user deletions of any row and honour them in the applicability filter, and test this through the delete API instead of seeding _deleted_parameters.

Minor

  • data_model_parameter_editor.py:2794: the filter also excludes rows that the step's delete_parameters rule removed at load, so switching the battery monitor inline from Analog to I2C never restores BATT_I2C_BUS (a fresh load does). Not a regression; consider tracking rule-driven deletions separately from user deletions.
Minor test coverage (1)
  • data_model_parameter_editor.py:2822: the is_dirty guard, the export-time _inline_derived_parameters.clear() (line 2622) and the GNSS rename-target skip (line 2812) can each be removed without failing any test; the first two change behaviour, so focused tests would help.

@AP-Review

AP-Review commented Oct 30, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-10-30)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head ad15fb41ca.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/2.html#prMethodicConfigurator-2289

The two follow-up commits fix the main problem, and what is left is non-blocking: a pre-existing loss of saved rows, plus minor edge cases and test gaps.

Since the last review at c3da9d8, a derived row that the user deletes now stays deleted through inline component edits, port changes and save, until it is re-added or the step is reloaded.

Should fix

  • data_model_parameter_editor.py:2631: rows lost after save (pre-existing, base is worse). _export_current_file leaves _connection_renames keyed by the old SERIAL1_* names. So after "Upload selected and stay", the next inline component edit, even an unrelated one, deletes SERIAL2_BAUD and BRD_SER2_RTSCTS, and the next save writes the file without them. Clear or rebase _connection_renames on export, here or in a follow-up.

Minor

  • data_model_parameter_editor.py:2790: deleted row returns through a rename (pre-existing). If SERIAL2_PROTOCOL came from a saved SERIAL1 rename and is deleted, moving the port to SERIAL3 and back recreates and exports it, because the rename refresh does not check _suppressed_derived_parameters.
  • data_model_parameter_editor.py:2803: BATT_I2C_BUS not restored inline (still open).
Minor test coverage (2)

@AP-Review

AP-Review commented Oct 31, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-10-31)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 7685d356b3.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/3.html#prMethodicConfigurator-2289

The latest commit fixes the saved-row loss, but it adds a narrow regression when a renamed serial row is deleted and then re-added. Not blocking, but worth fixing before merge.

Since the review at ad15fb4, saving now rebases connection renames, so serial rows survive upload-and-stay plus a later edit. A deleted renamed row also stays deleted through a port round trip.

Should fix

  • data_model_parameter_editor.py:2406: re-add leaves the row on the old port. Deleting SERIAL2_BAUD (or _PROTOCOL) that came from a saved SERIAL1 rename suppresses SERIAL1_BAUD, but re-adding it discards only SERIAL2_BAUD. After a later change to SERIAL3, the save has SERIAL2_BAUD=57 and no SERIAL3_BAUD. The docs branch at 2424 has the same problem. On re-add, also discard the sources whose current _connection_renames target is param_name.
Minor (2)
  • data_model_parameter_editor.py:2816: BATT_I2C_BUS not restored inline (still open, pre-existing).
  • test_data_model_parameter_editor.py:5909: test gaps (still open). The dirty-value test never reaches the is_dirty guard because the fixture FC lacks OTHER; add OTHER to fc_parameters or clear it. The export clear of _suppressed_connection_renames, both re-add discards, the reload clear of _suppressed_derived_parameters and the docs-path derived unsuppress can each still be removed with all tests passing.

Head moved during review: observed c5af74165ab6a9b85bdebe0e5c57704c28d74c61. This review covers only 7685d356b3a3e04df239af58567b38968e813995; followup eligible.

@nflyernz

Copy link
Copy Markdown
Contributor Author

Follow-up validation — latest ParameterEditor changes

I've pushed the latest correction in c5af7416, addressing automatic derived-parameter ownership across export and connection renames.

The changes ensure that automatically derived serial assignments can be retired when their derivation no longer applies, while preserving existing saved settings, user additions and manual overrides.

Validation:

  • 568 affected ParameterEditor and ConfigurationStep tests passed.
  • Combined the current fix: reconcile inline derived parameters after component edits #2289 head (c5af7416) with my local consolidated ArduPlane serial-port integration (77edfa67) in an isolated temporary worktree.
  • 807 tests passed, 0 failed, including all four previously failing transitions where a saved serial selection was subsequently changed back to None or RCIN.
  • RC receiver, telemetry, ESC telemetry, GNSS, same-UART driver changes, repeated export and OSD template checks passed.
  • Ruff, targeted ty and focused Pylint checks passed.

The consolidated ArduPlane work combines the corrections currently in draft PRs #2284, #2285, #2287 and #2288. It remains local and unpushed, pending #2289.

The ownership tracking is deliberately session-only; no persistent project metadata or flight-controller reset values were introduced.

The separate, pre-existing BATT_I2C_BUS inline-restoration issue is noted for a possible follow-up after the Basic configuration work.

@coveralls

coveralls commented Oct 31, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 42996752006

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.3%) to 95.07%

Details

  • Coverage increased (+0.3%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 253 coverage regressions across 13 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

253 previously-covered lines in 13 files lost coverage.

Top 10 Files by Coverage Loss Lines Losing Coverage Coverage
data_model_parameter_editor.py 52 96.6%
backend_bin_log.py 43 87.93%
backend_internet.py 40 89.5%
frontend_tkinter_log_analysis.py 32 77.93%
main.py 31 90.21%
frontend_tkinter_parameter_editor.py 15 96.05%
annotate_params.py 10 93.28%
backend_filesystem_program_settings.py 9 97.59%
backend_flightcontroller.py 8 97.56%
log_analysis/data_model_log_analysis.py 6 95.16%

Coverage Stats

Coverage Status
Relevant Lines: 31478
Covered Lines: 29926
Line Coverage: 95.07%
Relevant Branches: 9644
Covered Branches: 8645
Branch Coverage: 89.64%
Branches in Coverage %: No
Coverage Strength: 2.83 hits per line

💛 - Coveralls

@AP-Review

AP-Review commented Oct 31, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-10-31)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head ad0b3b4499.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/4.html#prMethodicConfigurator-2289

The two new commits fix most of the earlier re-add problem, but one adds a regression where a saved serial protocol does not come back when its port is re-selected. Nothing is blocking.

Since the review at 7685d35, re-adding a deleted renamed row straight away now follows later port changes, edited values move with the port, and manual overrides on renamed rows are kept.

Should fix

  • data_model_parameter_editor.py:2836: saved derived row lost on re-select. After a save, deselecting a port (e.g. RC receiver SERIAL5 to RCin/SBUS) retires SERIAL5_PROTOCOL into _deleted_parameters, and the filter at 2822 treats that as a user deletion. Re-selecting SERIAL5 shows no SERIAL5_PROTOCOL row and the next save writes the file without it until the step is reloaded. Regression from c5af741. Track retirements separately from explicit deletions.
  • data_model_parameter_editor.py:2933: re-add after an intermediate edit (still open, narrowed). If any component edit runs while SERIAL2_BAUD is deleted, this branch drops the SERIAL1_BAUD→SERIAL2_BAUD mapping, so after re-add and a move to SERIAL3 the file has SERIAL2_BAUD=230 and no SERIAL3_BAUD (FC and docs paths). Keep the mapping while the source is suppressed.
Minor (3)
  • data_model_parameter_editor.py:2944: return to the original port drops the edit (pre-existing). A re-added SERIAL2_BAUD edited to 230 and moved back to SERIAL1 saves SERIAL1_BAUD=57, while a move to SERIAL3 keeps 230; carry the current value here too.
  • data_model_parameter_editor.py:2822: BATT_I2C_BUS not restored inline (still open, pre-existing).
  • test_data_model_parameter_editor.py:5909: test gaps (still open). Also, no test re-selects a port after a saved retirement or edits while a renamed row is deleted, which is why both should-fix items pass CI.

@nflyernz

nflyernz commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #4

I've pushed 271d1e45, addressing both Should fix findings from the latest automated review.

  • Saved derived parameter re-selection: Automatic retirement is now tracked separately from explicit user deletion. A saved serial protocol returns when its port is re-selected, with or without an intervening export.
  • Re-add after an intervening edit: Suppressed connection-rename mappings are retained so manually re-added parameters continue following subsequent port changes, including their edited values.

Both issues were reproduced before correction, and regression tests now cover five serial-parameter lifecycle scenarios.

Validation:

One existing behaviour remains unchanged: returning a re-added parameter to its original saved port restores the saved source value. I'd welcome maintainer guidance on whether that should instead preserve the edited value.

The previously identified BATT_I2C_BUS restoration issue remains deferred as a separate, pre-existing problem.

No persistent ownership metadata or FC reset values were introduced.

@AP-Review

AP-Review commented Nov 1, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-01)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 271d1e45c5.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/5.html#prMethodicConfigurator-2289

Both earlier should-fix items are fixed, but the way the re-add fix keeps rename mappings adds a new value-reset regression, and there is one further stale-row case in automatic retirement. Nothing is blocking.

Since the review at ad0b3b4, a saved serial protocol comes back when its port is re-selected (with or without a save in between), and a row re-added after an intervening edit now follows the next port move.

Should fix

  • data_model_parameter_editor.py:2377: re-adding the saved source name revives its stale rename. Delete renamed SERIAL2_BAUD, return the port to SERIAL1, add SERIAL1_BAUD and set it to 230: the next unrelated component edit resets it to the saved 57, and 57 is what gets saved (same for _PROTOCOL). Regression from 271d1e4. Drop the source's own mapping (self._connection_renames.pop(param_name, None)) before unsuppressing it.
  • data_model_parameter_editor.py:2909: retired row comes back after a different-port selection. Save with telemetry on SERIAL2, then select None, SERIAL3 (no save) and None again, then save: the file still has SERIAL2_PROTOCOL=2. Retirement drops ownership, so the SERIAL3 rename is not owned and undoing it restores the saved SERIAL2 row. Carry ownership from the retired set too, or reconcile retired sources before renaming.
Minor (4)

@nflyernz

nflyernz commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #5

Thanks for the continued review. Both Should fix findings have now been reproduced and corrected in the latest commit.

  • Re-added saved source: Stale connection-rename mappings are cleared or reconciled so re-adding an original saved parameter no longer unexpectedly resets its edited value. The related stale-target case is also covered.
  • Automatic retirement across port changes: Derivation ownership now follows renamed parameters, preventing obsolete serial assignments from returning after sequences such as SERIAL2 → None → SERIAL3 → None.

Both failures were reproduced before the corrections.

Local validation:

  • 33 focused lifecycle tests passed.
  • 583 affected ParameterEditor/ConfigurationStep tests passed.
  • 926 combined ArduPlane integration tests passed, including all earlier integration coverage and ten additional regression cases.
  • Ruff, targeted ty, focused Pylint and diff checks passed.

Tkinter GUI tests were not rerun locally because of the existing macOS environment issue.

Two existing behaviours remain deliberately unchanged pending maintainer guidance: restoration of the original saved value when returning to the original port, and the pre-existing BATT_I2C_BUS inline-restoration issue.

No persistent ownership metadata or FC reset values were introduced.

@AP-Review

AP-Review commented Nov 1, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-01)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 85cf228464.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/6.html#prMethodicConfigurator-2289

Nothing is blocking, but the latest fix for re-added rows adds a new regression, and there is a second, older regression in initial step loading.

Since the review at 271d1e4, both should-fix items are fixed at head 85cf228: re-adding the saved source after a delete and return keeps the edited value, and a retired protocol no longer comes back after SERIAL2, None, SERIAL3, None and a save.

Should fix

  • data_model_parameter_editor.py:2377: the new _connection_renames.pop() also runs while the source's rename is still live. Move the port SERIAL1 to SERIAL2, add SERIAL1_BAUD back for another device, then move to SERIAL3: SERIAL1_BAUD is deleted, SERIAL3_BAUD gets the saved value instead of the edit, and a stale SERIAL2_BAUD is saved (for _PROTOCOL this leaves a second UART configured). Only pop when the source is in _suppressed_connection_renames.
  • data_model_parameter_editor.py:2142: on step load a derived destination is marked as owned even when a saved rename then replaces it. With saved SERIAL1_PROTOCOL=7 and telemetry selected on SERIAL2, selecting None and saving drops SERIAL1_PROTOCOL entirely; base keeps it. This contradicts test_saved_connection_rename_wins_over_new_derived_destination on the refresh path. Drop the destination's ownership when the saved rename replaces it, and add a test for the load path.
Minor (4)

@nflyernz

nflyernz commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

ArduCopter Basic cross-validation — shared ParameterEditor behaviour

I've now tested #2289 against existing ArduCopter Basic configuration, using the Holybro_X500 and Holybro_X500_V2 templates.

This was intended to establish whether the serial lifecycle issues were Plane-specific.

Results:

These counts aren't directly comparable as regression counts because several inline workflows aren't supported on master.

The investigation identified three significant behaviours:

  1. Pre-existing unsaved-value loss: Editing saved telemetry SERIAL1_BAUD from 57 to 115 and then changing to SERIAL2 loses the edit. This reproduces on master, fix: reconcile inline derived parameters after component edits #2289 and Plane.

  2. Ownership after reload: Automatically derived RC/ESC serial protocol assignments can remain after saving, reloading and deselecting the connection. This also occurs on master. Session-only ownership cannot reliably distinguish those saved rows from manually configured settings after reload.

  3. Changed behaviour in fix: reconcile inline derived parameters after component edits #2289: Starting with the X500's saved RC serial settings, moving through SERIAL5 and SERIAL6 with exports, then selecting RCIN/SBUS leaves SERIAL6_PROTOCOL=23 and the renamed baud/options settings. Master removes all three. Retaining the derived protocol after deselection appears undesirable, but automatically removing the saved serial settings raises an ownership question.

Other exercised Copter RC, telemetry, ESC, battery and GNSS paths generally passed on #2289.

These were headless ParameterEditor integration tests using real templates with mocked filesystem/FC boundaries. In-memory export/reload was tested; physical disk serialization and Tkinter GUI behaviour were not.

I'd appreciate guidance on the intended ownership policy: should automatically derived protocol assignments be retired when their connection is deselected, while preserving independently configured baud/options values? And should provenance survive saving and reopening a step?

I've made no further code changes pending that decision. The unrelated, pre-existing unsaved-baud edit issue can be handled separately if preferred.

@AP-Review

AP-Review commented Nov 1, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-01)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 7eabc8066c.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/7.html#prMethodicConfigurator-2289

Nothing is blocking at head 7eabc80; what remains is minor or waits on a maintainer decision.

Since the review at 85cf228, both should-fix items and the stale-target minor item are fixed: the rename pop only runs for a suppressed source, step load drops ownership of a derived destination that a saved rename replaces, and a suppressed mapping falls back to the source name.

Minor (3)
  • data_model_parameter_editor.py:3023: unsaved edit lost on port move (still open). This now also covers the first move, which happens on master too: edit saved SERIAL1_BAUD 57 to 115, move to SERIAL2, and you get 57. Using _take_current_rename_par(orig_name, original_params[orig_name]) in _apply_new_connection_rename fixes the first move. The return-to-original-port case still needs maintainer guidance.
  • data_model_parameter_editor.py:2835: BATT_I2C_BUS not restored inline (still open, pre-existing, deferred).
  • data_model_parameter_editor.py:2885: test gaps (still open, narrowed). The 7eabc80 changes are well pinned. Swapping this saved_par baseline for derived_par, or dropping the dirty guard, still passes all 400 editor tests. The dirty-value test never reaches the guard because the fixture's FC dict filters OTHER out.

Note

  • data_model_parameter_editor.py:2662: this answers your point 3. Head keeps saved SERIAL6_PROTOCOL/BAUD/OPTIONS after SERIAL5, save, SERIAL6, save, RCin/SBUS, while master drops them. Master drops them only because its rename map is stale after export. Without the saves, or on direct deselection, master keeps the saved rows too, as head does. Retiring derived protocols across saves and reloads would need persistent provenance, so that is a maintainer decision, not a regression here.

@amilcarlucas
amilcarlucas force-pushed the fix/inline-derived-parameter-refresh branch from 7eabc80 to 02c97e3 Compare November 2, 2026 00:29

@amilcarlucas amilcarlucas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I did some changes and rebased it. Let's see if all tests pass.

@AP-Review

AP-Review commented Nov 2, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-02)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 02c97e3ecb.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/8.html#prMethodicConfigurator-2289

Nothing is blocking at head 02c97e3, but the new disable-port prompt has one should-fix gap.

Since the review at 7eabc80, all three minor items are fixed. Unsaved serial edits follow port moves, BATT_I2C_BUS is restored inline, and both test gaps are now pinned. The new disable prompt also answers the ownership question.

Should fix

  • data_model_parameter_editor.py:3014: an accepted disable is undone before export. Move SERIAL1 -> SERIAL2, answer Yes to disabling SERIAL1, then select None without saving. This branch restores the saved SERIAL1_PROTOCOL=2 over the staged -1. The kept row is still the source of a live rename, because preserve_or_disable_serial_protocol only marks it declined. Skip the restore when the source is a declined row that still exists, and add a no-save two-move test. Related policy question: that kept row also makes the conflict check cancel any move back to SERIAL1.
Minor (1)
  • data_model_parameter_editor.py:3020: a no-edit round trip SERIAL1 -> SERIAL2 -> SERIAL1 marks a saved row with no comment as added and the step dirty, because Par(57, None) != Par(57, ""). Compare the value and the normalised comment.

Note

  • frontend_tkinter_parameter_editor.py:1884: every serial move now asks whether to disable the old port, so a protocol created only in this session is kept (No) or set to -1 (Yes) rather than retired. That is fine as a design choice. Consider skipping the prompt for rows created in this session.

@nflyernz

nflyernz commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #8 — serial disable lifecycle

I've pushed 5279e614, addressing the Should fix finding from AP-Review #8 following Amílcar's connection-confirmation changes.

The reported failure was reproduced before correction: selecting SERIAL1 → SERIAL2, accepting SERIAL1_PROTOCOL=-1, then selecting None without an intervening save incorrectly restored the original protocol value.

The fix preserves the explicitly staged disabled value when the retained source row already exists. Normal rename restoration remains unchanged.

Validation:

  • 6 new regression cases passed.
  • 623 affected ParameterEditor/configuration-step tests passed.
  • 5 headless confirmation/conflict tests passed.
  • 6,094 broader headless tests passed, with environment-restricted cases verified separately.
  • Ruff, targeted ty, focused Pylint and diff checks passed.

The return-to-SERIAL1 conflict behaviour was reproduced but deliberately left unchanged, pending guidance on the intended policy.

Only the implementation and regression-test files changed.

@AP-Review

AP-Review commented Nov 2, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-02)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 5279e6141e.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/9.html#prMethodicConfigurator-2289

Nothing is blocking at head 5279e61, but one should-fix remains in the conflict-resolution path.

Since the review at 02c97e3, the should-fix is fixed: an accepted disable of the old serial port now survives a second move before saving, and the new tests pin it.

Should fix

  • data_model_parameter_editor.py:2371: following the conflict warning loses the selected port's protocol. Move telemetry SERIAL1 -> SERIAL2, try to go back (blocked), delete SERIAL1_PROTOCOL as the warning advises, then go back before saving. The export has no SERIAL1_PROTOCOL; with a save in between it has 2. The delete puts the row in _suppressed_connection_renames, so the refresh never restores it. Don't suppress a preserved old-port row that is still a live rename source, or let the conflict check ignore it, and add a no-save delete-and-return test.
Minor (2)

Note

@amilcarlucas
amilcarlucas force-pushed the fix/inline-derived-parameter-refresh branch 2 times, most recently from b9bd20e to 036f5ea Compare November 2, 2026 23:38
@AP-Review

AP-Review commented Nov 2, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-02)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head b9bd20e659.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/10.html#prMethodicConfigurator-2289

Nothing is blocking at head b9bd20e, but one should-fix remains in the telemetry port-move path.

Since the review at 5279e61 (now rebased, plus b9bd20e), the delete-and-return conflict fix, the deferred inline-editor rebuild and the clean no-edit round trip are all in, and the policy notes are settled.

Should fix

  • data_model_parameter_editor.py:3010: in the Rover and Heli telemetry steps, the second port move after a save exports the new port disabled. Start with SERIAL1 telemetry, move to SERIAL2, accept disabling SERIAL1, save, re-enter the step, then move to SERIAL3. The result is SERIAL3_PROTOCOL=-1, and SERIAL2 is also disabled. The saved SERIAL1_PROTOCOL=-1 row is no longer marked declined after the reload, so it sorts first and wins the rename to SERIAL3. Restrict rename sources to the previously selected port's rows, or rebuild the independent-row marker on load, and add a save/reload/move test.

Note

  • data_model_parameter_editor.py:2393: deleting the preserved SERIAL1_PROTOCOL after a move, then selecting None before saving, now restores the deleted row (SERIAL1_PROTOCOL=2). With a save in between, it stays deleted. This probably matches the 'None reverts unsaved moves' behaviour, but a delete-then-None case in test_deleting_preserved_conflict_then_returning_keeps_selected_protocol would pin the intended outcome.

Head moved during review: observed 036f5ea2dd84f2255a6557f45b98166df21085e2. This review covers only b9bd20e6595c330a118a2cf5ee1e3c27606c3ed0; followup eligible.

@AP-Review

AP-Review commented Nov 3, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-03)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 036f5ea2dd.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/11.html#prMethodicConfigurator-2289

Nothing is blocking at head 036f5ea, but two should-fix items remain in the serial-port rename paths.

Since the review at b9bd20e, the save/reload/move telemetry bug is fixed. SERIAL1 → SERIAL2 with disable, save, re-enter, then SERIAL3 now exports SERIAL3_PROTOCOL=2.

Should fix

  • data_model_parameter_editor.py:3015: a port → None → port change no longer moves the saved rows. _connection_rename_candidates() passes old_connection="None" to _generate_connection_renames(), which only matches <TYPE><N>, so no candidates are left. With Rover/Heli telemetry, SERIAL1 → None → SERIAL2 without a save exports SERIAL1_BAUD/SERIAL1_PROTOCOL and nothing on SERIAL2. If the user accepted disabling, SERIAL1_PROTOCOL=-1 and no port has telemetry. Copter/Plane re-derive SERIAL2_PROTOCOL but leave the baud and flow-control settings on SERIAL1. Base moves all of them. When the old connection is not a port, use the rows of the last port the session moved off. Add a port → None → port test with and without a save in between.
  • data_model_parameter_editor.py:2159: on step load, the saved SERIAL1_PROTOCOL=-1 row written by "Yes, disable" can still win the rename. Move SERIAL1 → SERIAL2 with disable and save. Then change the connection to SERIAL3 outside the step and re-enter it. The prompt offers SERIAL1_PROTOCOL → SERIAL3_PROTOCOL, so Rover/Heli end with SERIAL3_PROTOCOL=-1 and SERIAL2_PROTOCOL=2 left behind. First-source-wins predates this PR, but the PR now creates that file in normal use. Skip a -1 SERIALn_PROTOCOL source when another source maps to the same target, and add a save → out-of-step change → load test.
Minor (2)

@nflyernz

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #11

Pushed 26c1d90f, addressing both Should fix findings:

  • Port → None → port: Preserves serial protocol, baud and flow-control settings across deselection and reselection.
  • Disabled protocol on reload: Prevents a stale SERIALn_PROTOCOL=-1 from overriding an active protocol source.

Both failures were reproduced before correction. 548 affected-module tests passed, along with focused lint and type checks.

CI is running. Requesting a fresh AP-Review on the updated head.

@AP-Review

AP-Review commented Nov 10, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-10)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 26c1d90fe6.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/12.html#prMethodicConfigurator-2289

Nothing is blocking at head 26c1d90, but two should-fix serial-port cases and three minor notes remain.

Since the review at 036f5ea, both should-fix items are fixed for the reported cases: SERIAL1 → None → SERIAL2 now moves the serial rows, and a saved SERIALn_PROTOCOL=-1 no longer wins the step-load rename.

Should fix

  • data_model_parameter_editor.py:3015: rows left on the old port (still open, narrower). The fallback only covers a literal None within one step session, so these paths still leave baud/flow-control/options (and on Rover/Heli the protocol) on the old port with no prompt, where base moves them: a CAN1 or RCin/SBUS intermediate (e.g. GNSS SERIAL3 → CAN1 → SERIAL4), re-entering the step while None (reset at 2163), and SERIAL1 → SERIAL2 → None → SERIAL3 without a save, where the restored SERIAL1 rows no longer match the cached SERIAL2. Track which port the rows belong to, not just the last port string, and add tests for these three paths.
  • data_model_parameter_editor.py:3037: telemetry on SERIAL1, select None and accept disabling, then select SERIAL1 again. Rover/Heli export SERIAL1_PROTOCOL=-1 with no warning (Copter/Plane only after a save), because the existing -1 row blocks the copy of the remembered protocol. When the user returns to the port they disabled, restore the protocol or ask, and add a port → None → same-port test.
Minor (3)

@nflyernz

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #12

Pushed a consolidated set of fixes for serial connection changes:

  • Corrected parameter ownership across port changes, None selections, saves and reloads.
  • Fixed protocol restoration, GNSS/CAN transitions, flow-control renames, and stale suppression.
  • Preserved explicit disable/delete decisions, manual overrides, and destination-conflict protection.
  • Added GUI safeguards for ambiguous ownership and missing/disabled protocols, including derived-parameter eligibility.
  • Prevented unrelated serial settings from blocking valid connection changes.

Validation: 615 model tests and 14 mocked GUI tests passed. Ruff, Pylint and targeted type checks passed.

Requesting a fresh AP-Review of the updated changes.

@AP-Review

AP-Review commented Nov 11, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-11)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head a28e15d593.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/13.html#prMethodicConfigurator-2289

One regression in the new ownership gate blocks this at head a28e15d, plus three should-fix serial-port cases and two minor notes.

Since the review at 26c1d90, both should-fix items are fixed: rows now follow CAN/RCin/None intermediates and re-entry, returning to a disabled port restores its protocol, and the None-path conflict check uses the same source port as the rename.

Blocking

  1. data_model_parameter_editor.py:3055: after a step-load rename (Yes to rename and to disabling the old port), _serial_rename_source maps the live port back to the saved one. Inline moves are then refused ('No active serial protocol') on all vehicles and on Tarot_X4/FETtec-5/Marmotte5v2. On OMP_M4 and mixed-port files the move goes through but leaves the rows behind with the protocol at -1, so telemetry ends up disabled. Resolve ownership and read the protocol from the live rows (see 3038, 3333), and add a test that goes through _repopulate_configuration_step_parameters before the inline move.

Should fix

  • data_model_parameter_editor.py:3369: float() on the raw rule result rejects string protocols like MAVLink2. After a disable, save and reload, Copter/Plane refuse a port the real derivation would set to 2. Reuse the normal metadata string resolution and add a string-rule test.
  • data_model_parameter_editor.py:3119: SERIAL1 -> None (disable), delete SERIAL1_PROTOCOL, reselect SERIAL1 raises KeyError, with or without a save, leaving the table unrefreshed. Handle the missing target (or clear the declined marker on delete).
  • data_model_parameter_editor.py:3330: GNSS steps with several disabled SERIALn_PROTOCOL=-1 rows (e.g. Hoverit_X13) refuse CAN/None -> serial as ambiguous ownership, and as missing protocol after the suggested delete. Base sets protocol 5. Handle this within the GNSS protocol assignment.
Minor (2)

@nflyernz

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #13

Pushed e9260908, addressing all four substantive findings:

  • Step-load ownership: Subsequent port changes now follow the live renamed settings, validated against real vehicle templates.
  • Derived protocols: Named values such as MAVLink2 now use normal metadata resolution.
  • Deletion lifecycle: Fixed same-port return errors and unintended protocol resurrection.
  • GNSS: Handles multiple disabled serial ports while preserving unrelated assignments and applying protocol 5.

Also clarified GUI warnings and added regression coverage.

Validation: 628 model tests and 14 mocked GUI tests passed; focused lint and type checks passed.

Requesting AP-Review #14.

@AP-Review

AP-Review commented Nov 11, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-11)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head e9260908b2.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/14.html#prMethodicConfigurator-2289

One blocking regression remains at head e926090: after a step-load rename, an inline port move leaves the baud behind on shipped mixed-port telemetry templates.

Since a28e15d, the single-source step-load move, MAVLink2 rule resolution, the delete-then-reselect KeyError, GNSS with several disabled rows, the protocol advice text and the delete-then-None test are all fixed.

Blocking

  1. data_model_parameter_editor.py:3051: step-load ownership (still open, narrowed). When some live-port rows came from a load-time rename, only those sources are candidates. On Tarot_X4, FETtec-5 and normal_plane, accepting the BRD_SERn_RTSCTS rename and then moving the port before saving leaves SERIAL2_BAUD/SERIAL4_BAUD on the old port, and the new port gets no baud. Base moves it. Also keep rows natively on the old port that are not rename targets, and add a test that loads the template at its own port and asserts the destination baud (5833 switches to SERIAL3 first).

Should fix

  • data_model_parameter_editor.py:3065: after the user deletes the unrelated row to clear an ambiguous-ownership refusal, the gate accepts the move. But this call still plans from the unfiltered saved rows, so nothing moves, and the component says SERIAL2 while the parameters stay on SERIAL1. Use the same live/suppressed view as serial_transition_issue.
Minor (3)

@nflyernz

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #14

Pushed 44b3d2b4, addressing both substantive findings:

  • Mixed-port ownership: Step-load and subsequent inline changes now preserve native baud settings alongside renamed protocol and flow-control rows. Verified against Tarot_X4, FETtec-5 and normal_plane.
  • Post-deletion retry: Rename planning now excludes deleted or suppressed rows, matching the validator and preserving independent settings.

Both failures were reproduced before correction.

Validation: 632 model tests and 14 mocked GUI tests passed, along with focused lint and type checks.

The three minor findings remain unchanged for maintainer consideration, particularly the explicit-deletion policy questions.

Requesting AP-Review #15.

@AP-Review

AP-Review commented Nov 11, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-11)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head 44b3d2b46b.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/15.html#prMethodicConfigurator-2289

One blocker remains at head 44b3d2b: after a step-load rename, moving the telemetry port through None, CAN1 or "other" still leaves the baud on the old port.

Since e926090, the direct move now carries the native baud on Tarot_X4, FETtec-5 and normal_plane, and the retry after deleting an unrelated row now moves the live rows.

Blocking

  1. data_model_parameter_editor.py:3098: detour strands the baud (still open, narrowed). Load Tarot_X4/FETtec-5/normal_plane, accept the BRD_SERn_RTSCTS rename, select None/CAN1/other, then SERIAL5: the export has SERIAL5_PROTOCOL and BRD_SER5_RTSCTS but SERIAL2_BAUD/SERIAL4_BAUD stays on the old port. Base moves it. 3196 caches one owner port (the flow-control source), so native rows drop out. Remember the full source set across deselection, and add a None/CAN1 case to the 5920 test asserting the destination baud.

Should fix

Minor (3)

Cold-pass P2 on GNSS FC availability downgraded: base writes the same row.

@nflyernz

Copy link
Copy Markdown
Contributor Author

Follow-up to AP-Review #15

Pushed 6c16efd0, addressing both substantive findings:

  • Nonserial detours: Complete serial parameter ownership now survives None/CAN1/other transitions, preserving protocol, baud and flow-control settings.
  • Pylint: Restructured the parametrized regression test to eliminate R0913/R0917.

Both failures were reproduced before correction. Regression coverage includes Tarot_X4, FETtec-5 and normal_plane, with destination-conflict and independent-port checks.

Validation: 641 model tests and 14 mocked GUI tests passed. CI-pinned Pylint, Ruff and targeted type checks passed.

The three minor findings remain unchanged for maintainer consideration.

Requesting AP-Review #16.

@AP-Review

AP-Review commented Nov 11, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-11)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head 6c16efd011.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/16.html#prMethodicConfigurator-2289

One blocker remains at head 6c16efd: saving during a None/CAN1 detour still leaves the telemetry baud on the old port.

Since 44b3d2b, None/CAN1/other detours without a save now carry the baud on Tarot_X4, FETtec-5 and normal_plane, and the pylint R0913/R0917 failure is fixed.

Blocking

  1. data_model_parameter_editor.py:2740: save during a detour (still open, narrowed). _export_current_file clears _last_connection_source_rows, so after None/CAN1 → save (e.g. Upload selected and stay) → SERIAL5, Tarot_X4 keeps SERIAL2_BAUD=921 and normal_plane keeps SERIAL4_BAUD=38 on the old port, while protocol and flow control move. Base moves all three. This contradicts the comment at 207. Remap the set through _connection_renames on export instead of clearing it, and add a save-during-detour case to the parametrized test.

Should fix

  • data_model_parameter_editor.py:3535: the detour branch of connection_change_conflicts drops the kept old-port protocol, so Holybro_X500 SERIAL3→None/CAN1→SERIAL4 and Rover SERIAL1→None→SERIAL2 onto an occupied protocol row go through with no warning. 44b3d2b and the direct move both warn. Report the {last}_PROTOCOL→{new}_PROTOCOL pair, but still allow a return to the original port.
  • data_model_parameter_editor.py:3186: the copied protocol is recorded under _last_connection_port (the flow-control port) instead of its real source. With a mixed-source Rover/Heli file, SERIAL2→None→SERIAL5→SERIAL6 leaves the protocol on SERIAL5, and SERIAL6 gets only baud and flow control; base writes SERIAL6_PROTOCOL=2. Track the real source, and test a second move after a detour.
Minor (3)

@amilcarlucas

Copy link
Copy Markdown
Collaborator

@nflyernz thanks for working on this. I will continue working on this like we wrote on discord. I got some other stuff fixed and 5.1.1 has been released so this is next on my list. Please do be patient because this is a complex one that needs some planning and a lot of tests.

nflyernz and others added 18 commits November 22, 2026 21:46
Ask before applying connection parameter renames when loading a step or
changing a component connection inline. Cancel an inline connection change
when its proposed rename is declined or a destination is already occupied.

When leaving a serial connection, ask whether to disable its protocol.
Stage SERIALn_PROTOCOL=-1 for upload if accepted; otherwise preserve the
previous assignment. Keep retained old-port rows separate from later
connection moves during the editing session.

Preserve unsaved parameter values across serial-port renames and returns
to the original port. Keep declined step-load renames suppressed across
exports.

Add regression coverage for confirmation choices, destination conflicts,
derived protocol handling, export and subsequent moves.

Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
Keep serial source rows associated with their exported names when saving
during a non-serial detour, so baud and flow control follow the next port
selection.

Track copied protocols by their actual source and report occupied
protocol destinations after a detour while allowing a return to the
original port. Respect explicitly deleted GNSS protocol targets and
clarify the warning when the previous connection is unavailable.

Add regression coverage for saves during detours, subsequent port
changes, destination conflicts, and deleted GNSS protocols.

Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <[email protected]>
@amilcarlucas
amilcarlucas force-pushed the fix/inline-derived-parameter-refresh branch from 6c16efd to 7d894a6 Compare November 22, 2026 21:19
@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head 7d894a6696.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/methodicconfigurator/2289/17.html#prMethodicConfigurator-2289

One blocker remains at 7d894a6: a sequence of serial-port changes can silently leave the file with no telemetry protocol.

Since 6c16efd, saving during a None/CAN1 detour now carries the baud, the copied protocol follows its real source, detour conflicts are reported, an unsaved GNSS deletion is respected, and the unknown-connection wording is fixed.

Blocking

  1. data_model_parameter_editor.py:3163: returning to a kept port leaves its protocol marked declined. On Rover AION_R1, SERIAL1 → None (No to disable) → SERIAL1 → SERIAL2 (Yes, Yes) applies with no warning and exports SERIAL1_PROTOCOL=-1 with no SERIAL2_PROTOCOL; base writes SERIAL2_PROTOCOL=2. Clear the declined marker when the port is selected again, so the filter at 3055 does not skip it, and test a following move.

Should fix

  • data_model_parameter_editor.py:3557: the new return exemption covers only the last-selected port, so SERIAL1→None→SERIAL2→None→SERIAL1 (and the CAN1 variants) is now refused on Copter and Rover, where the previous head and base allow it. Treat the original source rows as a return and restore the protocol, and add a two-hop case to the return test.
  • data_model_parameter_editor.py:3053: after SERIAL1→SERIAL2→SERIAL1 is refused, deleting SERIAL1_PROTOCOL and retrying is accepted, but the export has no SERIAL1_PROTOCOL and SERIAL2_PROTOCOL stays set. The deletion at 2421 suppresses the rename source. Suppress only the deleted live row.
Minor (1)

The other previous findings are fixed at this head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIReview Request an automated AI review; picked up by the reviewprs sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants