pub fn resolve_usage(
cache: Option<&CacheStore>,
lock: Option<&LockStore>,
transport: &dyn UsageTransport,
credentials: &dyn Fn() -> Arc<Result<Credentials, CredentialError>>,
jsonl: &dyn Fn() -> Result<JsonlAggregate, JsonlError>,
now: &dyn Fn() -> Timestamp,
config: &UsageCascadeConfig,
) -> Result<UsageData, UsageError>Expand description
Resolve OAuth usage data using the full fallback cascade.
credentials and jsonl are lazily evaluated: the cascade does
NOT invoke either on a fresh-cache or stale-lock-serve path,
preserving the “no Keychain subprocess on cache hits” guarantee.
cache and lock being None is equivalent to pointing at paths
that don’t exist: reads degrade to “miss” and writes are skipped.
Write failures fall into two classes. Real bugs (disk full,
missing parent dir, EACCES) log via lsm_error! (bypasses the
level gate). The documented Windows MoveFileEx race-loser case
logs via lsm_debug! (suppressible) so multi-terminal Windows
users don’t get persistent stderr noise on healthy runs. Either
way the cascade still returns fetched data.