All problems

Firmware Fleet Versions Are Sorted Lexicographically

Level 2 · node · API · Lexicographic sorting of dotted numeric firmware versions

Scenario

A fictional device operations platform lists installed firmware versions per site. Versions consist of three nonnegative integer components, such as 2.9.0 and 2.10.0. The dashboard should list newer versions first, but string comparison places 2.9.0 ahead of 2.10.0. Inspect the repository, service, and controller flow.

Requirements

Compare major, minor, and patch components numerically in descending order. Preserve site isolation, registration format checks, device replacement on re-registration, and the existing API response shape.

Acceptance criteria

  • Version 2.10.0 sorts ahead of 2.9.0.
  • A greater major version sorts before a smaller one.
  • When major and minor versions match, compare patch components.
  • Devices belonging to different sites remain isolated.
  • Invalid version strings are rejected.
  • Registering the same device again replaces its version.