Package update race

Time ago I asked something similar to this, but not exactly the same; and I still have some doubts about what is expected to happen when an environment has added two packages with a common dependency, in a situation like this:

Package A has two versions:

  • A@1.0.0 with no dependency.
  • A@2.0.0 depending on D with compat D = "1".

Package B has also two versions:

  • B@1.0.0 depending on D with compat D = "1".
  • B@2.0.0 with updated compat D = "2"

This allows the following combinations of A and B:

  1. A@1.0.0 and B@1.0.0 (with D = "1")
  2. A@2.0.0 and B@1.0.0 (with D = "1")
  3. A@1.0.0 and B@2.0.0 (with D = "2")

Let’s suppose that in Day 1, A is updated to v2.0.0; and in Day 2 D and B update their versions. I’d expect that if I had updated my environment in Day 1 - i.e. I was in status #2, I will remain there. I mean, if after Day 2 I try to update again, nothing will happen… or would A be downgraded and I would move to status #3?

And what will happen if I do nothing in Day 1, and I try to update (or just add) A and B after Day 2? Will I be in status #2 or #3? Or that’s not well defined and depends on particular conditions, e.g. which package is attempted to be updated first?