Deduplicate guards-mode CLI completions with canonical DIFC mode list#5244
Merged
Conversation
5 tasks
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/b4704323-4863-49cd-8abb-630e0c2a0430 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix duplicate code pattern for enforcement mode constants
Deduplicate May 7, 2026
guards-mode CLI completions with canonical DIFC mode list
Collaborator
|
@copilot merge main |
…-code-enforcement-modes # Conflicts: # internal/cmd/flags.go # internal/cmd/flags_test.go Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Contributor
Author
Merged 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR deduplicates the --guards-mode shell completion values by sourcing them from the canonical DIFC mode list in internal/difc, preventing CLI completions from drifting from supported enforcement modes.
Changes:
- Replace hardcoded
[]string{"strict", "filter", "propagate"}completions withdifc.ValidModesin both root flag completions and theproxysubcommand. - Update completion tests to assert against
difc.ValidModesrather than duplicating literals.
Show a summary per file
| File | Description |
|---|---|
| internal/cmd/proxy.go | Use difc.ValidModes as the --guards-mode completion source for the proxy subcommand. |
| internal/cmd/proxy_test.go | Align proxy completion test expectations with difc.ValidModes. |
| internal/cmd/flags.go | Use difc.ValidModes as the canonical completion source for root --guards-mode. |
| internal/cmd/flags_test.go | Align root flag completion test expectations with difc.ValidModes. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
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.
The CLI shell completions for
--guards-moderedefined DIFC enforcement modes in multiple places instead of using the canonical list frominternal/difc. That made completions easy to drift from the actual supported modes.Use the canonical DIFC mode list
[]string{"strict", "filter", "propagate"}completions in:internal/cmd/flags.gointernal/cmd/proxy.godifc.ValidModesAlign completion tests with the shared source of truth
difc.ValidModesinstead of duplicating the mode literals againResult
internal/difcnow automatically updates shell completion behavior in both CLI entry pointsWarning
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-build4079301644/b509/launcher.test /tmp/go-build4079301644/b509/launcher.test -test.testlogfile=/tmp/go-build4079301644/b509/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /internal/httpcommon/ascii.go /internal/httpcommon/headermap.go x_amd64/vet --gdwarf-5 ct/protoregistry-atomic =0 x_amd64/vet swit�� g_.a 8049330/b150/ x_amd64/vet -dynout gr/logr/funcr p=/opt/hostedtoo-bool x_amd64/vet(dns block)/tmp/go-build80479181/b513/launcher.test /tmp/go-build80479181/b513/launcher.test -test.testlogfile=/tmp/go-build80479181/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build80479181/b506/vet.cfg /tmp/go-build3676587456/b093/vet.cfg -goversion x_amd64/compile -c=4 -nolocalimports -importcfg x_amd64/compile(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build4079301644/b491/config.test /tmp/go-build4079301644/b491/config.test -test.testlogfile=/tmp/go-build4079301644/b491/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 1.80.0/status/status.go om/tetratelabs/wazero@v1.11.0/internal/wasip1/clgoogle.golang.org/protobuf/internal/encoding/jso-atomic x_amd64/vet --gdwarf-5 ternal/engine/wa-unsafeptr=false -o x_amd64/vet 3MdK�� g_.a --debug-prefix-map x_amd64/vet abis binarylog -I x_amd64/vet(dns block)/tmp/go-build80479181/b495/config.test /tmp/go-build80479181/b495/config.test -test.testlogfile=/tmp/go-build80479181/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s 6587�� /tmp/go-build1708049330/b433/_pkg_.a .cfg 64/pkg/tool/linux_amd64/vet -p golang.org/x/net--norc -lang=go1.25 64/pkg/tool/linux_amd64/vet 6587�� HwxzEigtvtf4iKtLrGai/HwxzEigtvtf4iKtLrGai -goversion 64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports -importcfg 64/pkg/tool/linuorigin(dns block)nonexistent.local/tmp/go-build4079301644/b509/launcher.test /tmp/go-build4079301644/b509/launcher.test -test.testlogfile=/tmp/go-build4079301644/b509/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /internal/httpcommon/ascii.go /internal/httpcommon/headermap.go x_amd64/vet --gdwarf-5 ct/protoregistry-atomic =0 x_amd64/vet swit�� g_.a 8049330/b150/ x_amd64/vet -dynout gr/logr/funcr p=/opt/hostedtoo-bool x_amd64/vet(dns block)/tmp/go-build80479181/b513/launcher.test /tmp/go-build80479181/b513/launcher.test -test.testlogfile=/tmp/go-build80479181/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build80479181/b506/vet.cfg /tmp/go-build3676587456/b093/vet.cfg -goversion x_amd64/compile -c=4 -nolocalimports -importcfg x_amd64/compile(dns block)slow.example.com/tmp/go-build4079301644/b509/launcher.test /tmp/go-build4079301644/b509/launcher.test -test.testlogfile=/tmp/go-build4079301644/b509/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true /internal/httpcommon/ascii.go /internal/httpcommon/headermap.go x_amd64/vet --gdwarf-5 ct/protoregistry-atomic =0 x_amd64/vet swit�� g_.a 8049330/b150/ x_amd64/vet -dynout gr/logr/funcr p=/opt/hostedtoo-bool x_amd64/vet(dns block)/tmp/go-build80479181/b513/launcher.test /tmp/go-build80479181/b513/launcher.test -test.testlogfile=/tmp/go-build80479181/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build80479181/b506/vet.cfg /tmp/go-build3676587456/b093/vet.cfg -goversion x_amd64/compile -c=4 -nolocalimports -importcfg x_amd64/compile(dns block)this-host-does-not-exist-12345.com/tmp/go-build4079301644/b518/mcp.test /tmp/go-build4079301644/b518/mcp.test -test.testlogfile=/tmp/go-build4079301644/b518/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true .cfg olang.org/grpc@v-ifaceassert x_amd64/vet _amd64.s --gdwarf2 --64 x_amd64/vet .cfg�� 8049330/b392/_pkg_.a -I x_amd64/vet --gdwarf-5 g/protobuf/inter/usr/bin/runc -o x_amd64/vet(dns block)/tmp/go-build80479181/b522/mcp.test /tmp/go-build80479181/b522/mcp.test -test.testlogfile=/tmp/go-build80479181/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s estl�� se .com/github/gh-aw-mcpg/sessions/b4704323-4863-49cd-8abb-630e0c2a0430 .cfg ppb/timestamp.pbrunc user.email ache/go/1.25.9/x-lang=go1.24 ache/go/1.25.9/x64/pkg/tool/linux_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: