• Stefy Lanza (nextime / spora )'s avatar
    call the accessor by its real name, and check that workers' helpers exist (v0.5.0) · 903195bc
    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: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01S8LAP3ueNzQJtwzhgVbq66
    903195bc
Name
Last commit
Last update
..
admin Loading commit data...
api Loading commit data...
backends Loading commit data...
broker Loading commit data...
cluster Loading commit data...
compose Loading commit data...
frontproxy Loading commit data...
models Loading commit data...
ocr Loading commit data...
openai Loading commit data...
pydantic Loading commit data...
queue Loading commit data...
tasks Loading commit data...
util Loading commit data...
__init__.py Loading commit data...
cli.py Loading commit data...
config.py Loading commit data...
hf_cache.py Loading commit data...
main.py Loading commit data...
ocr_fleet_workers.py Loading commit data...
platform_paths.py Loading commit data...
system_app.py Loading commit data...