Windows MDM osquery-perf fix (#44152)

The previous fix #43940 was incomplete and caused a regression. This is
the complete fix.

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

* **Bug Fixes**
* Resolved a validation error occurring during Windows mobile device
synchronization by preventing unnecessary status-only messages from
being sent to the server.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Victor Lyuboslavsky
2026-04-27 12:15:11 -05:00
committed by GitHub
co-authored by Copilot
parent fb19bd48b6
commit 65b4da9725
+12
View File
@@ -302,6 +302,18 @@ func (c *TestWindowsMDMClient) shouldAuth(req *fleet.SyncML) (bool, *string) {
}
func (c *TestWindowsMDMClient) SendResponse() (map[string]fleet.ProtoCmdOperation, error) {
// A real Windows client does not POST a message that contains only a SyncHdr Status ack and
// no protocol commands. Per [MS-MDM] §2.2.7.8 (Status):
// "when a client creates a message containing only a successful Status in a SyncHdr,
// the entire message MUST NOT be sent."
// (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-mdm/36b1a4d9-fd93-48ce-b865-6a9d396c52a4)
// This is the same section that limits Status-on-Status to auth-renegotiation edge cases, so
// when Fleet's response contained only <Status> acks, the client has nothing to send back.
// Fleet also rejects such a body with "invalid SyncML body: no SyncML protocol commands"
if len(c.queuedCommandResponses) == 0 {
return nil, nil
}
// Get SessionID
sessionID, err := c.lastManagementResp.GetSessionID()
if err != nil {