Background
During review of PR #2738, several type-safety improvements were proposed and implemented, but ultimately deemed too large to include in the original bugfix PR. This issue tracks them as a follow-up.
Proposed changes
modelsdev.ID struct — Add ID{Provider, Model string}, NewID, ParseID, ParseIDOrZero, String() to pkg/modelsdev
Store.GetModel(ctx, ID) — Change from bare string to modelsdev.ID, so the compiler prevents passing unqualified model names
Provider.ID() modelsdev.ID — Change the provider.Provider interface method to return modelsdev.ID instead of string
base.Config.ID() and ModelCapsID() — Return modelsdev.ID
modelcaps.Load / LoadFromStore — Accept modelsdev.ID instead of string
- All downstream callers —
getEffectiveModelID, calculateSemanticUsageCost, VectorStore.modelID, EmbeddingConfig.ModelID, rulebased.LastSelectedModelID, team.go, runtime.go, rag/strategy, teamloader, modelinfo, etc.
Motivation
The original bug (#2737) existed because modelcaps.Load took a bare string and callers accidentally passed just the model name (e.g. "claude-sonnet-4-6") instead of the required "provider/model" format. A struct type makes this class of error impossible to compile.
Scope
This is a significant but mechanical refactor — ~50 call sites, mostly renaming string to modelsdev.ID and calling .String() at the boundaries where strings are required (slog, event payloads, etc.).
Background
During review of PR #2738, several type-safety improvements were proposed and implemented, but ultimately deemed too large to include in the original bugfix PR. This issue tracks them as a follow-up.
Proposed changes
modelsdev.IDstruct — AddID{Provider, Model string},NewID,ParseID,ParseIDOrZero,String()topkg/modelsdevStore.GetModel(ctx, ID)— Change from barestringtomodelsdev.ID, so the compiler prevents passing unqualified model namesProvider.ID() modelsdev.ID— Change theprovider.Providerinterface method to returnmodelsdev.IDinstead ofstringbase.Config.ID()andModelCapsID()— Returnmodelsdev.IDmodelcaps.Load/LoadFromStore— Acceptmodelsdev.IDinstead ofstringgetEffectiveModelID,calculateSemanticUsageCost,VectorStore.modelID,EmbeddingConfig.ModelID,rulebased.LastSelectedModelID,team.go,runtime.go,rag/strategy,teamloader,modelinfo, etc.Motivation
The original bug (#2737) existed because
modelcaps.Loadtook a barestringand callers accidentally passed just the model name (e.g."claude-sonnet-4-6") instead of the required"provider/model"format. A struct type makes this class of error impossible to compile.Scope
This is a significant but mechanical refactor — ~50 call sites, mostly renaming
stringtomodelsdev.IDand calling.String()at the boundaries where strings are required (slog, event payloads, etc.).