Weekly Commit #012
This week I built a mandatory document upload, and the file disappeared without a single error.
The silent drop
The feature was simple on paper: at the end of a subscription flow, the user now has to upload a specific document before finishing. The frontend returned the file correctly. The backend service passed it through clean. And yet, further down the pipeline, the document was nowhere.
I spent a while assuming I had wired the frontend wrong, because that is where I had made the change. But the file was reaching the handler intact. The problem was the handler itself: I had assumed it was a pass-through, and it was not. It only ingests documents that have a hardcoded block extracting them by description. Other document types had one. Mine did not. So the file arrived, matched nothing, and got silently dropped. The fix was to add the block, plus a case downstream so it would not get misclassified. Assume nothing is a pass-through until you have read what it actually does.
Smaller things this week
A task asked me to show a label instead of a value for certain items in the mobile app. My first instinct was to compute it in the ViewModel, in the frontend, where the change felt smallest. Then I checked the model and it did not even expose the fields I needed. The logic had to move server-side, where the raw data lives.
Another task: show which user uploaded a document. I guessed the message type, logged it at runtime, and I was wrong. But the better find came next: instead of altering a database view, I realised the audit column already stored the uploader's email for every message, including historical ones. The data I needed was already there. I just had not looked before reaching for a bigger change.
Something I read this week
I have been reading A Philosophy of Software Design by John Ousterhout, and the chapter I read this week was "Modules should be deep." The idea: a good module hides a lot of complexity behind a simple interface. Shallow modules add an interface without hiding much, so the complexity leaks through. That handler pretended to be a simple pass-through but leaked a hardcoded whitelist through its interface, exactly the shallow module that makes you assume one thing while it does another. I would have understood my own bug faster if I had read the chapter first.
Twelve weeks in
The theme this week was assumptions: about where logic belongs, about what a component does, about what my tools are doing under the hood. Most of the work was noticing them before they cost me. See you next week.
#WeeklyCommit #SoftwareDesign #Debugging #Backend
Follow along here or on LinkedIn where I'll be sharing each new commit.