Conversation
…d_names constants Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/ca961a71-80d3-4b64-a1f9-97f6b8a4c10a Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…d add import Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/ca961a71-80d3-4b64-a1f9-97f6b8a4c10a Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove dead code for is_forked_pull_request_with_callback
[rust-guard] Move test-only function out of production code; add missing field_names constants
Apr 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves code quality and consistency in the Rust GitHub guard by removing dead production code (reducing WASM binary size) and centralizing commonly used JSON field name strings into the existing field_names constants module.
Changes:
- Moved
is_forked_pull_request_with_callbackout of production code and into#[cfg(test)]scope inbackend.rs. - Added missing
field_namesconstants (FULL_NAME,NUMBER,PRIVATE,LOGIN) and replaced raw JSON field string literals with these constants across labeling modules. - Added missing
field_namesimports where needed (response_items.rs,response_paths.rs).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/backend.rs | Removes test-only helper from production and rehomes it under #[cfg(test)]. |
| guards/github-guard/rust-guard/src/labels/constants.rs | Adds new field_names constants for commonly accessed JSON fields. |
| guards/github-guard/rust-guard/src/labels/helpers.rs | Switches JSON field access to use field_names constants (e.g., NUMBER, FULL_NAME, LOGIN). |
| guards/github-guard/rust-guard/src/labels/response_items.rs | Replaces raw "private" / "full_name" lookups with field_names constants and adds the needed import. |
| guards/github-guard/rust-guard/src/labels/response_paths.rs | Replaces raw "private" / "full_name" lookups with field_names constants and adds the needed import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 3, 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.
Two small code quality improvements to the Rust guard: dead production code inflating the WASM binary, and JSON field strings scattered as raw literals instead of using the existing
field_namesconvention.Changes
1.
is_forked_pull_request_with_callback→#[cfg(test)]only (backend.rs)The function was
pubin production code with#[allow(dead_code)]suppressing the warning, but was only ever called from tests. Moved it into the#[cfg(test)] mod testsblock as a privatefn, removing the suppression annotation and eliminating the dead WASM binary code.2. New
field_namesconstants + replacement of raw literals (constants.rs,helpers.rs,response_items.rs,response_paths.rs)Added
FULL_NAME,NUMBER,PRIVATE, andLOGINto thefield_namesmodule alongside the existingOWNER,REPO,SHA, etc. Replaced all production-code JSON field string lookups with the new constants across the four affected files. Addeduse super::constants::field_names;toresponse_items.rsandresponse_paths.rswhich previously lacked the import.Note:
"private".to_string()in secrecy label constructions (not field lookups) are intentionally left as-is.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-build3562526043/b336/launcher.test /tmp/go-build3562526043/b336/launcher.test -test.testlogfile=/tmp/go-build3562526043/b336/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 64/src/net 64/src/mime/encodedword.go x_amd64/vet -p crypto/internal/-atomic -lang=go1.25 x_amd64/vet -o ify@v1.11.1/asse-errorsas -trimpath(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build3562526043/b318/config.test /tmp/go-build3562526043/b318/config.test -test.testlogfile=/tmp/go-build3562526043/b318/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 64/src/runtime/cgo 2zQN/vEak0ZJ9yzSgbLLs2zQN x_amd64/vet guard.3t4ldemkr1/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet mcpgodebug /home/REDACTED/.ru-unreachable=false x_amd64/vet 1226�� 122696/b119/_pkg_.a nn_n/bFgeOALOdCKszpT-nn_n x_amd64/vet /home/REDACTED/wor/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /home/REDACTED/wor-unsafeptr=false /home/REDACTED/wor-unreachable=false x_amd64/vet(dns block)nonexistent.local/tmp/go-build3562526043/b336/launcher.test /tmp/go-build3562526043/b336/launcher.test -test.testlogfile=/tmp/go-build3562526043/b336/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 64/src/net 64/src/mime/encodedword.go x_amd64/vet -p crypto/internal/-atomic -lang=go1.25 x_amd64/vet -o ify@v1.11.1/asse-errorsas -trimpath(dns block)slow.example.com/tmp/go-build3562526043/b336/launcher.test /tmp/go-build3562526043/b336/launcher.test -test.testlogfile=/tmp/go-build3562526043/b336/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 64/src/net 64/src/mime/encodedword.go x_amd64/vet -p crypto/internal/-atomic -lang=go1.25 x_amd64/vet -o ify@v1.11.1/asse-errorsas -trimpath(dns block)this-host-does-not-exist-12345.com/tmp/go-build3562526043/b345/mcp.test /tmp/go-build3562526043/b345/mcp.test -test.testlogfile=/tmp/go-build3562526043/b345/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true _.a 58122696/b151//_-ifaceassert x_amd64/vet go1.25.8 ternal/engine/wa--version 122696/b151/ x_amd64/vet ctor�� .cfg 122696/b151/ x_amd64/vet --gdwarf-5 ut-1903621372.c -o x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: