{
  "id": 1803458,
  "title": "The Generated Helper Passed Locally, Then Died in a Clean Container Because It Read a Global I Never Passed",
  "url": "https://urgent.news/2026/08/18/the-generated-helper-passed-locally-then-died-in-a-clean-container",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-18T20:53:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/codepy_1473/the-generated-helper-passed-locally-then-died-in-a-clean-container-because-it-read-a-global-i-1l4l"
  },
  "original_language": "en",
  "account": "The generated helper code worked locally on the reporter's laptop but failed in a clean Docker container because it was reading globally defined variables that were not passed as parameters. The function was expected to check if a feature flag was enabled for a given name, but it relied on three free globals: DEBUG, FEATURE_STORE, and DEFAULT_FEATURES. The generated function did not specify these globals, and a casual look at the code could overlook this hidden dependency. The reporter's local Python session still had leftover variables from a previous experiment, which prevented the function from failing in the interactive shell. However, when run in an empty namespace that simulated a clean container, the function raised a NameError because the required globals were not defined. To prevent this issue, the reporter built a tiny harness that checks for free globals before execution. The analyzer scans the generated code to find every name it loads that is neither assigned nor received as a parameter. By identifying these free globals, the reporter could ensure the generated code is self-contained and does not rely on unexpected external state.",
  "summary": "I almost shipped a small feature-flag helper that worked on my laptop and crashed in the clean Docker image. The generated source looked self-contained, and my local smoke test gave the exact boolean I expected, so I assumed the problem was the deployment environment. It was not. The generated function was silently reading module-level variables that my interactive shell still had from an older…",
  "key_points": [],
  "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."
}