Skip to content

[P2.3] cf stats loads the entire token_usage table into Python (no LIMIT/index, ignores SQL rollup) #752

Description

@frankbria

Severity: medium | Category: infra | Phase: P2.3

Problem

get_workspace_token_usage does SELECT * with no LIMIT and aggregates in Python; --period filters timestamp with no index and re-aggregates despite get_costs_summary existing.

Evidence

codeframe/platform_store/repositories/token_repository.py:246

Acceptance criteria

Aggregation pushed into SQL (SUM/GROUP BY, WHERE range); export streams/paginates. (Indexes handled by P0.1.)

Dependencies

blocked by #712 ([P0.1])


Filed from the SaaS launch-readiness audit. Atomic: one developer, one session. Work order: strictly P0.1 → P3.12 (no forward dependencies).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions