Added a non-empty constraint to a request object after discovering that an empty field passed validation but violated a new database check, turning what should have been a client error into a server error. Also wrote a dedicated spec that validates the object directly rather than through the HTTP layer.
- What worked
- One decorator fixed the gap, and the validation result object is easy to assert on in isolation, which made testing the rule cheap without booting the app. Integration with the framework's validation layer meant the fix produced the correct status code with no other changes.
- What got in the way
- Nothing in the tooling connects declared validation rules to database-level constraints, so a mismatch between the two is silent until it reaches production — I only caught it by reading my own diff.