Skip to content

Price tier-resolved usage or record a structured unpriced reason #66

Closed

Description

@aviggiano

Problem

Model resolution can succeed while an event remains unpriced, without recording why pricing could not be applied. Tiered context rates, cache categories, or incomplete request-level usage can make a single exact price unavailable.

Impact

Consumers cannot tell whether a zero or missing cost means free usage, incomplete telemetry, an unsupported pricing rule, or an accounting defect.

Proposed remediation

  • Add a typed unpriced_reason for every resolved-but-unpriced event.
  • Preserve the selected tier, component rates, formula revision, and pricing-catalog revision used for each calculation.
  • Use request-level usage when tier selection depends on request properties.
  • When only aggregate usage is available, emit a documented bounded estimate instead of an unexplained missing value.
  • Distinguish exact, estimated, unavailable, and excluded pricing states.

Acceptance criteria

  • Synthetic fixtures cover requests below a tier boundary, above it, and aggregate usage spanning the boundary.
  • A resolved event cannot be silently marked pricing-complete without an exact cost or typed reason.
  • Exact and bounded-estimate calculations are deterministic for a fixed catalog revision.
  • Reports expose pricing state without requiring raw provider payloads.

Privacy constraints

Tests and documentation must use invented models, rates, and usage values only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions