[Repo Assist] refactor(proxy): replace private truncateForLog with strutil.Truncate#2322
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
Conversation
truncateForLog in handler.go is a private helper that duplicates the behaviour of strutil.Truncate, which already exists as a shared utility and is used by logger/rpc_helpers.go and auth/header.go. Remove the private copy and use strutil.Truncate directly. The semantics are identical: both truncate to maxLen characters and append '...' if the string was longer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
15 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
internal/proxy/handler.gocontained a privatetruncateForLoghelper that duplicates the behaviour ofstrutil.Truncate, which already exists as a shared utility used byinternal/logger/rpc_helpers.goandinternal/auth/header.go.Changes
internal/proxy/handler.go:github.com/github/gh-aw-mcpg/internal/strutiltruncateForLog(string(graphQLBody), 500)withstrutil.Truncate(string(graphQLBody), 500)truncateForLogfunction (6 lines)Rationale
The removed function was semantically identical to
strutil.Truncate:Using the shared utility:
logger/rpc_helpers.go,auth/header.goboth usestrutil.Truncate)Test Status
gofmt -l internal/proxy/handler.goreports no formatting issues (file is clean)proxy.golang.org). Code was verified syntactically viagofmt -eand logic-reviewed manually.truncateForLoghad no direct unit test, and the call site behaviour is unchanged.Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.