fix(guard): remove unused org-ownership functions blocking release#4290
Merged
fix(guard): remove unused org-ownership functions blocking release#4290
Conversation
Remove get_cached_owner_is_org and is_repo_org_owned which are never called outside of tests. These were added for future use but currently trigger -D warnings (dead_code) failures in CI release builds. The cache setter (set_cached_owner_is_org) is retained as it's called during is_repo_private lookups to populate the cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes unused org-ownership helper APIs from the Rust guard to unblock release builds that treat warnings as errors.
Changes:
- Deleted unused cache reader
get_cached_owner_is_organd public APIis_repo_org_ownedthat were triggeringdead_codewarnings. - Removed the associated unit tests for
is_repo_org_owned. - Kept owner-type cache population during
is_repo_privatelookups.
Show a summary per file
| File | Description |
|---|---|
guards/github-guard/rust-guard/src/labels/backend.rs |
Removes unused org-ownership functions/tests to eliminate dead_code warnings during release builds. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
guards/github-guard/rust-guard/src/labels/backend.rs:66
- After removing the only read path (
get_cached_owner_is_org/is_repo_org_owned), the owner-type cache is now write-only:set_cached_owner_is_orgis called fromis_repo_private_with_callback, but nothing ever readsrepo_owner_type_cache. This adds extra work and can grow memory over the process lifetime without providing value. Consider removing the owner-type extraction/caching until there is a real consumer, or adding a bounded/evicting cache before keeping it.
This issue also appears on line 1287 of the same file.
fn set_cached_owner_is_org(repo_id: &str, is_org: bool) {
if let Ok(mut cache) = repo_owner_type_cache().lock() {
cache.insert(repo_id.to_string(), is_org);
}
guards/github-guard/rust-guard/src/labels/backend.rs:1290
- With the
is_repo_org_ownedtests removed, the helperclear_owner_type_cache_for_tests(defined earlier in this module) is now unused. This can reintroduce a dead_code warning when compiling tests (and can fail CI if warnings are denied). Consider deleting the helper or annotating it to suppress dead_code if you want to keep it for future tests.
});
assert_eq!(extract_owner_is_org(&response, "myorg/myrepo"), None);
}
}
- Files reviewed: 1/1 changed files
- Comments generated: 0
Was only called by the test functions removed in the previous commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 21, 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.
Problem
The Release workflow (run #24740822133) failed in the
dockerjob because the Rust guard build has-D warningsenabled and two functions trigger dead_code warnings:Fix
Remove the two unused functions (
get_cached_owner_is_organdis_repo_org_owned) and their associated tests. These were added for future org-ownership detection but are never called from production code.The cache setter (
set_cached_owner_is_org) is retained — it's called duringis_repo_privatelookups to populate the owner-type cache for when these functions are needed later.Removed
get_cached_owner_is_org()— private cache reader (line 63)is_repo_org_owned()— public API (line 282)test_is_repo_org_owned_uses_cache— testtest_is_repo_org_owned_empty_args— testVerification
make agent-finishedpasses (format, build, lint, all tests including Rust guard).