Skip to content

Community Health: monthly community health report system - #4336

Open
functionzz wants to merge 14 commits into
mozilla:mainfrom
functionzz:community_health_alert_system
Open

Community Health: monthly community health report system#4336
functionzz wants to merge 14 commits into
mozilla:mainfrom
functionzz:community_health_alert_system

Conversation

@functionzz

@functionzz functionzz commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

This PR creates a community health alert system for PMs, and allows PMs see month-over-month changes to CHS at a glance. It is compiled monthly.

image

Fixes #4329.

@codecov-commenter

codecov-commenter commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.32314% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.25%. Comparing base (d98e0ac) to head (c5a088b).
⚠️ Report is 2 commits behind head on main.

🚀 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.

@functionzz
functionzz force-pushed the community_health_alert_system branch 2 times, most recently from 96979a9 to e6cf8c9 Compare August 4, 2026 13:28
@functionzz
functionzz requested a review from mathjazz August 4, 2026 15:46

@mathjazz mathjazz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work!

Some high-level questions:

  • Why is the /insights page shown to and the notification sent to is_staff users , but the emails can be opted in by is_superuser users?
  • Why don't we automatically opt in all is_staff users also for receiving emails and drop the settings? This is an altert system afterall. Or at least opt them in by default, if we really want to keep the ability to opt out.
  • Have we tested the notification in the translate view, which has its own notification implementation?
  • The docstring says rows are "ranked by the size of that change", but the biggest gains come first and the worst regressions land at the bottom of the table. In an alert system, the regressions are the actionable half. Sort by abs(percentage) to match the docstring?
  • The new command needs to be documented on documentation/docs/dev/deployment.md. We should mention it silently depends on cron ordering - it reads the current month's snapshot — which collect_chs_snapshots creates on that same day.
  • We should also document the reporting feature for the Admins. Note that there's still #4338 (comment).


{% if description and (description.startswith("Unreviewed suggestions") or notification.verb == "has reviewed suggestions" or notification.verb == "ignore") %}
<span class="description">{{ description|safe }}</span>
<div class="description">{{ description|safe }}</div>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If we keep it as a span, if the description contains html elements, they will all be converted to text, which is not what we want.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The main point is now we have a system notification that automatically sends but also contains more complex html + css, which was not supported with the current code. All our previous system notifications were just one-liner spans.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of these changes?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because I changed description to a div, I also want it to inherit css styling as well.

Comment thread pontoon/base/migrations/0128_userprofile_monthly_health_report.py
assert mail.outbox[0].to == [user_a.contact_email]


@pytest.mark.django_db

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should also add a test for the case when none of the locales passes a threshold.

@flodolo

flodolo commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator
  • Why don't we automatically opt in all is_staff users also for receiving emails and drop the settings? This is an altert system afterall. Or at least opt them in by default, if we really want to keep the ability to opt out.

I don't think all superusers are PMs interested in this information, so they should have a way to opt out. I have the feeling the majority falls into this category, hence the opt-in suggestion to Jamie.

@functionzz

Copy link
Copy Markdown
Collaborator Author

Why is the /insights page shown to and the notification sent to is_staff users , but the emails can be opted in by is_superuser users?

I actually think it should be only reserved to is_staff users - I made the change before you reviewed, but it seems I didn't completely change options. I need to change both user pool to be from is_staff.

Why don't we automatically opt in all is_staff users also for receiving emails and drop the settings? This is an alert system after all. Or at least opt them in by default, if we really want to keep the ability to opt out.

Just like the other email systems in Pontoon, I think we should keep the option to opt in given both the notification & email output very similar things.

Have we tested the notification in the translate view, which has its own notification implementation?

Not yet, will do that now.

The docstring says rows are "ranked by the size of that change", but the biggest gains come first and the worst regressions land at the bottom of the table. In an alert system, the regressions are the actionable half. Sort by abs(percentage) to match the docstring?

Sure.

The new command needs to be documented on documentation/docs/dev/deployment.md. We should mention it silently depends on cron ordering - it reads the current month's snapshot — which collect_chs_snapshots creates on that same day. We should also document the reporting feature for the Admins. Note that there's still #4338 (comment).

Sure, I'll make the changes in this PR.

@functionzz
functionzz force-pushed the community_health_alert_system branch from 5b5bde8 to b9a755c Compare August 7, 2026 18:22
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.

Community health: alert system for PMs

4 participants