Skip to content

Fix My device software list appending macos_applications param on pagination#48145

Merged
dantecatalfamo merged 2 commits into
mainfrom
worktree-fix-macos-applications-mydevice
Jun 24, 2026
Merged

Fix My device software list appending macos_applications param on pagination#48145
dantecatalfamo merged 2 commits into
mainfrom
worktree-fix-macos-applications-mydevice

Conversation

@dantecatalfamo

@dantecatalfamo dantecatalfamo commented Jun 23, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #39017
Related issue: Resolves #47846

Follow up for #46223

Summary

PR #46223 introduced a macos_applications query param for the host details software list, controlled by an /Applications filter dropdown. On the My device > Software tab, that dropdown is intentionally hidden — but macosApplicationsFilter was still computed as defined (true) for macOS devices, so paginating the list appended macos_applications=true to the URL.

The fix gates macosApplicationsFilter on !isMyDevicePage at its source in HostSoftware.tsx, leaving it undefined on the My device page. This is a single root-cause change: it stops the param from being appended to the URL on pagination, sent to the API, or otherwise leaking into a page that has no filter control.

Checklist for submitter

  • 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

Added two regression tests in HostSoftwareTable.tests.tsx: pagination appends macos_applications when the filter is set (host details page), and does not append it when the filter is undefined (My device page).

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes

    • Fixed pagination in My device > Software so it no longer incorrectly adds the macos_applications query parameter when the current page shouldn’t use the macOS Applications filter.
  • Tests

    • Added/updated pagination tests to cover macOS versus non-macOS and My device page behavior, verifying whether the macos_applications parameter is included in navigation URLs.

…ination

The macos_applications query param (added in #46223 for the host details
page filter) was being appended to the URL when paginating the My device
software list, even though that page has no /Applications filter dropdown.

Gate macosApplicationsFilter on !isMyDevicePage at its source so it stays
undefined on the My device page, preventing the param from being sent to
the API or appended to the URL.

Resolves #39017
@dantecatalfamo dantecatalfamo requested a review from a team as a code owner June 23, 2026 23:19
Copilot AI review requested due to automatic review settings June 23, 2026 23:19

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

@coderabbitai

coderabbitai Bot commented Jun 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

Run ID: 6a627bae-1022-4aac-89aa-69eda5401d7f

📥 Commits

Reviewing files that changed from the base of the PR and between b39fa48 and e3a67b6.

📒 Files selected for processing (1)
  • frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tests.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tests.tsx

Walkthrough

The fix addresses pagination on the My device > Software tab incorrectly appending a macos_applications query parameter to the URL. In HostSoftware.tsx, the macosApplicationsFilter derivation is updated to require both !isMyDevicePage and isMacOS(platform); when either condition is false the value is now undefined, preventing the parameter from being sent. Two new tests in HostSoftwareTable.tests.tsx cover the corrected behavior: one confirms macos_applications=true is present in the URL after pagination on a host details macOS page with the filter active, and the other confirms the parameter is absent when paginating on a My Device page.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main bug fix: preventing the macos_applications parameter from being appended during pagination on the My device software tab.
Description check ✅ Passed The description comprehensively covers the issue, root cause, solution, testing approach, and related issues. The author completed the relevant checklist items (changes file, automated tests, QA) and provided clear context about the follow-up to PR #46223.
Linked Issues check ✅ Passed The PR successfully addresses both linked issues: #39017 (macOS filter on host details page) and #47846 (inconsistent My Device > Software results). The fix gates macosApplicationsFilter on !isMyDevicePage, preventing parameter leakage on the My device page while preserving filter functionality on host details pages. Two regression tests verify both scenarios.
Out of Scope Changes check ✅ Passed All changes directly address the linked issues. Modifications to HostSoftware.tsx, HostSoftwareTable.tests.tsx, and the changes file are narrowly scoped to fixing the macos_applications parameter handling, with no unrelated alterations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 worktree-fix-macos-applications-mydevice

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.

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

Fixes an unintended macos_applications=true query param being appended during pagination on My device > Software for macOS devices, even though that page intentionally hides the /Applications filter UI. The fix ensures the filter is only computed/applied on the host details software page.

Changes:

  • Gate macosApplicationsFilter so it’s undefined on the My device page (prevents URL/API leakage during pagination).
  • Add regression tests covering pagination URL behavior when the filter is set vs. undefined.
  • Add a changes/ entry for the user-visible fix (content not visible due to repo policy).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
frontend/pages/hosts/details/cards/Software/HostSoftware.tsx Gates macosApplicationsFilter on !isMyDevicePage so My device pagination doesn’t append macos_applications.
frontend/pages/hosts/details/cards/Software/HostSoftwareTable/HostSoftwareTable.tests.tsx Adds regression tests verifying pagination appends/omits macos_applications appropriately.
changes/39017-mydevice-macos-applications-query-param Release note entry (diff excluded by policy).
Files excluded by content exclusion policy (1)
  • changes/39017-mydevice-macos-applications-query-param

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

Comment on lines +16 to +23
// Server-side pagination only renders when a full page of rows is present
// (DEFAULT_PAGE_SIZE = 20) and there are further results.
const fullPageWithNextResults = createMockGetHostSoftwareResponse({
software: Array.from({ length: 20 }, (_, index) =>
createMockHostSoftware({ id: index + 1 })
),
meta: { has_next_results: true, has_previous_results: false },
});
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.32%. Comparing base (264036b) to head (e3a67b6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ages/hosts/details/cards/Software/HostSoftware.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #48145   +/-   ##
=======================================
  Coverage   67.32%   67.32%           
=======================================
  Files        3657     3657           
  Lines      231233   231233           
  Branches    12062    12062           
=======================================
+ Hits       155676   155687   +11     
+ Misses      61590    61579   -11     
  Partials    13967    13967           
Flag Coverage Δ
frontend 58.44% <0.00%> (+0.03%) ⬆️

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.

Use a fresh createMockRouter() per pagination test and assert on its
replace mock directly, instead of calling .mockClear() on the shared
router (typed as LocationFunction, so .mockClear() failed tsc).
data: fullPageWithNextResults,
});

fireEvent.click(screen.getByRole("button", { name: /next/i }));

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.

we're moving away from fireEvent and using user.click, not worth blocking

@dantecatalfamo dantecatalfamo merged commit 0e3bc85 into main Jun 24, 2026
26 checks passed
@dantecatalfamo dantecatalfamo deleted the worktree-fix-macos-applications-mydevice branch June 24, 2026 17:36
JordanMontgomery pushed a commit that referenced this pull request Jun 26, 2026
…ination (#48145)

**Related issue:** Resolves #39017
Related issue: Resolves #47846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants