Skip to content

fix(windows): default to per-user installation with an all-users option - #2307

Open
EchoZive wants to merge 4 commits into
ArduPilot:masterfrom
EchoZive:codex/windows-per-user-minimal
Open

EchoZive wants to merge 4 commits into
ArduPilot:masterfrom
EchoZive:codex/windows-per-user-minimal

Conversation

@EchoZive

@EchoZive EchoZive commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

Default to a non-elevated Windows user installation, while offering an
all-users installation through Inno Setup's built-in selection dialog.

 [Setup]
+PrivilegesRequired=lowest
+PrivilegesRequiredOverridesAllowed=dialog
+UsePreviousPrivileges=no
-DefaultDirName={commonpf}\{#MyAppName}
+DefaultDirName={autopf}\{#MyAppName}

Only three source files change:

  • windows/ardupilot_methodic_configurator.iss: offer the installation-mode
    dialog with the current-user mode as default, even when an older installation
    exists. Use automatic application, template and desktop constants so the
    destinations follow the selected mode. Retain upstream obsolete-template
    cleanup, but do not recursively delete the application directory. Apply the
    optional PATH task to the selected mode.
  • ardupilot_methodic_configurator/backend_filesystem_program_settings.py:
    prefer user-installed Windows templates, falling back to shared templates
    when no user template directory exists.
  • windows/modpath.iss: match the registered application directory when
    choosing the uninstall registry and PATH scope, rather than inferring the
    scope from the uninstaller's elevation.

No signing, separate install-scope metadata, migration machinery, build helper,
installer binary, dependency, test or CI change is included. This is a small
alternative to #2240; that PR is not modified.

Evidence

  • Before: the installer defaults to elevation, installs in machine-wide
    locations and offers an all-users PATH task.
    After: the installer uses PrivilegesRequired=lowest and the built-in
    mode dialog, with destinations and PATH handling following the chosen mode.
  • An earlier unsigned 4.5.6 user-only test installer was built successfully,
    and the requester confirmed that it installed. That executable does not
    contain the newly added installation-mode selection.
  • The branch was subsequently rebased onto upstream master; upstream
    cleanup additions were preserved and their template paths made user-scoped.
    The current revision with optional all-users installation has not been
    built or runtime-tested.
  • No local automated tests, pre-commit checks or hardware tests were run,
    as explicitly requested by the requester.

Merge Danger

Door: Two-way for the code change. Existing installations may require
manual uninstall/reinstall when changing installation scope.

Blast Radius: Windows.

User installation is the default; choosing all-users requires administrative
rights. Existing installations and templates are not migrated between scopes.
When both user and shared template directories exist, Windows uses the user's
templates. Other platforms retain their existing template lookup behavior.
Company policies restricting unsigned software are not changed.

Checklist

  • Run pre-commit checks locally
  • Verified by a human programmer
  • All commits are signed off
  • Unit and integration tests pass
  • Manual installation reported successful for the earlier user-only 4.5.6 build
  • Tested on flight controller hardware

Signed-off-by: I013442 <max.leonardo.reupke@iav.de>
I013442 added 2 commits October 30, 2026 13:53
Signed-off-by: I013442 <max.leonardo.reupke@iav.de>
Signed-off-by: I013442 <max.leonardo.reupke@iav.de>
@EchoZive EchoZive changed the title fix(windows): install for the current user without elevation fix(windows): default to per-user installation with an all-users option Oct 30, 2026
@amilcarlucas amilcarlucas added the AIReview Request an automated AI review; picked up by the reviewprs sweep label Oct 30, 2026
amilcarlucas
amilcarlucas previously approved these changes 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: REQUEST CHANGES

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

This PR fixes template lookup for per-user Windows installs, but it breaks upgrades of existing all-users installs and can hide templates after a scope switch.

Blocking

  1. windows/ardupilot_methodic_configurator.iss:26: UsePreviousPrivileges=no makes every upgrade, including the in-app updater's, default to a new per-user install. The existing all-users install is left in place beside it, and component presets saved under ProgramData stop showing. Drop the line so existing installs keep their scope (fresh installs still get the dialog), or detect and handle the legacy install.
  2. ardupilot_methodic_configurator/backend_filesystem_program_settings.py:509: an existing %APPDATA% vehicle_templates directory is not proof of a per-user install. After a per-user uninstall it can hold only user_vehicle_components_template.json, and then an all-users install shows no vehicle or component templates. Check for an installer-owned file such as system_vehicle_components_template.json instead.

Should fix

Minor (2)

The installer was not compiled or run on Windows; installer behaviour above is from the Inno Setup 6.7.1 source and docs.

Keep existing all-users installations in their original scope during
upgrades by removing UsePreviousPrivileges=no. Fresh installations
continue to default to per-user mode and offer an all-users option.

Require system_vehicle_components_template.json to be a regular file
before selecting the per-user templates directory. Fall back to shared
templates when uninstall leaves an empty directory or personal presets
behind.

Restore stale application-file cleanup in the default installation
directory for the selected scope. When uninstalling an all-users
installation with the PATH task selected, also remove matching entries
from the current user's PATH left by older installers.

Replace the machine-dependent Windows lookup test with isolated cases
covering absent, empty, leftover-only, invalid-marker, and installed
template directories. Add a scope-switch regression that verifies shared
templates are selected after per-user uninstall while personal presets
remain intact.

Update the Windows build workflow's Inno Setup download and cache key
from 6.7.1 to 6.7.4.

Validation:
- 291 settings, component-template, and vehicle-project tests passed.
- ty, Ruff, Pylint, and pre-commit checks passed for the application,
  test, and installer changes.
- Windows compilation and upgrade/uninstall testing remain unverified.

Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
@AP-Review

Copy link
Copy Markdown

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

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

The installer and template-lookup changes now look right; one personal-preset visibility issue on scope changes is left.

Since the last review, both blockers are fixed: dropping UsePreviousPrivileges=no keeps existing all-users installs in their scope on upgrade, and template lookup now requires the installer-owned system_vehicle_components_template.json. The test isolation, PATH cleanup and stale-file wipe items are fixed too.

Should fix

  • ardupilot_methodic_configurator/backend_filesystem_program_settings.py:510: personal component presets (user_vehicle_components_template.json) are read from whichever scope the lookup picks. After uninstalling an old all-users version and taking the new per-user default, or after any later scope switch, presets saved under the other scope no longer show. The file stays on disk. When the selected scope has no presets file, read or migrate the other scope's file, and add a test that loads a saved preset after a scope switch.
Minor (1)
  • windows/ardupilot_methodic_configurator.iss:26: default installs now go to the per-user Program Files (%LOCALAPPDATA%\Programs), but INSTALL.md:190 still gives C:\Program Files (x86)\... for the PowerShell completion module. Document both locations.

The note about keeping templates in the roaming profile was dropped as a design preference. The installer was still not compiled or run on Windows; installer behaviour here comes from the Inno Setup 6.7.4 source.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 41118277630

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.02%) to 93.602%

Details

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

Uncovered Changes

No uncovered changes found.

Coverage Regressions

11 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
frontend_tkinter_parameter_editor.py 10 96.0%
frontend_tkinter_component_editor.py 1 94.57%

Coverage Stats

Coverage Status
Relevant Lines: 29853
Covered Lines: 27943
Line Coverage: 93.6%
Relevant Branches: 9004
Covered Branches: 7869
Branch Coverage: 87.39%
Branches in Coverage %: No
Coverage Strength: 2.79 hits per line

💛 - Coveralls

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