Skip to content

Add require_all_software_windows config option - #43011

Merged
getvictor merged 4 commits into
mainfrom
victor/42853-require-win-software
Apr 6, 2026
Merged

Add require_all_software_windows config option#43011
getvictor merged 4 commits into
mainfrom
victor/42853-require-win-software

Conversation

@getvictor

@getvictor getvictor commented Apr 3, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #42853

This PR simply adds the require_all_software_windows config option. It doesn't use it. The logic to use it will be hooked up in subsequent PRs.

The fleetctl TestIntegrationsPreview test is expected to fail since it builds the server against main and doesn't know about our new config option.

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.

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

New Fleet configuration settings

Summary by CodeRabbit

  • New Features

    • Added a Windows setup experience software requirement setting. When enabled, Windows devices will cancel the Autopilot setup if any required software installation fails.
  • Tests

    • Added test coverage for the new Windows software requirement configuration.

@getvictor

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new require_all_software_windows configuration option so Windows setup experience can be canceled when a software install fails (paralleling the existing macOS behavior).

Changes:

  • Extend setup experience “require all software” logic to apply to Windows hosts.
  • Add require_all_software_windows to config/payload structs and wire it through API + GitOps/team spec application paths.
  • Update fleetctl apply/get expected outputs and add targeted tests.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/service/setup_experience.go Extends require-all-software checks and cancellation gating to Windows.
server/service/setup_experience_test.go Adds unit tests covering macOS/Windows/team/global behavior for the new flag.
server/fleet/apple_mdm.go Extends setup-experience PATCH payload with require_all_software_windows.
server/fleet/app.go Adds RequireAllSoftwareWindows to persisted setup-experience config struct.
ee/server/service/teams.go Applies/validates require_all_software_windows during GitOps/team spec edits and team MDM setup updates.
ee/server/service/mdm.go Supports updating app config via API for require_all_software_windows and validates Windows MDM configuration.
cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1Set.yml Updates expected YAML to include require_all_software_windows.
cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1Empty.yml Updates expected YAML to include require_all_software_windows.
cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1And2Set.yml Updates expected YAML to include require_all_software_windows.
cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1And2Empty.yml Updates expected YAML to include require_all_software_windows.
cmd/fleetctl/fleetctl/testdata/macosSetupExpectedAppConfigSet.yml Updates expected YAML to include require_all_software_windows.
cmd/fleetctl/fleetctl/testdata/macosSetupExpectedAppConfigEmpty.yml Updates expected YAML to include require_all_software_windows.
cmd/fleetctl/fleetctl/testdata/expectedGetTeamsYaml.yml Updates expected teams YAML output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetTeamsJson.json Updates expected teams JSON output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetConfigIncludeServerConfigYaml.yml Updates expected config YAML output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetConfigIncludeServerConfigJson.json Updates expected config JSON output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigYaml.yml Updates expected app config YAML output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigTeamMaintainerYaml.yml Updates expected team-maintainer YAML output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigTeamMaintainerJson.json Updates expected team-maintainer JSON output with the new field.
cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigJson.json Updates expected app config JSON output with the new field.
cmd/fleetctl/fleetctl/apply_test.go Adds a fleetctl apply roundtrip test covering require_all_software_windows.
changes/38785-windows-setup-experience-cancel Adds a user-visible changelog entry for the new setting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ee/server/service/mdm.go Outdated
Comment thread server/fleet/app.go
Comment thread server/fleet/apple_mdm.go
@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds a new require_all_software_windows configuration setting for Windows Autopilot setup experiences. The setting is added to the MacOSSetup configuration struct and MDM API payload, with supporting validation logic in the service layer. When enabled, it cancels the Windows setup experience if any software installation fails during enrollment. The change includes updates to team and app-level configuration handling, platform-specific logic in setup experience functions, and comprehensive test coverage across test fixtures and service tests.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary change: adding a new configuration option for Windows software requirements during setup.
Linked Issues check ✅ Passed The PR implements the core requirements from #42853: adds require_all_software_windows field to config structs, extends API payload, adds service layer validation for Windows MDM enablement, implements team config handling, and updates test fixtures with the new field.
Out of Scope Changes check ✅ Passed All changes are tightly scoped to the requirement: adding the require_all_software_windows setting across config structs, API payloads, service layers, and test fixtures. No unrelated features or refactoring present.
Description check ✅ Passed The PR description is comprehensive and covers all critical sections required by the template, including the related issue, checklist items for user-visible changes, testing, and GitOps configuration settings with detailed explanations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch victor/42853-require-win-software

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/fleetctl/fleetctl/apply_test.go`:
- Around line 2717-2738: The test currently uses strings.ReplaceAll on
expectedTm1 which flips both fleet- and team-level require_all_software_windows
values; change the test to only update the team occurrence (or add an explicit
assertion) so fleet-level remains false: locate the expectedTm1 string used for
comparison and either perform a targeted replacement that matches the team
section (e.g., replace the block under "team:" or the specific line following
that header) or after RunAppForTest(... "get", "teams", "--yaml") assert that
the fleet section still contains `require_all_software_windows: false`; keep the
existing checks for ds.SaveTeamFuncInvoked and the applied output assertions
(RunAppForTest, windowsRequireSpec, expectedWithWindowsRequire) but ensure only
the team value is flipped in expectedWithWindowsRequire or add a separate
assertion verifying fleet-level remains false.

In `@ee/server/service/teams.go`:
- Around line 1596-1607: The code validates RequireAllSoftwareWindows only on
edits but not on team creation, allowing creation of a team with
spec.MDM.MacOSSetup.RequireAllSoftwareWindows=true even when
appCfg.MDM.WindowsEnabledAndConfigured is false; update the team-creation path
where team.Config.MDM.MacOSSetup is copied/persisted (the assignment of
team.Config.MDM.MacOSSetup.RequireAllSoftwareWindows from
spec.MDM.MacOSSetup.RequireAllSoftwareWindows) to perform the same guard:
determine windowsEnabledAndConfigured (respecting
opts.DryRunAssumptions.WindowsEnabledAndConfigured if present) and if
spec.MDM.MacOSSetup.RequireAllSoftwareWindows is true while
windowsEnabledAndConfigured is false, return the same
fleet.NewInvalidArgumentError("setup_experience.require_all_software_windows",
...) wrapped with ctxerr.Wrap, before assigning/persisting the value.

In `@server/service/setup_experience_test.go`:
- Around line 228-243: The test currently sets both macOS and Windows flags to
the same values in appCfg and the TeamLite returned by ds.TeamLiteFunc so it
doesn't exercise branching; update the fixtures so the app-level and team-level
values differ and also make RequireAllSoftware and RequireAllSoftwareWindows
different from each other (e.g. appCfg.MDM.MacOSSetup.RequireAllSoftware=true
but appCfg.MDM.MacOSSetup.RequireAllSoftwareWindows=false, and the
TeamLite.TeamConfigLite.MDM.MacOSSetup flags set to the opposite) so the code
paths in the functions that read appCfg vs TeamLite and macOS vs Windows flags
(look for appCfg, ds.AppConfigFunc, ds.TeamLiteFunc, fleet.AppConfig,
fleet.TeamLite, RequireAllSoftware, RequireAllSoftwareWindows, MacOSSetup,
TeamMDM) are actually exercised; apply the same pattern for the other affected
block (lines ~250-293).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ca9bb85-0237-4606-a16c-d29e7ac3f57b

📥 Commits

Reviewing files that changed from the base of the PR and between 9eb1e2a and ba07a31.

📒 Files selected for processing (22)
  • changes/38785-windows-setup-experience-cancel
  • cmd/fleetctl/fleetctl/apply_test.go
  • cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigJson.json
  • cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigTeamMaintainerJson.json
  • cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigTeamMaintainerYaml.yml
  • cmd/fleetctl/fleetctl/testdata/expectedGetConfigAppConfigYaml.yml
  • cmd/fleetctl/fleetctl/testdata/expectedGetConfigIncludeServerConfigJson.json
  • cmd/fleetctl/fleetctl/testdata/expectedGetConfigIncludeServerConfigYaml.yml
  • cmd/fleetctl/fleetctl/testdata/expectedGetTeamsJson.json
  • cmd/fleetctl/fleetctl/testdata/expectedGetTeamsYaml.yml
  • cmd/fleetctl/fleetctl/testdata/macosSetupExpectedAppConfigEmpty.yml
  • cmd/fleetctl/fleetctl/testdata/macosSetupExpectedAppConfigSet.yml
  • cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1And2Empty.yml
  • cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1And2Set.yml
  • cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1Empty.yml
  • cmd/fleetctl/fleetctl/testdata/macosSetupExpectedTeam1Set.yml
  • ee/server/service/mdm.go
  • ee/server/service/teams.go
  • server/fleet/app.go
  • server/fleet/apple_mdm.go
  • server/service/setup_experience.go
  • server/service/setup_experience_test.go

Comment thread cmd/fleetctl/fleetctl/apply_test.go
Comment thread ee/server/service/teams.go
Comment thread server/service/setup_experience_test.go
@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.82759% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.81%. Comparing base (b6c0fd0) to head (27c1964).
⚠️ Report is 37 commits behind head on main.

Files with missing lines Patch % Lines
ee/server/service/teams.go 25.00% 6 Missing and 3 partials ⚠️
ee/server/service/mdm.go 0.00% 3 Missing and 2 partials ⚠️
server/service/setup_experience.go 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #43011      +/-   ##
==========================================
- Coverage   66.85%   66.81%   -0.04%     
==========================================
  Files        2578     2578              
  Lines      206880   206900      +20     
  Branches     9166     9166              
==========================================
- Hits       138301   138247      -54     
- Misses      56003    56102      +99     
+ Partials    12576    12551      -25     
Flag Coverage Δ
backend 68.58% <44.82%> (-0.04%) ⬇️

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.

@getvictor
getvictor marked this pull request as ready for review April 6, 2026 12:39
@getvictor
getvictor requested a review from a team as a code owner April 6, 2026 12:39

@claude claude Bot left a comment

Copy link
Copy Markdown

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.

@getvictor
getvictor merged commit c4479c6 into main Apr 6, 2026
51 of 54 checks passed
@getvictor
getvictor deleted the victor/42853-require-win-software branch April 6, 2026 22:40
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.

WCS (phase 1): add require_all_software_windows migration and API support, add rename support for existing require_all_software

3 participants