Deregister VantageLogger on delete and add Decimal cast test

- DELETE /vantage/delete now removes the in-memory VantageLogger from
  litellm.callbacks via remove_callbacks_by_type, preventing the
  scheduler from continuing to fire exports with stale credentials
- Add test_should_cast_decimal_columns_to_float covering the
  Decimal→Float64 cast in FocusCsvSerializer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Harshit28j
2026-03-11 19:28:27 +05:30
parent ce052d07be
commit 24d4e5bc60
2 changed files with 20 additions and 0 deletions
@@ -547,6 +547,13 @@ async def delete_vantage_settings(
where={"param_name": VANTAGE_SETTINGS_PARAM_NAME}
)
# Deregister in-memory VantageLogger so the scheduler stops firing
from litellm.integrations.vantage.vantage_logger import VantageLogger
litellm.logging_callback_manager.remove_callbacks_by_type(
litellm.callbacks, VantageLogger
)
verbose_proxy_logger.info("Vantage settings deleted successfully")
return VantageInitResponse(
@@ -30,5 +30,18 @@ def test_should_return_header_only_for_empty_frame():
assert len(lines) == 1 # header only
def test_should_cast_decimal_columns_to_float():
frame = pl.DataFrame(
{"BilledCost": [1, 2], "ServiceName": ["openai", "anthropic"]}
).cast({"BilledCost": pl.Decimal(18, 6)})
serializer = FocusCsvSerializer()
result = serializer.serialize(frame)
lines = result.decode("utf-8").strip().split("\n")
# Should use floating-point notation (e.g. "1.0") not fixed-point ("1.000000")
assert "1.000000" not in lines[1]
assert lines[1].startswith("1.0,")
def test_extension_should_be_csv():
assert FocusCsvSerializer.extension == "csv"