Use new multiplatform keys on the front end - #41763
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #41763 +/- ##
=======================================
Coverage 66.64% 66.64%
=======================================
Files 2532 2532
Lines 202930 202931 +1
Branches 9026 9026
=======================================
+ Hits 135242 135243 +1
Misses 55441 55441
Partials 12247 12247
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:
|
6410513 to
259a8ab
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThis PR refactors frontend MDM configuration naming to use more generic/Apple-specific field names across type definitions, components, utilities, and services. Primary changes include renaming Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx (1)
832-841:⚠️ Potential issue | 🟡 MinorDrop the deprecated key when rewriting these filters.
If a user lands on a legacy link, spreading
queryParamspreservesbootstrap_package/macos_settingsand then addsmacos_bootstrap_package/apple_settingson top. That leaves contradictory URL state, and the backend contract inserver/service/transport.go:361-375treats both aliases together as invalid.Suggested fix
const handleChangeBootstrapPackageStatusFilter = ( newStatus: BootstrapPackageStatus ) => { router.replace( getNextLocationPath({ pathPrefix: PATHS.MANAGE_HOSTS, routeTemplate, routeParams, - queryParams: { ...queryParams, macos_bootstrap_package: newStatus }, + queryParams: { + ...omit(queryParams, ["bootstrap_package"]), + macos_bootstrap_package: newStatus, + }, }) ); }; @@ routeTemplate, routeParams, queryParams: { - ...queryParams, + ...omit(queryParams, ["macos_settings"]), apple_settings: newMacSettingsStatus, page: 0, // resets page index }, })Also applies to: 893-901
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx` around lines 832 - 841, When rewriting filter query params in handleChangeBootstrapPackageStatusFilter (and the other host filter handlers that add macos_bootstrap_package / apple_settings), remove the deprecated alias keys (bootstrap_package and macos_settings) from the queryParams before calling getNextLocationPath; i.e., build the new queryParams by spreading queryParams but explicitly deleting or omitting bootstrap_package and macos_settings and then setting macos_bootstrap_package (or apple_settings) so the URL contains only the canonical keys; update the analogous handler at the other block to do the same.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@frontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/BootstrapPackage.tsx`:
- Around line 141-145: The current flow calls mdmAPI.deleteBootstrapPackage(...)
and then mdmAPI.updateSetupExperienceSettings(...) so a PATCH failure
incorrectly makes the UI report the whole delete as failed and leaves
macos_manual_agent_install enabled; fix by treating the cleanup as best-effort:
either set macos_manual_agent_install to false before calling
deleteBootstrapPackage, or (preferred) wrap updateSetupExperienceSettings in its
own try/catch so deleteBootstrapPackage success is honored regardless of PATCH
outcome—use the functions deleteBootstrapPackage and
updateSetupExperienceSettings and the currentTeamId/macos_manual_agent_install
flag in BootstrapPackage.tsx, ensure the UI flash for deletion is only tied to
deleteBootstrapPackage success and log or silently ignore PATCH errors while
keeping the admin-visible state consistent.
In `@frontend/services/entities/teams.ts`:
- Around line 27-30: The ILoadTeamResponse interface currently claims both team
and fleet exist simultaneously; change it to reflect that the backend returns
one field aliased as either name by making team and fleet optional (team?:
ITeamConfig; fleet?: ITeamConfig) or, preferably, convert the interface to a
union type (export type ILoadTeamResponse = { team: ITeamConfig } | { fleet:
ITeamConfig }) so callers of ILoadTeamResponse, and code referring to
data.team/data.fleet, correctly model a single present property; update any
usage that assumes both properties exist to handle the optional/union shape.
---
Outside diff comments:
In `@frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx`:
- Around line 832-841: When rewriting filter query params in
handleChangeBootstrapPackageStatusFilter (and the other host filter handlers
that add macos_bootstrap_package / apple_settings), remove the deprecated alias
keys (bootstrap_package and macos_settings) from the queryParams before calling
getNextLocationPath; i.e., build the new queryParams by spreading queryParams
but explicitly deleting or omitting bootstrap_package and macos_settings and
then setting macos_bootstrap_package (or apple_settings) so the URL contains
only the canonical keys; update the analogous handler at the other block to do
the same.
🪄 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: 917bf6bf-e19c-4a81-bb09-3bd8a78765e0
📒 Files selected for processing (28)
frontend/__mocks__/configMock.tsfrontend/__mocks__/hostMock.tsfrontend/__mocks__/mdmMock.tsfrontend/interfaces/config.tsfrontend/interfaces/host.tsfrontend/interfaces/team.tsfrontend/pages/ManageControlsPage/OSSettings/cards/DiskEncryption/DiskEncryption.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/Passwords/Passwords.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/BootstrapPackage.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/components/BootstrapAdvancedOptions/BootstrapAdvancedOptions.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/components/BootstrapPackageTable/BootstrapPackageTableConfig.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/EndUserAuthentication/EndUserAuthentication.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/InstallSoftware/InstallSoftware.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/RunScript/RunScript.tsxfrontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsxfrontend/pages/ManageControlsPage/SetupExperience/helpers.tsfrontend/pages/hosts/ManageHostsPage/HostsPageConfig.tsxfrontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsxfrontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsxfrontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsxfrontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsxfrontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsTableConfig.tsxfrontend/pages/hosts/details/cards/HostSummary/OSSettingsIndicator/OSSettingsIndicator.tsxfrontend/services/entities/hosts.tsfrontend/services/entities/mdm.tsfrontend/services/entities/teams.tsfrontend/utilities/url/index.tsfrontend/utilities/url/url.tests.ts
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.
There was a problem hiding this comment.
Pull request overview
Updates the Fleet frontend to use the newly aliased/renamed multiplatform API keys (notably for Apple settings and Setup Experience), and aligns team/fleet config consumption with the updated response shape.
Changes:
- Renames host query params and filters (e.g.,
macos_settings→apple_settings,bootstrap_package→macos_bootstrap_package) while preserving legacy URL compatibility on initial load/clear. - Migrates Setup Experience + Apple settings consumers to the new config keys (e.g.,
macos_setup→setup_experience,manual_agent_install→macos_manual_agent_install). - Updates team config fetch/select logic to prefer the new
.fleetresponse property.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/utilities/url/url.tests.ts | Updates URL utility tests to expect new query param keys. |
| frontend/utilities/url/index.ts | Switches reconciled query param keys to the new aliases. |
| frontend/services/entities/teams.ts | Updates team load response typing to include fleet key. |
| frontend/services/entities/mdm.ts | Renames setup experience update payload keys to new aliases. |
| frontend/services/entities/hosts.ts | Updates hosts API query params to send new filter keys. |
| frontend/pages/hosts/details/cards/HostSummary/OSSettingsIndicator/OSSettingsIndicator.tsx | Updates wording to reflect Apple settings terminology. |
| frontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsTableConfig.tsx | Switches host MDM settings access to apple_settings. |
| frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx | Switches host MDM setup/settings access to new keys. |
| frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx | Switches host MDM setup/settings access to new keys. |
| frontend/pages/hosts/ManageHostsPage/components/HostsFilterBlock/HostsFilterBlock.tsx | Updates filter labels and clears both canonical + legacy params. |
| frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx | Reads canonical params with fallback to legacy; writes canonical params on change. |
| frontend/pages/hosts/ManageHostsPage/HostsPageConfig.tsx | Whitelists both canonical + legacy query param keys for manage-hosts routing behavior. |
| frontend/pages/ManageControlsPage/SetupExperience/helpers.ts | Updates manual agent install config lookup to new setup_experience key. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx | Selects .fleet and updates release-device flag key. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/RunScript/RunScript.tsx | Selects .fleet for team config in Setup Experience. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/InstallSoftware/InstallSoftware.tsx | Selects .fleet and updates config field path to setup_experience. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/EndUserAuthentication/EndUserAuthentication.tsx | Selects .fleet and updates config field path to setup_experience. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/components/BootstrapPackageTable/BootstrapPackageTableConfig.tsx | Updates “view all hosts” link param to macos_bootstrap_package. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/components/BootstrapAdvancedOptions/BootstrapAdvancedOptions.tsx | Updates API payload key to macos_manual_agent_install. |
| frontend/pages/ManageControlsPage/SetupExperience/cards/BootstrapPackage/BootstrapPackage.tsx | Selects .fleet and updates API payload key to macos_manual_agent_install. |
| frontend/pages/ManageControlsPage/OSSettings/cards/Passwords/Passwords.tsx | Selects .fleet for team config in OS settings. |
| frontend/pages/ManageControlsPage/OSSettings/cards/DiskEncryption/DiskEncryption.tsx | Selects .fleet for team config in OS settings. |
| frontend/interfaces/team.ts | Renames team MDM config keys to new aliases. |
| frontend/interfaces/host.ts | Renames host MDM data keys to new aliases. |
| frontend/interfaces/config.ts | Renames global MDM config keys to new aliases. |
| frontend/mocks/mdmMock.ts | Updates mock host MDM keys to new aliases. |
| frontend/mocks/hostMock.ts | Updates mock host MDM keys to new aliases. |
| frontend/mocks/configMock.ts | Updates mock global MDM config keys to new aliases. |
| changes/41601-use-multiplatform-names-in-front-end | Adds user-visible change note. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (macSettingsStatus) { | ||
| // ensure macos_settings filter is always applied in | ||
| // ensure apple_settings filter is always applied in | ||
| // conjunction with a fleet_id, 0 (no fleets) by default | ||
| reconciled.macos_settings = macSettingsStatus; | ||
| reconciled.apple_settings = macSettingsStatus; | ||
| reconciled.fleet_id = teamId ?? 0; | ||
| } |
There was a problem hiding this comment.
reconcileMutuallyInclusiveHostParams currently always initializes reconciled with fleet_id: teamId, so when teamId is undefined and no inclusive filters are set it returns { fleet_id: undefined }. That contradicts the unit test case that expects an empty object when neither macSettingsStatus nor teamId are present. Consider only including fleet_id when teamId is defined (or when a filter requires defaulting it to 0), so the "no params" case returns {}.
iansltx
left a comment
There was a problem hiding this comment.
Assuming I understand what's going on correctly with the one line-level comment I added, we're good to go here I think. Copilot's reviews seem a bit off-base here.
| label={label} | ||
| onClear={() => handleClearFilter(["macos_settings"])} | ||
| onClear={() => | ||
| handleClearFilter(["macos_settings", "apple_settings"]) |
There was a problem hiding this comment.
Do we need to specify both here because we want URL parameters with the older names to continue working with the new UI? Seems to match how HostsPageConfig.tsx changes are?
There was a problem hiding this comment.
I thought we did but after going through and testing everything, I found we rewrite the keys in the URL so I'm pretty sure macos_settings is never going to be there to clear. It doesn't hurt to keep it for now in case there's an edge case I'm missing. We'll do a sweep and 🔪 all older keys for good in Fleet 5.
Related issue: Resolves #41601
Details
This PR updates the front end to use the following renamed API keys:
It also ensures that consumers of the "get fleet config" API pull from the
.fleetproperty rather than.team, so that they can use all of the newly renamed response fields.Summary by CodeRabbit
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
Manual Test Plan
Prerequisites
macOS settings filter:
Bootstrap package filter:
Bootstrap package:
End user authentication:
Setup assistant:
Install software: