Add Apple marketing names to backend, frontend, and an osquery table#46482
Add Apple marketing names to backend, frontend, and an osquery table#46482spalmesano0 wants to merge 6 commits into
Conversation
Added a Go map of Apple hardware identifiers to marketing names. The Fleet API now returns `hardware_marketing_name` for all Apple hosts (macOS, iOS, iPadOS; but other platforms are in the map for future support). Falls back to the raw identifier if the model isn't in the map.
The "Hardware model" field on the Hosts and Host details pages now shows the marketing name instead of the raw identifier.
Added a new `apple_hardware_info` table (macOS only) with a single `marketing_name` column.
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis pull request adds human-readable hardware marketing names for Apple devices across the Fleet system. It introduces a new 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Pull request overview
This PR adds Apple hardware identifier-to-marketing-name support across Fleet host API responses, frontend host displays, and a new Darwin osquery extension table.
Changes:
- Adds a backend Apple hardware model map and exposes
hardware_marketing_nameon host list/detail responses. - Updates host table and host vitals UI to show marketing names for Apple platforms.
- Adds a Darwin
apple_hardware_infofleetd table and schema entry.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/service/hosts.go | Populates hardware marketing name on host detail responses. |
| server/fleet/hostresponse.go | Adds hardware_marketing_name to host response structs and list response construction. |
| server/fleet/apple_hardware_models.go | Defines the Apple hardware identifier to marketing name map. |
| schema/osquery_fleet_schema.json | Adds schema metadata for the new apple_hardware_info table. |
| orbit/pkg/table/extension_darwin.go | Registers the new Darwin osquery extension table. |
| orbit/pkg/table/apple_hardware_info/apple_hardware_info_darwin.go | Implements the new table by querying system_info and mapping the model. |
| frontend/utilities/constants.tsx | Includes hardware_marketing_name in host vitals data. |
| frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx | Displays Apple marketing names in the hardware model column. |
| frontend/pages/hosts/details/cards/Vitals/Vitals.tsx | Displays Apple marketing names in host vitals. |
| frontend/pages/hosts/details/cards/Vitals/Vitals.tests.tsx | Updates vitals tests for Apple marketing-name display. |
| frontend/interfaces/host.ts | Adds the new host response field to frontend types. |
| frontend/mocks/hostMock.ts | Adds the new field to host test mock defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| "name": "apple_hardware_info", | ||
| "description": "Maps the Apple hardware model identifier to its marketing name.", |
| { | ||
| "name": "apple_hardware_info", | ||
| "description": "Maps the Apple hardware model identifier to its marketing name.", |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #46482 +/- ##
==========================================
- Coverage 66.90% 66.81% -0.09%
==========================================
Files 2797 2804 +7
Lines 223492 223592 +100
Branches 11429 11315 -114
==========================================
- Hits 149518 149390 -128
- Misses 60431 60647 +216
- Partials 13543 13555 +12
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:
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx (1)
193-199: ⚡ Quick winSame blank-cell risk as
Vitals.tsx— add a fallback tocellProps.cell.value.When
hardware_marketing_nameis empty/undefined for an Apple host, the column renders blank rather than the raw model.♻️ Proposed defensive fallback
<TextCell value={ isAppleDevice(cellProps.row.original.platform) - ? cellProps.row.original.hardware_marketing_name + ? cellProps.row.original.hardware_marketing_name || + cellProps.cell.value : cellProps.cell.value } />🤖 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/hosts/ManageHostsPage/HostTableConfig.tsx` around lines 193 - 199, The Apple-host display can be blank when hardware_marketing_name is empty; update the TextCell value expression used in HostTableConfig.tsx so that when isAppleDevice(cellProps.row.original.platform) is true it renders cellProps.row.original.hardware_marketing_name || cellProps.cell.value (i.e. fall back to the raw model value) rather than only hardware_marketing_name; reference the TextCell component and the isAppleDevice check and replace the conditional branch to use the fallback.frontend/pages/hosts/details/cards/Vitals/Vitals.tsx (1)
350-358: ⚡ Quick winConsider falling back to
hardware_modelwhen the marketing name is empty.For Apple devices this renders
hardware_marketing_nameunconditionally. The backend is expected to fall back to the raw model when unmapped, but if the field is empty/undefined (older agent data, partial rollout, or a model the backend map didn't cover) the row would render blank instead of showing the identifier.♻️ Proposed defensive fallback
value={ <TooltipTruncatedText value={ isAppleDevice(vitalsData.platform) - ? vitalsData.hardware_marketing_name + ? vitalsData.hardware_marketing_name || vitalsData.hardware_model : vitalsData.hardware_model } /> }🤖 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/hosts/details/cards/Vitals/Vitals.tsx` around lines 350 - 358, The Apple-device branch renders hardware_marketing_name unconditionally which can be empty; update the value passed to TooltipTruncatedText in Vitals.tsx (the isAppleDevice(...) branch) to prefer vitalsData.hardware_marketing_name but fall back to vitalsData.hardware_model when the marketing name is falsy (empty/undefined), ensuring the row never renders blank; locate the usage around the TooltipTruncatedText call in Vitals.tsx and change the ternary to a conditional that checks the marketing name before falling back to hardware_model.
🤖 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/hosts/details/cards/Vitals/Vitals.tsx`:
- Around line 350-358: The Apple-device branch renders hardware_marketing_name
unconditionally which can be empty; update the value passed to
TooltipTruncatedText in Vitals.tsx (the isAppleDevice(...) branch) to prefer
vitalsData.hardware_marketing_name but fall back to vitalsData.hardware_model
when the marketing name is falsy (empty/undefined), ensuring the row never
renders blank; locate the usage around the TooltipTruncatedText call in
Vitals.tsx and change the ternary to a conditional that checks the marketing
name before falling back to hardware_model.
In `@frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx`:
- Around line 193-199: The Apple-host display can be blank when
hardware_marketing_name is empty; update the TextCell value expression used in
HostTableConfig.tsx so that when isAppleDevice(cellProps.row.original.platform)
is true it renders cellProps.row.original.hardware_marketing_name ||
cellProps.cell.value (i.e. fall back to the raw model value) rather than only
hardware_marketing_name; reference the TextCell component and the isAppleDevice
check and replace the conditional branch to use the fallback.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 69854d5f-2e2e-4769-b102-5da15807721a
📒 Files selected for processing (14)
changes/20413-apple-hardware-marketing-namesfrontend/__mocks__/hostMock.tsfrontend/interfaces/host.tsfrontend/pages/hosts/ManageHostsPage/HostTableConfig.tsxfrontend/pages/hosts/details/cards/Vitals/Vitals.tests.tsxfrontend/pages/hosts/details/cards/Vitals/Vitals.tsxfrontend/utilities/constants.tsxorbit/changes/20413-apple-hardware-marketing-namesorbit/pkg/table/apple_hardware_info/apple_hardware_info_darwin.goorbit/pkg/table/extension_darwin.goschema/osquery_fleet_schema.jsonserver/fleet/apple_hardware_models.goserver/fleet/hostresponse.goserver/service/hosts.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Backend
hardware_marketing_namefor all hosts. If thehardware_modelisn't in the map, the rawhardware_modelis returned.Frontend
hardware_marketing_namefor the "Hardware model" on the Hosts and Host details pages. Other hosts still showhardware_model.osquery table
apple_hardware_infofor darwin with only themarketing_namecolumn. This uses the same Go map.Related issue: Resolves #20413
Checklist for submitter
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
fleetd/orbit/Fleet Desktop
runtime.GOOSis used as needed to isolate changesSummary by CodeRabbit