Add stdin-path test coverage for stdio server auth validation#3769
Add stdin-path test coverage for stdio server auth validation#3769
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/9bb8172a-0619-4ff2-a7be-d88c9c3c668b Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds test coverage for the stdin JSON config conversion/validation path to ensure that stdio servers configured with an auth block fail with a stable, structured rules.ValidationError (including message, JSONPath, and suggestion), preventing regressions in error typing/formatting.
Changes:
- Extends
TestConvertStdinServerConfig_ValidationErrorwith a"stdio with auth block"table case to cover the stdin conversion validation message. - Adds
TestConvertStdinServerConfig_StdioWithAuthto assert the returned error is a*rules.ValidationErrorwith expectedField,Message,JSONPath, and non-emptySuggestion.
Show a summary per file
| File | Description |
|---|---|
| internal/config/config_stdin_test.go | Adds stdin-path tests asserting stdio+auth is rejected and that the structured validation error remains stable. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| require.True(t, errors.As(err, &valErr), "expected a *rules.ValidationError, got %T: %v", err, err) | ||
| assert.Equal(t, "auth", valErr.Field) | ||
| assert.Contains(t, valErr.Message, "auth is only supported for HTTP servers") | ||
| assert.Contains(t, valErr.JSONPath, "mcpServers.my-server") |
There was a problem hiding this comment.
TestConvertStdinServerConfig_StdioWithAuth says it verifies the “correct JSONPath”, but the assertion uses assert.Contains on valErr.JSONPath. Since the expected path is deterministic (mcpServers.my-server), asserting equality would make this test stricter and better at catching regressions (e.g., a different prefix/suffix that still contains the substring).
| assert.Contains(t, valErr.JSONPath, "mcpServers.my-server") | |
| assert.Equal(t, "mcpServers.my-server", valErr.JSONPath) |
Review comment noted missing test coverage for the
validateServerAuthpath when a stdio server includes anauthblock via the stdin JSON config path, leaving the structured error type and message unguarded against regressions.Changes
TestConvertStdinServerConfig_ValidationError— added"stdio with auth block"table case to cover the error message viaconvertStdinServerConfig(the stdin JSON path)TestConvertStdinServerConfig_StdioWithAuth— focused test asserting the returned error is a*rules.ValidationErrorwith the correctField,Message,JSONPath, and non-emptySuggestion:Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build2349467698/b514/launcher.test /tmp/go-build2349467698/b514/launcher.test -test.testlogfile=/tmp/go-build2349467698/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s go_.�� @v1.43.0/semconv-errorsas @v1.43.0/semconv-ifaceassert x_amd64/vet . --gdwarf2 --64 LEXxvrp/NoLlItYx-buildtags -I g_.a -I x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build2349467698/b496/config.test /tmp/go-build2349467698/b496/config.test -test.testlogfile=/tmp/go-build2349467698/b496/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2349467698/b392/vet.cfg g_.a k/gh-aw-mcpg/gh-aw-mcpg/internal-nolocalimports x_amd64/vet -dynout xcontext -dynlinker x_amd64/vet(dns block)nonexistent.local/tmp/go-build2349467698/b514/launcher.test /tmp/go-build2349467698/b514/launcher.test -test.testlogfile=/tmp/go-build2349467698/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s go_.�� @v1.43.0/semconv-errorsas @v1.43.0/semconv-ifaceassert x_amd64/vet . --gdwarf2 --64 LEXxvrp/NoLlItYx-buildtags -I g_.a -I x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet(dns block)slow.example.com/tmp/go-build2349467698/b514/launcher.test /tmp/go-build2349467698/b514/launcher.test -test.testlogfile=/tmp/go-build2349467698/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s go_.�� @v1.43.0/semconv-errorsas @v1.43.0/semconv-ifaceassert x_amd64/vet . --gdwarf2 --64 LEXxvrp/NoLlItYx-buildtags -I g_.a -I x_amd64/vet --gdwarf-5 --64 -o x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build2349467698/b523/mcp.test /tmp/go-build2349467698/b523/mcp.test -test.testlogfile=/tmp/go-build2349467698/b523/testlog.txt -test.paniconexit0 -test.timeout=10m0s -o g_.a -trimpath x_amd64/vet -p ernal/server -lang=go1.25 x_amd64/vet ut-1�� .cfg -buildtags x_amd64/vet ctor -ifaceassert E=3 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: