fix(types): annotate make_valid_bedrock_tool_use_id as Optional[str] -> Optional[str]

Greptile review caught that the helper passes None through unchanged, but
the annotation said str -> str (which forced a # type: ignore[arg-type] in
the empty-passthrough test). Match the annotation to the actual contract
and drop the type: ignore.

Behavior unchanged.
This commit is contained in:
Lance Kuo 2026-05-25 22:41:42 -04:00
parent 007e97d61e
commit 7fd8c255e9
No known key found for this signature in database
GPG key ID: 548D51586D2EDAD8
2 changed files with 4 additions and 2 deletions

View file

@ -5361,7 +5361,9 @@ def make_valid_bedrock_tool_name(input_tool_name: str) -> str:
return valid_string
def make_valid_bedrock_tool_use_id(input_tool_use_id: str) -> str:
def make_valid_bedrock_tool_use_id(
input_tool_use_id: Optional[str],
) -> Optional[str]:
"""
Replaces any invalid characters in the input tool_use_id with underscores
so it matches Bedrock Converse's required pattern ``^[a-zA-Z0-9_.:-]+$``.

View file

@ -2818,7 +2818,7 @@ def test_make_valid_bedrock_tool_use_id_empty_passthrough():
)
assert make_valid_bedrock_tool_use_id("") == ""
assert make_valid_bedrock_tool_use_id(None) is None # type: ignore[arg-type]
assert make_valid_bedrock_tool_use_id(None) is None
def test_bedrock_tool_call_invoke_sanitizes_drifted_name_and_id():