Redirect FMA installs to the active version after auto-update - #49525
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #49525 +/- ##
=======================================
Coverage 67.81% 67.81%
=======================================
Files 3890 3888 -2
Lines 247565 247614 +49
Branches 13135 13134 -1
=======================================
+ Hits 167886 167928 +42
- Misses 64521 64523 +2
- Partials 15158 15163 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughFleet-maintained installer promotion now redirects queued installs to the newly active version while canceling already-dispatched work. Retry paths resolve frozen installer IDs to the current active installer before enqueueing retries. Auto-update and pinned-version flows rely on this datastore transition, with updated service tests and new MySQL coverage for Fleet-maintained and custom installers. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/datastore/mysql/software_installers.go`:
- Around line 793-803: Update ResolveActiveInstallerForFrozen to resolve only
when the frozen and active installers share the same non-null
fleet_maintained_app_id; otherwise return frozenInstallerID unchanged. Add the
matching-app filter to the SQL and remove reliance on LIMIT 1 so ordinary
multi-package titles cannot select an arbitrary active sibling.
In `@server/service/orbit.go`:
- Around line 1814-1825: The retry flow must preserve attempt lineage when
ResolveActiveInstallerForFrozen switches software installer IDs. Update the
policy retry logic at server/service/orbit.go lines 1814-1825 and the non-policy
retry logic at lines 1843-1854 so attempts remain associated by stable
policy/title identity or the next attempt ordinal is explicitly carried through
HostSoftwareInstallOptions; ensure both paths continue enforcing the configured
retry cap rather than restarting attempts under the new installer ID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c92ab38d-2d06-4d4c-a805-060429433e9b
📒 Files selected for processing (10)
changes/49495-stale-fma-installer-versionee/server/service/maintained_apps_auto_update.goee/server/service/maintained_apps_auto_update_test.goee/server/service/software_installers.goserver/datastore/mysql/software_installers.goserver/datastore/mysql/software_installers_fma_redirect_test.goserver/fleet/datastore.goserver/mock/datastore_mock.goserver/service/orbit.goserver/service/orbit_test.go
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
This PR addresses installs of Fleet-maintained apps (FMAs) targeting a stale/superseded cached installer after an auto-update promotion or pin change. It does this by atomically switching the active installer and redirecting still-queued install activities to the newly-active version, and by ensuring install retries re-resolve to the currently-active installer for the title.
Changes:
- Redirect queued (not-yet-activated) software install activities from the previous active FMA installer to the newly-active one during
SetFleetMaintainedAppActiveInstaller. - Add
ResolveActiveInstallerForFrozento re-resolve retries to the currently-active installer for the title, used by Orbit retry paths. - Add MySQL integration coverage for the redirect + resolve behavior; remove now-redundant side-effect processing in EE pin/auto-update flows.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/service/orbit.go | Retry logic now resolves retries to the currently-active installer for the title. |
| server/service/orbit_test.go | Updates retry tests to capture installer ID and adds a case for “active installer after version change” (non-policy). |
| server/mock/datastore_mock.go | Extends datastore mock with ResolveActiveInstallerForFrozen. |
| server/fleet/datastore.go | Adds ResolveActiveInstallerForFrozen to the Datastore interface with docstring. |
| server/datastore/mysql/software_installers.go | Implements active-installer flipping with queued-install redirect + new resolver query. |
| server/datastore/mysql/software_installers_fma_redirect_test.go | New integration test verifying queued redirect, dispatched cancel, and active resolution. |
| ee/server/service/software_installers.go | Removes explicit side-effects call on pin-only changes (now handled by datastore method). |
| ee/server/service/maintained_apps_auto_update.go | Removes explicit side-effects call after promotion (now handled atomically in datastore method). |
| ee/server/service/maintained_apps_auto_update_test.go | Updates expectations to no longer require ProcessInstallerUpdateSideEffects during promotion. |
Files excluded by content exclusion policy (1)
- changes/49495-stale-fma-installer-version
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related issue: Resolves #49495
Redirects queued Fleet-maintained app installs to the newly-active installer (canceling already-dispatched ones) atomically when an auto-update or pin change flips the active version, and re-resolves install retries to the active installer, so a host no longer installs a superseded cached version.
Checklist for submitter
changes/.See Changes files for more information.
Testing
Summary by CodeRabbit