Skip to content

flaky: #226 Hash Stats adopters sort E2E — server sorts multiByteNodes on packets only, ties come out in random order #256

Description

@dborup

test-issue-226-hash-stats-sort-e2e.js fails intermittently in CI with not the server order. It failed on attempts 1 and 2 of run 37293748200 for #252, then passed on attempt 3. The PR it ran on changes only an unrelated E2E file.

Cause

computeAnalyticsHashSizes in cmd/server/store.go (master d05b0db5, around lines 9072–9093) builds multiByteNodes by ranging over the byNode map. It then sorts on packets only:

sort.Slice(multiByteNodes, func(i, j int) bool {
    return multiByteNodes[i]["packets"].(int) > multiByteNodes[j]["packets"].(int)
})

Go map iteration order is random, and sort.Slice is not stable. Nodes with equal packet counts therefore come out in a different order on each recompute of the analytics cache.

The test reads serverOrder from the API once (line ~135). It then compares the rows of later page loads against it (lines ~146 and ~211). If the cache recomputes in between and there are ties, the comparison fails, although nothing is wrong with the page.

This is also a small UX issue: the default ("server order") adopters table can reshuffle tied rows between visits.

Expected

  • Server: a deterministic order. Sort by packets descending, then by pubkey ascending as a tie-breaker. A Go unit test with tied counts should give the same order across repeated computes.
  • Test (optional extra hardening): the E2E takes the expected order from the same /api/analytics/hash-sizes response the page rendered, or asserts only on rows with distinct packet counts.
  • Check the other analytics lists built from map iteration and sorted on a single key, and fix them in the same way if they are shown in "server order".

Evidence

Activity

  1. added
    bugSomething isn't working
    type:bugSomething broken
    on Oct 5, 2026
  2. added a commit that references this issue on Oct 5, 2026
  3. dborup commented on Oct 5, 2026

    @dborup
    OwnerAuthor

    Fixed by #261 (merged as 5e889a88).

  4. dborup commented on Oct 5, 2026

    @dborup
    OwnerAuthor

    Reopened: the fix in #261 was reverted by #275 (see the correction on #261). It stays open until #261 is re-applied or replaced.

  5. reopened this on Oct 5, 2026
  6. added a commit that references this issue on Oct 6, 2026
  7. dborup commented on Oct 6, 2026

    @dborup
    OwnerAuthor

    Fixed by #293 (merged as 4f1de049), which re-applies #261.

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

    bugSomething isn't workingtype:bugSomething broken

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions