Fix: create_config TypeError when read_timeout is passed via config#368
Fix: create_config TypeError when read_timeout is passed via config#368evanerwee wants to merge 1 commit into
Conversation
When a user passes read_timeout (or retries, user_agent_appid) via the config JSON string, Config() receives duplicate keyword arguments and raises TypeError. The fix uses setdefault() for all hardcoded values — the same pattern already used for max_pool_connections on the line immediately above. User-provided values take precedence; defaults apply when absent. Fixes awslabs#361
|
Thanks, we will review you PR shortly. |
mykola-pereyma
left a comment
There was a problem hiding this comment.
Thanks for the fix — the setdefault approach is clean and correct. Asking for regression tests before merge since this is a bug fix and best practice is to have a test that would have caught the original issue.
| config_args.setdefault('read_timeout', 600) | ||
| config_args.setdefault('retries', {'total_max_attempts': 1, 'mode': 'standard'}) | ||
| config_args.setdefault('user_agent_appid', f'graphrag-lexical-graph-{toolkit_version}') | ||
|
|
There was a problem hiding this comment.
Fix looks correct and follows same pattern already used for max_pool_connections above. Could you add regression tests for the three fields that were breaking? The existing TestCreateConfig class in test_neptune_graph_stores.py already has this pattern for max_pool_connections so should be straightforward. Without regression tests there is nothing preventing someone from refactoring this back to kwargs and reintroducing the TypeError.
|
Thanks for opening this @evanerwee I’d like to help get this over the line. Since the requested changes have been waiting for a couple weeks, I’m going to open a follow-up PR that cherry-picks your commits and addresses the review feedback. Happy to close mine if you’d prefer to continue this one. |
Fixes #361.
Problem
create_config()hardcodesread_timeout=600as a keyword argument AND spreads user config via**config_args. When a user passesread_timeoutin their config JSON, Python raises:Same issue affects
retriesanduser_agent_appid.Fix
Use
setdefault()for all hardcoded values — the same pattern already used formax_pool_connectionson the line immediately above. User-provided values take precedence; defaults apply when absent.Impact
read_timeout,retries, anduser_agent_appid