Hmm It looks like the issue is SwiftData abuses Codable (i.e. doesn't just use encode(to:) and init(from:) and the way in which it does so (which seems to include using reflection) is not robust to custom implementations of those methods.
Some of the nuance is covered by this blog post: https://fatbobman.com/en/posts/considerations-for-using-codable-and-enums-in-swiftdata-models/
That blog post also describes a trick where you can nudge SwiftData into actually using the Codable protocol correctly by storing the codable property in an Array (which did work around my issue) though it is unclear if this will be robust to future "improvements" to SwiftData...
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: