target / grease

Automated Scripting Engine For the Modern Age
https://grease.readthedocs.io
MIT License
42 stars 22 forks source link

Guaranteed order in deduplication dictionary hashes #98

Closed CameronJHall closed 5 years ago

CameronJHall commented 5 years ago

GREASE Developer Pull Request Checklist Guaranteed order in deduplication dictionary hashes

USE THIS TEMPLATE FOR YOUR PULL REQUEST!

Purpose

In deduplication, the order of items in the dictionary to be hashed is not guaranteed. This PR fixes that by turning an unsorted dictionary into an ordered tuple before hashing.

Expected Outcome

Hashes will be consistent regardless of the ordering of the incoming dictionary in deduplication.

Checklist

CameronJHall commented 5 years ago

It's also worth noting that this only effects T1 deduplication so there is almost no cost to migrate from 2.4.x to 2.5.0.

CameronJHall commented 5 years ago

using $addToSet instead of $push when adding prototypes to roles in mongo prevents multiple of the same prototype getting logged even if there is only a singe instance on the grease execution server itself.