40314 patch policy autoupdate#41168
Merged
jkatz01 merged 17 commits intofeat/31914-patch-policyfrom Mar 9, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feat/31914-patch-policy #41168 +/- ##
==========================================================
Coverage ? 66.35%
==========================================================
Files ? 2470
Lines ? 198095
Branches ? 8755
==========================================================
Hits ? 131449
Misses ? 54743
Partials ? 11903
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jahzielv
reviewed
Mar 9, 2026
| var touchUploaded string | ||
| var clearFleetMaintainedAppID string // FMA becomes custom package when uploading a new installer file | ||
| if payload.InstallerFile != nil { | ||
| // installer cannot be changed when associated with an FMA |
Contributor
There was a problem hiding this comment.
I like this change, it makes things cleaner 🙏
jahzielv
reviewed
Mar 9, 2026
|
|
||
| err := ds.withTx(ctx, func(tx sqlx.ExtContext) error { | ||
| // check if there is a patch policy that uses this title | ||
| policyStmt := `SELECT 1 FROM policies p JOIN software_installers si ON si.title_id = p.patch_software_title_id AND si.global_or_team_id = p.team_id WHERE si.id = ?` |
Contributor
There was a problem hiding this comment.
Nit: I think we typically do SELECT EXISTS (SELECT 1 FROM ...
jahzielv
reviewed
Mar 9, 2026
jahzielv
reviewed
Mar 9, 2026
jahzielv
approved these changes
Mar 9, 2026
cdcme
pushed a commit
that referenced
this pull request
Mar 11, 2026
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #40314 - New error when attempting to delete an installer that has a patch policy associated - New error when attempting to update the file for an installer associated with an FMA - Gitops runs will generate the patch policy every time so it matches the current installer version - Existing code checks if the query was changed and resets membership, which should be enough. - Added patch_policy object to software title, but we might change that based on discussion ## 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 For unreleased bug fixes in a release candidate, one of: - [ ] Confirmed that the fix is not expected to adversely impact load test results - [ ] Alerted the release DRI if additional load testing is needed
cdcme
added a commit
that referenced
this pull request
Mar 13, 2026
Implements patch policies #31914 - #40816 - #41248 - #41276 - #40948 - #40837 - #40956 - #41168 - #41171 - #40691 - #41524 - #41674 --------- Co-authored-by: Jonathan Katz <44128041+jkatz01@users.noreply.github.com> Co-authored-by: jkatz01 <yehonatankatz@gmail.com> Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: Resolves #40314
Testing
Added/updated automated tests
Where appropriate, automated tests simulate multiple hosts and test for host isolation (updates to one hosts's records do not affect another)
QA'd all new/changed functionality manually
For unreleased bug fixes in a release candidate, one of: