Skip to main content

Module cascade

Module cascade 

Source
Expand description

OAuth usage fallback cascade.

Glues the slice modules (cache, credentials, fetcher, jsonl, usage) into the full cascade from docs/specs/data-fetching.md §OAuth fallback cascade. The orchestrator is a pure function keyed on injected dependencies so every branch is exercised without real I/O, network, or Keychain access.

The lock-active short-circuit runs before the credentials read so a process observing another’s backoff window can answer from disk (or the JSONL fallback) without paying the Keychain subprocess. NoCredentials-vs-Timeout masking is preserved because credentials are still resolved before any endpoint call that could time out.

Structs§

UsageCascadeConfig
Tunables threaded into resolve_usage. Out-of-box defaults match docs/specs/data-fetching.md §OAuth usage cache stack.

Constants§

DEFAULT_API_BASE_URL
Default endpoint base URL per ADR-0011 §Endpoint contract.
DEFAULT_CACHE_DURATION
Default cache freshness window per docs/specs/data-fetching.md §OAuth usage cache stack.
DEFAULT_ERROR_TTL
Shorter TTL applied to error responses and lock-backoff windows for non-429 failures, per docs/specs/data-fetching.md §OAuth usage cache stack (“Error cache uses a shorter TTL (30s default)”).
DEFAULT_RATE_LIMIT_BACKOFF
Fallback backoff when a 429 arrives without a parseable Retry-After. Matches DEFAULT_RATE_LIMIT_BACKOFF in fetcher.rs (300s per ADR-0011 §Cache stack).

Functions§

resolve_usage
Resolve OAuth usage data using the full fallback cascade.