HeadlinesBriefing favicon HeadlinesBriefing.com

Why One Status Field Beat Three

DEV Community •
×

A developer initially shipped a simple status field for import configs, but user demands for tracking last run results and wizard progress bloated it into three separate fields. This created a combinatorial nightmare with 40 possible states, making basic questions like "Is this ready to run?" impossible to answer without complex logic.

The resulting code required a convoluted function to determine display status, masking a deeper modeling failure. The developer realized they had accumulated symptoms rather than modeling the actual state. The fix consolidated everything into a single Status field with five mutually exclusive states: draft, ready, running, paused, and failed.

This refactor touched 193 files with thousands of additions and deletions. Wizard state now lives in a separate DraftData field, ensuring pending resources like schemas aren't orphaned in the database. The display logic collapsed from a complex conditional tree to a simple property access. It was a painful but necessary fix for long-term maintainability.