Skip to content

JS SDK incorrectly decodes WorkspaceBillingSummaryResponse, reports incorrect cost data (stale bindings) #4127

Description

@RJFelix

Summary

It looks like the JS SDK modal 0.9.0's bindings for WorkspaceBillingSummaryResponse are stale - a revision behind the Python SDK bindings - and so the response is incorrectly decoded.

Field Python (correct) JS (incorrect)
1 start_timestamp startTimestamp
2 end_timestamp endTimestamp
3 metered_cost meteredCost
4 billed_cost (string) planCost (string)
5 metered_cost_breakdown (map) creditsApplied (string)
6 adjustments (map) reservationsDiscount (string)
7 - volumesDiscount (string)
8 - billedCost (string)
9 - meteredCostBreakdown (map)

...so when the server sends something like:

{
  "metered_cost": "100.00000000",
  "billed_cost": "40.00000000",
  "metered_cost_breakdown": {
    "Ephemeral Apps": "75.00000000", "Volumes": "20.00000000", "LLM Tokens": "5.00000000"
  },
  "adjustments": {
    "Credits": "-50.00000000", "Free Storage": "-10.00000000", "Plan Cost": "0.00000000", "Reservation Adjustment": "0.00000000"
  }
}

it's decoded by modal@0.9.0 as: (can vary based on the maps' serialization order)

{
  "meteredCost": "100.00000000",
  "planCost": "40.00000000",
  "creditsApplied": "\n\nLLM Tokens\u0012\n5.00000000",
  "reservationDiscount": "\n\u0016Reservation Adjustment\u0012\n0.00000000",
  "volumesDiscount": "",
  "billedCost": "",
  "meteredCostBreakdown": {}
}

Version

modal@0.9.0

App ID

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions