From d505f64c99c8382d850887beb6ba5172fd9551a2 Mon Sep 17 00:00:00 2001 From: Mathias Date: Fri, 2 Oct 2026 17:20:38 +0200 Subject: [PATCH] test: second review -- the upload chat model outside the chain, room checked before spooling, a cut-off body is a 400, bidi controls in titles, the ensemble's deadline wiring, an honest test name (red) Co-Authored-By: Claude Sonnet 5.5 --- cmd/tapir/uploads_chat_models_test.go | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/cmd/tapir/uploads_chat_models_test.go b/cmd/tapir/uploads_chat_models_test.go index eb64f93..cc749de 100644 --- a/cmd/tapir/uploads_chat_models_test.go +++ b/cmd/tapir/uploads_chat_models_test.go @@ -44,3 +44,42 @@ func TestUploadChatModels_NoLocalModelMeansNoneOfferedNotACloudDefault(t *testin t.Errorf("uploadChatModels = %v, want none", got) } } + +// A valid local TAPIR_UPLOAD_CHAT_MODEL that is not in the video chat's chain used to be +// accepted by config and then silently ignored: the shared chat service re-maps a model it +// does not offer, so the user got koala/phi4-mini, whose 8,192-token context cannot hold an +// hour of speech (second adversarial review). + +func TestChatModels_AnUploadChatModelOutsideTheChainIsOfferedWhenUploadsAreOn(t *testing.T) { + var cfg config.Config + cfg.SummarizerModel = "koala/phi4-mini" + cfg.FallbackModel = "iguana/gemma4-26b" + cfg.UploadsEnabled = true + cfg.UploadChatModel = "iguana/gemma4-31b" + + service := chatModels(cfg) + upload := uploadChatModels(cfg) + + if !reflect.DeepEqual(service, []string{"koala/phi4-mini", "iguana/gemma4-26b", "iguana/gemma4-31b"}) { + t.Errorf("chatModels = %v: the shared service must be able to call the configured upload model", service) + } + if !reflect.DeepEqual(upload, service) { + t.Errorf("uploadChatModels = %v, want %v", upload, service) + } +} + +func TestChatModels_NothingIsAddedWhenUploadsAreOffOrTheModelIsNotLocal(t *testing.T) { + var cfg config.Config + cfg.SummarizerModel = "koala/phi4-mini" + cfg.UploadChatModel = "iguana/gemma4-31b" + + if got := chatModels(cfg); !reflect.DeepEqual(got, []string{"koala/phi4-mini"}) { + t.Errorf("uploads off: chatModels = %v, want the video chain unchanged", got) + } + + cfg.UploadsEnabled = true + cfg.UploadChatModel = "berget/mistral-small" + if got := chatModels(cfg); !reflect.DeepEqual(got, []string{"koala/phi4-mini"}) { + t.Errorf("a cloud upload chat model was added to the service: %v", got) + } +}