[Spike] The new check system for the usage billing pipeline

Description

We want to make the billing‑related decisions in the system easier to understand, reuse, and safely change. Right now, the "should we allow this request?" and "should we process this usage event?" logic is spread across different places, even we have tried to keep them in sync. That makes it harder to verify behavior and harder to change without risk.

The proposal is:

  1. Clear decision points
    We'll define two clear types of decisions:
  • Usage quota requests: allowed, skipped or denied (with a reason and status).
  • Usage events: accepted, rejected, or ignored.

This makes it explicit what the system decided, and why.

  1. A consistent rule engine

Instead of scattering rules across controllers or services, we'll put checks into a consistent rule pipeline. Each rule can say:

  • accept/allow
  • reject/deny
  • ignore/skip

This keeps the logic organized and makes it easy to add or remove checks without rewriting multiple files.

  1. Safer rollout
    We'll keep the current behavior in place and only enable the new checks behind a feature flag. That means:
  • We can turn it on only for some requests.
  • We can compare outcomes against the current behavior.
  • We can roll it out gradually and safely.
  1. Better visibility
    We'll add lightweight logging so we can see which rule decided the outcome. This helps support teams and makes debugging easier.

  2. Minimal disruption
    We are not changing business behavior right away. The goal is to reorganize it so future changes are faster and safer, while keeping results the same.

In short: this is a structural improvement to make billing decisions clearer, reusable, and safer to evolve - without changing how the system behaves today

Assignee Loading
Time tracking Loading