Patch when closed: default continuous automation off for Force patch - #50691
Conversation
The continuous software & script automations checkbox no longer follows the Patch radio. Selecting Force patch in Edit policy leaves it unchecked and lets the user turn it on without switching to another option. Force patch policies created from Add software and the Deploy modal also start with continuous automation off, matching how the server creates them.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/39962-patch-when-closed #50691 +/- ##
===============================================================
Coverage ? 67.99%
===============================================================
Files ? 3897
Lines ? 248993
Branches ? 13327
===============================================================
Hits ? 169293
Misses ? 64475
Partials ? 15225
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
WalkthroughThe frontend now enables continuous automation only for closed-patch policies. Manual patching disables it, while other patch options preserve the stored toggle state. The automation toggle no longer changes the patch option. Policy forms pass patch controls through Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/pages/policies/components/PolicyAutomationsFields/PolicyAutomationsFields.tests.tsx (1)
459-477: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the persisted value for Force patch.
These tests verify only the rendered checkbox state. They do not verify
getAutomationsPayload(). A payload regression could leave the checkbox checked but savecontinuous_automations_enabled: false. Use a valid patch fixture withpatch_softwareand a handle ref. Assert that the payload containscontinuous_automations_enabled: trueafter the explicit toggle and for the already-enabled case.Also applies to: 479-492
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/pages/policies/components/PolicyAutomationsFields/PolicyAutomationsFields.tests.tsx` around lines 459 - 477, Update the Force patch tests around renderWithHandle to use a valid patch fixture including patch_software and a handle ref, then assert getAutomationsPayload() contains continuous_automations_enabled: true after explicitly toggling the checkbox and in the already-enabled case. Keep the existing checkbox state assertions while adding payload verification for both scenarios.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@frontend/pages/policies/components/PolicyAutomationsFields/PolicyAutomationsFields.tests.tsx`:
- Around line 459-477: Update the Force patch tests around renderWithHandle to
use a valid patch fixture including patch_software and a handle ref, then assert
getAutomationsPayload() contains continuous_automations_enabled: true after
explicitly toggling the checkbox and in the already-enabled case. Keep the
existing checkbox state assertions while adding payload verification for both
scenarios.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b02a4ed7-5e22-4386-918a-c911088e446a
📒 Files selected for processing (6)
frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/DeployModal/DeployModal.tests.tsxfrontend/pages/SoftwarePage/components/forms/SoftwareDeploySelector/SoftwareDeploySelector.tsxfrontend/pages/policies/components/PolicyAutomationsFields/PolicyAutomationsFields.tests.tsxfrontend/pages/policies/components/PolicyAutomationsFields/PolicyAutomationsFields.tsxfrontend/pages/policies/edit/components/PolicyForm/PolicyForm.tests.tsxfrontend/pages/policies/edit/components/PolicyForm/PolicyForm.tsx
💤 Files with no reviewable changes (1)
- frontend/pages/policies/edit/components/PolicyForm/PolicyForm.tsx
Related issue: Resolves #
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), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.Timeouts are implemented and retries are limited to avoid infinite loops
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:
Summary by CodeRabbit