optional do not persist None value

Misunderstanding.

optional is a validating step in the check process, so it’s an alternative to things like exists, that cause the request to be marked as failed if the value is missing. It’s a best effort.

So yes, you might want to clean the session of previously saved values, depending on your use case.

PS: doIfOrElse(_.contains(“testValue”))