fleet/server/datastore
Jonathan Katz ebd2cb0012
Fix patch policy bugs (#43420)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #43389
1. Added verifyPatchPolicy check
2. Fixed nil pointer dereference when calling spec/policies with no
fleet_maintained_app_slug key provided
3. Fixed bug where renaming a patch policy in a gitops file caused it to
be deleted on the first run, and only added when gitops is run again.

# Checklist for submitter

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

- [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.


## Testing

- [x] Added/updated automated tests
- [ ] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [x] QA'd all new/changed functionality manually


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Renaming a patch policy via GitOps now updates the existing policy
instead of deleting it.
  * Fixed nil-pointer errors in policy API operations.
* Reject applying patch policies with missing, invalid, or disallowed
Fleet Maintained App references (including global/enterprise slugs).
* Improved matching for patch policies to avoid unintended deletions
when names differ.
* Patch policies now preserve intended platform/target behavior during
apply/update.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-10 21:42:14 -04:00
..
cached_mysql Use FMA names for macOS software (#42221) 2026-03-30 10:41:37 -06:00
failing Cloudfront signing for in-house apps (#37650) 2026-01-05 16:30:31 -05:00
filesystem Cloudfront signing for in-house apps (#37650) 2026-01-05 16:30:31 -05:00
mysql Fix patch policy bugs (#43420) 2026-04-10 21:42:14 -04:00
mysqlredis Add activity feed entries for host deletion and expiration (#34720) 2025-10-31 09:37:31 -07:00
redis ACME MDM -> main (#42926) 2026-04-02 15:56:31 -05:00
s3 Run multiple independent Fleet dev servers in parallel (#41865) 2026-03-18 13:58:58 -05:00