Skip to content

fix: Remove userGroup field from usage tracking (fixes #673)#857

Open
nikhase wants to merge 6 commits into
codecentric:mainfrom
nikhase:claude/issue-673-remove-group-usage-tracking-Jn1r9
Open

fix: Remove userGroup field from usage tracking (fixes #673)#857
nikhase wants to merge 6 commits into
codecentric:mainfrom
nikhase:claude/issue-673-remove-group-usage-tracking-Jn1r9

Conversation

@nikhase
Copy link
Copy Markdown
Collaborator

@nikhase nikhase commented Jan 3, 2026

Since users can have multiple groups, it's unclear which group usage should be attributed to. This change removes the userGroup field from the usages table.

Changes:

  • Add migration to drop userGroup column from usages table
  • Remove userGroup field from UsageEntity
  • Remove userGroup from usage tracking calls
  • Remove group-level quota check from CheckUsageMiddleware
  • Update tests to not set userGroup field

The change maintains user-level quota enforcement while removing ambiguous group-level tracking.

Since users can have multiple groups, it's unclear which group
usage should be attributed to. This change removes the userGroup
field from the usages table.

Changes:
- Add migration to drop userGroup column from usages table
- Remove userGroup field from UsageEntity
- Remove userGroup from usage tracking calls
- Remove group-level quota check from CheckUsageMiddleware
- Update tests to not set userGroup field

The change maintains user-level quota enforcement while removing
ambiguous group-level tracking.
@nikhase nikhase force-pushed the claude/issue-673-remove-group-usage-tracking-Jn1r9 branch from 0f087c1 to 26b4eef Compare January 4, 2026 22:07
Comment on lines +55 to +56
// Note: Group-level quota check removed because userGroup field was removed from usage tracking (issue #673)
// Only user-level quotas are enforced now
Copy link
Copy Markdown
Collaborator

@surt91 surt91 Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this comment, since it does not document existing code (but removed code).

Copy link
Copy Markdown
Collaborator

@surt91 surt91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes the usage data by group, which is good.
But this PR also needs to remove the monthlyTokens from the UserGroupRepository as well as all UI elements, where this property can be set. Otherwise c4 would offer a UI to set the maximum number of tokens per group but would not enforce it.

claude added 5 commits January 5, 2026 20:58
Since group-level usage tracking was removed in the previous commit,
the monthlyTokens field (group-level quota) can no longer be enforced.
This commit removes the field entirely to prevent user confusion.

Changes:
- Remove monthlyTokens from UserGroupEntity
- Add migration to drop monthlyTokens column from database
- Remove monthlyTokens from backend DTOs and interfaces
- Remove monthlyTokens input fields from frontend dialogs
- Remove comment referencing removed functionality
- Keep monthlyUserTokens (per-user quota) which is still enforced

Only user-level quotas (monthlyUserTokens) are now supported.
Removed monthlyTokens field references from create and update user group
use-cases to complete the removal of group-level quota tracking. This
fixes TypeScript compilation errors where UpsertUserGroupDto no longer
contains monthlyTokens but the use-cases still expected it.

Changes:
- Updated Values type to only include monthlyUserTokens and name
- Removed monthlyTokens from destructuring and entity assignment
- Updated package-lock.json from dependency install
Removed all references to the monthlyTokens field from user group
dialog tests to match the removal of group-level quota tracking.

Changes:
- Removed monthlyTokens from mockUserGroup in UpdateUserGroupDialog tests
- Removed monthlyTokens field assertions from tests
- Removed entire test for "monthly tokens goes below zero"
- Cleaned up remaining test to only validate monthlyUserTokens
Removed monthlyTokens field from user group e2e test assertions and
test data to match the removal of group-level quota tracking.

Changes:
- Removed monthlyTokens from newUserGroup test data
- Removed monthlyTokens from updatedUserGroup test data
- Removed monthlyTokens assertions from create/update test cases
Updated the generated OpenAPI specification to reflect the removal
of the monthlyTokens field from UserGroup DTOs.
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.

3 participants