Skip to content

fix(sdk): bring billing activity filters in line with the V2 usage report - #190

Draft
bmaydan wants to merge 2 commits into
mainfrom
ben/usage-report-v2-filters
Draft

bmaydan wants to merge 2 commits into
mainfrom
ben/usage-report-v2-filters

Conversation

@bmaydan

@bmaydan bmaydan commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Note

Depends on #154 (Vendor cloud changes), which brings in the generated client methods and parameters this uses. Land that first.

Why are we doing this work?

Placeholder for author's human input

What does this PR change?

  • Does this change live behind a feature-flag? Add "FF" label

The SDK's billing activity filters now match the V2 usage report on grid master.

  • Activity queries can filter by cloud account, and by tag (jobs, multi-machine jobs, deployments) or API key (assistant messages).
  • Filter values now list cloud accounts, tags and API keys; resource IDs are paged through a new searchable call.
  • Removes filter-value fields and download parameters the server no longer sends or reads.
  • Docstrings use the server's real resource type values (lightning_code, job), not Studio/Job.
Breaking changes (billing shipped in v2026.09.18)
  • BillingActivityFilterValues.resource_ids / resource_ids_truncated are gone: the server reserved those fields, so they were always empty. Use Organization.get_activity_filter_resource_names.
  • get_session_activity / get_resource_activity no longer take cursor, and ignore filters.limit. Both download endpoints return the whole report and never read either, so they never had any effect.
Verification
  • Billing unit tests (41) and mypy pass with Vendor cloud changes #154's vendored client applied on top of this branch.
  • Checked every subfilter kwarg against the generated billing_service_get_usage_report_v2 parameters, and parsed real generated response models through the new _from_api methods.

What else should a reviewer know?

  • The CSV download endpoints read every subfilter on grid master (grid #47735), so get_session_activity / get_resource_activity forward tag subfilters under the same dotted query keys the UI sends (subfilters.job.tagIds, subfilters.multiMachineJob.matchAllTags, ...).

— Claude Opus 5.5, via /create-pr; text not reviewed

bmaydan and others added 2 commits October 7, 2026 21:34
…port

The V2 usage report and its filter-values endpoint gained cloud account
and per-resource-type filters, and moved resource IDs to a paginated
endpoint, so the SDK's billing filters had fallen behind:

- Add cluster_ids and subfilters (job/MMT/deployment tags, assistant
  message API keys) to BillingActivityFilters and BillingApi.
- Return cluster_ids and subfilter values from get_activity_filter_values,
  dropping resource_ids/resource_ids_truncated, which the server no
  longer sends.
- Add get_activity_filter_resource_names for paging through resource IDs.
- Stop sending limit and the pagination cursor to the CSV downloads,
  which ignore them, and reject tag subfilters there since the download
  endpoints don't apply them yet.
- Fix resource type examples to the raw values the server uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The session and resource download endpoints now read the job, multi-machine
job and deployment tag subfilters (grid #47735), so forward them under the
same dotted keys the UI uses instead of rejecting them with a ValueError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant