Skip to content

Comments

feat: add feature name to microdollar usage rows#369

Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
session/agent_13b70462-cc74-475c-a52e-f4dba6d643ea
Open

feat: add feature name to microdollar usage rows#369
kiloconnect[bot] wants to merge 1 commit intomainfrom
session/agent_13b70462-cc74-475c-a52e-f4dba6d643ea

Conversation

@kiloconnect
Copy link
Contributor

@kiloconnect kiloconnect bot commented Feb 19, 2026

Summary

Add the feature name (e.g. vscode-extension, jetbrains-extension, cli, slack, kilo-claw, cloud-agent, code-review, etc.) to the usage rows exposed to users, for both organization-level and user-level usage.

The feature_id already exists in microdollar_usage_metadata, linking to the feature lookup table. This PR joins through that relationship to surface the feature name in the API responses and usage tables.

Changes

Backend

  • src/app/api/profile/usage/route.ts — User-level usage API: LEFT JOIN microdollar_usage_metadata + feature tables, add feature to select fields and GROUP BY
  • src/routers/organizations/organization-usage-details-router.ts — Org-level usage get endpoint: LEFT JOIN microdollar_usage_metadata + feature tables, add feature to select/groupBy/response schema

Types

  • src/lib/organizations/organization-types.ts — Add optional feature field to UsageDetailByDay

Frontend

  • src/app/(app)/usage/page.tsx — Add Feature column to user-level usage table
  • src/components/organizations/usage-details/hooks/useUsageTableData.tsx — Add Feature column to org usage table (parent + expanded child rows)
  • src/components/organizations/usage-details/utils/csvExport.ts — Add Feature column to CSV export

Testing

  • pnpm typecheck passes cleanly
  • Lint-staged (prettier + typecheck) passes on commit

Built for Brendan by Kilo for Slack

Join the feature lookup table via microdollar_usage_metadata to expose
the feature name (e.g. vscode-extension, jetbrains-extension, cli, etc.)
in usage rows for both user-level and organization-level usage endpoints.

Changes:
- User usage API (GET /api/profile/usage): LEFT JOIN metadata + feature
  tables, add feature to select/groupBy
- Org usage details router (get endpoint): LEFT JOIN metadata + feature
  tables, add feature to select/groupBy/response schema
- UsageDetailByDay type: add optional feature field
- User usage page: add Feature column to table
- Org usage table hook: add Feature column to table and expanded rows
- CSV export: add Feature column
@kiloconnect
Copy link
Contributor Author

kiloconnect bot commented Feb 19, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
src/components/organizations/usage-details/hooks/useUsageTableData.tsx 158 WARNING: Duplicate React keys for expanded child rows. The child row id is constructed as `${rollup.date}-${usage.user.email}${groupByModel ? `-${usage.model || 'unknown'}` : ''}` which does not include feature. Since the backend now groups by feature.feature, the same user on the same date (and model) can have multiple rows with different features. These child rows will have identical id values, causing React duplicate key warnings and potential rendering bugs. Consider appending -${usage.feature || 'none'} to the child row ID.
Files Reviewed (6 files)
  • src/app/(app)/usage/page.tsx - 0 issues
  • src/app/api/profile/usage/route.ts - 0 issues
  • src/components/organizations/usage-details/hooks/useUsageTableData.tsx - 1 issue (not in diff)
  • src/components/organizations/usage-details/utils/csvExport.ts - 0 issues
  • src/lib/organizations/organization-types.ts - 0 issues
  • src/routers/organizations/organization-usage-details-router.ts - 0 issues

Fix these issues in Kilo Cloud

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.

0 participants