Skip to content

Fix unused imports compile error in Rust guard labels/mod.rs#5089

Merged
lpcox merged 2 commits into
mainfrom
copilot/fix-docker-actions-job
May 4, 2026
Merged

Fix unused imports compile error in Rust guard labels/mod.rs#5089
lpcox merged 2 commits into
mainfrom
copilot/fix-docker-actions-job

Conversation

Copilot AI commented May 4, 2026

Copy link
Copy Markdown
Contributor

The docker CI job was failing during the WASM guard build because has_demotion_label and has_promotion_label were re-exported unconditionally in labels/mod.rs, but are only used in test code. With -D warnings, Rust treats this as a compile error.

Change

Added #[cfg(test)] to the re-export, matching the existing pattern for has_approval_label and secret_label:

// Before
pub use helpers::{has_demotion_label, has_promotion_label};

// After
#[cfg(test)]
pub use helpers::{has_demotion_label, has_promotion_label};

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
    • Triggering command: /tmp/go-build1708705991/b513/launcher.test /tmp/go-build1708705991/b513/launcher.test -test.testlogfile=/tmp/go-build1708705991/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -goversion go1.25.9 -c=4 -nolocalimports -importcfg /tmp/go-build1708705991/b504/importcfg -pack /tmp/go-build1708705991/b504/_testmain.go o_.o�� 64/src/net -trimpath x_amd64/vet 617502/b172/ google.golang.or-test.testlogfile=/tmp/go-build1708705991/b498/testlog.txt -lang=go1.24 x_amd64/vet (dns block)
  • invalid-host-that-does-not-exist-12345.com
    • Triggering command: /tmp/go-build1708705991/b495/config.test /tmp/go-build1708705991/b495/config.test -test.testlogfile=/tmp/go-build1708705991/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build1708705991/b393/vet.cfg aHyH/ZRyj9BryPL3itfTYaHyH k/gh-aw-mcpg/gh-aw-mcpg/internal/guard/guard.go x_amd64/vet 617502/b172/ net/http/interna-unsafeptr=false -lang=go1.25 x_amd64/vet o_.o�� ache/go/1.25.9/x64/src/runtime/cgo -fPIC x_amd64/vet ut-2187906326.c -Wl,--no-gc-sect-atomic -fmessage-length-bool x_amd64/vet (dns block)
  • nonexistent.local
    • Triggering command: /tmp/go-build1708705991/b513/launcher.test /tmp/go-build1708705991/b513/launcher.test -test.testlogfile=/tmp/go-build1708705991/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -goversion go1.25.9 -c=4 -nolocalimports -importcfg /tmp/go-build1708705991/b504/importcfg -pack /tmp/go-build1708705991/b504/_testmain.go o_.o�� 64/src/net -trimpath x_amd64/vet 617502/b172/ google.golang.or-test.testlogfile=/tmp/go-build1708705991/b498/testlog.txt -lang=go1.24 x_amd64/vet (dns block)
  • slow.example.com
    • Triggering command: /tmp/go-build1708705991/b513/launcher.test /tmp/go-build1708705991/b513/launcher.test -test.testlogfile=/tmp/go-build1708705991/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s -goversion go1.25.9 -c=4 -nolocalimports -importcfg /tmp/go-build1708705991/b504/importcfg -pack /tmp/go-build1708705991/b504/_testmain.go o_.o�� 64/src/net -trimpath x_amd64/vet 617502/b172/ google.golang.or-test.testlogfile=/tmp/go-build1708705991/b498/testlog.txt -lang=go1.24 x_amd64/vet (dns block)
  • this-host-does-not-exist-12345.com
    • Triggering command: /tmp/go-build1708705991/b522/mcp.test /tmp/go-build1708705991/b522/mcp.test -test.testlogfile=/tmp/go-build1708705991/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'docker' Fix unused imports compile error in Rust guard labels/mod.rs May 4, 2026
Copilot AI requested a review from lpcox May 4, 2026 14:07
Copilot finished work on behalf of lpcox May 4, 2026 14:07
@lpcox lpcox marked this pull request as ready for review May 4, 2026 14:35
Copilot AI review requested due to automatic review settings May 4, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Rust -D warnings build failure in the GitHub WASM guard by ensuring test-only label helper re-exports are only compiled in test builds, eliminating unused-import warnings in release builds.

Changes:

  • Add #[cfg(test)] to the has_demotion_label / has_promotion_label re-export in labels/mod.rs to prevent unused-import warnings in non-test builds.
  • Apply minor whitespace/formatting cleanup in a couple Go files (no functional changes).
Show a summary per file
File Description
internal/strutil/format_duration_test.go Gofmt-style indentation cleanup within existing tests.
internal/server/circuit_breaker.go Removes a stray whitespace-only blank line.
internal/server/circuit_breaker_test.go Removes a stray whitespace-only blank line.
guards/github-guard/rust-guard/src/labels/mod.rs Gates test-only helper re-exports with #[cfg(test)] to avoid unused_imports under -D warnings.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/4 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants