-
Stefy Lanza (nextime / spora ) authored
The layout pass read its per-page option with `_opt("layout", True)`. The accessor is `_page_override`. A pod answered 500 {"detail": "surya ocr failed: name '_opt' is not defined"} after the image was built, pushed, signed and booted, because nothing executes these modules until a page reaches a pod: `codai/ocr/workers/*` run OUTSIDE the package -- the surya worker in its own venv, forbidden from importing codai -- so no test had ever run a line of them. The test I wrote for the layout pass asserted the SOURCE STRING of that call and proved only that the text was there. So the fix comes with a guard that would have caught it: every `_`-prefixed name a worker module loads must be bound somewhere in that module. Those are the module's own helpers, so an unbound one is a typo and not a global from elsewhere. Pure ast + builtins -- no linter, nothing added to requirements -- and it is checked against the bug itself, because a checker that passes everything is worse than none. Co-Authored-By:Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S8LAP3ueNzQJtwzhgVbq66
903195bc