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. Its frozen v1 is_billable predicate means source integrity only; it is not settlement authority.
  • settlement_evidence — bounded, payload-free v2 evidence reconciliation. It never calculates prices, approves customers, decides disputes, or issues invoices.

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;
pub use settlement_evidence::SettlementEligibilityV2;
pub use settlement_evidence::SettlementEvidenceManifestV2;
pub use settlement_evidence::reconcile_settlement_evidence_v2;

Modules§

metering
Usage-based metering — OSS stub (ADR-023).
plans
Commercial-plane plans and their entitlements (billing-plane-v1, EPIC 13.6).
settlement_evidence
Payload-free settlement-evidence eligibility for the open data plane.