litellm/ruff-strict-budget.json
ryan-crabbe-berri 9ec0145986
feat(proxy): add /team/daily/activity/aggregated and switch the Usage team tab to it (#36562)
* feat(proxy): add /team/daily/activity/aggregated and use it in the Usage UI

The Team Usage tab drained row-paginated pages client side, which painted
newest days first and drew duplicate bars when a day's rows straddled a
page boundary. Serve the whole range in one SQL GROUPING SETS pass instead:
the aggregated query gains optional per-entity rollup levels (entity as the
most-significant GROUPING bit) so breakdown.entities keeps per-team spend,
aliases, and per-key splits. The endpoint shares the paginated route's
scoping via _resolve_team_daily_activity_scope, accepts the timezone the UI
already sends, and the api_key filter now takes a list so non-admin member
scoping works. The dashboard tries the aggregated endpoint first and falls
back to page draining on failure.

* chore: ratchet B008 budget down by the endpoint converted to Annotated Depends

* chore: keep mutable-ok suppressions on their annotation lines after formatting

* fix(proxy): reject malformed or over-wide ranges on team aggregated activity

The aggregated endpoint has no pagination bounding its work, so validate
start_date and end_date as real dates and cap the span at 400 days. The
dashboard's widest presets fit well inside the cap, and an over-cap range
falls back to the paginated flow. Also trim implementation comments that
restated the grouping-set code.

* fix(proxy): parse aggregated range bounds as UTC to satisfy DTZ007

* refactor(proxy): fetch entity rollups with a companion query instead of extending the main one

The entity-as-extra-GROUPING-bit approach made the bitmask layout
mode-dependent: the same constant meant (date) for normal rows and
(date, entity) for entity rows, disambiguated by masking. Split it out:
the shared WHERE builder feeds both the untouched main query and a small
per-entity rollup query keyed by GROUPING(api_key), run concurrently, and
a fold writes breakdown.entities onto the built response.

* refactor(proxy): share the daily-activity error and entity-metadata shapes

The type-discipline ceiling for LIT002 ratcheted down on staging, so the new
aggregated endpoint had to stop hand-rolling collections the codebase already
builds elsewhere. Funnel the `{"error": ...}` detail through one construction
site, turn the range validator into an error-as-value, reuse a single
entity-metadata lookup for both breakdown paths, and widen
get_api_key_metadata to any set so callers stop copying frozensets.
2026-08-18 11:29:57 -07:00

263 lines
2.9 KiB
JSON

{
"ANN001": {
"limit": 3026
},
"ANN002": {
"limit": 71
},
"ANN003": {
"limit": 827
},
"ANN201": {
"limit": 2017
},
"ANN202": {
"limit": 855
},
"ANN204": {
"limit": 711
},
"ANN205": {
"limit": 114
},
"ANN206": {
"limit": 133
},
"ANN401": {
"limit": 1290
},
"ASYNC230": {
"limit": 11
},
"B004": {
"limit": 2
},
"B006": {
"limit": 178
},
"B008": {
"limit": 503
},
"B009": {
"limit": 59
},
"B010": {
"limit": 190
},
"B018": {
"limit": 2
},
"B019": {
"limit": 1
},
"B021": {
"limit": 1
},
"B026": {
"limit": 3
},
"BLE001": {
"limit": 2923
},
"C401": {
"limit": 8
},
"C404": {
"limit": 1
},
"C405": {
"limit": 19
},
"C408": {
"limit": 11
},
"C414": {
"limit": 4
},
"C419": {
"limit": 1
},
"C901": {
"limit": 312
},
"D419": {
"limit": 6
},
"DTZ001": {
"limit": 2
},
"DTZ003": {
"limit": 26
},
"DTZ005": {
"limit": 233
},
"DTZ006": {
"limit": 10
},
"DTZ007": {
"limit": 19
},
"DTZ011": {
"limit": 3
},
"EXE001": {
"limit": 4
},
"EXE002": {
"limit": 3
},
"F401": {
"limit": 17
},
"LOG015": {
"limit": 5
},
"N999": {
"limit": 1
},
"PERF102": {
"limit": 27
},
"PERF401": {
"limit": 12
},
"PERF403": {
"limit": 34
},
"PIE804": {
"limit": 18
},
"PIE810": {
"limit": 43
},
"PLC0206": {
"limit": 26
},
"PLC0414": {
"limit": 46
},
"PLR0124": {
"limit": 1
},
"PLR0206": {
"limit": 1
},
"PLR1704": {
"limit": 3
},
"PLR1714": {
"limit": 256
},
"PLW0127": {
"limit": 57
},
"PLW0133": {
"limit": 1
},
"PLW0602": {
"limit": 215
},
"PLW0603": {
"limit": 191
},
"PLW1508": {
"limit": 190
},
"PLW1510": {
"limit": 2
},
"PYI036": {
"limit": 3
},
"RET504": {
"limit": 176
},
"RUF012": {
"limit": 241
},
"RUF015": {
"limit": 8
},
"RUF019": {
"limit": 38
},
"RUF046": {
"limit": 4
},
"RUF059": {
"limit": 67
},
"RUF100": {
"limit": 0
},
"S110": {
"limit": 218
},
"S112": {
"limit": 22
},
"SIM101": {
"limit": 58
},
"SIM102": {
"limit": 317
},
"SIM103": {
"limit": 119
},
"SIM113": {
"limit": 3
},
"SIM115": {
"limit": 2
},
"SIM117": {
"limit": 6
},
"SIM201": {
"limit": 1
},
"SIM210": {
"limit": 8
},
"SIM211": {
"limit": 1
},
"SIM222": {
"limit": 1
},
"SIM401": {
"limit": 11
},
"TC004": {
"limit": 5
},
"TID251": {
"limit": 1216
},
"TRY002": {
"limit": 524
},
"TRY004": {
"limit": 96
},
"TRY201": {
"limit": 405
},
"TRY203": {
"limit": 113
},
"TRY300": {
"limit": 859
},
"UP028": {
"limit": 2
},
"UP031": {
"limit": 2
},
"UP036": {
"limit": 1
}
}