Week 067 — The Monster
Need I say more?
Week of March 2, 2026
Progress
Monday: a null being passed to ItemLostInstance lookup — the null coming from a state that had become lost after save. The refactor had created a case where a lost item being updated failed to look up its lost instance. Fixed.
Wednesday: the API routing approach was adopted. The existing api-item.php was a large switch statement. The new approach uses a router pattern similar to the page router — but Claude was given the task of generating the router and all the individual handlers. This saved time on implementation but raised the question of how well the generated code is understood. The answer, honestly: partially.
All hardcoded API URLs were moved to .env constants. This makes environment switching (dev vs production) cleaner and keeps URLs out of application logic.
The Hard Part
This refactor started as "move business logic out of the API." It became: rename the DTO, create mapper classes, update the webhook, fix found.php, update the router, generate handlers. Six weeks in, with new surfaces still appearing. The scope expansion happened in real time and was hard to stop once it was moving.
The reminder that came out of this: AI makes it easy to find things to refactor. That's not the same as making it easy to finish them.
Next Week
Item UI refactor.
