KovertKlaus v0.2.0-alpha shipped on October 1. The first real users are now creating Holiday Missions, building Wishlist Manifests, and inviting their Elf Agents.
On October 13 two things happened within a few hours: the first unprompted “this is actually sick” from a user, and the first user-reported bug. This post is about the bug, because what it revealed was more useful than the fix.
The Symptom
A user opened Account Preferences, edited their profile, and clicked save. They got this:
API route not found: /api/users/profile
The route existed, and it had worked in development. So why was it a 404?
The Diagnosis
The browser modal sent a PUT request. The production edge worker only had a handler for PATCH on that path, so a PUT fell through to the catch-all “route not found” response.
That explained the 404, but it was only the first layer. Once I read the handler line by line next to the client code, I found four more problems:
| # | Problem | Effect |
|---|---|---|
| 1 | The client sent PUT, the server accepted only PATCH | Every save failed with a 404 |
| 2 | The client sent currentPassword, the server read oldPassword | Password changes could never pass verification |
| 3 | Most dossier fields (address line 2, delivery notes, sizes, favorites, allergies, preferred codename) were never written or read | Data the user entered was silently dropped |
| 4 | Privacy toggles used one naming scheme in the UI and another in the database | Visibility preferences never persisted |
| 5 | The update response returned the entire user row, including the password hash | Sensitive data leaked to the client |
Item 5 is the one that mattered most. A password hash is not a plaintext password, but it should never leave the server. Nobody reported it; it turned up only because a different bug made me read the whole handler.
The Fix
All five issues share one root cause: the client and server each had their own idea of the API contract, and nothing checked that the two agreed.
The fix moved that contract into a single, tested module:
- One shared field allowlist. A new
profile-updatemodule defines which fields the profile endpoint accepts, maps each one to its database column, and sanitizes every value. Anything not on the list is ignored. - Both methods accepted. The route handles
PUTandPATCH, so the client’s choice of method no longer matters. - A safe response shape. The update returns an explicit
selectof non-sensitive fields, never the raw database row. - Tests for the contract. Six new unit tests cover the allowlist, field mapping, and sanitization. The full suite passed 201 of 201 before the merge.
The Delivery Loop
This is the part I’m proudest of. The full path from report to production:
- Bug report from an alpha user
- Diagnosis and a
fix/profile-updatebranch - Tests and build pass locally
- Pull request merged into the development repository’s
mainbranch - Automated sync: a CI workflow opens a sync pull request in the production repository
- Production deploy on Cloudflare after the sync merges
It all happened in one afternoon. The automated sync step had been finished only the day before, so this was its first real run.
Lessons
- A 404 can hide a contract problem. The visible error was a routing miss; the real problem was five separate disagreements between client and server.
- Define a contract once and test it. When field names exist in two places, they will drift. Put them in one module and test it.
- Never return raw database rows. Select the response fields explicitly, even on “internal” endpoints.
- Fixing one bug is a reason to read the whole function. The worst issue here was found next to the reported one, not in it.
- Build the pipeline before you need it. The fix shipped the same day because the sync automation was already in place.
A Note for Alpha Users
If you filled in your Operative Dossier (sizes, favorites, delivery notes, and so on) before October 13, those details were not saved. Please take a minute to enter them again. Everything saves correctly now.
Thank you to everyone testing the alpha. Keep the reports coming.
Try it: kovertklaus.com · Source: GitHub