You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently ran into an issue caused by two things happening at the same time: 1. forgetting to add :requires, 2. (keys norm-map) returning keys in a non-deterministic order.
What happened was that we added a new norm to our schema file, and suddenly tests in CI started to break. The reason for this was a much earlier norm without :requires and the fact that when we added a new key to the norm-map it seemed to trigger Clojure to change the internal order of the map, thus (keys norm-map) returned the keys in an order that provoked this issue.
(Just to note that this isn't really a bug in conformity, but our mistake of forgetting to add the :requires)
To prevent this happening in the future, I was planning to avoid the non-deterministic behavior by using the 3-arity version of the ensure-conforms and pass a sequence of norm-names, assuming that the norms are then transacted deterministically in the order or norm-names seq. However, the docstring of the norm-names doesn't mention anything about the order:
norm-names (optional) A collection of names of norms to conform to.
Will use keys of norm-map if not provided.
Question: By reading the code I can see that norms are reduced in the order of norm-names, but is this a behaviour I can rely on?
Change request: ☝️ If yes, would it be ok to add that in the docstring?
The text was updated successfully, but these errors were encountered:
Hi,
We recently ran into an issue caused by two things happening at the same time: 1. forgetting to add
:requires
, 2.(keys norm-map)
returning keys in a non-deterministic order.What happened was that we added a new norm to our schema file, and suddenly tests in CI started to break. The reason for this was a much earlier norm without
:requires
and the fact that when we added a new key to the norm-map it seemed to trigger Clojure to change the internal order of the map, thus(keys norm-map
) returned the keys in an order that provoked this issue.(Just to note that this isn't really a bug in conformity, but our mistake of forgetting to add the
:requires
)To prevent this happening in the future, I was planning to avoid the non-deterministic behavior by using the 3-arity version of the
ensure-conforms
and pass a sequence ofnorm-names
, assuming that the norms are then transacted deterministically in the order ornorm-names
seq. However, the docstring of thenorm-names
doesn't mention anything about the order:Question: By reading the code I can see that norms are reduced in the order of
norm-names
, but is this a behaviour I can rely on?Change request: ☝️ If yes, would it be ok to add that in the docstring?
The text was updated successfully, but these errors were encountered: