I’ve stumbled across a rather weird behavior when working with text layers that have been resized using a size transform.
The following attached gif shows this behavior.
The first few updates do not change the font size as no transform has been made.
After resizing the text layer, updates change the font size.

The underlying code is just assigning to the contents property of the layer’s textItem, so:
layer.textItem.contents = contents;
in the shown example, the updated contents is the same as the existing contents.
My question is therefore:
is this a bug, or is this expected behavior?