The phrase "sanity check" comes up often in programming, e.g.
It's a good sanity check before attempting to decrypt the key.
Usually, its context is one in which a commonly assumed state (e.g. no memory corruption) is being tested, explicitly. For a long time, I interpreted "sanity" as the state opposed to "insanity", e.g.
It's a good check to make sure we don't lose our minds before attempting to decrypt the key.
Because of the many instances I'd spent hours, or days, debugging a mysterious bug, only to find the cause to be some uncommon state in the environment or data, this interpretation made sense to me; a sanity check would have saved my sanity.
But then I realized that "sanity" had a more canonical meaning: cleanness, e.g.
It's a good check for cleanness before attempting to decrypt the key.
Which is the interpretation meant by the phrase, "sanity check"?