Skip to content
Snippets Groups Projects

collect_integration: Order the "ignore" items

Merged Mathieu Bridon requested to merge bochecha/ujson-set into master

We currently return the "ignore" items as a set, to remove duplicates in the underlying collection.

The goal of returning a set was also to avoid ordering issues: since sets aren't ordered, comparing two sets containing the same elements will always return True no matter the order of the elements. This way, cache keys would match no matter the order of the items in the "ignore" collection.

However, the set is then serialized as JSON further down in Buildstream.

Sets don't exist in JSON though, so ujson actually transforms it into a list. Lists are ordered, and that means cache key comparison depends on the order of the items once serialized.

Sorting the set before returning it achieves the desired result to have identical cache keys computed for 2 ignore lists which only differ in the order of their items.

Incidentally, this fixes a second issue, which is what was originally observed: the yet-unreleased ujson 2.0 does not serialize sets any more, intentionally, considering that to be an input error as sets don't exist in JSON:

https://github.com/esnme/ultrajson/commit/53f85b1bd6e4f27a3e4cdc605518c48a6c7e7e9e

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading