Repository navigation
test: raise real coverage to 92% and measure every package in CI - #71
Merged
Merged
Conversation
- Guard Choices[0] access in openai, grok and groq clients with a length check - Return "no response choices from <provider>" instead of panicking with index out of range - Align behavior with the deepseek, kimi, qwen and perplexity HTTP clients
- Expose apiURL in deepseek, kimi, qwen and perplexity and baseURL in grok and groq as package vars - Add endpointOptions to the gemini client so tests can target a local REST endpoint - Drive openai and anthropic tests through OPENAI_BASE_URL and ANTHROPIC_BASE_URL, and ollama through OLLAMA_HOST - Replace tautological constant checks with tests asserting request shape, auth headers, model and response parsing - Cover non-200, malformed json, empty choices, invalid url and unreachable server error paths - Isolate HOME and provider env vars so tests never read real keys or call live APIs
- Add teaOptions to root.go and pass it to every bubbletea program so tests can script input and capture output - Make githubAPIURL and executablePath vars in upgrade.go to substitute a local server and scratch binary - Run commit end to end in a temp git repo with fake providers, covering success, notices and error paths - Test keys, models and dashboard models directly plus via RunE with scripted keystrokes - Test release fetch, download, tar.gz and zip extraction, binary replacement and the full upgrade flow - Replace the skipped CommitWMessage test with real ones using GIT_EDITOR to avoid an interactive editor
- Run go test with -coverprofile over ./... instead of a hand-picked subset of internal packages - Enable -race with atomic cover mode to catch data races in CI - Read the Go version from go.mod instead of pinning 1.22, which mismatched the 1.25 toolchain
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
17 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The awesome-go review of vibecheck (avelino/awesome-go#5938) was closed because
go test -cover ./...reported 35–39% total while the Codecov badge showed 82.96%. The gap had a clear cause:coverage.yamlonly measured 7 hand-pickedinternal/*packages and skippedcmd/and every LLM provider, which had almost no real tests.This PR raises the real number and makes Codecov report it honestly.
Result (
go test -coverprofile=c.out ./... && go tool cover -func=c.out)cmdinternal/gitinternal/llm/ollamainternal/llm/{deepseek,kimi,qwen}internal/llm/{anthropic,grok,groq}internal/llm/{openai,gemini,perplexity}* Those numbers came from tests silently calling the live APIs with whatever keys were in the developer's
~/.vibecheck_keys.json.Changes
fix(llm):
openai,grokandgroqindexedChoices[0]without a length check, so an empty response would panic. They now returnno response choices from <provider>, like the HTTP clients already did.test(llm): Every provider is now tested against an
httptestserver. The tests check request shape, auth headers, model, response parsing and error paths (non-200, bad JSON, empty choices, bad URL, unreachable host). This replaces the old tautological tests (if "x" != "x").apiURL/baseURLpackage vars on the 6 clients with hardcoded endpoints, andendpointOptionson gemini. openai/anthropic use the SDKs' ownOPENAI_BASE_URL/ANTHROPIC_BASE_URL, and ollama usesOLLAMA_HOST. Default behaviour is unchanged.HOMEand the provider env vars, so no real keys are read and no network calls go out.test(cmd):
commitruns end to end in a temp git repo with fake providers (GIT_EDITOR=true).keys,modelsanddashboardare tested at the model level and throughRunEwith scripted keystrokes. This uses a newteaOptionshook inroot.go; the default is empty, so production behaviour is identical.upgraderuns the full download → extract → replace flow against a fake GitHub API with a scratch binary.githubAPIURLis now a var, and there is a newexecutablePathhook.CommitWMessagetest is now real.ci(github-actions):
coverage.yamlnow runsgo test -race -covermode=atomic -coverprofile=coverage.out ./..., so Codecov matches localgo test -cover ./.... The workflow also reads the Go version fromgo.mod; it had been pinned to 1.22, while the module requires 1.25.Verification
go vet ./...andgofmt -l .are cleango test -race -count=3 ./...passesHTTP(S)_PROXYpointed at a dead port, which proves no test hits an external APINot covered (intentionally):
rerunWithSudoandExecutecallos.Exit, andmain()is the process entrypoint.