woyin's Routing rows show cline-pass/deepseek-v4.1-flash-1017 served as vmc/deepseek-v4p1-flash-1017-contributor-fallbacks. Third-party Cline Pass tools record that name as a private contributor deployment (finalProvider "openai-compatible-private"), not DeepSeek's own API. So the row has to keep saying it was served elsewhere. 6db5e9d59's ClineServing already does this, because only the exact model maps. This commit is tests only: they hold the rule, so a looser match (a prefix, say) can't hide the route later. - TestSwappedClineServingName: -contributor-fallbacks (with and without the -1017 date), -contributor and -fallbacks are swaps. - TestRouteKeptClineServingNameNotSwapped: a kept row served as ...-contributor-fallbacks stays swapped when it is read again. Run at 616c87256's tree: - go test ./internal/usage: ok. - go test ./internal/gateway -run 'Clin|Swap|Served|routedAgain|History': ok. - go vet on darwin, linux and windows: ok. gofmt -l: clean. Broken by hand: ClineServing changed to a prefix match. Three usage cases and the history case went red. Restored afterwards. Not run: the full suite (tests only, in two packages).
54 lines
2.5 KiB
Go
54 lines
2.5 KiB
Go
package usage
|
|
|
|
import "testing"
|
|
|
|
// ClinePass answers a cline-pass/ model under its virtual model config's
|
|
// name, the version's dot written "p" (cline-pass/deepseek-v4.1-flash-1017
|
|
// as vmc/deepseek-v4p1-flash-1017, hy125245 on X and zRain on Discord):
|
|
// the model asked for, whichever upstream served it. Another model under
|
|
// a vmc/ name, and a vmc/ name for a model not asked of ClinePass, are
|
|
// still swaps.
|
|
func TestSwappedClineServingName(t *testing.T) {
|
|
for _, c := range [][2]string{
|
|
{"cline-pass/deepseek-v4.1-flash-1017", "vmc/deepseek-v4p1-flash-1017"},
|
|
{"cline/cline-pass/deepseek-v4.1-flash-1017", "vmc/deepseek-v4p1-flash-1017"},
|
|
{"cline-pass/deepseek-v4.1-flash", "vmc/deepseek-v4p1-flash"},
|
|
{"cline-pass/deepseek-v4.1-flash", "VMC/DeepSeek-V4p1-Flash"},
|
|
{"cline-pass/glm-5.3", "vmc/glm-5p3"},
|
|
{"cline-pass/deepseek-v4-pro", "vmc/deepseek-v4-pro"},
|
|
} {
|
|
if Swapped(c[0], c[1]) {
|
|
t.Errorf("%s answered as %s is the model asked for", c[0], c[1])
|
|
}
|
|
}
|
|
for _, c := range [][2]string{
|
|
{"cline-pass/deepseek-v4-pro", "vmc/deepseek-v4p1-flash"},
|
|
{"cline-pass/deepseek-v4.1-flash", "vmc/deepseek-v4p1-pro"},
|
|
{"cline-pass/deepseek-v4.1-flash", "vmc/deepseek-v4p2-flash"},
|
|
{"cline-pass/glm-5.3", "vmc/glm-5p3-flash"},
|
|
{"deepseek/deepseek-v4.1-flash", "vmc/deepseek-v4p1-flash"},
|
|
{"cline-pass/deepseek-v4.1-flash", "other/deepseek-v4p1-flash"},
|
|
{"cline-pass/deepseek-v4.1-flash-1017", "vmc/deepseek-v4p1-flash-1017-contributor-fallbacks"},
|
|
{"cline-pass/deepseek-v4.1-flash", "vmc/deepseek-v4p1-flash-contributor-fallbacks"},
|
|
{"cline-pass/deepseek-v4.1-flash-1017", "vmc/deepseek-v4p1-flash-1017-contributor"},
|
|
{"cline-pass/deepseek-v4.1-flash-1017", "vmc/deepseek-v4p1-flash-1017-fallbacks"},
|
|
} {
|
|
if !Swapped(c[0], c[1]) {
|
|
t.Errorf("%s answered as %s is another model", c[0], c[1])
|
|
}
|
|
}
|
|
}
|
|
|
|
// A row kept marked swapped before is read back as not swapped when
|
|
// ClinePass named its vmc/ config for the model; a real swap stays one.
|
|
func TestKeptRowClineServingNameNotSwapped(t *testing.T) {
|
|
c := &rowChunk{}
|
|
c.add(Row{Record: Record{Model: "cline-pass/deepseek-v4.1-flash-1017", Served: "vmc/deepseek-v4p1-flash-1017"}, Swapped: true}, "", 0, false)
|
|
c.add(Row{Record: Record{Model: "cline-pass/deepseek-v4-pro", Served: "vmc/deepseek-v4p1-flash"}, Swapped: true}, "", 1, false)
|
|
for _, chunk := range []*rowChunk{c, c.pack().unpack()} {
|
|
if chunk.row(0).Swapped || !chunk.row(1).Swapped {
|
|
t.Fatalf("serving name %v, another model %v", chunk.row(0).Swapped, chunk.row(1).Swapped)
|
|
}
|
|
}
|
|
}
|