From a275711bb56c0b3106b7553a1c09565e5aa26608 Mon Sep 17 00:00:00 2001 From: Darien Kindlund Date: Fri, 17 Apr 2026 10:52:27 -0400 Subject: [PATCH] test(spend_tracking): cover acreate_file branch in get_spend_logs_id The hash-based id path triggers for both `aretrieve_batch` and `acreate_file`, but only the former was tested. Add a parallel test asserting that `acreate_file` also returns a hash (not the client-supplied call id) even when `litellm_call_id_from_client` is true. Addresses Greptile P2 review feedback on PR #25952. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../spend_tracking/test_spend_tracking_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py b/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py index c099d54ca60..9df5ec11c17 100644 --- a/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py +++ b/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py @@ -1548,3 +1548,17 @@ class TestGetSpendLogsId: # Hash-based id, not the client uuid assert result is not None assert result != "client-uuid" + + def test_acreate_file_unchanged(self): + """The acreate_file hash path is also independent of the flag.""" + result = self.fn( + call_type="acreate_file", + response_obj={"id": "file-id", "data": "y"}, + kwargs={ + "litellm_call_id": "client-uuid", + "litellm_call_id_from_client": True, + }, + ) + # Hash-based id, not the client uuid + assert result is not None + assert result != "client-uuid"