Validate user presence assumptions for Key model
Summary
The Key model delegates to user but doesn't enforce user presence via Rails validations or database constraints. This creates ambiguity about whether key.user can be nil.
Investigation Needed
- Determine if
user_id: nilis a valid state for keys - Check production data for keys with
NULL user_id - Either add validation/constraints OR update code to handle nil users consistently
Context
During code review, it was discovered that while the Key model delegates to user (suggesting it should always be present), Rails and the database don't actually prevent user_id from being nil.