Conversation
…promotion helper Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/c372969c-97ba-4f22-a304-c3483b5d3ba2
Copilot
AI
changed the title
[WIP] Consolidate identical match arms in tool_rules.rs
[rust-guard] Consolidate identical repo-scoped match arms and extract approval-label promotion helper
Mar 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Rust GitHub guard labeling logic to reduce duplication while keeping labeling behavior unchanged, improving maintainability of tool-to-label mappings and integrity promotion logic.
Changes:
- Consolidates multiple identical repo-scoped match arms in
apply_tool_labelsinto a single combined arm. - Extracts shared approval-label integrity promotion logic from
pr_integrityandissue_integrityinto a new helper.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Collapses identical repo-scoped tool match arms into one arm that applies repo-visibility secrecy and writer-level integrity. |
| guards/github-guard/rust-guard/src/labels/helpers.rs | Introduces apply_approval_label_promotion and uses it from PR/issue integrity computation to remove duplicated logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Mar 25, 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 refactors to reduce duplication in the Rust guard with no behavior changes.
tool_rules.rs: Consolidate 11 identical match arms11 arms across 17 tool names all shared the same two-line body. Collapsed into one arm:
helpers.rs: Extractapply_approval_label_promotionpr_integrityandissue_integrityended with an identical 13-line approval-label promotion block, differing only in the log prefix ("pr:"vs"issue:"). Extracted into a shared helper: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-build861487278/b333/launcher.test /tmp/go-build861487278/b333/launcher.test -test.testlogfile=/tmp/go-build861487278/b333/testlog.txt -test.paniconexit0 -test.timeout=10m0s 64/s�� ache/go/1.25.8/x64/src/runtime/c-c=4 erive-f8a9da973ea849b8.serde_der-nolocalimports x_amd64/vet erive-f8a9da973e/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet terpreter /home/REDACTED/.ru-unreachable=false x_amd64/vet go_.�� --noprofile /home/REDACTED/.rustup/toolchains/stable-x86_64-un--64 x_amd64/vet /home/REDACTED/.ru/tmp/go-build861487278/b315/cmd.test 2979575/b136/ bug/deps/rustcxy-test.paniconexit0 x_amd64/vet(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build861487278/b318/config.test /tmp/go-build861487278/b318/config.test -test.testlogfile=/tmp/go-build861487278/b318/testlog.txt -test.paniconexit0 -test.timeout=10m0s eriv�� 64/src/runtime/cgo erive-f8a9da973ea849b8.serde_dergithub.com/tetratelabs/wazero/internal/wasmdebug x_amd64/compile erive-f8a9da973e/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet abis erive-f8a9da973e-unreachable=false x_amd64/compile eriv�� ortcfg erive-f8a9da973ea849b8.serde_der-nolocalimports x_amd64/vet erive-f8a9da973e/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet erive-f8a9da973e-unsafeptr=false 64-REDACTED-linux-unreachable=false x_amd64/vet(dns block)nonexistent.local/tmp/go-build861487278/b333/launcher.test /tmp/go-build861487278/b333/launcher.test -test.testlogfile=/tmp/go-build861487278/b333/testlog.txt -test.paniconexit0 -test.timeout=10m0s 64/s�� ache/go/1.25.8/x64/src/runtime/c-c=4 erive-f8a9da973ea849b8.serde_der-nolocalimports x_amd64/vet erive-f8a9da973e/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet terpreter /home/REDACTED/.ru-unreachable=false x_amd64/vet go_.�� --noprofile /home/REDACTED/.rustup/toolchains/stable-x86_64-un--64 x_amd64/vet /home/REDACTED/.ru/tmp/go-build861487278/b315/cmd.test 2979575/b136/ bug/deps/rustcxy-test.paniconexit0 x_amd64/vet(dns block)slow.example.com/tmp/go-build861487278/b333/launcher.test /tmp/go-build861487278/b333/launcher.test -test.testlogfile=/tmp/go-build861487278/b333/testlog.txt -test.paniconexit0 -test.timeout=10m0s 64/s�� ache/go/1.25.8/x64/src/runtime/c-c=4 erive-f8a9da973ea849b8.serde_der-nolocalimports x_amd64/vet erive-f8a9da973e/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet terpreter /home/REDACTED/.ru-unreachable=false x_amd64/vet go_.�� --noprofile /home/REDACTED/.rustup/toolchains/stable-x86_64-un--64 x_amd64/vet /home/REDACTED/.ru/tmp/go-build861487278/b315/cmd.test 2979575/b136/ bug/deps/rustcxy-test.paniconexit0 x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build861487278/b342/mcp.test /tmp/go-build861487278/b342/mcp.test -test.testlogfile=/tmp/go-build861487278/b342/testlog.txt -test.paniconexit0 -test.timeout=10m0s go_.�� v0.12.18/builtin-p v0.12.18/code.gogithub.com/github/gh-aw-mcpg/internal/config/rules x_amd64/vet -p github.com/segme-qE -lang=go1.17 x_amd64/vet -I g_.a 2979575/b151/ x_amd64/vet -o go-sdk/internal/docker-cli-plugin-metadata /tmp/cc6Vi6PM.s x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either:
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.