Anomalous snap list devmode flag

Yesterday @niemeyer observed an anomalous output from snap list in snapd 2.24. The locally installed snap was showing as devmode but behaved as if installed in strict mode.

Inspection of the state showed that devmode flag was not set in the state. Since observation we lost the state so no additional material is available.

I had a look at the code in 2.24, specifically at github.com/snapcore/snapd/cmd/snap/NotesFromLocal and found the expression decides if a snap is shown as devmode in snap list. The expression is
!snap.JailMode && (snap.DevMode || snap.Confinement == client.DevModeConfinement)

While my initial reaction was that the expression must be wrong somehow I cannot actually find anything that may be wrong with it. Does anyone have a theory what else might have gone wrong that would cause this to happen?

After a brief chat about this in the standup, we’ll be changing it so that a local snap’s devmode only means that it is installed in devmode, ignoring whether it’s a confinement:devmode snap or not entirely.

This is now addressed in https://github.com/snapcore/snapd/pull/3361