I'd include this assignment inside the `if spec.version != locked_spec_version` check (promote that check to block level). It's weird to compute it then throw it away.