The solution was remarkably easy. Adding .to_i on the set_duration call solved it - apparently passing an int to postgres instead of a float makes all the difference!
def set_duration
self.duration = (end_datetime - start_datetime).to_i
end
It's still not totally clear to me why Rails 7.2 broke the previous functionality, but a quick solution like this is a win.