The explorer lists only what a node loads

A repository with neither GGUF nor safetensors (by the registry's summary
or its tags) is hidden under "runs here", which is ticked by default, and
counted with the architectures llama.cpp cannot load; unticked it is
listed. An open repository's pickle files are not offered, only counted,
and a repository of pickles only says to look for another version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-26 13:00:28 +01:00
1 parent 4466d2d15a
commit e84631ce3a
10 files changed
+105 -27

No files matched your search

+49
View File
@@ -247,3 +247,52 @@ func TestAdaptersAreListedForAModelAndToldFromModelsByTheirFiles(t *testing.T) {
t.Error("the merged file is not marked as a model")
}
}
func TestARepositoryWithNothingANodeLoadsIsNotListed(t *testing.T) {
// Pickles only, or ONNX: a node refuses the first and no engine here
// reads the second, so the row would only invite a fetch that fails.
now := time.Now()
pickles := hf.Model{ID: "someone/old-pytorch", CreatedAt: now, LastModified: now, Tags: []string{"pytorch"}}
st := hf.Model{ID: "Qwen/Qwen3-8B", CreatedAt: now, LastModified: now, Tags: []string{"safetensors"}}
reg := &fakeRegistry{results: []hf.Model{pickles, st, ggufModel("Qwen/Qwen3-8B-GGUF", "qwen3", 8.2e9, now)}}
mux := mirrorPageLlama(t, MirrorDeps{Mirror: &fakeMirror{}, Registry: reg})
body := mirrorGet(t, mux, "/admin/mirror?tab=explore").Body.String()
if strings.Contains(body, "someone/old-pytorch") {
t.Error("a repository with no GGUF and no safetensors is listed")
}
if !strings.Contains(body, "Qwen/Qwen3-8B<") && !strings.Contains(body, "Qwen/Qwen3-8B\"") || !strings.Contains(body, "Qwen/Qwen3-8B-GGUF") {
t.Errorf("the loadable repositories should stay: %s", body)
}
if !strings.Contains(body, "neither GGUF nor safetensors") {
t.Error("the page should say why one was hidden")
}
// Unticked, everything is shown.
body = mirrorGet(t, mux, "/admin/mirror?x=1&view=downloads&task=any").Body.String()
if !strings.Contains(body, "someone/old-pytorch") {
t.Error("with the box unticked the repository should be listed")
}
}
func TestARepositorysPickleFilesAreNotOffered(t *testing.T) {
reg := &fakeRegistry{repo: hf.Repo{
ID: "a/Both", Revision: "abc123def456",
Files: []hf.File{{Path: "model.safetensors", Bytes: 10}, {Path: "pytorch_model.bin", Bytes: 10},
{Path: "config.json", Bytes: 1}},
}}
mux := mirrorPageWith(t, &fakeMirror{}, reg, true)
body := mirrorGet(t, mux, "/admin/mirror?repo=a/Both").Body.String()
if strings.Contains(body, "pytorch_model.bin") {
t.Error("the pickle file is offered")
}
if !strings.Contains(body, "model.safetensors") || !strings.Contains(body, "1 file is not shown") {
t.Errorf("the safetensors should be offered and the pickle counted: %s", body)
}
reg.repo = hf.Repo{ID: "a/OnlyPickle", Revision: "abc123def456",
Files: []hf.File{{Path: "model.ckpt", Bytes: 10}}}
body = html.UnescapeString(mirrorGet(t, mux, "/admin/mirror?repo=a/OnlyPickle").Body.String())
if strings.Contains(body, "/resolve/abc123def456/model.ckpt") || !strings.Contains(body, "only in a pickle format") {
t.Errorf("a repository of pickles only should say so and offer nothing: %s", body)
}
}