Skip to content

Follow-up fix for FMA counts - #48818

Merged
cdcme merged 1 commit into
mainfrom
fix-48528-fma-count-per-platform
Jul 7, 2026
Merged

cdcme merged 1 commit into
mainfrom
fix-48528-fma-count-per-platform

Conversation

@cdcme

@cdcme cdcme commented Jul 6, 2026 •

Copy link
Copy Markdown
Member

Related issue: Resolves #48528

Follow-up to #48783, which changed the Fleet-maintained apps "items" count from per-platform entries to per-app, dropping it from 1,263 to 1,023. This restores the count to COUNT(DISTINCT fma.id): macOS and Windows entries are separately installable (each its own Add button), so each counts (1,263 / 960 macOS / 303 Windows). The token-based row-combining and pagination from #48783 are kept.

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

  • Bug Fixes
    • Corrected available-app counts in listings so pagination totals now match what users can actually add.
    • Improved pagination consistency for apps with multiple platform variants, reducing confusion where totals did not align with visible entries.
    • Updated team-based filtering so already-added apps are excluded more accurately from available results.

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

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

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 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: 63bbe249-dc74-409c-8703-7e4725869d05

📥 Commits

Reviewing files that changed from the base of the PR and between e005245 and b895830.

📒 Files selected for processing (3)
  • server/datastore/mysql/maintained_apps.go
  • server/datastore/mysql/maintained_apps_test.go
  • server/service/integration_enterprise_test.go

Walkthrough

This PR corrects the TotalResults count returned by ListAvailableFleetMaintainedApps in the MySQL datastore. The filtered count query now uses COUNT(DISTINCT fma.id) to count individual installable platform entries (e.g., macOS and Windows rows counted separately) instead of COUNT(DISTINCT SUBSTRING_INDEX(fma.slug, '/', 1)), which previously collapsed platform-specific rows sharing the same app token into a single count. Inline comments were updated to clarify pagination-by-token versus count-by-platform-entry semantics. Corresponding datastore unit tests and an enterprise integration test were updated to assert the new, higher TotalResults/Count values matching per-platform-entry counting.

Possibly related PRs

  • fleetdm/fleet#47615: Updates the same maintained-apps listing pagination/count logic and aligns TotalResults/count with platform-row semantics.
  • fleetdm/fleet#47951: Modifies fleetMaintainedAppsTeamJoin used by the same ListAvailableFleetMaintainedApps listing, coupling with the count behavior changed here.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title is concise and accurately describes the follow-up fix to FMA counts.
Description check ✅ Passed Description covers the related issue, checklist items, and testing, and is mostly complete.
Linked Issues check ✅ Passed The count change restores per-platform item totals and matches the macOS mismatch reported in #48528.
Out of Scope Changes check ✅ Passed The edits are confined to FMA count logic and tests, with no evident unrelated changes.
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 fix-48528-fma-count-per-platform

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.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.03%. Comparing base (b3c2a63) to head (b895830).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
server/datastore/mysql/maintained_apps.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #48818   +/-   ##
=======================================
  Coverage   68.03%   68.03%           
=======================================
  Files        3687     3687           
  Lines      234180   234190   +10     
  Branches    12485    12485           
=======================================
+ Hits       159319   159335   +16     
+ Misses      60545    60541    -4     
+ Partials    14316    14314    -2     
Flag Coverage Δ
backend 69.69% <0.00%> (+<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.

Pull request overview

This PR adjusts the Fleet-maintained apps (FMA) listing “count” semantics to count installable platform entries (distinct fleet_maintained_apps.id) instead of counting distinct app tokens (slug prefix), while keeping the token-based row-combining and pagination behavior introduced in #48783.

Changes:

  • Update MySQL datastore count query for available FMAs to COUNT(DISTINCT fma.id) (platform entries).
  • Update datastore and integration tests to expect the new count semantics.
  • Update inline test/documentation comments to describe the new meaning of “count”.

Reviewed changes

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

File Description
server/service/integration_enterprise_test.go Updates integration test expectation/documentation so response count equals number of returned platform rows for the unfiltered fixture.
server/datastore/mysql/maintained_apps.go Changes the filtered count query from distinct token to distinct fma.id and updates function-level documentation accordingly.
server/datastore/mysql/maintained_apps_test.go Updates unit tests and comments to reflect platform-entry counting instead of token counting.

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

@cdcme cdcme assigned jkatz01 and unassigned allenhouchins Jul 7, 2026
@cdcme
cdcme merged commit 7248356 into main Jul 7, 2026
46 of 47 checks passed
@cdcme
cdcme deleted the fix-48528-fma-count-per-platform branch July 7, 2026 14:30
cdcme added a commit that referenced this pull request Jul 7, 2026
**Related issue:** Resolves #48528

Follow-up to #48783, which changed the Fleet-maintained apps "items"
count from per-platform entries to per-app, dropping it from 1,263 to
1,023. This restores the count to `COUNT(DISTINCT fma.id)`: macOS and
Windows entries are separately installable (each its own Add button), so
each counts (1,263 / 960 macOS / 303 Windows). The token-based
row-combining and pagination from #48783 are kept.

  # Checklist for submitter

- [x] 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

  - [x] Added/updated automated tests
  - [x] QA'd all new/changed functionality manually

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

- [x] Confirmed that the fix is not expected to adversely impact load
test results

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Corrected available-app counts in listings so pagination totals now
match what users can actually add.
* Improved pagination consistency for apps with multiple platform
variants, reducing confusion where totals did not align with visible
entries.
* Updated team-based filtering so already-added apps are excluded more
accurately from available results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
cdcme added a commit that referenced this pull request Jul 7, 2026
Cherry-pick of #48783 and #48818 into the RC branch.

This branch was previously deployed

1 inactive deployment
Docker Hub — b895830e Deployed Jul 6, 2026 by cdcme via publish #95999
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