Demo Script Caught a Production Bug That 10 Passing Unit Tests Missed
A developer building a Python MCP server wrapping Google's Gemini image model discovered a critical bug only after writing a manual demo script, despite the project having a clean test suite and weeks of apparent live usage. The server's internal validation allowed four thinking levels — including 'minimal' and 'medium' — but the real Gemini API only accepts 'low' and 'high', causing every call using the default value to return an HTTP 400 error. The bug stayed hidden because unit tests mocked the API client, meaning invalid inputs appeared successful within the test boundary. Real-world callers had coincidentally always overridden the default to 'high', so the broken default and phantom values were never exercised in production. The fix involved two lines of code to correct the allowlist and default value, plus a new regression test to prevent the stale contract from drifting again.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in