Skip to content

Investigate inconsistencies with host_emails ordering #48631

Description

@juan-fdz-hawa

Fleet has two code paths that turn the same host_emails rows into a device_mapping array, and today they
disagree in the ordering used:

Path A — sorted (ORDER BY email, source) via listHostDeviceMappingDB → ListHostDeviceMapping. This
serves:

  • GET /hosts/{id}/device_mapping — the host details page (hosts.go:2240)
  • PUT /hosts/{id}/device_mapping — returns the updated list after adding a custom email (hosts.go:2357)
  • GET /device/{token}/device_mapping — the end-user "My Device" page (devices.go:420)

Path B — unordered (GROUP_CONCAT with no ORDER BY) via the list query. This serves:

  • GET /hosts?device_mapping=true — the Hosts table (hosts.go:1311)
  • GET /labels/{id}/hosts?device_mapping=true — a label's host list (labels.go:1237)
  • GET /hosts/report — the CSV export (same query)

We need to decide whether this is something worth fixing or if its inconsequential

Metadata

Metadata

Assignees

No one assigned

    Labels

    :productProduct Design department (shows up on 🦢 Drafting board)bugSomething isn't working as documented

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    📨 Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions