Skip to content

Fleet UI: Hide empty host summary card on Free-tier Android hosts#49848

Merged
RachelElysia merged 4 commits into
mainfrom
49441-android-free-empty-card
Jul 23, 2026
Merged

Fleet UI: Hide empty host summary card on Free-tier Android hosts#49848
RachelElysia merged 4 commits into
mainfrom
49441-android-free-empty-card

Conversation

@RachelElysia

@RachelElysia RachelElysia commented Jul 23, 2026

Copy link
Copy Markdown
Member

Issue

Resolves #49441

Description

On Fleet Free, the host details page renders an empty card above the Vitals section for hosts where every summary section is gated off. The reporter flagged this for Android, but the same shape hits iOS and iPadOS too:

  • Status / Issues / Bootstrap package — hidden for Android and for iOS/iPadOS (!isAndroidHost, !isIosOrIpadosHost)
  • Fleet (team) / Scheduled maintenance — hidden on Free (!isPremiumTier)
  • OS settings — only shows when the host actually has settings

When none apply, the wrapper still renders empty. Hoisted each section's visibility into named show* booleans and short-circuit to <></> when none are true, so the card is skipped instead of rendering an empty shell. The rendering conditions themselves are unchanged.

Screenshot mock returning null instead of the card

Screenshot 2026-07-23 at 12 28 07 PM

Testing

  • Added parametrized HostSummary tests asserting the card renders nothing for Free-tier Android, iOS, and iPadOS hosts with no OS settings
  • yarn test --testPathPattern=HostSummary — 12/12 pass
  • make lint-js — 0 errors in touched files
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an empty summary card appearing above the Vitals section on Fleet Free host details pages.
    • Summary cards now remain hidden when no relevant content is available for Android, iOS, and iPadOS hosts.

On Free tier, every child of the summary card is hidden for Android hosts
unless the host has OS settings, leaving an empty card above Vitals.
Hoist the section visibility into named booleans and skip rendering the
Card wrapper entirely when nothing inside would render.
Copilot AI review requested due to automatic review settings July 23, 2026 18:35

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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

This PR prevents the Host details “Summary” card from rendering as an empty shell when all of its child sections are gated off (notably on Fleet Free + Android), addressing the empty card above the Vitals section reported in #49441.

Changes:

  • Hoists each section’s render condition into show* booleans and returns early when none would render, skipping the <Card> entirely.
  • Updates the JSX to use the new show* booleans for readability while keeping the underlying conditions unchanged.
  • Adds a React Testing Library test to assert the summary card renders nothing for a Free-tier Android host with no OS settings.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx Adds show* booleans and early return to avoid rendering an empty summary card.
frontend/pages/hosts/details/cards/HostSummary/HostSummary.tests.tsx Adds coverage to ensure the summary card does not render for Free-tier Android hosts when empty.
changes/fix-49441-android-free-empty-summary-card Release note / change entry (content excluded from review by policy).
Files excluded by content exclusion policy (1)
  • changes/fix-49441-android-free-empty-summary-card

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

…ver iOS/iPadOS

- Drop trailing issue ref from the "hide empty card" comment (git blame is the audit trail).
- Replace the two "---" literals with DEFAULT_EMPTY_CELL_VALUE from utilities/constants.
- Parametrize the empty-card test over Android, iOS, and iPadOS — the fix covers all three, not just Android.
Copilot AI review requested due to automatic review settings July 23, 2026 18:40
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.91%. Comparing base (f72de68) to head (249fbee).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...es/hosts/details/cards/HostSummary/HostSummary.tsx 93.10% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #49848   +/-   ##
=======================================
  Coverage   67.91%   67.91%           
=======================================
  Files        3905     3905           
  Lines      249669   249682   +13     
  Branches    13179    13190   +11     
=======================================
+ Hits       169557   169567   +10     
- Misses      64837    64840    +3     
  Partials    15275    15275           
Flag Coverage Δ
frontend 60.40% <93.10%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Files excluded by content exclusion policy (1)
  • changes/fix-49441-android-free-empty-summary-card

Rename the changes file and update the line to reflect that the fix
also covers Free-tier iOS/iPadOS hosts with no OS settings, not just
Android.
Copilot AI review requested due to automatic review settings July 23, 2026 18:47
- Switch the empty-return in HostSummary from <></> to null (codebase
  convention: 171 uses of `return null` vs 25 of `return <></>`).
- Widen the return type to JSX.Element | null accordingly.
- Type the parametrized empty-card test tuple as [string, HostPlatform, string]
  so the platform string is checked against HostPlatform, dropping the
  `as "android" | "ios" | "ipados"` cast.

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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Files excluded by content exclusion policy (1)
  • changes/fix-49441-free-tier-empty-summary-card

Copilot AI review requested due to automatic review settings July 23, 2026 18:52

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.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Files excluded by content exclusion policy (1)
  • changes/fix-49441-free-tier-empty-summary-card

@RachelElysia
RachelElysia marked this pull request as ready for review July 23, 2026 19:29
@RachelElysia
RachelElysia requested a review from a team as a code owner July 23, 2026 19:29
@RachelElysia

Copy link
Copy Markdown
Member Author

Self-review

Small, well-scoped fix. Behavior is preserved for every populated case; only the empty shell is skipped. Tests cover Free-tier Android, iOS, and iPadOS. No must-fixes.

Must fix

None.

Should fix

None.

Nit

  1. Redundant guard on showOsSettings renderHostSummary.tsx:263

    {showOsSettings && derivedHostSettings && (

    showOsSettings already implies !!derivedHostSettings && derivedHostSettings.length > 0, but TS narrowing doesn't carry across the hoisted boolean, so the second derivedHostSettings && is here just to satisfy the compiler when passing it into <OSSettingsIndicator profiles={derivedHostSettings}>. Fine as-is; extracting to const osSettingsToShow = showOsSettings ? derivedHostSettings : null would read a hair cleaner but isn't worth another round-trip.

  2. Redundant guard on showBootstrapPackage renderHostSummary.tsx:276

    {showBootstrapPackage && bootstrapPackageData?.status && (

    Same story — showBootstrapPackage already encodes !!bootstrapPackageData?.status. TS just doesn't narrow the optional chain. Non-blocking.

Nice things worth calling out

  • Swapped the two open-coded "---" literals for DEFAULT_EMPTY_CELL_VALUE — the TODO - refactor normalizeEmptyValues pattern comment stayed put (not this PR's job to fix).
  • Return type narrowed to JSX.Element | null — both call sites (HostDetailsPage.tsx:1516, DeviceUserPage.tsx:789) render it as a standalone grid item, so null is safe and doesn't leave an orphan gap in the display: grid; gap: $pad-medium panel.
  • Parametrized it.each covers all three affected platforms without duplication.
  • Comment on the early return explains the why (empty shell above Vitals) — the context that would otherwise get lost.

Test coverage

Adequate. The new Empty card describe block asserts toBeEmptyDOMElement() for all three gated platforms on Free tier. Existing tests still cover the populated paths (Premium, macOS, issues present, bootstrap package present), so the render branches are exercised on both sides of the new if (...) return null.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c118075c-b640-44b6-aae0-a02a8af21841

📥 Commits

Reviewing files that changed from the base of the PR and between f72de68 and 249fbee.

📒 Files selected for processing (3)
  • changes/fix-49441-free-tier-empty-summary-card
  • frontend/pages/hosts/details/cards/HostSummary/HostSummary.tests.tsx
  • frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx

Walkthrough

Updated HostSummary to compute section visibility and return no DOM when a Free-tier Android, iOS, or iPadOS host has no summary content. Empty-value checks now use the shared sentinel, and section rendering follows the new visibility flags. Parameterized tests cover the affected platforms, with a release note documenting the fix.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: hiding the empty host summary card on Free-tier Android hosts.
Description check ✅ Passed The description covers the issue, behavior change, and testing, though it omits the template's checklist structure.
Linked Issues check ✅ Passed The PR hides the empty summary card for Free-tier Android hosts and extends the fix to iOS/iPadOS without changing visibility rules.
Out of Scope Changes check ✅ Passed The only extra change is a release note and tests, which are in scope for this UI fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 49441-android-free-empty-card

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.

@RachelElysia
RachelElysia merged commit 9cfd907 into main Jul 23, 2026
28 of 29 checks passed
@RachelElysia
RachelElysia deleted the 49441-android-free-empty-card branch July 23, 2026 19:54
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.

Host details — empty card above Vitals for Android hosts on Free tier

3 participants