<#1087 fix: accept common cache behavior aliases (...
# flyte-github
a
#1087 fix: accept common cache behavior aliases (enable/on/off/...) Pull request opened by EngHabu Summary
Cache(behavior=...)
(and thus
@env.task(cache=...)
,
task.override(cache=...)
, etc.) only accepted the three
CacheBehavior
literals
"auto"
,
"override"
,
"disable"
. Users very reasonably reach for
"enable"
,
"on"
,
"off"
,
"true"
, etc., and the resulting
ValueError: Invalid cache behavior: enable. Must be one of ['auto', 'override', 'disable']
lands in Sentry as if it were an SDK crash even though it's user-input validation. Normalize a small list of common aliases (`enable`/`enabled`/`on`/`true`/`yes` →
auto
, `off`/`false`/`no`/`none` →
disable
) before validating, and include the alias list in the error message so users who type something else (e.g.
enbale
) can self-correct. Sentry issues Fixes FLYTE-SDK-37 (
ValueError: Invalid cache behavior: enable. Must be one of ['auto', 'override', 'disable']
) Test plan • New parametrized test covers each accepted alias (`enable`/`enabled`/`on`/`True`/`YES`/`off`/`false`/`no`/`None`) and asserts it canonicalizes to the expected
CacheBehavior
. • New test asserts the updated error message lists the accepted aliases when the value is still invalid (e.g. typo
"enbale"
). • Existing
tests/user_api/test_cache.py
suite (26 tests) still passes. •
make fmt
clean. 🤖 Generated with Claude Code flyteorg/flyte-sdk