How was this handled in the past when things were decriminalized, e.g. homosexuality? Is there an automatic process that guarantees freedom for those held under an abolished law, or does this have to be made explicit every time? Can one's criminal record include an offence against a statute that is no longer valid?
There are two sides to this question. First, there is the International Covenant on Civil and Political Rights, which states:
1 . No one shall be held guilty of any criminal offence on account of any act or omission which did not constitute a criminal offence, under national or international law, at the time when it was committed. Nor shall a heavier penalty be imposed than the one that was applicable at the time when the criminal offence was committed. If, subsequent to the commission of the offence, provision is made by law for the imposition of the lighter penalty, the offender shall benefit thereby.
When signing this treaty, however, the United States of America made a couple of reservations, including this one:
I. The Senate's advice and consent is subject to the following reservations:
(4) That because U.S. law generally applies to an offender the penalty in force at the time the offense was committed, the United States does not adhere to the third clause of paragraph 1 of Article 15.
(emphasis mine in both cases)
The Supreme Court of California found in People v Harmon 54 Cal. 2d 9 (1960) that even a defendant undergoing trial for assault was not entitled to the benefit of an amendment of the mandatory death penalty to a lesser sentence at judicial discretion.
However, In re Estrada, 63 Cal. 2d 740 (1965), the Court overturned the previous ruling, and agreed with the dissenting opinion - that the defendant was entitled to the relief from the amendment.
Ultimately, this would depend on whether the Act that repeals the sections of the law that made those actions criminal is retroactive or not. As with most laws, the general presumption is that it is not retroactive.
As for your criminal record, indictments and misdemeanors will appear unless expunged, the process for which varies between jurisdictions.
1. p.43 - it is generally denied, or limited to cases where the legislation does not have a 'saving class' (statutes that prevent the abatement of past or pending convictions), or where final judgment is pending.
A crime is a crime if it was unlawful at the time. A law is not retroactively applied or repealed unless that is explicit in the law that creates or repeals it. For very good reasons most governments are very careful about retrospective legislation.
A criminal record will include all crimes of which you were convicted unless there is a law saying otherwise (e.g. expungement laws).