Should missing state keys and null values be the same?

Was just discussing that with @pedronis, and so far it seems reasonable to say yes, they are equivalent. This allows us to remove data from the state when it’s not needed (temporarily or otherwise), and also means we have one less alternative to handle when getting data out of the state.

We may need to tweak the way state.Get works so that when observing null it behaves the same as missing.

IIRC, this is also the way configuration handling behaves already, so one more reason to go in that direction.

@niemeyer I will make a small independent PR to address this, I need it to remove “aliases” on transition in

@niemeyer opened:

https://github.com/snapcore/snapd/pull/3132

1 Like