rust-guard: downscope pub→pub(crate) for labels/helpers internals; add deploy key test#9051
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Downscope pub to pub(crate) for helpers internal functions
rust-guard: downscope pub→pub(crate) for labels/helpers internals; add deploy key test
Jul 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces the public API surface of the Rust GitHub guard label helpers by tightening helper visibility and cleaning up label-module re-exports, and it adds a focused regression test to ensure deploy-key management tools are labeled as access-sensitive with writer-level integrity.
Changes:
- Downscopes many
labels/helpers.rsfunctions frompubtopub(crate)to avoid exposing crate-internal helpers. - Cleans up
labels/mod.rsre-exports by removing unused/suppressed exports and separating test-only re-exports behind#[cfg(test)]. - Adds a new
tool_rules.rsunit test covering deploy key management labeling (add_deploy_key/delete_deploy_key).
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Adds deploy-key labeling test asserting policy-private secrecy + writer integrity. |
| guards/github-guard/rust-guard/src/labels/mod.rs | Trims public re-exports and moves test-only helper re-exports behind cfg(test). |
| guards/github-guard/rust-guard/src/labels/helpers.rs | Reduces visibility of helper functions to pub(crate) where they’re not meant to be public API. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Low
6 tasks
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
~38 functions in
helpers.rswere declaredpubbut never used outsidelabels/. Themod.rsre-export block silenced the resulting dead-export warnings with#[allow(unused_imports)], hiding real signal and bloating the public API surface.helpers.rs — visibility reduction
Changed 37 functions from
pub fn→pub(crate) fn. Functions thatlib.rsactually calls remainpub:mod.rs — re-export cleanup
#[allow(unused_imports)]pub use helpers::{…}block to the 14 itemslib.rsactually imports#[cfg(test)] pub(crate) use helpers::{…}blocktool_rules.rs — deploy key test coverage
Added
apply_tool_labels_deploy_key_management_is_access_sensitive_with_writer_integrityto assert thatadd_deploy_key/delete_deploy_keycarry access-sensitive (policy-private-scope) secrecy and writer-level integrity — the same pattern used by the existing user-key-management test added alongside it.