test(responses): enforce managed ownership with unmanaged ID opt-in

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
ryan 2026-10-31 05:51:46 +00:00
parent 670564689b
commit 74d9da7a20
2 changed files with 4 additions and 5 deletions

View file

@ -870,10 +870,11 @@ def _comparison_options(data: object, nested: bool) -> Mapping[str, str]:
@pytest.mark.asyncio
@pytest.mark.parametrize("nested", (False, True))
@pytest.mark.parametrize("stranger", ("user", "team"))
@pytest.mark.parametrize("allow_unmanaged", (False, True))
async def test_regression_comparison_id_reentry_keeps_ownership_after_owner_retry(
salt_key_env: str, nested: bool, stranger: str
salt_key_env: str, nested: bool, stranger: str, allow_unmanaged: bool
) -> None:
hook: Final = ResponsesIDSecurity(general_settings_reader=lambda: {}, signing_key_reader=lambda: salt_key_env)
hook: Final = _hook({"allow_unmanaged_response_ids": allow_unmanaged}, signing_key=salt_key_env)
owner: Final = UserAPIKeyAuth(user_id="owner-user", team_id="owner-team")
caller: Final = UserAPIKeyAuth(
user_id="stranger-user" if stranger == "user" else owner.user_id,

View file

@ -24,7 +24,6 @@ from litellm.types import litellm_params
from litellm.types import utils as types_utils
from litellm.types.caching import DynamicCacheControl
from litellm.types.litellm_params import (
ADDRESSED_COMPARISON_RESPONSE_ID_FIELD,
ADDRESSED_RESPONSE_ID_FIELD,
LITELLM_OWNED_ROOTS,
TRUSTED_CALLBACK_VARS_FIELD,
@ -460,10 +459,9 @@ def test_bedrock_batch_names_concatenate_as_a_tuple() -> None:
def test_proxy_stamped_fields_keep_their_wire_names() -> None:
assert (TRUSTED_CALLBACK_VARS_FIELD, ADDRESSED_RESPONSE_ID_FIELD, ADDRESSED_COMPARISON_RESPONSE_ID_FIELD) == (
assert (TRUSTED_CALLBACK_VARS_FIELD, ADDRESSED_RESPONSE_ID_FIELD) == (
"litellm_trusted_callback_vars",
"_litellm_addressed_response_id",
"_litellm_addressed_comparison_response_id",
)