Update how deleted hosts show in batch scripts (#32290)#32375
Merged
sgress454 merged 1 commit intorc-minor-fleet-v4.73.0from Aug 27, 2025
Merged
Update how deleted hosts show in batch scripts (#32290)#32375sgress454 merged 1 commit intorc-minor-fleet-v4.73.0from
sgress454 merged 1 commit intorc-minor-fleet-v4.73.0from
Conversation
for #32231 # Details This PR adjusts the queries for listing batch scripts slightly to count _every_ row in `batch_activities` matching the filters, regardless of whether any `batch_activity_host_results` rows exist for it. This handles the edge case of a batch script where all the hosts have been deleted. # Checklist for submitter If some of the following don't apply, delete the relevant line. - [X] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) ## Testing - [ ] Added/updated automated tests I didn't add tests for this because these tests have already changed quite a bit in #32174. I can add tests in there when this merges. - [X] QA'd all new/changed functionality manually * Select a host in Manage Hosts, click Run Script, select a script and do Run Now * Delete that host * Go to the batch scripts list (Controls -> Scripts -> Batch Progress) * Verify that the batch script is still listed. We don't have clear expectations for what numbers should be displayed for the progress of a batch like this, but this PR at least ensures the batch doesn't disappear. For unreleased bug fixes in a release candidate, one of: - [X] Confirmed that the fix is not expected to adversely impact load test results
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## rc-minor-fleet-v4.73.0 #32375 +/- ##
=========================================================
Coverage ? 62.07%
=========================================================
Files ? 1984
Lines ? 194194
Branches ? 6523
=========================================================
Hits ? 120543
Misses ? 64070
Partials ? 9581
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:
|
getvictor
approved these changes
Aug 27, 2025
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.
for #32231
Details
This PR adjusts the queries for listing batch scripts slightly to count every row in
batch_activitiesmatching the filters, regardless of whether anybatch_activity_host_resultsrows exist for it. This handles the edge case of a batch script where all the hosts have been deleted.Checklist for submitter
If some of the following don't apply, delete the relevant line.
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements)Testing
Added/updated automated tests I didn't add tests for this because these tests have already changed quite a bit in Add "batch script host results" API #32174. I can add tests in there when this merges.
QA'd all new/changed functionality manually
We don't have clear expectations for what numbers should be displayed for the progress of a batch like this, but this PR at least ensures the batch doesn't disappear.
For unreleased bug fixes in a release candidate, one of:
Checklist for submitter
If some of the following don't apply, delete the relevant line.
Changes file added for user-visible changes in
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Input data is properly validated,
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements)If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes
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:
Database migrations
COLLATE utf8mb4_unicode_ci).New Fleet configuration settings
If you didn't check the box above, follow this checklist for GitOps-enabled settings:
fleetctl generate-gitopsfleetd/orbit/Fleet Desktop
runtime.GOOSis used as needed to isolate changes