Repository navigation
mdm: A DEP device refresh keeps the MDM migration deadline - #1731
Merged
Merged
Conversation
Coverage Report for CI Build 43012115984Coverage increased (+0.001%) to 91.599%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
sebastian-zentral
force-pushed
the
20260924-mdm-dep-keep-migration-deadline
branch
4 times, most recently
from
October 1, 2026 09:46
e972253 to
a9af3d6
Compare
Apple leaves the MDM migration deadline out of the device details, even when the device has one. Zentral read an absent key as no deadline, so the refresh of a device, and the profile assignments that read the device back from the device details endpoint, cleared the deadline that the synchronization had just stored. The device lists, the fetch and the sync, report the deadline, and keep reporting it after it is removed in Apple Business Manager. Only a change of MDM server clears it. The deadline is updated from the keys of the payload now: a deadline in the payload is stored, a deleted operation clears it, because the device left the MDM server, and an absent key leaves it alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sebastian-zentral
force-pushed
the
20260924-mdm-dep-keep-migration-deadline
branch
from
November 11, 2026 11:27
a9af3d6 to
46f5ece
Compare
np5
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How Apple reports the MDM migration deadline
Found while testing against the Apple API:
POST /devices(Get Device Details) never includesmdm_migration_deadline, even when a deadline is set in ABM. The documentation doesn't say this: all three endpoints are documented as returning the sameDeviceobject, where the field is optional.POST /server/devices(fetch) andPOST /devices/sync(sync) report the deadline. They keep reporting it after it is removed in ABM, and only stop when the device changes MDM server.Problem
dep_device_update_dict()treated an absent key as no deadline. So every path that reads a device back throughget_devices()cleared the deadline the sync had just stored:apply_dep_device_updates)assign_dep_device_profilerefresh_dep_device(the refresh button)This happened on a tenant after a device was moved to Zentral with a migration deadline set in ABM. The sync stored the deadline at 10:45:01, and the default enrollment assignment cleared it at 10:45:02. A later sync stored the deadline again, after it had been changed in ABM, and the next refreshes cleared it again.
Change
dep_device_update_dict()updates the deadline from the keys of the payload, the same way it already handlesreleased_by_replacement. There's no flag, and the callers don't change:mdm_migration_deadlinein the payload: stored.op_typeisdeleted: cleared, because the device left the MDM server.A deadline removed in ABM stays in Zentral until the device changes MDM server, because Apple keeps reporting it. Zentral can't detect the removal. The changelog says so.
Tests
tests.mdm.test_dep,tests.mdm.test_management_dep_device,tests.mdm.test_api_dep_viewsandtests.mdm.models.test_dep_device_modelpass (110 tests), and ruff is clean.🤖 Generated with Claude Code