Skip to content

feat(software-update): auto-update policy: Update Software with Auto-update on keeps the package updated, Turn Off Auto-Update, ON / OFF state CU-17tkuw5zc6q - #2878

Merged
andrii-flamingo merged 3 commits into
mainfrom
feat/package-auto-update-policy
Oct 29, 2026
Merged

andrii-flamingo merged 3 commits into
mainfrom
feat/package-auto-update-policy

Conversation

@andrii-flamingo

@andrii-flamingo andrii-flamingo commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

ClickUp task: CU-17tkuw5zc6q BE-2: Auto-update policy: model + admin API

BE-2: where the auto-update policy lives, how it is turned on and off, and the AUTO-UPDATE state the UI shows. The trigger that acts on enabled policies (BE-3) comes next.

Policy store

  • PackageAutoUpdatePolicy (package_auto_update_policies): one row per device and package, unique on (tenantId, machineId, packageManager, packageName), with softwareId, enabled and settings. Indexes for the trigger (tenant_package) and the Software lookups (tenant_software).
  • enable: bulk upsert on that key. Re-enabling updates settings and updatedBy, keeps the creator, and keeps an earlier softwareId when the run has none.
  • disableBySoftwareId: one updateMulti turns off every enabled policy linked to the Software. Rows stay, so the Software shows OFF.

Turning it on

  • PackageAutoUpdatePolicyService.turnOn: a run with Auto-update on enables the package on its devices with autoUpdate.settings, or the run's update settings when it has none ("Same settings for auto-update").
  • Auto-update off on a run leaves existing policies alone; only Turn Off Auto-Update turns one off.
  • Called from SoftwareBundleOnlineDispatcher and SoftwareScheduleFireDispatcher, only for devices that take the package-update order (the script path cannot run auto-update), before the order goes out.

Turning it off and the state

  • turnOffSoftwareAutoUpdate(softwareId): idempotent, returns the updated Software, unknown softwareId → NOT_FOUND. Orders already sent finish.
  • Software.autoUpdate / SoftwareOnDevice.autoUpdate (SoftwareAutoUpdateStatus): ON while any linked policy is enabled, OFF once all are off, null without policies. One lookup per page:
    • software, softwares: by softwareId;
    • deviceSoftware: by machine and softwareId (that device's state);
    • softwareDevices: by softwareId and machine (each device's state).
  • SoftwareAutoUpdateService holds the rules, so the read model (feat(software-cdc): Debezium CDC projection for Fleet software & vulnerabilities CU-17tkuw5tdwn #2651) can apply the same ones.

Contract

Additive: optional softwareId: ID on SoftwarePackageInput / SoftwareSchedulePackageInput, returned on SoftwareBundlePackage / SoftwareSchedulePackage. It links a policy to the Software for autoUpdate and Turn Off. A scheduled bundle passes it to the schedule it creates.

Not in this PR

  • autoUpdateStatuses filter and facet: they need paging at the source and come with the read model.
  • NO_PACKAGE / NEEDS_ADOPTION: come with Adopt.

Consumers

saas-tenant's ai-agent SoftwareActionMapper has unmappedTargetPolicy = ERROR. The bump that brings this (and #2849) needs ignore = true for softwareId (toPackageInput) and updateSettings / autoUpdate (toSubmitInput), plus a Federation snapshot update.

Testing

  • Unit tests: PackageAutoUpdatePolicyService, both dispatchers (policy only for order targets), SoftwareAutoUpdateService (state rules, empty page, turn-off), SoftwareBundleServiceTest (softwareId reaches the created schedule), SoftwareInventoryServiceFleetPagingTest (state on the page, NOT_FOUND).
  • PackageAutoUpdatePolicyRepositoryIT against Mongo: one row per device, re-enable in place, separate packages, turn-off scoped to the Software and idempotent.

Change-Set: package-auto-update

Change set flamingo-stack/package-auto-update: this pull request is the only one in it so far. Another pull request joins by naming this one in a Depends-On line, or by carrying the same Change-Set line.

  • flamingo-stack/openframe-oss-lib#2878 (this pull request): feat(software-update): auto-update policy: Update Software with Auto-update on keeps the package updated, Turn Off Auto-Update, ON / OFF state CU-17tkuw5zc6q · landed

Linked work

  • …and 1 linked item not shown here

Linked by the Depends-On / Change-Set lines in these descriptions; this block is maintained by the hub.

…o-update on keeps the package updated on its devices
@github-actions

Copy link
Copy Markdown
Contributor

🦩 Flamingo Code Review

Not reviewed yet. Reviews start when you ask, so the reviewer reads this pull request when it is ready, not when it is opened.

When it is ready:

  • Review this pull request

Or comment @flamingo-review. Add the flamingo-review-always label to review every push.

Updated 2026-10-29 12:38 UTC · workflow run

…o-update on keeps the package updated on its devices
@andrii-flamingo andrii-flamingo changed the title feat(software-update): an Update Software run with Auto-update on keeps the package updated on its devices CU-17tkuw5zc6q feat(software-update): auto-update policy: Update Software with Auto-update on keeps the package updated, Turn Off Auto-Update, ON / OFF state CU-17tkuw5zc6q Oct 29, 2026
@andrii-flamingo
andrii-flamingo added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 84b625e Oct 29, 2026
3 checks passed
@andrii-flamingo
andrii-flamingo deleted the feat/package-auto-update-policy branch October 29, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants