fix(memory): handle SELF_MANAGED override type in _wrap_configuration#290
Open
fix(memory): handle SELF_MANAGED override type in _wrap_configuration#290
Conversation
Bug aws#1 from issue aws#212: The _wrap_configuration method was crashing with ValueError when trying to modify CUSTOM strategies with SELF_MANAGED configuration type. Root cause: The code attempted to convert override_type string to OverrideType enum without handling the case where override_type is not a valid enum value (e.g., 'SELF_MANAGED' which is a valid configuration type but not in the OverrideType enum). Fix: Add _try_get_override_type() helper method that safely converts override_type to OverrideType enum, returning None for invalid values. Update _wrap_configuration to use this helper and fall through to pass-through behavior when override_enum is None or not in the wrapper key dictionaries. This allows CUSTOM strategies with SELF_MANAGED configuration to be modified without crashing, with their configuration passed through as-is (no special wrapping). Fixes aws#212 (Bug aws#1) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Bug #1 from issue #212: The
_wrap_configurationmethod was crashing withValueError: 'SELF_MANAGED' is not a valid OverrideTypewhen trying to modify CUSTOM strategies with SELF_MANAGED configuration type.Root Cause
The code attempted to convert
override_typestring toOverrideTypeenum without handling the case whereoverride_typeis not a valid enum value (e.g., 'SELF_MANAGED' which is a valid configuration type but not defined in theOverrideTypeenum).Changes
_try_get_override_type()helper method that safely convertsoverride_typestring toOverrideTypeenum, returningNonefor invalid/unknown values_wrap_configuration()to use this helper and fall through to pass-through behavior whenoverride_enumisNoneor not in the wrapper key dictionarieselseclauses in the consolidation and reflection handling to ensure configuration is passed through for unknown override typesTests
Added 3 new tests:
test_wrap_configuration_custom_self_managed- verifies SELF_MANAGED configs work without crashingtest_try_get_override_type_valid- verifies valid override types are converted correctlytest_try_get_override_type_invalid- verifies invalid override types return NoneAll 110 existing tests continue to pass.
Test Plan
_wrap_configurationtests pass (7 tests)Reproduction
Before this fix:
After this fix, the above code works without crashing.
Fixes #212 (Bug #1)
Generated with Claude Code