fleet/changes
Magnus Jensen 6147a12ece
Fix stale pending remove apple declarations if host was offline for add and remove declaration (#30981)
Fixes: #29824 

This PR fixes a situtation where Apple Declarations could be lingering
around for hosts, if they were offline when the decl. was added and
removed, and no further declaration config is pushed to force a status
update.

It tackles it by deleting the pending and failed installs from the
table, before setting the remaining (verified and verifying) to be
remove operation, as those have hit the host.

I couldn't come up with a way that would auto-fix the hosts we see in
dogfood, as those have the same declaration identifier and token for
both an install row and pending remove row. Those needs to manually be
adjusted and then it should be good.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.
- [x] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
2025-07-22 11:22:04 +02:00
..
.keep Issue 1009 calculate diff software (#1305) 2021-07-08 13:57:43 -03:00
9931-replace-saml-impl-with-crewjam-saml-package Replace home-made SAML implementation with https://github.com/crewjam/saml (#28486) 2025-07-07 15:13:46 -03:00
10744-calendar-webhook-deleted-hosts Handle null HostID on calendar webhook endpoint (#30130) 2025-06-23 13:10:10 -04:00
14801-allow-team-selection-when-saving-query-as-new UI: Allow editing the name and team of a "Save as new" query (#30544) 2025-07-03 13:11:06 -07:00
16846-update-side-nav-styles UI: New side nav styles, abstractions (#30568) 2025-07-07 08:29:09 -07:00
21947-oval-amzn-cleanup Clean up OVAL-sourced vulnerabilities reported on Amazon Linux 2 hosts prior to v4.56 (#30078) 2025-06-17 09:15:15 -05:00
22796-tooltip-flashing Fleet UI: Fix os settings tooltips from flashing during refetch (#30080) 2025-06-17 09:35:03 -04:00
23899-IdP-labels UI: Labels by IdP (#30368) 2025-06-30 10:05:03 -07:00
25587-pkg-name-extraction Use install path on packageInfo XML if it's a .app before falling back to bundle ID for PKG name extraction (#30669) 2025-07-09 08:21:10 -05:00
25798-move-settings-to-integrations UI: Move SSO and Host status webhook settings (#30582) 2025-07-07 07:37:13 -07:00
25807-windows-10-cis-3 Windows 10 CIS 3.0 (#30288) 2025-06-27 11:14:40 -04:00
25827-ios-refetch Delete iOS host refetch commands on MDM re-enrollment (#30158) 2025-06-23 10:14:00 -05:00
26258-empty-host-software-filters Fleet API: Return 0 hosts instead of 404 when filtering hosts by team x software non existent on that team (#30249) 2025-06-24 11:32:37 -04:00
26618-software-vuln-detected-dates fix issue with CVE showing wrong date (#30768) 2025-07-10 22:38:22 -04:00
27061-dedupe-cve Revise OS vuln query to avoid duplicate entries (#30812) 2025-07-15 14:03:25 -05:00
27447-auto-install-queries-for-custom-msi-2 Use upgrade code if available to improve accuracy of auto-install policy (#30977) 2025-07-17 12:18:06 -04:00
27580-vuln-counts Fix insufficient deduplication on vulnerabilities count query (#31021) 2025-07-17 17:40:21 -05:00
27758-msi-unnstall Extract UpgradeCode from MSI custom packages, use for better uninstall script generation (#30969) 2025-07-17 10:33:23 -05:00
27961-delete-calendar-event Fixed error deleting calendar event for non-existent user. (#30009) 2025-06-18 17:03:06 -05:00
28224-team-name-null 28224: Added missing property to hosts/identifier/:id endpoint (#30097) 2025-06-23 13:01:33 -04:00
28342-linux-escrow-error-report 28342: Do not report error if host already escrowed (#30652) 2025-07-09 12:47:17 -04:00
28499-windows-csp-verification Update windows CSP verification logic (#30203) 2025-06-24 15:18:38 -04:00
28501-api-only-frontend API only users show a different avatar in the activity feed (#30512) 2025-07-07 10:45:51 -04:00
28502-api-only-user-backend Add api_only key to activities API (#30353) 2025-06-30 16:49:04 -04:00
28613-filesystem-log-tooltip Fixed tooltip not showing the correct log destination (#30124) 2025-06-19 10:39:07 -04:00
28818-tpm-backed-http-signatures Fleet server verifies HTTP signature (#30825) 2025-07-16 20:08:27 +02:00
28819-windows-software-last-used Add last used information for Windows software (programs) (#30577) 2025-07-08 12:58:25 -07:00
28996-parse-cert-dn-with-slashes Fix host certificate parsing with embedded slash (#30827) 2025-07-15 21:24:15 +02:00
29220-fma-uninstall FMA uninstall (#29977) 2025-06-19 16:14:06 -05:00
29286-sort-package-ids Sort package ids to ensure consistent uninstall script generation (#30968) 2025-07-16 20:44:30 -05:00
29315-manual-label-scoping Manual labels no longer factor in created_at time for exclusions (#30745) 2025-07-11 12:18:34 -05:00
29325-apple-mdm-user-channel Apple mdm user channel initial support (#29882) 2025-06-16 16:46:38 -04:00
29400-fix-policy-deadlock Add retry mechanism to SavePolicy to reduce/eliminate deadlock errors… (#30550) 2025-07-03 14:29:16 -03:00
29482-migrate-to-aws-sdk-go-v2 Migrate from aws-sdk-go v1 to v2 (#30308) 2025-06-30 17:45:39 -03:00
29506-ios-and-darwin-vpp stop erroring if a VPP app with darwin and ios versions is added to setup experience (#30187) 2025-06-20 13:17:25 -04:00
29609-scim-add-department Add support for IdP department to SCIM and add FLEET_VAR_HOST_END_USER_IDP_DEPARTMENT fleet variable (#30375) 2025-06-29 15:23:03 -03:00
29617-software-url-gitops fix: Include Software URLs in fleet generate-gitops when software has URL (#30177) 2025-06-24 16:42:59 -05:00
29618-fix-version-in-generate-gitops Persist download URL when adding FMAs via non-GitOps API, fix software versions on GitOps YAML generation (#30331) 2025-06-26 14:29:23 -05:00
29619-validate-required-default-gitops 29619: Validate required default.yml on gitops run (#30360) 2025-06-30 21:04:37 -04:00
29632-macos-missing-uid-ingest Fixed broken macos users causing errors during query ingestion (#30128) 2025-06-23 09:37:35 -04:00
29728-host-software-page-updates Fleet UI: Revamp host > software page with inventory/library tabs (#29759) 2025-06-20 15:02:22 -04:00
29762-run-script-modal-free-tier 29762: Fixed bug with run script modal on FreeTier. (#30138) 2025-06-23 13:03:22 -04:00
29823-26258-empty-host Host API: Return empty array instead of 404 for software filter not found (#30045) 2025-06-17 09:20:09 -04:00
29824-declarations-status-not-respected-with-remove-operations Fix declaration status conditions not following profile status conditions (#30911) 2025-07-16 18:03:16 +02:00
29824-delete-installs-that-has-not-reached-hosts Fix stale pending remove apple declarations if host was offline for add and remove declaration (#30981) 2025-07-22 11:22:04 +02:00
29830-verify-vpp-db-migration Verify VPP: core implementation (#30295) 2025-06-26 17:55:43 -04:00
29848-tooltip-missing-webhook-url Add missing webhook tooltip URL (#30603) 2025-07-09 14:37:54 -04:00
29849-filter-linux-installers Filter out DEB/RPM installers in ListHostSoftware when they're incompatible with the target host's distro (#30852) 2025-07-15 15:41:42 -05:00
29867-block-profile-scope-changes 29867 Block profile PayloadScope changes (#30429) 2025-07-02 10:54:54 -04:00
29869-verify-user-scoped-profiles DCLK: add mechanism to verify user-scoped profiles (#30110) 2025-06-25 09:51:43 -04:00
29893-verify-vpp-apps-installed Fleet UI: VPP command copy includes command verification nuance (#30431) 2025-07-01 12:07:13 -05:00
29897-setup-experience-flag Setup experience flag for InstalledSoftware activity (#30433) 2025-07-02 16:43:08 -05:00
29916-refetch Ensure a host vitals refetch is queued when installs/uninstalls are successful (#30505) 2025-07-03 09:22:20 -05:00
29923-hdek-archive Update GET /hosts/:id/encryption_key to return archived key when current key is unavailable (#30396) 2025-07-02 14:57:25 -05:00
29962-user_logged_in-fullname Use user full name for login activity instead of email (#30553) 2025-07-03 13:02:19 -04:00
29988-os-vulns-flakiness Fix OS vulnerability expiration due to avoiding updating updated_at, while avoiding test flakiness (#30713) 2025-07-10 15:42:26 -05:00
29994-use-comshim For 29994: Use comshim for proper COM initialization (#30920) 2025-07-16 14:40:28 -04:00
30057-add-host-vitals-labels Add cron job to update host vitals label membership every 5 minutes (#30330) 2025-06-30 13:00:55 -05:00
30086-scim-user-groups Update PATCH /fleet/scim/Groups/<group name> endpoint to handle duplicate entries (#30533) 2025-07-07 09:33:17 -05:00
30157-enable_software_inventory-default-true Set enable_software_inventory to default true in gitops (#30744) 2025-07-10 16:38:56 -04:00
30188-avail-for-install available_for_install false hides uninstalled software (#30404) 2025-07-01 11:08:15 -05:00
30192-lock-unenrolled-host Disallow lock request for unenrolled macOS hosts (#30313) 2025-06-25 13:31:33 -05:00
30199-mdm-check-fix Use dedicated, string-interpolated queries for single-host MDM status checks to reduce prepared statement usage (#30264) 2025-06-24 10:12:33 -05:00
30199-stmt-tweak Avoid unnecessary prepared statements in "select config from team" uncached queries (#30206) 2025-06-23 21:09:55 -05:00
30259-fix-linux-uninstall 30259 - fix linux uninstall script (#30488) 2025-07-01 17:50:47 -05:00
30282-software-url-in-fma-ui-upload Persist download URL when adding FMAs via non-GitOps API, fix software versions on GitOps YAML generation (#30331) 2025-06-26 14:29:23 -05:00
30311-fix-race-cond-test 30311: Fix race condition in test (#30903) 2025-07-17 10:20:49 -04:00
30325-gitops-fma-sha Generate SHA from file if FMA sha is no_check (#30558) 2025-07-07 11:05:19 -05:00
30359-mdm-eula-url-extra-slash Remove additional / from MDM EULA urls (#30985) 2025-07-18 13:30:32 +01:00
30385-software-polling Decrease software batch apply polling interval from 5s to 1s (#30414) 2025-07-02 15:49:37 -05:00
30393-pagination Bump page size to 10 for software title versions list (#30588) 2025-07-07 09:22:52 -05:00
30409-list-mdm-commands-sql Potential datastore optimizations for concurrent use of list mdm command API to poll results by host identifier (#30804) 2025-07-17 15:25:31 -05:00
30435-hash-for-policy-in-software-path Fix handling of software policy automations when a hash is specified inside a software file (#30814) 2025-07-15 13:24:24 -05:00
30461-fleetd-generate-tpm-key fleetd generate TPM key and issue SCEP certificate (#30932) 2025-07-18 11:31:52 -03:00
30481-gitops-manual-label-no-hosts Allow manual label with empty host list in gitops (#30756) 2025-07-18 11:07:19 -04:00
30502-fix-macos-setup-generation Fix macos_setup not always being exported correctly by generate-gitops (#30504) 2025-07-02 09:07:58 -03:00
30522-zero-software-id-counts Skip software_id=0 and log, but otherwise complete counts, when counting host software on a host_software table including rows with software ID zero (#30523) 2025-07-02 13:47:51 -05:00
30636-apple-account-driven-user-enrollment Managed Apple account user enrollment - integrate PoC changes (#30755) 2025-07-15 15:02:11 -04:00
30653-host-details-default-tab Default to Details tab on device page (#30698) 2025-07-10 14:57:06 -04:00
30749-primo-mode-expansion Allow users of Fleet in Primo mode to access Software automations and Failing policy ticket & webhook automations (#30865) 2025-07-17 15:53:31 -07:00
30797-argparse Add changes file for #30797 (#30798) 2025-07-11 14:41:00 -05:00
add-fmas Add FMA icons and icon tool (#30933) 2025-07-18 13:58:45 -06:00
fleetd-extensions-support-arm64 Add arm64 support for fleetd extensions and fixes on test scripts (#31084) 2025-07-21 15:47:59 -03:00
fma-cron-cadence Check for new Fleet-maintained apps hourly instead of daily (#30563) 2025-07-03 19:53:10 -05:00
issue-28143-disable-ui-eula-upload-gitops disable uploading EULA in UI when gitops is enabled (#30174) 2025-06-23 14:27:33 +01:00
issue-28691-add-eula-via-gitops Add ability to upload EULA via gitops (#30332) 2025-07-01 17:28:13 +01:00
issue-29505-idp-premium-message fix typos and add premium feature message to idp integration page (#30079) 2025-06-19 12:34:53 +01:00
issue-29505-premium-tier-certificates premium tier message for certificates section in integrations (#30509) 2025-07-02 17:03:34 +01:00
issue-29696-fix-truncation-mdm-server-url fix truncation of mdm server url value in about card (#30085) 2025-06-19 12:34:06 +01:00
issue-30352-add-fleetctl-binary-identifier Specify binary-identifier when signing fleetctl for macOS (#30374) 2025-07-01 10:38:15 -04:00
issue-30782-updates-to-UI-for-personally-enrolled-devices Updates across UI to support personal devices enrolled in MDM (#30830) 2025-07-21 12:07:03 +01:00
update-go-1.24.5 Update Go to 1.24.5 (#30770) 2025-07-15 10:59:17 -07:00