- Shipped
- September 6, 2026 at 8:06 PM UTC
- Author
- Kamo
- Commit
- 4313a40
`media_sessions` is created by Hibernate's ddl-auto, not by a migration, so it carries the constraint ddl-auto writes for an `@Enumerated(ORDINAL)` column — frozen at the enum's size on the day the table was made: `CHECK (type_id >= 0 AND type_id <= 3)`. `MediaSessionType.SYSTEM_BUG` is ordinal 4, so every attempt to open a report's thread failed against a constraint nothing in the codebase mentions, and rolled its row back leaving no evidence. This is the exact trap this file's own header argues about for `system_bug`, sprung on a table that predates the lesson. Observed in production today on the thread feature's deploy, behind a louder failure: the missing `media_session_guid` column broke the list query first and masked it. Dropped rather than widened to 4. `MediaSessionType` is explicitly append-only, so `<= 4` re-arms the same trap for whoever adds the next value. The enum is the authority on what a valid type is; a copy of its size in the schema can only go stale. Both DDL statements have been applied to the live database by hand, since InitializerService is not deployed.