Skip to main content

Module billing

Module billing 

Source
Expand description

Commercial-plane billing substrate (billing-plane-v1): plans, entitlements, and usage metering derived from the signed savings ledger. Never gates local. Commercial-plane billing substrate (billing-plane-v1, EPIC 13.6).

Turns the existing plan-upgrade flow into real plans + entitlements plus usage-based metering derived from the signed savings ledger (EPIC 12.20) — without touching the local experience.

§Two halves, one invariant

  • plans — the plan catalog and their Entitlements. Commercial, additive. entitlement_allows expresses the Local-Free Invariant: every local-always-on capability is allowed on every plan, including Plan::Free. No local feature is ever gated.
  • meteringUsage derived read-only from the privacy-preserving, Ed25519-signed ledger aggregate. Only signed + intact chains are billable.

Crucially, this module computes and describes commercial state; it never enforces anything against the local plane. Enforcement (checkout, plan gating) lives on the hosted control plane, which is the only place an account/plan is consulted. The local engine has no entitlement checks — asserted by tests/local_free_invariant.rs.

Re-exports§

pub use metering::Usage;
pub use metering::metered_usage;
pub use plans::Entitlements;
pub use plans::Plan;
pub use plans::entitlement_allows;
pub use plans::min_plan_for;

Modules§

metering
Usage-based metering derived from the signed savings ledger (billing-plane-v1, EPIC 13.6).
plans
Commercial-plane plans and their entitlements (billing-plane-v1, EPIC 13.6).