From 86be12f4be85bc1a3d82967f8c9e2d918c7b80ea Mon Sep 17 00:00:00 2001 From: Jeroen Ubbink Date: Tue, 25 Aug 2026 20:28:16 +0200 Subject: [PATCH] fix(admin): show the rate that needs fixing in the single-model view too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The listing already renders a stored non-finite rate as text rather than letting the encoder report it as `null`, indistinguishable from a rate the row never carried. The single-model view is the other view of that same row — the one an operator opens from the listing to repair it — and still answered `null`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011cKHVF5LA7TR5QuYi6ErLM --- routstr/core/admin.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routstr/core/admin.py b/routstr/core/admin.py index 0e8b1158..f018b6a5 100644 --- a/routstr/core/admin.py +++ b/routstr/core/admin.py @@ -682,9 +682,13 @@ async def get_provider_model(provider_id: str, model_id: str) -> dict[str, objec raise HTTPException( status_code=404, detail="Model not found for this provider" ) - return _row_to_model( - row, apply_provider_fee=False, provider_fee=provider.provider_fee - ).dict() # type: ignore + # Same duty as the listing this view is opened from: a stored rate that + # is not a usable number must be shown as it is, not encoded as `null`. + return json_compliant( # type: ignore[return-value] + _row_to_model( + row, apply_provider_fee=False, provider_fee=provider.provider_fee + ).dict() + ) @admin_router.delete(