refactor: remove the unnecessary tool and parameter, implement unit tests#39
Merged
wu-sheng merged 10 commits intoapache:mainfrom Mar 31, 2026
Merged
refactor: remove the unnecessary tool and parameter, implement unit tests#39wu-sheng merged 10 commits intoapache:mainfrom
wu-sheng merged 10 commits intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors network transports to stop accepting the SW-URL request header (SSE/HTTP now always use the configured --sw-url/default), and introduces unit tests + CI coverage to lock in the intended URL/auth/session behavior.
Changes:
- Removed
SW-URLheader-based URL resolution for SSE/HTTP contexts; always useconfiguredSkyWalkingURL(). - Added unit tests covering URL finalization,
${ENV_VAR}credential resolution, session override behavior, and server registry expectations. - Added
make test/make test-covertargets and wiredmake testinto the CI workflow; updated docs to match the new transport behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/swmcp/server.go | Removes header-based URL selection and updates SSE/HTTP context enrichment to use CLI-configured URL/auth only. |
| internal/swmcp/session.go | Updates the session tool help text to remove references to SW-URL headers. |
| internal/swmcp/server_test.go | Adds tests for configured URL, env var resolution, configured auth injection, and session override semantics. |
| internal/swmcp/server_registry_test.go | Adds tests asserting expected tool/prompt/resource registration (currently via reflect/unsafe). |
| README.md | Documents updated URL behavior across stdio, sse, and streamable transports. |
| Makefile | Adds test and test-cover targets and exposes flags/package selectors. |
| CLAUDE.md | Updates documentation around transport URL priority and existence of unit tests. |
| .github/workflows/CI.yaml | Runs make test as part of the CI build job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SW-URL from the HTTP header and add unit tests
wu-sheng
approved these changes
Mar 31, 2026
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.
set_skywalking_urltool andSW-URLparameter.Signed-off-by: Qiuxia Fan qiuxiafan@apache.org