Say you have a law change which states that something which was a crime up to Aug 30th 2020 is not a crime from Sep 1st 2020 onward. And a person has been convicted of the crime and served their sentence, or has been convicted of the crime and is serving their sentence, or is in court accused of the crime, or has committed the crime on Aug 30th or before.
It depends on other laws how this situation should be treated. If we are lucky, a country has a general law that states unambiguously how each of these cases should be treated, independent on which of its many criminal laws have changed. (Most countries have a general law for the other direction, that something that was legal now becomes legal - you cannot be convicted for something that was legal when you did it).
You may also be lucky and the law change is combined with laws how old cases should be handled. For example the law could say "X is legal from Sep 1st onwards. No prosecution shall be started from Sep 1st onward for doing X before or from this date. Ongoing prosecution shall continue and convictions shall be upheld. " Or the law might be more generous.
If we are unlucky there is nothing in the law books of some country to handle this. A police officer may decide on their own that they have more important things to do than investigate things that wouldn't be crimes if done today. A prosecutor may decide on his own that prosecuting something that would be legal today is not in the public interest. Different police officers or prosecutors may see things differently.