mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 07:12:12 +03:00
refactor(usage): type saveRequestUsage with UsageEntry interface + any-budget ratchet (#3512) (#6809)
Replace saveRequestUsage(entry: any) with a typed UsageEntry interface
mirroring the usage_history columns 1:1. Fields stay optional/nullable
since different writers (chatCore success/failure, rejected-request
accounting, Codex Responses WS) populate the row incrementally; tokens
stays unknown since callers pass either raw provider-shaped usage or
the normalized {input,output,cacheRead,...} shape.
Also cleaned the file's other any usages (getUsageHistory filter,
getUsageDb next-cursor cast, appendRequestLog tokens param,
getRecentLogs catch) so it now sits at zero any and can be added to
the check:any-budget:t11 zero-any allowlist.
Documents the DB-entity <-> TS-interface convention in
docs/architecture/CODEBASE_DOCUMENTATION.md Sec 11.
This commit is contained in:
committed by
GitHub
parent
6d3d122b84
commit
d96bd80343
@@ -22,6 +22,10 @@ const budget = [
|
||||
{ file: "src/lib/db/prompts.ts", maxAny: 0 },
|
||||
{ file: "src/lib/db/providers.ts", maxAny: 0 },
|
||||
{ file: "src/lib/db/settings.ts", maxAny: 0 },
|
||||
// #3512: saveRequestUsage typed with UsageEntry (DB-entity 1:1 interface); the
|
||||
// other any's in this file (getUsageHistory filter, nextCursor cast,
|
||||
// appendRequestLog tokens, getRecentLogs catch) were cleaned in the same pass.
|
||||
{ file: "src/lib/usage/usageHistory.ts", maxAny: 0 },
|
||||
{ file: "open-sse/config/providerRegistry.ts", maxAny: 0 },
|
||||
{ file: "open-sse/config/providerModels.ts", maxAny: 0 },
|
||||
{ file: "open-sse/mcp-server/audit.ts", maxAny: 0 },
|
||||
|
||||
Reference in New Issue
Block a user