fix: fold in PR #3 review findings (llamaswap test + error message)
Build & push image / build-and-push (pull_request) Successful in 33s

The 11-model swarm (incl. the new claude-code/sonnet competitor)
reviewed PR #3. 52 findings graded via the MCP — almost all accurate
clean-verifications of a small, clean PR (telemetry over-extracts them).
Two were real and are folded in:

- model_test.go: add llamaswap with/without-token cases to
  TestEndpointProvider. Caught by claude-code/sonnet itself, citing
  CLAUDE.md's "add a test when you add logic" rule — the standout
  finding and a strong validation of the Phase-1 engine.
- model.go: the default provider error messages omitted
  "openai-compatible" though the switch accepts it. Caught by gpt-oss.
  Added it to both messages.

gofmt clean, go vet quiet, go test -race green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-27 17:53:16 -04:00
parent 9a6c662615
commit 540645c2ae
2 changed files with 16 additions and 2 deletions
+2 -2
View File
@@ -104,7 +104,7 @@ func resolveModel() (llm.Model, error) {
}
return google.New(opts...).Model(model)
default:
return nil, fmt.Errorf("GADFLY_BASE_URL is set but GADFLY_PROVIDER %q has no endpoint-override support (use openai/ollama/llamaswap/foreman/anthropic/google, or unset GADFLY_BASE_URL to resolve via majordomo)", provider)
return nil, fmt.Errorf("GADFLY_BASE_URL is set but GADFLY_PROVIDER %q has no endpoint-override support (use openai/openai-compatible/ollama/llamaswap/foreman/anthropic/google, or unset GADFLY_BASE_URL to resolve via majordomo)", provider)
}
}
@@ -252,6 +252,6 @@ func endpointProvider(name, raw string) (llm.Provider, error) {
}
return google.New(opts...), nil
default:
return nil, fmt.Errorf("unknown provider %q (use ollama/llamaswap/foreman/openai/anthropic/google)", provider)
return nil, fmt.Errorf("unknown provider %q (use ollama/llamaswap/foreman/openai/openai-compatible/anthropic/google)", provider)
}
}
+14
View File
@@ -32,6 +32,20 @@ func TestEndpointProvider(t *testing.T) {
t.Fatalf("unexpected error: %v", err)
}
})
t.Run("llamaswap registers under its name", func(t *testing.T) {
p, err := endpointProvider("ls", "llamaswap|http://swap.lan:8080|tok")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if p.Name() != "ls" {
t.Errorf("Name() = %q, want %q", p.Name(), "ls")
}
})
t.Run("llamaswap without token", func(t *testing.T) {
if _, err := endpointProvider("ls2", "llamaswap|http://swap.lan:8080"); err != nil {
t.Fatalf("unexpected error: %v", err)
}
})
for _, bad := range []string{"", "ollama", "noprovider-no-pipe", "mystery|http://x"} {
t.Run("rejects "+bad, func(t *testing.T) {
if _, err := endpointProvider("n", bad); err == nil {