Skip to content

Drift takes the smallest component's drift where the specification adds them #16

Open
51Degrees/device-detection-java
#614

Description

@jwrosewell

What happens

DeviceDataHashDefault.getDriftInternal returns the smallest drift among the native results, which hold one result per component, starting from Integer.MAX_VALUE (DeviceDataHashDefault.java#L178-L186).

The specification's match metrics table describes Drift as the total difference in character positions (device-detection-on-premise.md), and 51Degrees/specifications#39 says it in full: the drift of every component's result added together, never the largest or smallest alone. The C++ results add them (ResultsHash.cpp#L183-L192), and so do Go and the Node, PHP and Python wrappers, so the same evidence gives a smaller Drift here than in those implementations whenever more than one component drifted. Difference, Iterations and MatchedNodes in the same class already add the results.

What to change

Add the results' drift, as getDifferenceInternal does, and cover it with a test that gives two mocked native results different drifts and reads getDrift.

Activity

  1. added theissue type on Oct 26, 2026
  2. oleksandrlazarenko-pi commented on Nov 11, 2026

    @oleksandrlazarenko-pi
    Contributor

    Reviewed and approved. The fix (#60, merged into rc) is correct; nothing critical found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions