devops(ocr): improve startup error clarity for invalid CLAHE env vars #257
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
Deferred during PR #255 review cycle 1 (Tobias Wendt — DevOps review).
Concern
CLAHE_TILE_SIZE = int(os.environ.get("OCR_CLAHE_TILE_SIZE", "8"))crashes at service startup if the env var is set to a non-integer (e.g."8x8"). The rawValueErrortraceback from Python'sint()call is cryptic — on-call engineers have to trace it back to find which env var is wrong.Suggested fix
Extract a
_parse_int_env(name, default)helper that wraps theint()call and raises a human-readableValueError:This is also testable directly, unlike the module-level assignment.
Why deferred
Non-blocking. The current fail-fast behaviour is correct; only the error message quality suffers. Implementing cleanly required the refactor above which was out of scope for the preprocessing pipeline PR.
Reference
PR: http://heim-nas:3005/marcel/familienarchiv/pulls/255