litellm/tests/unit/enterprise/proxy/hooks
ryan-crabbe-berri 09a37044e1
fix(proxy): send the deployment's provider file id when an image edit names a LiteLLM file (#54274)
* fix(proxy): send the deployment's provider file id when an image edit names a LiteLLM file

Image edits sent a LiteLLM file id to OpenAI unchanged, so even the owning team
got a 400. The managed files hook now checks ownership of every nested file_id
in the edit body, records the file id mapping, and swaps each one for the routed
deployment's provider file id, the same way batches and fine-tuning already do.

* fix(proxy): swap image edit file ids in one pass and check raw provider ids for ownership

Repeating one file id many times in an image edit made the swap copy the same
list once per repeat, which blocked the worker for seconds. The swap now rebuilds
the body once from the innermost level up.

Raw provider file ids in an image edit now go through the same ownership check as
file downloads, so another team's file is refused while ids with no record still
pass.

* test(proxy): drop the wall-clock limit from the image edit repeat test

* fix(proxy): return a new image edit request instead of editing the caller's

* fix(proxy): type the image edit request and file id lookups for the type check gate

* fix(proxy): batch image edit file ownership checks and cap distinct file ids at 64
2026-11-28 23:05:51 +00:00
..
__init__.py ci: move caching, proxy-extras, gateway and enterprise tests into tests/unit and run them from litellm-tests (#42902) 2026-09-24 15:49:59 -07:00
test_managed_files.py fix(proxy): send the deployment's provider file id when an image edit names a LiteLLM file (#54274) 2026-11-28 23:05:51 +00:00