{
  "id": 20480878,
  "title": "I fixed the limit check in a function nothing calls: green tests, dead code, live payment route",
  "url": "https://urgent.news/2026/11/17/i-fixed-the-limit-check-in-a-function-nothing-calls-green-tests-dead",
  "topic": "business",
  "section": "Business",
  "published": "2026-11-17T19:31:07.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ericgitangu/i-fixed-the-limit-check-in-a-function-nothing-calls-green-tests-dead-code-live-payment-route-1k03"
  },
  "original_language": "en",
  "account": "In this report, I detail a limit check I identified, tested, and implemented in a function that was not called by the live payment route. The setup involves users topping up a wallet through various payment channels, each with its own minimum and maximum limits. A problem arose when a blank limit was treated as an empty value instead of \"nothing set\", causing the system to enforce an unattainable maximum limit. The fix involved a resolver that only applied the default limit if the input was a positive number, otherwise falling back to the default. This fix was implemented across four payment routing files and included source checks to prevent the old code from reappearing. Another issue discovered was that the fix had been implemented in a function that was not called by the live route, meaning the new code would never be used in real-world scenarios. To address this, the fix was moved to the appropriate place where the money is entered, allowing for earlier refusal of invalid payments. Tests were added to validate the new implementation, ensuring that the route refuses invalid payments before any further processing occurs. The report concludes with a summary of the changes and lessons learned, emphasizing the importance of testing through the actual route of the software and deleting any dead code to prevent confusion and future reimplementation of the same fix.",
  "summary": "I'm Eric Gitangu. I work on the backend of a mobility/fintech platform. This one is about a limit check I fixed, tested and shipped, in a function the live payment route never calls. The setup Users top up a wallet through several payment rails: card, a few mobile-money rails, a web flow. Each location can set a minimum and a maximum top-up amount. If it sets none, a default range applies. Each…",
  "key_points": [
    "Fixed limit check in unused function",
    "Implemented fix across four payment routing files",
    "Added tests to validate new implementation"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}