Skip to content

🐛(entitlements) identify mailboxes in DeployCenter usage metrics - #868

Merged
jbpenrath merged 1 commit into
mainfrom
fix/dc-metric-account
Nov 17, 2026
Merged

jbpenrath merged 1 commit into
mainfrom
fix/dc-metric-account

Conversation

@jbpenrath

@jbpenrath jbpenrath commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

DeployCenter ties a usage metric to an account only when the entry carries an id: without one, it stores the mailbox usage against no account, so its entitlements response answers metrics.account as null, which Messages reads as an empty mailbox. In an organization with a per-mailbox quota, the storage gauge then showed "0 / 15 GB" whatever the mailbox held; elsewhere it gauges the organization, whose usage is tied through its siret, which hid the problem.

The mailbox entries pushed with the entitlements request and served by the usage metrics endpoint now carry the mailbox id, a stable identifier.

Summary by CodeRabbit

  • Improvements
    • Mailbox usage metrics now include the mailbox’s unique ID alongside its email and account type.

DeployCenter ties a usage metric to an account only when the entry carries
an id: without one, it stores the mailbox usage against no account, so its
entitlements response answers metrics.account as null, which Messages reads
as an empty mailbox. In an organization with a per-mailbox quota, the
storage gauge then showed "0 / 15 GB" whatever the mailbox held; elsewhere
it gauges the organization, whose usage is tied through its siret, which
hid the problem.

The mailbox entries pushed with the entitlements request and served by the
usage metrics endpoint now carry the mailbox id, a stable identifier.
@jbpenrath jbpenrath self-assigned this Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Mailbox-level usage metrics now include the mailbox UUID as a string in account.id in the API response and DeployCenter payload. Tests assert the mailbox account’s type, ID, and email.

Changes: Mailbox usage metrics

Layer / File(s) Summary
Include mailbox IDs in usage accounts
src/backend/core/api/viewsets/metrics.py, src/backend/core/entitlements/backends/deploycenter.py, src/backend/core/tests/api/test_mailbox_usage_metrics.py, src/backend/core/tests/entitlements/test_mailbox_backends.py
Both mailbox usage metric paths include the mailbox UUID as a string in account.id. Tests check the account’s type, ID, and email.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: sylvinus

Merge Risk: Minimal · up to f13d7

This change adds the mailbox ID to mailbox usage metrics so that Messages can show mailbox usage instead of "0 / 15 GB". The change is small and tested, and no concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: mailbox IDs are now included in DeployCenter usage metrics, so DeployCenter can associate mailbox usage with the correct account. The raw summary confirms the mailbox …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: mailbox IDs are now included in DeployCenter usage metrics, so DeployCenter can associate mailbox usage with the correct account. The raw summary confirms the mailbox ID is added to the account sent to DeployCenter and returned by the metrics endpoint. The title uses a gitmoji and a scope, which is a style choice, not a relevance problem.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8563ac0b-96ec-4d7c-91c7-cf907e12716c
Commits

Reviewing files that changed from the base of the PR and between 69d7de7 and f13d793.

Files selected for processing: 4

  • src/backend/core/api/viewsets/metrics.py
  • src/backend/core/entitlements/backends/deploycenter.py
  • src/backend/core/tests/api/test_mailbox_usage_metrics.py
  • src/backend/core/tests/entitlements/test_mailbox_backends.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@jbpenrath
jbpenrath requested a review from sylvinus November 17, 2026 17:45
@jbpenrath
jbpenrath merged commit 2e6717d into main Nov 17, 2026
24 checks passed
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.

2 participants