Clean up setup experience cancellation behavior#43437
Hidden character warning
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #43437 +/- ##
==========================================
- Coverage 66.90% 66.90% -0.01%
==========================================
Files 2598 2599 +1
Lines 208220 208267 +47
Branches 9208 9333 +125
==========================================
+ Hits 139313 139341 +28
- Misses 56236 56253 +17
- Partials 12671 12673 +2
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:
|
…ctivity emission Zed + Opus 4.6; prompt: Are there tests covering the new activity creation in `server/worker/apple_mdm.go` L594-608? If not, add test coverage to assert that the activity is as expected.
Zed + Opis 4.6; prompt: Update tests added on this branch to reflect the cleanup done in the most recent commit.
Zed + Opus 4.6; prompt: Resolve test failures in `TestIntegrationsEnterprise/TestSetupExperienceLinuxWithSoftware` and `TestIntegrationsMDM/TestCancelUpcomingActivity`. You can enable MySQL tests to validate that tests run correctly; don't guess based on code analysis.
(even though I personally use "cancelled")
| { | ||
| HostUUID: hostUUID, | ||
| Status: fleet.SetupExperienceStatusFailure, | ||
| SetupExperienceScriptID: ptr.Uint(4), |
There was a problem hiding this comment.
@marko-lisica @melpike Right now we don't block setup experience on a failed script, so we don't emit a cancelled setup experience activity when a script is cancelled. Looks like we emit the ran_script activity with a failure status, but the FromSetupExperience flag doesn't actually get persisted so setup experience script activities aren't retrieves as such.
Given that setup experience scripts for macOS are a bit of a legacy feature (vs. script packages), do we need to do anything here?
There was a problem hiding this comment.
I think it's ok to leave it as is.
| assert.True(t, vppAct.FromSetupExperience) | ||
| }) | ||
|
|
||
| t.Run("script cancellation does not trigger activity", func(t *testing.T) { |
There was a problem hiding this comment.
@melpike @marko-lisica This test explicitly describes what I mentioned above.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
@claude review once |
There was a problem hiding this comment.
Pull request overview
Adds audit-log visibility and UI rendering for setup experience cancellation due to software install failures, and improves cancellation attribution for related “canceled install” activities.
Changes:
- Adds a new
canceled_setup_experienceactivity type and UI templates for host + global activity feeds. - Extends “canceled install” activities (software + App Store app) with
from_setup_experiencemetadata and surfaces that in UI copy. - Records additional activities on VPP enqueue failures during setup experience and adds/updates tests accordingly.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
server/worker/apple_mdm.go |
Emits an installed_app_store_app activity when VPP enqueue fails during iOS/iPadOS setup experience. |
server/worker/apple_mdm_test.go |
Adds worker test coverage asserting activity emission on VPP enqueue failure. |
server/service/integration_mdm_test.go |
Updates integration expectations to include from_setup_experience: false on canceled install activities. |
server/service/integration_enterprise_test.go |
Updates setup-experience Linux integration test to expect canceled install activity semantics. |
server/fleet/setup_experience.go |
Adds helper IsForVPPApp() to classify setup experience status results. |
server/fleet/activities.go |
Adds canceled_setup_experience activity type; extends canceled install activity details with from_setup_experience. |
frontend/pages/hosts/details/cards/Activity/ActivityItems/CanceledSetupExperienceActivityItem/index.ts |
Exports the new host activity item component. |
frontend/pages/hosts/details/cards/Activity/ActivityItems/CanceledSetupExperienceActivityItem/CanceledSetupExperienceActivityItem.tsx |
Renders the new host-scoped canceled setup experience activity item. |
frontend/pages/hosts/details/cards/Activity/ActivityItems/CanceledInstallSoftwareActivityItem/CanceledInstallSoftwareActivityItem.tsx |
Updates host activity copy to mention “during setup experience” when applicable. |
frontend/pages/hosts/details/cards/Activity/ActivityConfig.tsx |
Wires the new activity type to the host activity component map. |
frontend/pages/DashboardPage/cards/ActivityFeed/GlobalActivityItem/GlobalActivityItem.tsx |
Adds global-feed detail template + switch case for canceled setup experience; updates copy for canceled installs. |
frontend/interfaces/activity.ts |
Introduces new activity enum value and filter label; adds from_setup_experience to details typing. |
ee/server/service/setup_experience.go |
Emits an installed_app_store_app activity on VPP enqueue failure during setup experience. |
ee/server/service/orbit.go |
Replaces “fail cancelled installs” logic with “record canceled activities + mark cancelled as failure” logic. |
ee/server/service/orbit_test.go |
Adds unit tests for the new cancellation-recording helper and WasFromAutomation behavior. |
ee/server/service/devices.go |
Uses the new cancellation-recording helper when serving device setup experience status. |
cmd/fleet/serve.go |
Passes svc.NewActivity into the Apple MDM worker schedule. |
cmd/fleet/cron.go |
Threads NewActivityFn into the Apple MDM worker instance. |
changes/34288-setup-experience-cancel-activity |
Adds release notes for the new cancellation/failure activities behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Zed + Opus 4.6; prompts in same conversation: > Fix the following code review issue: [#43437 (comment) as markdown] (performed two fixes; one was a bit over-broad) > Pretty sure we _don't_ want to do fix 2, because we still want to emit the cancelled setup experience activity when a single piece of software is queued and its failure cancels setup experience. > Good. Add tests that reproduce the original issue and prove that the guard updates perform the expected fix.
Zed + Opus 4.6; prompts: > For the most recent commit, for each of the SQL queries edited, why do we have separate SELECT and UPDATE queries? Given the latter isn't conditioned on the former in any meaningful way, seems like we should just include the WHEREs from the SELECT in the UPDATE. (asked for confirmation) > yes
Zed + Opus 4.5; prompts: > Are there any non-test usages of maybeUpdateSetupExperienceStatus that set `requireTerminalStatus` to `false`? > Cool. Clean up the logic (and remove no-longer-relevant tests) since we're always requiring terminal status.
# Conflicts: # server/fleet/activities.go
|
@claude review once |
|
@JordanMontgomery I think this is ready. |
Fixes #34288. # 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 - [ ] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Setup experience cancellations now create explicit cancellation activities for skipped/failed software and VPP app installs, plus a new "Canceled setup experience" activity type and a from_setup_experience flag. Activity text and host activity views now indicate "during setup experience" when applicable. * **Tests** * Added and updated tests for cancellation activity creation, VPP license-failure handling, and WasFromAutomation/from_setup_experience behaviors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> # Conflicts: # server/fleet/activities.go # server/service/setup_experience.go
Merged into `main` in #43437. Conflicts resolved in `activities.go` and `setup_experience.go`, with the latter due to Windows setup experience cancellation landing in `main` for 4.85.
Fixes #34288.
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Testing
Added/updated automated tests
QA'd all new/changed functionality manually
Summary by CodeRabbit