Skip to content

Count FMAs by slug#48783

Merged
cdcme merged 2 commits into
mainfrom
fix-48528-macos-software-numbers
Jul 6, 2026
Merged

Count FMAs by slug#48783
cdcme merged 2 commits into
mainfrom
fix-48528-macos-software-numbers

Conversation

@cdcme

@cdcme cdcme commented Jul 6, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #48528

This keys the count, pagination, and the frontend row-combining on the app's slug token (the prefix before /, shared across an app's platform entries but distinct across apps). The count now equals the rows shown in every view (macOS, Windows, All), and name-colliding apps stay as separate rows.

Checklist for submitter

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.

Testing

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

For unreleased bug fixes in a release candidate, one of:

  • Confirmed that the fix is not expected to adversely impact load test results

Summary by CodeRabbit

  • New Features

    • Software listings now group platform-specific installers into a single app row based on the app identifier, improving how macOS and Windows entries appear together.
  • Bug Fixes

    • Apps with the same display name but different identifiers now stay separate instead of being merged incorrectly.
    • List counts and pagination now match the combined app view more accurately across the software pages.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.01%. Comparing base (158a3d0) to head (2ef0357).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
server/datastore/mysql/maintained_apps.go 75.00% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #48783      +/-   ##
==========================================
- Coverage   68.02%   68.01%   -0.01%     
==========================================
  Files        3681     3685       +4     
  Lines      233960   234094     +134     
  Branches    12457    12333     -124     
==========================================
+ Hits       159145   159216      +71     
- Misses      60496    60562      +66     
+ Partials    14319    14316       -3     
Flag Coverage Δ
backend 69.68% <75.00%> (+0.01%) ⬆️
frontend 58.85% <100.00%> (-0.11%) ⬇️

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.

@cdcme cdcme marked this pull request as ready for review July 6, 2026 18:17
@cdcme cdcme requested review from a team as code owners July 6, 2026 18:17
Copilot AI review requested due to automatic review settings July 6, 2026 18:17

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

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

This PR fixes a mismatch between the Fleet-maintained apps “items” count and the number of rows rendered in the UI by keying pagination, counts, and frontend row-combining on the app’s slug token (the slug prefix before /, shared across platform variants but unique across apps).

Changes:

  • Updated MySQL listing logic to count and paginate by distinct slug token (instead of per-platform rows or by name).
  • Updated frontend table row-combining to group by slug token (preventing name-colliding apps from collapsing into one row).
  • Added/updated backend + frontend tests to lock in the new semantics (including shared-name apps like “Gemini”).

Reviewed changes

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

Show a summary per file
File Description
server/service/integration_enterprise_test.go Updates integration expectations so API count matches distinct app tokens rather than raw platform rows.
server/datastore/mysql/maintained_apps.go Counts and paginates by slug token; selects all platform rows for tokens on the current page.
server/datastore/mysql/maintained_apps_test.go Updates pagination/count assertions and adds a regression test for apps sharing the same name.
frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppsTable/FleetMaintainedAppsTable.tsx Combines API rows into UI rows by slug token (not name) and exports helper for testing.
frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppsTable/FleetMaintainedAppsTable.tests.tsx Adds unit tests for token-based combining and shared-name apps.
frontend/interfaces/software.ts Adds required slug field to IFleetMaintainedApp.
frontend/components/TableContainer/DataTable/InstallerActionCell/InstallerActionCell.tests.tsx Updates test fixtures to include required slug.
frontend/mocks/softwareMock.ts Updates maintained-app mock to include required slug.

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

Comment thread server/datastore/mysql/maintained_apps.go
Comment thread server/datastore/mysql/maintained_apps.go
@coderabbitai

coderabbitai Bot commented Jul 6, 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: fa2fea56-16f7-47c7-9e12-3d3976e26299

📥 Commits

Reviewing files that changed from the base of the PR and between 51f1e85 and 2ef0357.

📒 Files selected for processing (8)
  • frontend/__mocks__/softwareMock.ts
  • frontend/components/TableContainer/DataTable/InstallerActionCell/InstallerActionCell.tests.tsx
  • frontend/interfaces/software.ts
  • frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppsTable/FleetMaintainedAppsTable.tests.tsx
  • frontend/pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppsTable/FleetMaintainedAppsTable.tsx
  • server/datastore/mysql/maintained_apps.go
  • server/datastore/mysql/maintained_apps_test.go
  • server/service/integration_enterprise_test.go

Walkthrough

This PR adds a required slug field to IFleetMaintainedApp and updates mocks/tests to include it. combineAppsByPlatform on the frontend now groups apps by a token derived from slug (portion before /) instead of by name, and is exported. The MySQL datastore's ListAvailableFleetMaintainedApps counting and pagination logic is changed to use distinct slug-token grouping (via SUBSTRING_INDEX) instead of distinct name/id, so apps sharing a display name but differing in slug are treated as separate entries. Associated datastore and integration tests are updated to reflect token-based counting and pagination, and new tests cover apps with shared names but distinct slugs.

Possibly related PRs

  • fleetdm/fleet#47615: Introduced the original combineAppsByPlatform/ListAvailableFleetMaintainedApps pagination and grouping logic that this PR modifies from name-based to slug-token-based grouping.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: counting fleet maintained apps by slug token, and it's concise and specific.
Description check ✅ Passed The description includes the related issue, a clear change summary, and relevant testing/checklist items from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 fix-48528-macos-software-numbers

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.44.1)
server/service/integration_enterprise_test.go

ast-grep timed out on this file


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.

@cdcme cdcme merged commit b3c2a63 into main Jul 6, 2026
49 checks passed
@cdcme cdcme deleted the fix-48528-macos-software-numbers branch July 6, 2026 21:06
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.

MacOS software number of items within table does not match total Items number

4 participants