DUP-CROSS-2: provider/model key construction repeated across Go and TypeScript #51

Closed
opened 2026-05-27 16:57:56 +02:00 by dries · 0 comments
Owner

Summary

The pattern provider + "/" + model (with checks for both being non-empty) is used to build a canonical model key in at least 5 places:

Go (internal/db/stats.go):

  • Line 231–233 in scanDashboardRows
  • Line 1131 in GetModelUsage
  • Lines 1402–1406 in GetNewAssistantMessages

TypeScript (frontend/src/lib/):

  • sessionStatus.ts line 51 (formatModelRef)
  • api.ts lines 207–217 (model param builder, bypassing formatModelRef)

Fix

  • Go: extract a one-liner func modelKey(provider, model string) string (alongside the existing extractModelProvider in stats.go)
  • TypeScript: ensure all callers use formatModelRef consistently (the api.ts param builder should call it)

Effort

Low.

## Summary The pattern `provider + "/" + model` (with checks for both being non-empty) is used to build a canonical model key in at least 5 places: **Go** (`internal/db/stats.go`): - Line 231–233 in `scanDashboardRows` - Line 1131 in `GetModelUsage` - Lines 1402–1406 in `GetNewAssistantMessages` **TypeScript** (`frontend/src/lib/`): - `sessionStatus.ts` line 51 (`formatModelRef`) - `api.ts` lines 207–217 (model param builder, bypassing `formatModelRef`) ## Fix - Go: extract a one-liner `func modelKey(provider, model string) string` (alongside the existing `extractModelProvider` in `stats.go`) - TypeScript: ensure all callers use `formatModelRef` consistently (the api.ts param builder should call it) ## Effort Low.
dries closed this issue 2026-07-11 11:23:18 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dries/ocman#51
No description provided.