Skip to content

Log orphan MDM command references instead of returning 500#40877

Merged
nulmete merged 3 commits intomainfrom
nulmete/500-host-details-orphan-refs
Mar 9, 2026
Merged

Log orphan MDM command references instead of returning 500#40877
nulmete merged 3 commits intomainfrom
nulmete/500-host-details-orphan-refs

Conversation

@nulmete
Copy link
Copy Markdown
Member

@nulmete nulmete commented Mar 3, 2026

Related issue: Resolves #36682

The actual fix would be to remove the host_mdm_actions record that contains the orphan lock_ref mentioned in the issue.
I'm not sure what the root cause is, but I think setting up some monitoring on the logs I added should help determining that.

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

@nulmete nulmete requested a review from a team as a code owner March 3, 2026 19:21

// for ADE enrolled iDevices, we don't advance to "locked" until we have location data
if hostPlatform == "ios" || hostPlatform == "ipados" {
if status.LockMDMCommand != nil && (hostPlatform == "ios" || hostPlatform == "ipados") {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guarding against the orphan case where cmd is nil (without this, LocationPending could be incorrectly set to true for iDevices even when no lock command exists)

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.36%. Comparing base (f5f26b8) to head (9e9f83a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/datastore/mysql/scripts.go 53.84% 1 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #40877      +/-   ##
==========================================
+ Coverage   66.34%   66.36%   +0.01%     
==========================================
  Files        2477     2473       -4     
  Lines      198425   198140     -285     
  Branches     8780     8652     -128     
==========================================
- Hits       131649   131488     -161     
+ Misses      54877    54753     -124     
  Partials    11899    11899              
Flag Coverage Δ
backend 68.14% <60.00%> (+<0.01%) ⬆️

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

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

@nulmete nulmete merged commit 03f7d2b into main Mar 9, 2026
48 checks passed
@nulmete nulmete deleted the nulmete/500-host-details-orphan-refs branch March 9, 2026 12: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.

5XX on /api/v1/fleet/hosts/:id (single host)

2 participants