Conversation
…issue_author_association Closes #4329 Two dead-code / duplication fixes in backend.rs: 1. Remove repo_owner_type_cache and set_cached_owner_is_org. The cache was written to on every is_repo_private_with_callback call but never read — no get_cached_owner_is_org exists anywhere in the codebase. This wasted a Mutex acquisition and grew a HashMap indefinitely without ever being consulted. The piggyback log line is retained; only the cache write is dropped. 2. Replace the 35-line get_issue_author_association_with_callback body with a one-liner that delegates to get_issue_author_info_with_callback. Both functions made the identical issue_read call and parsed the same fields; the only difference was that the info variant also extracted author_login. Any future change to the issue_read fetch path now needs to be made in exactly one place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes dead, write-only caching and reduces duplicated backend-call logic in Rust Guard’s labels backend layer (backend.rs), improving efficiency and maintainability without changing the public API.
Changes:
- Removed the unused
repo_owner_type_cacheand its write path fromis_repo_private_with_callback(retaining debug logging). - Simplified
get_issue_author_association_with_callbackby delegating toget_issue_author_info_with_callbackto eliminate duplicated parsing/callback logic.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/backend.rs | Deletes write-only owner-type cache and de-duplicates issue author-association fetching logic via delegation |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
This was referenced Apr 22, 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.
🤖 This is an automated pull request from Repo Assist.
Closes #4329
Root Cause
Two dead-code / duplication issues in
guards/github-guard/rust-guard/src/labels/backend.rs:Issue 1 — Write-only
repo_owner_type_cacheset_cached_owner_is_org(and therepo_owner_type_cacheit writes to) existed in anticipation of aget_cached_owner_is_orgreader that was never wired up. Everyis_repo_private_with_callbackcall acquired a Mutex lock and inserted into aHashMapthat grew without bound and was never consulted. Classic incomplete-feature footgun.Issue 2 —
get_issue_author_association_with_callbackis a strict subset ofget_issue_author_info_with_callbackBoth functions made the same
issue_readbackend call, parsed the same args, allocated the same buffer size, and extractedauthor_associationvia the identical two-field fallback. The only difference was that theinfovariant also extractedauthor_login. This 35-line duplication meant any future change to theissue_readcall shape had to be applied in two places.Fix
Remove
repo_owner_type_cache,set_cached_owner_is_org, and the call site insideis_repo_private_with_callback. The debug log line is retained; only the cache write is dropped.Replace the 35-line body of
get_issue_author_association_with_callbackwith a one-liner that delegates toget_issue_author_info_with_callback:Trade-offs
get_issue_author_associationpublic API is unchanged.Test Status
cargo build— compiles without warningscargo test— 322 / 322 tests passproxy.golang.orgblocked by network firewall (pre-existing infrastructure limitation)