Skip to content

Add usage notifications for billing limits#6056

Merged
sanne-san merged 15 commits intomasterfrom
sanne-billing-notifications
Feb 16, 2026
Merged

Add usage notifications for billing limits#6056
sanne-san merged 15 commits intomasterfrom
sanne-billing-notifications

Conversation

@sanne-san
Copy link
Contributor

Changes

  • As a first step towards improving the subscription settings page, this commit adds usage notifications for billing limits. These are not yet being displayed in the UI.

Tests

  • Automated tests have been added

Changelog

  • This PR does not make a user-facing change

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

- As a first step towards improving the subscription settings page, this commit adds usage notifications for billing limits. These are not yet being displayed in the UI.
@sanne-san sanne-san force-pushed the sanne-billing-notifications branch from 4fe93b2 to 0936c29 Compare February 10, 2026 08:36
@sanne-san sanne-san force-pushed the sanne-billing-notifications branch from 4d89e7b to db8fa96 Compare February 10, 2026 09:15
Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

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

I like where we're going with this! As you've probably realized, the billing logic is incredibly complex and there are a lot of different considerations at every step. So even a small PR like this has a bunch of comments 😄

PS: The screen recordings you shared are 💯👌! Excited to see those changes in :)

- Move `determine_notification_type` function from Notice component to `Plausible.Billing.Quota`
- Rename `determine_notification_type` to `usage_notification_type`
- Cut down on the number of arguments to make the `usage_notification_type` function more readable
- Add public `has_billing_cycles` predicate function
- Update `exceeds_last_two_usage_cycles` to use `has_billing_cycles`
- Extract `pageview_cycle_usage_notification_type` for pageview limit notifications
- Rename :limits_reached_combined to :site_and_team_member_limit_reached
- Update all tests to use realistic data structures
- Split traffic_exceeded_sustained into base notification and grace_period_active variant
- Add GracePeriod.days_left/1 to calculate remaining days in grace period
- Display "within the next X days" for active grace periods
@sanne-san sanne-san force-pushed the sanne-billing-notifications branch from d0efcd2 to 197febf Compare February 12, 2026 13:27
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
grace period end in hours + remove unused fn
@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sanne-billing-notifications

Comment @coderabbitai help to get the list of available commands and usage tips.

- Enterprise manual locks (no end date) now use separate notification
without countdown, while regular grace periods show dynamic "within X
days/hours".
- Update exceeded_cycles to support checking with or without
allowance margin.
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
@sanne-san sanne-san force-pushed the sanne-billing-notifications branch from 217fb01 to 20db67e Compare February 16, 2026 16:41
- A manual lock can be triggered not only due to pageview limit, but also due to site limit. For this reason, it needs a separate notification with copy that fits both use cases.
@sanne-san sanne-san force-pushed the sanne-billing-notifications branch from 20db67e to 90dddfb Compare February 16, 2026 16:46
@sanne-san sanne-san added this pull request to the merge queue Feb 16, 2026
Merged via the queue into master with commit 3119839 Feb 16, 2026
26 of 39 checks passed
@sanne-san sanne-san deleted the sanne-billing-notifications branch February 16, 2026 17:14
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