Skip to content

Internal statistic for users performing actions - #2919

Merged
pylipp merged 9 commits into
masterfrom
users-performing-actions-metric
Sep 30, 2026
Merged

pylipp merged 9 commits into
masterfrom
users-performing-actions-metric

Conversation

@pylipp

@pylipp pylipp commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.24%. Comparing base (a9ab13d) to head (06fe183).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2919      +/-   ##
==========================================
+ Coverage   74.23%   74.24%   +0.01%     
==========================================
  Files         332      332              
  Lines       25447    25459      +12     
  Branches     2535     2537       +2     
==========================================
+ Hits        18890    18902      +12     
  Misses       6507     6507              
  Partials       50       50              
Flag Coverage Δ
backend 99.65% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pylipp
pylipp marked this pull request as ready for review September 30, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Missing organisation data can crash the cron, and the new metric repeatedly scans an unindexed history range.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds internal statistics distinguishing logged-in users from users performing recorded actions.

Changes:

  • Renames the Auth0-based metric to “logged-in users.”
  • Adds a history-based “active users” metric.
  • Updates cron output and tests for seven statistics.
File Description
back/​boxtribute_server/​business_logic/​metrics/​crud.py Implements logged-in and active-user metrics.
back/​boxtribute_server/​cron/​internal_stats.py Publishes both metrics.
back/​test/​endpoint_tests/​test_metrics.py Tests metric calculations.
back/​test/​endpoint_tests/​test_cron.py Updates cron expectations.
back/​test/​auth0_integration_tests/​test_operations.py Updates Auth0 integration coverage.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread back/boxtribute_server/business_logic/metrics/crud.py Outdated
Comment on lines +435 to +437
DbChangeHistory.user.is_null(False),
DbChangeHistory.change_date >= start,
DbChangeHistory.change_date <= end,

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Normalize Auth0 login timestamps and correct or omit historical login-window comparisons.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Latest login cannot reconstruct historical comparison windows

back/​boxtribute_server/​business_logic/​metrics/​crud.py:394

last_login is Auth0's current/latest login, so it cannot reconstruct an earlier window once the user logs in again. get_internal_data() passes the same users to compute_with_trend for both the current and prior windows, which moves such users out of the comparison period and makes the logged-in trend and historical column values inaccurate. Please fetch login events/history per window, or omit/mark the historical comparison for this metric until that data is available.

Comment thread back/boxtribute_server/business_logic/metrics/crud.py
@pylipp
pylipp merged commit 86cfb24 into master Sep 30, 2026
13 of 15 checks passed
@pylipp
pylipp deleted the users-performing-actions-metric branch September 30, 2026 11:27
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