Skip to content

Clean up setup experience cancellation behavior#43437

Merged
iansltx merged 43 commits into
mainfrom
🤖-34288-rev-2
Apr 14, 2026

Hidden character warning

The head ref may contain hidden characters: "\ud83e\udd16-34288-rev-2"
Merged

Clean up setup experience cancellation behavior#43437
iansltx merged 43 commits into
mainfrom
🤖-34288-rev-2

Conversation

@iansltx
Copy link
Copy Markdown
Contributor

@iansltx iansltx commented Apr 11, 2026

Fixes #34288.

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/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Testing

  • Added/updated automated tests

  • QA'd all new/changed functionality manually

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.

For #34288. Zed + Opus 4.6; prompt: Implement #34288, taking into account feedback mentioned on the ticket. Use the PRs in the last comment on the issue as inspiration. Check subtasks for more specs.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 55.00000% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.90%. Comparing base (ed13c58) to head (13ce6c6).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...vityFeed/GlobalActivityItem/GlobalActivityItem.tsx 11.11% 8 Missing ⚠️
ee/server/service/orbit.go 58.82% 4 Missing and 3 partials ⚠️
ee/server/service/setup_experience.go 57.14% 3 Missing and 3 partials ⚠️
server/service/setup_experience.go 68.42% 2 Missing and 4 partials ⚠️
...tivityItem/CanceledSetupExperienceActivityItem.tsx 40.00% 3 Missing ⚠️
...wareActivityItem/InstalledSoftwareActivityItem.tsx 0.00% 3 Missing ⚠️
...ms/RanScriptActivityItem/RanScriptActivityItem.tsx 0.00% 3 Missing ⚠️
server/service/orbit.go 0.00% 0 Missing and 2 partials ⚠️
server/worker/apple_mdm.go 83.33% 1 Missing and 1 partial ⚠️
cmd/fleet/cron.go 0.00% 1 Missing ⚠️
... and 4 more
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     
Flag Coverage Δ
backend 68.69% <64.10%> (+<0.01%) ⬆️
frontend 54.75% <22.72%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…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.
iansltx added 2 commits April 12, 2026 14:35
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),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok to leave it as is.

Comment thread ee/server/service/orbit_test.go Outdated
assert.True(t, vppAct.FromSetupExperience)
})

t.Run("script cancellation does not trigger activity", func(t *testing.T) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@melpike @marko-lisica This test explicitly describes what I mentioned above.

@iansltx iansltx marked this pull request as ready for review April 13, 2026 02:37
@iansltx iansltx requested review from a team as code owners April 13, 2026 02:37
Copilot AI review requested due to automatic review settings April 13, 2026 02:37
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@iansltx
Copy link
Copy Markdown
Contributor Author

iansltx commented Apr 13, 2026

@claude review once

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_experience activity type and UI templates for host + global activity feeds.
  • Extends “canceled install” activities (software + App Store app) with from_setup_experience metadata 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.

Comment thread ee/server/service/orbit.go Outdated
Comment thread ee/server/service/orbit.go Outdated
Comment thread ee/server/service/devices.go Outdated
Comment thread server/fleet/activities.go
Comment thread frontend/interfaces/activity.ts
Comment thread changes/34288-setup-experience-cancel-activity Outdated
Comment thread server/worker/apple_mdm.go Outdated
Comment thread ee/server/service/setup_experience.go
Comment thread ee/server/service/orbit_test.go Outdated
iansltx added 4 commits April 13, 2026 15:06
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
rachaelshaw pushed a commit that referenced this pull request Apr 13, 2026
Zed + Sonnet 4.6; prompt: Update audit-logs.md to reflect the new fields
introduced in `d3666ab`
@iansltx
Copy link
Copy Markdown
Contributor Author

iansltx commented Apr 13, 2026

@claude review once

Comment thread server/fleet/activities.go
@iansltx
Copy link
Copy Markdown
Contributor Author

iansltx commented Apr 14, 2026

@JordanMontgomery I think this is ready.

Copy link
Copy Markdown
Member

@JordanMontgomery JordanMontgomery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@iansltx iansltx merged commit 3675f8f into main Apr 14, 2026
52 of 53 checks passed
@iansltx iansltx deleted the 🤖-34288-rev-2 branch April 14, 2026 14:39
iansltx added a commit that referenced this pull request Apr 14, 2026
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
iansltx added a commit that referenced this pull request Apr 14, 2026
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.
@coderabbitai coderabbitai Bot mentioned this pull request Apr 20, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity: macOS setup experience is canceled

5 participants