Skip to content

test: raise coverage of cmd/mcpcurl, internal/ghmcp and pkg/http helpers#14

Draft
israel2606 wants to merge 7 commits into
mainfrom
claude/test-coverage-analysis-s33ri0
Draft

test: raise coverage of cmd/mcpcurl, internal/ghmcp and pkg/http helpers#14
israel2606 wants to merge 7 commits into
mainfrom
claude/test-coverage-analysis-s33ri0

Conversation

@israel2606

@israel2606 israel2606 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

What & why

Pure-logic test coverage across three low-coverage areas. No production code changes — test files only.

Package / function Before After
cmd/mcpcurl (buildArgumentsMap, addCommandFromTool, buildJSONRPCRequest, printResponse) ~9% ~55%
internal/ghmcp createFeatureChecker 0% 100%
pkg/http/transport (UserAgent + Bearer round-trippers, incl. GraphQL-Features-from-context) 46.7% 100%
pkg/http/mark (With/Is/As/Unwrap/Error) 100%

All tests are offline/pure (no network): cobra flag→args mapping, JSON-RPC envelope, response pretty-printing, feature-flag resolution, header-setting round-trippers, and error-marking semantics.

Verification

go test ./cmd/mcpcurl/ ./internal/ghmcp/ ./pkg/http/transport/ ./pkg/http/mark/ -cover
go vet ./...        # clean
gofmt -l <files>    # no output

Note on CI

The only red checks are build (3.9/3.10/3.11) — a Python workflow that runs pytest on this Go repo and fails on every PR (collects 0 tests → exit 5). Pre-existing and unrelated to these tests; all Go checks (build matrix, lint, docs-check, mcp-diff) are green.

🤖 Generated with Claude Code

israel2606 and others added 6 commits April 26, 2026 23:39
This workflow installs Python dependencies, runs tests, and lints code with multiple Python versions.
Document the architecture, build/test workflow, toolset registration
pattern, parameter helpers, error handling conventions, and contribution
flow so AI assistants can act productively in this repo without
re-discovering conventions.

https://claude.ai/code/session_018psjWyFFcz83JXdxBQMUdd
…pers

Raise cmd/mcpcurl coverage from ~9% to ~55% by testing the pure-logic
helpers, in a separate file from the existing main_test.go:

- buildArgumentsMap: all property types (string/number/integer/boolean,
  string arrays, object arrays via -json) plus the JSON-parse error path.
- addCommandFromTool: flag registration, required flags, and enum PreRunE
  validation.
- buildJSONRPCRequest: request envelope shape.
- printResponse: plain, pretty-object, JSONL-array, empty, and invalid-JSON.

https://claude.ai/code/session_01W9xh1kJCqtHqBgBAMQikon
Add internal/ghmcp/feature_checker_test.go covering createFeatureChecker:
enabled+allowed flags resolve true, unknown/non-allowlisted/not-enabled
flags resolve false (no error), and insiders mode enables the insiders set.

https://claude.ai/code/session_01W9xh1kJCqtHqBgBAMQikon
Offline coverage work (not pushed):
- pkg/http/transport: UserAgentTransport, BearerAuthTransport (incl. the
  GraphQL-Features-from-context path) -> RoundTrip 100%, package 46.7%->100%.
- pkg/http/mark: With/Is/As/Unwrap/Error -> 100%.

No production code changes.
@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for neon-toffee-d6b114 ready!

Name Link
🔨 Latest commit a4392d9
🔍 Latest deploy log https://app.netlify.com/projects/neon-toffee-d6b114/deploys/6a3d1cc37474d50009147ef3
😎 Deploy Preview https://deploy-preview-14--neon-toffee-d6b114.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for cosmic-quokka-b1b316 ready!

Name Link
🔨 Latest commit a4392d9
🔍 Latest deploy log https://app.netlify.com/projects/cosmic-quokka-b1b316/deploys/6a3d1cc347e2cf00081468f5
😎 Deploy Preview https://deploy-preview-14--cosmic-quokka-b1b316.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@israel2606 israel2606 changed the title test(mcpcurl): cover argument-map, JSON-RPC, command and response helpers (~9%→55%) test: raise coverage of cmd/mcpcurl, internal/ghmcp and pkg/http helpers Jun 25, 2026
…ort tests

Address golangci-lint findings on the new transport tests:
- bodyclose: close resp.Body after RoundTrip in all three cases.
- revive(context-as-argument): make context.Context the first parameter
  of the newRequest test helper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants